@uicopilot/storybook-addon 0.5.15 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manager.mjs +54 -54
- package/package.json +1 -1
package/dist/manager.mjs
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
var $F=Object.create;var _a=Object.defineProperty;var UF=Object.getOwnPropertyDescriptor;var jF=Object.getOwnPropertyNames;var HF=Object.getPrototypeOf,WF=Object.prototype.hasOwnProperty;var VF=(e,t,n)=>t in e?_a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var rr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Se=(e,t)=>{for(var n in t)_a(e,n,{get:t[n],enumerable:!0})},GF=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jF(t))!WF.call(e,o)&&o!==n&&_a(e,o,{get:()=>t[o],enumerable:!(r=UF(t,o))||r.enumerable});return e};var $a=(e,t,n)=>(n=e!=null?$F(HF(e)):{},GF(t||!e||!e.__esModule?_a(n,"default",{value:e,enumerable:!0}):n,e));var or=(e,t,n)=>VF(e,typeof t!="symbol"?t+"":t,n);function py(){try{return typeof window<"u"&&localStorage.getItem(XF)==="true"}catch{return!1}}var XF,y,Oe=_(()=>{"use strict";XF="uicopilot:debug";y={debug:(...e)=>{py()&&console.log(...e)},info:(...e)=>{py()&&console.info(...e)},warn:(...e)=>console.warn(...e),error:(...e)=>console.error(...e)}});import QF,{createContext as JF,useContext as ZF,useReducer as eE,useMemo as dy}from"react";function tE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"RESET_AUTH":return typeof localStorage<"u"&&Object.keys(localStorage).filter(n=>n.startsWith("uicopilot_")).forEach(n=>localStorage.removeItem(n)),typeof sessionStorage<"u"&&Object.keys(sessionStorage).filter(n=>n.startsWith("uicopilot_")||n.startsWith("uicopilot-")).forEach(n=>sessionStorage.removeItem(n)),typeof localStorage<"u"&&localStorage.setItem("uicopilot_force_sign_in","true"),y.debug("[AuthContext] resetAuth: Cleared uicopilot_* localStorage + sessionStorage keys"),{...e,isConnected:!1,sessionToken:null,apiKey:"",authMethod:"apikey",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null};default:return e}}function mu({children:e}){let[t,n]=eE(tE,iE),r=dy(()=>({setIsConnected:i=>n({type:"SET_STATE",payload:{isConnected:i}}),setSessionToken:i=>{y.debug("[AuthContext] setSessionToken:",i?i.substring(0,20)+"...":"null"),typeof localStorage<"u"&&(i?localStorage.setItem("uicopilot_session_token",i):localStorage.removeItem("uicopilot_session_token")),n({type:"SET_STATE",payload:{sessionToken:i,isConnected:!!i,...i?{authError:null}:{}}})},setApiKey:i=>{typeof localStorage<"u"&&localStorage.setItem("uicopilot_api_key",i),n({type:"SET_STATE",payload:{apiKey:i}})},setAuthMethod:i=>n({type:"SET_STATE",payload:{authMethod:i}}),setDeviceCode:i=>n({type:"SET_STATE",payload:{deviceCode:i}}),setUserCode:i=>n({type:"SET_STATE",payload:{userCode:i}}),setVerificationUri:i=>n({type:"SET_STATE",payload:{verificationUri:i}}),setPollingInterval:i=>n({type:"SET_STATE",payload:{pollingInterval:i}}),setUsageData:i=>n({type:"SET_STATE",payload:{usageData:i,usageLastFetched:Date.now()}}),setAuthError:i=>n({type:"SET_STATE",payload:{authError:i}}),resetAuth:()=>n({type:"RESET_AUTH"})}),[]),o=dy(()=>({...t,...r}),[t,r]);return QF.createElement(gy.Provider,{value:o},e)}function we(){let e=ZF(gy);if(!e)throw new Error("useAuthStore must be used within an AuthProvider");return e}var nE,rE,oE,fy,iE,gy,hu=_(()=>{"use strict";Oe();nE=()=>{if(typeof localStorage>"u")return;let e=localStorage.getItem("uicopilot-session-token");e&&!localStorage.getItem("uicopilot_session_token")&&(localStorage.setItem("uicopilot_session_token",e),localStorage.removeItem("uicopilot-session-token"));let t=localStorage.getItem("uicopilot-api-key");t&&!localStorage.getItem("uicopilot_api_key")&&(localStorage.setItem("uicopilot_api_key",t),localStorage.removeItem("uicopilot-api-key"))};nE();rE=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_session_token"),oE=()=>typeof localStorage>"u"?"":localStorage.getItem("uicopilot_api_key")||"",fy=rE(),iE={isConnected:!!fy,sessionToken:fy,apiKey:oE(),authMethod:"apikey",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null},gy=JF(null)});import sE,{createContext as aE,useContext as lE,useReducer as cE,useMemo as my,useRef as uE,useEffect as pE}from"react";function dE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"SET_PROJECTS":return{...e,projects:t.payload};case"ADD_PROJECT":return{...e,projects:[...e.projects,t.payload]};case"UPDATE_PROJECT":return{...e,projects:e.projects.map(n=>n.id===t.payload.id?{...n,...t.payload.updates}:n)};case"DELETE_PROJECT":return{...e,projects:e.projects.filter(n=>n.id!==t.payload),selectedProjectId:e.selectedProjectId===t.payload?null:e.selectedProjectId};default:return e}}function xu({children:e}){let[t,n]=cE(dE,gE),r=uE(t);pE(()=>{r.current=t},[t]);let o=my(()=>({setProjects:s=>n({type:"SET_PROJECTS",payload:s}),setSelectedProjectId:s=>{typeof localStorage<"u"&&(s?localStorage.setItem("uicopilot_selected_project_id",s):localStorage.removeItem("uicopilot_selected_project_id")),n({type:"SET_STATE",payload:{selectedProjectId:s}})},setLoadingProjects:s=>n({type:"SET_STATE",payload:{loadingProjects:s}}),setCurrentStorybookPath:s=>n({type:"SET_STATE",payload:{currentStorybookPath:s}}),addProject:s=>n({type:"ADD_PROJECT",payload:s}),updateProject:(s,a)=>n({type:"UPDATE_PROJECT",payload:{id:s,updates:a}}),deleteProject:s=>n({type:"DELETE_PROJECT",payload:s}),getSelectedProject:()=>{let s=r.current;return s.projects.find(a=>a.id===s.selectedProjectId)},getMatchingProject:()=>{let s=r.current;if(s.currentStorybookPath)return s.projects.find(a=>a.storybookRoot===s.currentStorybookPath)}}),[]),i=my(()=>({...t,...o}),[t,o]);return sE.createElement(hy.Provider,{value:i},e)}function Je(){let e=lE(hy);if(!e)throw new Error("useProjectStore must be used within a ProjectProvider");return e}var fE,gE,hy,yu=_(()=>{"use strict";fE=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_selected_project_id"),gE={projects:[],selectedProjectId:fE(),loadingProjects:!1,currentStorybookPath:null},hy=aE(null)});import mE,{createContext as hE,useContext as xE,useReducer as yE,useMemo as xy}from"react";function bE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"REFRESH_MAPPINGS":return{...e,mappingsRefreshKey:e.mappingsRefreshKey+1};case"UPDATE_FRAMES_THUMBNAILS":return e.framesCache?{...e,framesCache:{...e.framesCache,thumbnails:{...e.framesCache.thumbnails,...t.payload}}}:e;case"SET_VARIANT_THUMBNAILS":{let n={...e.variantThumbnailsCache,[t.payload.componentSetId]:t.payload.thumbnails},r=Object.keys(n);if(r.length>yy)for(let o of r.slice(0,r.length-yy))delete n[o];return{...e,variantThumbnailsCache:n}}case"CLEAR_VARIANT_THUMBNAILS_FOR_SET":{let{[t.payload]:n,...r}=e.variantThumbnailsCache;return{...e,variantThumbnailsCache:r}}case"CLEAR_ALL_VARIANT_THUMBNAILS":return{...e,variantThumbnailsCache:{}};default:return e}}function bu({children:e}){let[t,n]=yE(bE,SE),r=xy(()=>({setShowComponentBrowser:i=>n({type:"SET_STATE",payload:{showComponentBrowser:i}}),setFigmaFileUrl:i=>n({type:"SET_STATE",payload:{figmaFileUrl:i}}),setCurrentStoryId:i=>n({type:"SET_STATE",payload:{currentStoryId:i}}),setCurrentStoryName:i=>n({type:"SET_STATE",payload:{currentStoryName:i}}),setCurrentMapping:i=>{n({type:"SET_STATE",payload:{currentMapping:i}})},setMappingsByStoryId:i=>n({type:"SET_STATE",payload:{mappingsByStoryId:i}}),refreshMappings:()=>n({type:"REFRESH_MAPPINGS"}),setReviewFigmaUrl:i=>n({type:"SET_STATE",payload:{reviewFigmaUrl:i}}),setMappingSource:i=>n({type:"SET_STATE",payload:{mappingSource:i}}),setLoadingMapping:i=>n({type:"SET_STATE",payload:{loadingMapping:i}}),setShowFigmaQuality:i=>n({type:"SET_STATE",payload:{showFigmaQuality:i}}),setFramesCache:i=>n({type:"SET_STATE",payload:{framesCache:i}}),setIsLoadingFrames:i=>n({type:"SET_STATE",payload:{isLoadingFrames:i}}),updateFramesThumbnails:i=>n({type:"UPDATE_FRAMES_THUMBNAILS",payload:i}),setVariantThumbnails:(i,s)=>n({type:"SET_VARIANT_THUMBNAILS",payload:{componentSetId:i,thumbnails:s}}),clearVariantThumbnailsForSet:i=>n({type:"CLEAR_VARIANT_THUMBNAILS_FOR_SET",payload:i}),clearAllVariantThumbnails:()=>n({type:"CLEAR_ALL_VARIANT_THUMBNAILS"})}),[]),o=xy(()=>({...t,...r}),[t,r]);return mE.createElement(by.Provider,{value:o},e)}function nt(){let e=xE(by);if(!e)throw new Error("useFigmaStore must be used within a FigmaProvider");return e}var yy,SE,by,Su=_(()=>{"use strict";yy=200;SE={showComponentBrowser:!1,figmaFileUrl:"",currentStoryId:null,currentStoryName:"",currentMapping:null,mappingsRefreshKey:0,mappingsByStoryId:{},reviewFigmaUrl:"",mappingSource:null,loadingMapping:!1,showFigmaQuality:!1,framesCache:null,isLoadingFrames:!1,variantThumbnailsCache:{}},by=hE(null)});var Ft,wu=_(()=>{"use strict";Ft={NAME:"UI Parity",SHORT:"Parity",DOMAIN:"uiparity.com",MARKETING_URL:"https://uiparity.com",APP_URL:"https://app.uiparity.com",API_URL:"https://api.uiparity.com",SUPPORT_EMAIL:"feedback@uiparity.com",TAGLINE:"Pixel-perfect isn't a feeling. It's a score."}});function wE(){if(typeof process<"u"&&process.env)return process.env.UICOPILOT_DEBUG==="1";if(typeof globalThis<"u"&&"localStorage"in globalThis)try{return globalThis.localStorage.getItem("uicopilot_debug")==="1"}catch{return!1}return!1}var Wa,vu,Sy=_(()=>{"use strict";wu();Wa=`[${Ft.NAME}]`,vu={debug:(...e)=>{wE()&&console.log(Wa,...e)},info:(...e)=>{console.log(Wa,...e)},warn:(...e)=>{console.warn(Wa,...e)},error:(...e)=>{console.error(Wa,...e)}}});var wy=_(()=>{"use strict"});var ku=_(()=>{"use strict"});function Ut(e){return e>=48&&e<=57}function Ln(e){return Ut(e)||e>=65&&e<=70||e>=97&&e<=102}function Ga(e){return e>=65&&e<=90}function kE(e){return e>=97&&e<=122}function CE(e){return Ga(e)||kE(e)}function TE(e){return e>=128}function Va(e){return CE(e)||TE(e)||e===95}function qa(e){return Va(e)||Ut(e)||e===45}function IE(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function ds(e){return e===10||e===13||e===12}function zr(e){return ds(e)||e===32||e===9}function Pn(e,t){return!(e!==92||ds(t)||t===0)}function gi(e,t,n){return e===45?Va(t)||t===45||Pn(t,n):Va(e)?!0:e===92?Pn(e,t):!1}function Ya(e,t,n){return e===43||e===45?Ut(t)?2:t===46&&Ut(n)?3:0:e===46?Ut(t)?2:0:Ut(e)?1:0}function Ka(e){return e===65279||e===65534?1:0}function Qa(e){return e<128?Cu[e]:Xa}var Cu,FE,fs,Tu,Xa,Iu,gs=_(()=>{"use strict";Cu=new Array(128),FE=128,fs=130,Tu=131,Xa=132,Iu=133;for(let e=0;e<Cu.length;e++)Cu[e]=zr(e)&&fs||Ut(e)&&Tu||Va(e)&&Xa||IE(e)&&Iu||e||FE});function mi(e,t){return t<e.length?e.charCodeAt(t):0}function Ja(e,t,n){return n===13&&mi(e,t+1)===10?2:1}function Gr(e,t,n){let r=e.charCodeAt(t);return Ga(r)&&(r=r|32),r===n}function qr(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){let i=r.charCodeAt(o-t),s=e.charCodeAt(o);if(Ga(s)&&(s=s|32),s!==i)return!1}return!0}function vy(e,t){for(;t>=0&&zr(e.charCodeAt(t));t--);return t+1}function ms(e,t){for(;t<e.length&&zr(e.charCodeAt(t));t++);return t}function Fu(e,t){for(;t<e.length&&Ut(e.charCodeAt(t));t++);return t}function Yr(e,t){if(t+=2,Ln(mi(e,t-1))){for(let r=Math.min(e.length,t+5);t<r&&Ln(mi(e,t));t++);let n=mi(e,t);zr(n)&&(t+=Ja(e,t,n))}return t}function hs(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!qa(n)){if(Pn(n,mi(e,t+1))){t=Yr(e,t)-1;continue}break}}return t}function Go(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),Ut(n)&&(t=Fu(e,t+1),n=e.charCodeAt(t)),n===46&&Ut(e.charCodeAt(t+1))&&(t+=2,t=Fu(e,t)),Gr(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),Ut(n)&&(t=Fu(e,t+1+r+1))}return t}function Za(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n===41){t++;break}Pn(n,mi(e,t+1))&&(t=Yr(e,t))}return t}function el(e){if(e.length===1&&!Ln(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var tl=_(()=>{"use strict";gs()});var hi,Eu=_(()=>{"use strict";hi=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"]});function xi(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var Au=_(()=>{"use strict"});function Ty(e){let t=e.source,n=t.length,r=t.length>0?Ka(t.charCodeAt(0)):0,o=xi(e.lines,n),i=xi(e.columns,n),s=e.startLine,a=e.startColumn;for(let u=r;u<n;u++){let c=t.charCodeAt(u);o[u]=s,i[u]=a++,(c===ky||c===Cy||c===EE)&&(c===Cy&&u+1<n&&t.charCodeAt(u+1)===ky&&(u++,o[u]=s,i[u]=a),s++,a=1)}o[n]=s,i[n]=a,e.lines=o,e.columns=i,e.computed=!0}var ky,EE,Cy,nl,Iy=_(()=>{"use strict";Au();gs();ky=10,EE=12,Cy=13;nl=class{constructor(t,n,r,o){this.setSource(t,n,r,o),this.lines=null,this.columns=null}setSource(t="",n=0,r=1,o=1){this.source=t,this.startOffset=n,this.startLine=r,this.startColumn=o,this.computed=!1}getLocation(t,n){return this.computed||Ty(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,r){return this.computed||Ty(this),{source:r,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+n,line:this.lines[n],column:this.columns[n]}}}}});function Fy(e,t,n){return e<t?t:e>n?n:e}var yr,br,xs,ol,So,Sr,rl,Ey=_(()=>{"use strict";Au();tl();Eu();yr=16777215,br=24,xs=1,ol=2,So=new Uint8Array(32);So[2]=22;So[21]=22;So[19]=20;So[23]=24;Sr=new Uint8Array(32);Sr[2]=xs;Sr[21]=xs;Sr[19]=xs;Sr[23]=xs;Sr[22]=ol;Sr[20]=ol;Sr[24]=ol;rl=class{constructor(t,n){this.setSource(t,n)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",n=()=>{}){t=String(t||"");let r=t.length,o=xi(this.offsetAndType,t.length+1),i=xi(this.balance,t.length+1),s=0,a=-1,u=0,c=t.length;this.offsetAndType=null,this.balance=null,i.fill(0),n(t,(l,d,f)=>{let p=s++;if(o[p]=l<<br|f,a===-1&&(a=d),i[p]=c,l===u){let g=i[c];i[c]=p,c=g,u=So[o[g]>>br]}else this.isBlockOpenerTokenType(l)&&(c=p,u=So[l])}),o[s]=0<<br|r,i[s]=s;for(let l=0;l<s;l++){let d=i[l];if(d<=l){let f=i[d];f!==l&&(i[l]=f)}else d>s&&(i[l]=s)}this.source=t,this.firstCharOffset=a===-1?0:a,this.tokenCount=s,this.offsetAndType=o,this.balance=i,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>br:0}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>br;if(r!==13&&r!==25&&t--===0)return r}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&yr:this.source.length}lookupOffsetNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>br;if(r!==13&&r!==25&&t--===0)return n-this.tokenIndex}return 0}lookupValue(t,n){return t+=this.tokenIndex,t<this.tokenCount?qr(this.source,this.offsetAndType[t-1]&yr,this.offsetAndType[t]&yr,n):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&yr:this.offsetAndType[this.tokenCount]&yr:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[Fy(t,0,this.tokenCount)]&yr}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[Fy(t,0,this.tokenCount)]>>br}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return Sr[t]===xs}isBlockCloserTokenType(t){return Sr[t]===ol}getBlockTokenPairIndex(t){let n=this.getTokenType(t);if(Sr[n]===1){let r=this.balance[t],o=this.getTokenType(r);return So[n]===o?r:-1}else if(Sr[n]===2){let r=this.balance[t],o=this.getTokenType(r);return So[o]===n?r:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]<t}isDelim(t,n){return n?this.lookupType(n)===9&&this.source.charCodeAt(this.lookupOffset(n))===t:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===t}skip(t){let n=this.tokenIndex+t;n<this.tokenCount?(this.tokenIndex=n,this.tokenStart=this.offsetAndType[n-1]&yr,n=this.offsetAndType[n],this.tokenType=n>>br,this.tokenEnd=n&yr):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.tokenEnd,t=this.offsetAndType[t],this.tokenType=t>>br,this.tokenEnd=t&yr):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,n){let r=t,o=0,i=0;e:for(;r<this.tokenCount;r++){if(o=this.balance[r],o<t)break e;switch(i=r>0?this.offsetAndType[r-1]&yr:this.firstCharOffset,n(this.source.charCodeAt(i))){case 1:break e;case 2:r++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[r]>>br)&&(r=o)}}this.skip(r-this.tokenIndex)}forEachToken(t){for(let n=0,r=this.firstCharOffset;n<this.tokenCount;n++){let o=r,i=this.offsetAndType[n],s=i&yr,a=i>>br;r=s,t(a,o,s,n)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((n,r,o,i)=>{t[i]={idx:i,type:hi[n],chunk:this.source.substring(r,o),balance:this.balance[i]}}),t}}});function wo(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Go(e,c),gi(n(c),n(c+1),n(c+2))){l=12,c=hs(e,c);return}if(n(c)===37){l=11,c++;return}l=10}function o(){let d=c;if(c=hs(e,c),qr(e,d,c,"url")&&n(c)===40){if(c=ms(e,c+1),n(c)===34||n(c)===39){l=2,c=d+4;return}s();return}if(n(c)===40){l=2,c++;return}l=1}function i(d){for(d||(d=n(c++)),l=5;c<e.length;c++){let f=e.charCodeAt(c);switch(Qa(f)){case d:c++;return;case fs:if(ds(f)){c+=Ja(e,c,f),l=6;return}break;case 92:if(c===e.length-1)break;let p=n(c+1);ds(p)?c+=Ja(e,c+1,p):Pn(f,p)&&(c=Yr(e,c)-1);break}}}function s(){for(l=7,c=ms(e,c);c<e.length;c++){let d=e.charCodeAt(c);switch(Qa(d)){case 41:c++;return;case fs:if(c=ms(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=Za(e,c),l=8;return;case 34:case 39:case 40:case Iu:c=Za(e,c),l=8;return;case 92:if(Pn(d,n(c+1))){c=Yr(e,c)-1;break}c=Za(e,c),l=8;return}}}e=String(e||"");let a=e.length,u=Ka(n(0)),c=u,l;for(;c<a;){let d=e.charCodeAt(c);switch(Qa(d)){case fs:l=13,c=ms(e,c+1);break;case 34:i();break;case 35:qa(n(c+1))||Pn(n(c+1),n(c+2))?(l=4,c=hs(e,c+1)):(l=9,c++);break;case 39:i();break;case 40:l=21,c++;break;case 41:l=22,c++;break;case 43:Ya(d,n(c+1),n(c+2))?r():(l=9,c++);break;case 44:l=18,c++;break;case 45:Ya(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(l=15,c=c+3):gi(d,n(c+1),n(c+2))?o():(l=9,c++);break;case 46:Ya(d,n(c+1),n(c+2))?r():(l=9,c++);break;case 47:n(c+1)===42?(l=25,c=e.indexOf("*/",c+2),c=c===-1?e.length:c+2):(l=9,c++);break;case 58:l=16,c++;break;case 59:l=17,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(l=14,c=c+4):(l=9,c++);break;case 64:gi(n(c+1),n(c+2),n(c+3))?(l=3,c=hs(e,c+1)):(l=9,c++);break;case 91:l=19,c++;break;case 92:Pn(d,n(c+1))?o():(l=9,c++);break;case 93:l=20,c++;break;case 123:l=23,c++;break;case 125:l=24,c++;break;case Tu:r();break;case Xa:o();break;default:l=9,c++}t(l,u,u=c)}}var sr=_(()=>{"use strict";gs();tl();ku();ku();Eu();gs();tl();Iy();Ey()});var yi,Xn,bs=_(()=>{"use strict";yi=null,Xn=class e{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return e.createItem(t)}allocateCursor(t,n){let r;return yi!==null?(r=yi,yi=yi.cursor,r.prev=t,r.next=n,r.cursor=this.cursor):r={prev:t,next:n,cursor:this.cursor},this.cursor=r,r}releaseCursor(){let{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=yi,yi=t}updateCursors(t,n,r,o){let{cursor:i}=this;for(;i!==null;)i.prev===t&&(i.prev=n),i.next===r&&(i.next=o),i=i.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){let o=e.createItem(r);n!==null?n.next=o:this.head=o,o.prev=n,n=o}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){let r=this.allocateCursor(null,this.head);for(;r.next!==null;){let o=r.next;r.next=o.next,t.call(n,o.data,o,this)}this.releaseCursor()}forEachRight(t,n=this){let r=this.allocateCursor(this.tail,null);for(;r.prev!==null;){let o=r.prev;r.prev=o.prev,t.call(n,o.data,o,this)}this.releaseCursor()}reduce(t,n,r=this){let o=this.allocateCursor(null,this.head),i=n,s;for(;o.next!==null;)s=o.next,o.next=s.next,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}reduceRight(t,n,r=this){let o=this.allocateCursor(this.tail,null),i=n,s;for(;o.prev!==null;)s=o.prev,o.prev=s.prev,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}some(t,n=this){for(let r=this.head;r!==null;r=r.next)if(t.call(n,r.data,r,this))return!0;return!1}map(t,n=this){let r=new e;for(let o=this.head;o!==null;o=o.next)r.appendData(t.call(n,o.data,o,this));return r}filter(t,n=this){let r=new e;for(let o=this.head;o!==null;o=o.next)t.call(n,o.data,o,this)&&r.appendData(o.data);return r}nextUntil(t,n,r=this){if(t===null)return;let o=this.allocateCursor(null,t);for(;o.next!==null;){let i=o.next;if(o.next=i.next,n.call(r,i.data,i,this))break}this.releaseCursor()}prevUntil(t,n,r=this){if(t===null)return;let o=this.allocateCursor(t,null);for(;o.prev!==null;){let i=o.prev;if(o.prev=i.prev,n.call(r,i.data,i,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new e;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(e.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(e.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(e.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(e.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(e.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}}});function Yo(e,t){let n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
2
|
-
`)}})}var
|
|
1
|
+
var HF=Object.create;var $a=Object.defineProperty;var WF=Object.getOwnPropertyDescriptor;var VF=Object.getOwnPropertyNames;var GF=Object.getPrototypeOf,qF=Object.prototype.hasOwnProperty;var YF=(e,t,n)=>t in e?$a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var rr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Se=(e,t)=>{for(var n in t)$a(e,n,{get:t[n],enumerable:!0})},KF=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of VF(t))!qF.call(e,o)&&o!==n&&$a(e,o,{get:()=>t[o],enumerable:!(r=WF(t,o))||r.enumerable});return e};var Ua=(e,t,n)=>(n=e!=null?HF(GF(e)):{},KF(t||!e||!e.__esModule?$a(n,"default",{value:e,enumerable:!0}):n,e));var or=(e,t,n)=>YF(e,typeof t!="symbol"?t+"":t,n);function dy(){try{return typeof window<"u"&&localStorage.getItem(ZF)==="true"}catch{return!1}}var ZF,y,Oe=_(()=>{"use strict";ZF="uicopilot:debug";y={debug:(...e)=>{dy()&&console.log(...e)},info:(...e)=>{dy()&&console.info(...e)},warn:(...e)=>console.warn(...e),error:(...e)=>console.error(...e)}});import eE,{createContext as tE,useContext as nE,useReducer as rE,useMemo as gy}from"react";function oE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"RESET_AUTH":return typeof localStorage<"u"&&Object.keys(localStorage).filter(n=>n.startsWith("uicopilot_")).forEach(n=>localStorage.removeItem(n)),typeof sessionStorage<"u"&&Object.keys(sessionStorage).filter(n=>n.startsWith("uicopilot_")||n.startsWith("uicopilot-")).forEach(n=>sessionStorage.removeItem(n)),typeof localStorage<"u"&&localStorage.setItem("uicopilot_force_sign_in","true"),y.debug("[AuthContext] resetAuth: Cleared uicopilot_* localStorage + sessionStorage keys"),{...e,isConnected:!1,sessionToken:null,apiKey:"",authMethod:"apikey",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null};default:return e}}function mu({children:e}){let[t,n]=rE(oE,lE),r=gy(()=>({setIsConnected:i=>n({type:"SET_STATE",payload:{isConnected:i}}),setSessionToken:i=>{y.debug("[AuthContext] setSessionToken:",i?i.substring(0,20)+"...":"null"),typeof localStorage<"u"&&(i?localStorage.setItem("uicopilot_session_token",i):localStorage.removeItem("uicopilot_session_token")),n({type:"SET_STATE",payload:{sessionToken:i,isConnected:!!i,...i?{authError:null}:{}}})},setApiKey:i=>{typeof localStorage<"u"&&localStorage.setItem("uicopilot_api_key",i),n({type:"SET_STATE",payload:{apiKey:i}})},setAuthMethod:i=>n({type:"SET_STATE",payload:{authMethod:i}}),setDeviceCode:i=>n({type:"SET_STATE",payload:{deviceCode:i}}),setUserCode:i=>n({type:"SET_STATE",payload:{userCode:i}}),setVerificationUri:i=>n({type:"SET_STATE",payload:{verificationUri:i}}),setPollingInterval:i=>n({type:"SET_STATE",payload:{pollingInterval:i}}),setUsageData:i=>n({type:"SET_STATE",payload:{usageData:i,usageLastFetched:Date.now()}}),setAuthError:i=>n({type:"SET_STATE",payload:{authError:i}}),resetAuth:()=>n({type:"RESET_AUTH"})}),[]),o=gy(()=>({...t,...r}),[t,r]);return eE.createElement(my.Provider,{value:o},e)}function we(){let e=nE(my);if(!e)throw new Error("useAuthStore must be used within an AuthProvider");return e}var iE,sE,aE,fy,lE,my,hu=_(()=>{"use strict";Oe();iE=()=>{if(typeof localStorage>"u")return;let e=localStorage.getItem("uicopilot-session-token");e&&!localStorage.getItem("uicopilot_session_token")&&(localStorage.setItem("uicopilot_session_token",e),localStorage.removeItem("uicopilot-session-token"));let t=localStorage.getItem("uicopilot-api-key");t&&!localStorage.getItem("uicopilot_api_key")&&(localStorage.setItem("uicopilot_api_key",t),localStorage.removeItem("uicopilot-api-key"))};iE();sE=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_session_token"),aE=()=>typeof localStorage>"u"?"":localStorage.getItem("uicopilot_api_key")||"",fy=sE(),lE={isConnected:!!fy,sessionToken:fy,apiKey:aE(),authMethod:"apikey",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null},my=tE(null)});import cE,{createContext as uE,useContext as pE,useReducer as dE,useMemo as hy,useRef as gE,useEffect as fE}from"react";function mE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"SET_PROJECTS":return{...e,projects:t.payload};case"ADD_PROJECT":return{...e,projects:[...e.projects,t.payload]};case"UPDATE_PROJECT":return{...e,projects:e.projects.map(n=>n.id===t.payload.id?{...n,...t.payload.updates}:n)};case"DELETE_PROJECT":return{...e,projects:e.projects.filter(n=>n.id!==t.payload),selectedProjectId:e.selectedProjectId===t.payload?null:e.selectedProjectId};default:return e}}function xu({children:e}){let[t,n]=dE(mE,xE),r=gE(t);fE(()=>{r.current=t},[t]);let o=hy(()=>({setProjects:s=>n({type:"SET_PROJECTS",payload:s}),setSelectedProjectId:s=>{typeof localStorage<"u"&&(s?localStorage.setItem("uicopilot_selected_project_id",s):localStorage.removeItem("uicopilot_selected_project_id")),n({type:"SET_STATE",payload:{selectedProjectId:s}})},setLoadingProjects:s=>n({type:"SET_STATE",payload:{loadingProjects:s}}),setCurrentStorybookPath:s=>n({type:"SET_STATE",payload:{currentStorybookPath:s}}),addProject:s=>n({type:"ADD_PROJECT",payload:s}),updateProject:(s,a)=>n({type:"UPDATE_PROJECT",payload:{id:s,updates:a}}),deleteProject:s=>n({type:"DELETE_PROJECT",payload:s}),getSelectedProject:()=>{let s=r.current;return s.projects.find(a=>a.id===s.selectedProjectId)},getMatchingProject:()=>{let s=r.current;if(s.currentStorybookPath)return s.projects.find(a=>a.storybookRoot===s.currentStorybookPath)}}),[]),i=hy(()=>({...t,...o}),[t,o]);return cE.createElement(xy.Provider,{value:i},e)}function Je(){let e=pE(xy);if(!e)throw new Error("useProjectStore must be used within a ProjectProvider");return e}var hE,xE,xy,yu=_(()=>{"use strict";hE=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_selected_project_id"),xE={projects:[],selectedProjectId:hE(),loadingProjects:!1,currentStorybookPath:null},xy=uE(null)});import yE,{createContext as bE,useContext as SE,useReducer as wE,useMemo as yy}from"react";function vE(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"REFRESH_MAPPINGS":return{...e,mappingsRefreshKey:e.mappingsRefreshKey+1};case"UPDATE_FRAMES_THUMBNAILS":return e.framesCache?{...e,framesCache:{...e.framesCache,thumbnails:{...e.framesCache.thumbnails,...t.payload}}}:e;case"SET_VARIANT_THUMBNAILS":{let n={...e.variantThumbnailsCache,[t.payload.componentSetId]:t.payload.thumbnails},r=Object.keys(n);if(r.length>by)for(let o of r.slice(0,r.length-by))delete n[o];return{...e,variantThumbnailsCache:n}}case"CLEAR_VARIANT_THUMBNAILS_FOR_SET":{let{[t.payload]:n,...r}=e.variantThumbnailsCache;return{...e,variantThumbnailsCache:r}}case"CLEAR_ALL_VARIANT_THUMBNAILS":return{...e,variantThumbnailsCache:{}};default:return e}}function bu({children:e}){let[t,n]=wE(vE,kE),r=yy(()=>({setShowComponentBrowser:i=>n({type:"SET_STATE",payload:{showComponentBrowser:i}}),setFigmaFileUrl:i=>n({type:"SET_STATE",payload:{figmaFileUrl:i}}),setCurrentStoryId:i=>n({type:"SET_STATE",payload:{currentStoryId:i}}),setCurrentStoryName:i=>n({type:"SET_STATE",payload:{currentStoryName:i}}),setCurrentMapping:i=>{n({type:"SET_STATE",payload:{currentMapping:i}})},setMappingsByStoryId:i=>n({type:"SET_STATE",payload:{mappingsByStoryId:i}}),refreshMappings:()=>n({type:"REFRESH_MAPPINGS"}),setReviewFigmaUrl:i=>n({type:"SET_STATE",payload:{reviewFigmaUrl:i}}),setMappingSource:i=>n({type:"SET_STATE",payload:{mappingSource:i}}),setLoadingMapping:i=>n({type:"SET_STATE",payload:{loadingMapping:i}}),setShowFigmaQuality:i=>n({type:"SET_STATE",payload:{showFigmaQuality:i}}),setFramesCache:i=>n({type:"SET_STATE",payload:{framesCache:i}}),setIsLoadingFrames:i=>n({type:"SET_STATE",payload:{isLoadingFrames:i}}),updateFramesThumbnails:i=>n({type:"UPDATE_FRAMES_THUMBNAILS",payload:i}),setVariantThumbnails:(i,s)=>n({type:"SET_VARIANT_THUMBNAILS",payload:{componentSetId:i,thumbnails:s}}),clearVariantThumbnailsForSet:i=>n({type:"CLEAR_VARIANT_THUMBNAILS_FOR_SET",payload:i}),clearAllVariantThumbnails:()=>n({type:"CLEAR_ALL_VARIANT_THUMBNAILS"})}),[]),o=yy(()=>({...t,...r}),[t,r]);return yE.createElement(Sy.Provider,{value:o},e)}function nt(){let e=SE(Sy);if(!e)throw new Error("useFigmaStore must be used within a FigmaProvider");return e}var by,kE,Sy,Su=_(()=>{"use strict";by=200;kE={showComponentBrowser:!1,figmaFileUrl:"",currentStoryId:null,currentStoryName:"",currentMapping:null,mappingsRefreshKey:0,mappingsByStoryId:{},reviewFigmaUrl:"",mappingSource:null,loadingMapping:!1,showFigmaQuality:!1,framesCache:null,isLoadingFrames:!1,variantThumbnailsCache:{}},Sy=bE(null)});var Ft,wu=_(()=>{"use strict";Ft={NAME:"UI Parity",SHORT:"Parity",DOMAIN:"uiparity.com",MARKETING_URL:"https://uiparity.com",APP_URL:"https://app.uiparity.com",API_URL:"https://api.uiparity.com",SUPPORT_EMAIL:"feedback@uiparity.com",TAGLINE:"Pixel-perfect isn't a feeling. It's a score."}});function CE(){if(typeof process<"u"&&process.env)return process.env.UICOPILOT_DEBUG==="1";if(typeof globalThis<"u"&&"localStorage"in globalThis)try{return globalThis.localStorage.getItem("uicopilot_debug")==="1"}catch{return!1}return!1}var Va,vu,wy=_(()=>{"use strict";wu();Va=`[${Ft.NAME}]`,vu={debug:(...e)=>{CE()&&console.log(Va,...e)},info:(...e)=>{console.log(Va,...e)},warn:(...e)=>{console.warn(Va,...e)},error:(...e)=>{console.error(Va,...e)}}});var vy=_(()=>{"use strict"});var ku=_(()=>{"use strict"});function Ut(e){return e>=48&&e<=57}function Ln(e){return Ut(e)||e>=65&&e<=70||e>=97&&e<=102}function qa(e){return e>=65&&e<=90}function IE(e){return e>=97&&e<=122}function FE(e){return qa(e)||IE(e)}function EE(e){return e>=128}function Ga(e){return FE(e)||EE(e)||e===95}function Ya(e){return Ga(e)||Ut(e)||e===45}function AE(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function gs(e){return e===10||e===13||e===12}function zr(e){return gs(e)||e===32||e===9}function Pn(e,t){return!(e!==92||gs(t)||t===0)}function fi(e,t,n){return e===45?Ga(t)||t===45||Pn(t,n):Ga(e)?!0:e===92?Pn(e,t):!1}function Ka(e,t,n){return e===43||e===45?Ut(t)?2:t===46&&Ut(n)?3:0:e===46?Ut(t)?2:0:Ut(e)?1:0}function Xa(e){return e===65279||e===65534?1:0}function Ja(e){return e<128?Cu[e]:Qa}var Cu,PE,fs,Tu,Qa,Iu,ms=_(()=>{"use strict";Cu=new Array(128),PE=128,fs=130,Tu=131,Qa=132,Iu=133;for(let e=0;e<Cu.length;e++)Cu[e]=zr(e)&&fs||Ut(e)&&Tu||Ga(e)&&Qa||AE(e)&&Iu||e||PE});function mi(e,t){return t<e.length?e.charCodeAt(t):0}function Za(e,t,n){return n===13&&mi(e,t+1)===10?2:1}function Gr(e,t,n){let r=e.charCodeAt(t);return qa(r)&&(r=r|32),r===n}function qr(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){let i=r.charCodeAt(o-t),s=e.charCodeAt(o);if(qa(s)&&(s=s|32),s!==i)return!1}return!0}function ky(e,t){for(;t>=0&&zr(e.charCodeAt(t));t--);return t+1}function hs(e,t){for(;t<e.length&&zr(e.charCodeAt(t));t++);return t}function Fu(e,t){for(;t<e.length&&Ut(e.charCodeAt(t));t++);return t}function Yr(e,t){if(t+=2,Ln(mi(e,t-1))){for(let r=Math.min(e.length,t+5);t<r&&Ln(mi(e,t));t++);let n=mi(e,t);zr(n)&&(t+=Za(e,t,n))}return t}function xs(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!Ya(n)){if(Pn(n,mi(e,t+1))){t=Yr(e,t)-1;continue}break}}return t}function Go(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),Ut(n)&&(t=Fu(e,t+1),n=e.charCodeAt(t)),n===46&&Ut(e.charCodeAt(t+1))&&(t+=2,t=Fu(e,t)),Gr(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),Ut(n)&&(t=Fu(e,t+1+r+1))}return t}function el(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n===41){t++;break}Pn(n,mi(e,t+1))&&(t=Yr(e,t))}return t}function tl(e){if(e.length===1&&!Ln(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var nl=_(()=>{"use strict";ms()});var hi,Eu=_(()=>{"use strict";hi=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token","comment-token"]});function xi(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var Au=_(()=>{"use strict"});function Iy(e){let t=e.source,n=t.length,r=t.length>0?Xa(t.charCodeAt(0)):0,o=xi(e.lines,n),i=xi(e.columns,n),s=e.startLine,a=e.startColumn;for(let u=r;u<n;u++){let c=t.charCodeAt(u);o[u]=s,i[u]=a++,(c===Cy||c===Ty||c===LE)&&(c===Ty&&u+1<n&&t.charCodeAt(u+1)===Cy&&(u++,o[u]=s,i[u]=a),s++,a=1)}o[n]=s,i[n]=a,e.lines=o,e.columns=i,e.computed=!0}var Cy,LE,Ty,rl,Fy=_(()=>{"use strict";Au();ms();Cy=10,LE=12,Ty=13;rl=class{constructor(t,n,r,o){this.setSource(t,n,r,o),this.lines=null,this.columns=null}setSource(t="",n=0,r=1,o=1){this.source=t,this.startOffset=n,this.startLine=r,this.startColumn=o,this.computed=!1}getLocation(t,n){return this.computed||Iy(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,r){return this.computed||Iy(this),{source:r,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+n,line:this.lines[n],column:this.columns[n]}}}}});function Ey(e,t,n){return e<t?t:e>n?n:e}var yr,br,ys,il,So,Sr,ol,Ay=_(()=>{"use strict";Au();nl();Eu();yr=16777215,br=24,ys=1,il=2,So=new Uint8Array(32);So[2]=22;So[21]=22;So[19]=20;So[23]=24;Sr=new Uint8Array(32);Sr[2]=ys;Sr[21]=ys;Sr[19]=ys;Sr[23]=ys;Sr[22]=il;Sr[20]=il;Sr[24]=il;ol=class{constructor(t,n){this.setSource(t,n)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",n=()=>{}){t=String(t||"");let r=t.length,o=xi(this.offsetAndType,t.length+1),i=xi(this.balance,t.length+1),s=0,a=-1,u=0,c=t.length;this.offsetAndType=null,this.balance=null,i.fill(0),n(t,(l,d,g)=>{let p=s++;if(o[p]=l<<br|g,a===-1&&(a=d),i[p]=c,l===u){let f=i[c];i[c]=p,c=f,u=So[o[f]>>br]}else this.isBlockOpenerTokenType(l)&&(c=p,u=So[l])}),o[s]=0<<br|r,i[s]=s;for(let l=0;l<s;l++){let d=i[l];if(d<=l){let g=i[d];g!==l&&(i[l]=g)}else d>s&&(i[l]=s)}this.source=t,this.firstCharOffset=a===-1?0:a,this.tokenCount=s,this.offsetAndType=o,this.balance=i,this.reset(),this.next()}lookupType(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t]>>br:0}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>br;if(r!==13&&r!==25&&t--===0)return r}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&yr:this.source.length}lookupOffsetNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>br;if(r!==13&&r!==25&&t--===0)return n-this.tokenIndex}return 0}lookupValue(t,n){return t+=this.tokenIndex,t<this.tokenCount?qr(this.source,this.offsetAndType[t-1]&yr,this.offsetAndType[t]&yr,n):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&yr:this.offsetAndType[this.tokenCount]&yr:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[Ey(t,0,this.tokenCount)]&yr}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[Ey(t,0,this.tokenCount)]>>br}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return Sr[t]===ys}isBlockCloserTokenType(t){return Sr[t]===il}getBlockTokenPairIndex(t){let n=this.getTokenType(t);if(Sr[n]===1){let r=this.balance[t],o=this.getTokenType(r);return So[n]===o?r:-1}else if(Sr[n]===2){let r=this.balance[t],o=this.getTokenType(r);return So[o]===n?r:-1}return-1}isBalanceEdge(t){return this.balance[this.tokenIndex]<t}isDelim(t,n){return n?this.lookupType(n)===9&&this.source.charCodeAt(this.lookupOffset(n))===t:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===t}skip(t){let n=this.tokenIndex+t;n<this.tokenCount?(this.tokenIndex=n,this.tokenStart=this.offsetAndType[n-1]&yr,n=this.offsetAndType[n],this.tokenType=n>>br,this.tokenEnd=n&yr):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.tokenEnd,t=this.offsetAndType[t],this.tokenType=t>>br,this.tokenEnd=t&yr):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(t,n){let r=t,o=0,i=0;e:for(;r<this.tokenCount;r++){if(o=this.balance[r],o<t)break e;switch(i=r>0?this.offsetAndType[r-1]&yr:this.firstCharOffset,n(this.source.charCodeAt(i))){case 1:break e;case 2:r++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[r]>>br)&&(r=o)}}this.skip(r-this.tokenIndex)}forEachToken(t){for(let n=0,r=this.firstCharOffset;n<this.tokenCount;n++){let o=r,i=this.offsetAndType[n],s=i&yr,a=i>>br;r=s,t(a,o,s,n)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken((n,r,o,i)=>{t[i]={idx:i,type:hi[n],chunk:this.source.substring(r,o),balance:this.balance[i]}}),t}}});function wo(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Go(e,c),fi(n(c),n(c+1),n(c+2))){l=12,c=xs(e,c);return}if(n(c)===37){l=11,c++;return}l=10}function o(){let d=c;if(c=xs(e,c),qr(e,d,c,"url")&&n(c)===40){if(c=hs(e,c+1),n(c)===34||n(c)===39){l=2,c=d+4;return}s();return}if(n(c)===40){l=2,c++;return}l=1}function i(d){for(d||(d=n(c++)),l=5;c<e.length;c++){let g=e.charCodeAt(c);switch(Ja(g)){case d:c++;return;case fs:if(gs(g)){c+=Za(e,c,g),l=6;return}break;case 92:if(c===e.length-1)break;let p=n(c+1);gs(p)?c+=Za(e,c+1,p):Pn(g,p)&&(c=Yr(e,c)-1);break}}}function s(){for(l=7,c=hs(e,c);c<e.length;c++){let d=e.charCodeAt(c);switch(Ja(d)){case 41:c++;return;case fs:if(c=hs(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=el(e,c),l=8;return;case 34:case 39:case 40:case Iu:c=el(e,c),l=8;return;case 92:if(Pn(d,n(c+1))){c=Yr(e,c)-1;break}c=el(e,c),l=8;return}}}e=String(e||"");let a=e.length,u=Xa(n(0)),c=u,l;for(;c<a;){let d=e.charCodeAt(c);switch(Ja(d)){case fs:l=13,c=hs(e,c+1);break;case 34:i();break;case 35:Ya(n(c+1))||Pn(n(c+1),n(c+2))?(l=4,c=xs(e,c+1)):(l=9,c++);break;case 39:i();break;case 40:l=21,c++;break;case 41:l=22,c++;break;case 43:Ka(d,n(c+1),n(c+2))?r():(l=9,c++);break;case 44:l=18,c++;break;case 45:Ka(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(l=15,c=c+3):fi(d,n(c+1),n(c+2))?o():(l=9,c++);break;case 46:Ka(d,n(c+1),n(c+2))?r():(l=9,c++);break;case 47:n(c+1)===42?(l=25,c=e.indexOf("*/",c+2),c=c===-1?e.length:c+2):(l=9,c++);break;case 58:l=16,c++;break;case 59:l=17,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(l=14,c=c+4):(l=9,c++);break;case 64:fi(n(c+1),n(c+2),n(c+3))?(l=3,c=xs(e,c+1)):(l=9,c++);break;case 91:l=19,c++;break;case 92:Pn(d,n(c+1))?o():(l=9,c++);break;case 93:l=20,c++;break;case 123:l=23,c++;break;case 125:l=24,c++;break;case Tu:r();break;case Qa:o();break;default:l=9,c++}t(l,u,u=c)}}var sr=_(()=>{"use strict";ms();nl();ku();ku();Eu();ms();nl();Fy();Ay()});var yi,Xn,Ss=_(()=>{"use strict";yi=null,Xn=class e{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return e.createItem(t)}allocateCursor(t,n){let r;return yi!==null?(r=yi,yi=yi.cursor,r.prev=t,r.next=n,r.cursor=this.cursor):r={prev:t,next:n,cursor:this.cursor},this.cursor=r,r}releaseCursor(){let{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=yi,yi=t}updateCursors(t,n,r,o){let{cursor:i}=this;for(;i!==null;)i.prev===t&&(i.prev=n),i.next===r&&(i.next=o),i=i.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){let o=e.createItem(r);n!==null?n.next=o:this.head=o,o.prev=n,n=o}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){let r=this.allocateCursor(null,this.head);for(;r.next!==null;){let o=r.next;r.next=o.next,t.call(n,o.data,o,this)}this.releaseCursor()}forEachRight(t,n=this){let r=this.allocateCursor(this.tail,null);for(;r.prev!==null;){let o=r.prev;r.prev=o.prev,t.call(n,o.data,o,this)}this.releaseCursor()}reduce(t,n,r=this){let o=this.allocateCursor(null,this.head),i=n,s;for(;o.next!==null;)s=o.next,o.next=s.next,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}reduceRight(t,n,r=this){let o=this.allocateCursor(this.tail,null),i=n,s;for(;o.prev!==null;)s=o.prev,o.prev=s.prev,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}some(t,n=this){for(let r=this.head;r!==null;r=r.next)if(t.call(n,r.data,r,this))return!0;return!1}map(t,n=this){let r=new e;for(let o=this.head;o!==null;o=o.next)r.appendData(t.call(n,o.data,o,this));return r}filter(t,n=this){let r=new e;for(let o=this.head;o!==null;o=o.next)t.call(n,o.data,o,this)&&r.appendData(o.data);return r}nextUntil(t,n,r=this){if(t===null)return;let o=this.allocateCursor(null,t);for(;o.next!==null;){let i=o.next;if(o.next=i.next,n.call(r,i.data,i,this))break}this.releaseCursor()}prevUntil(t,n,r=this){if(t===null)return;let o=this.allocateCursor(t,null);for(;o.prev!==null;){let i=o.prev;if(o.prev=i.prev,n.call(r,i.data,i,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new e;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(e.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(e.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(e.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(e.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(e.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}}});function Yo(e,t){let n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
2
|
+
`)}})}var al=_(()=>{"use strict"});function My({source:e,line:t,column:n,baseLine:r,baseColumn:o},i){function s(f,k){return c.slice(f,k).map((T,E)=>String(f+E+1).padStart(g)+" |"+T).join(`
|
|
3
3
|
`)}let a=`
|
|
4
|
-
`.repeat(Math.max(r-1,0)),u=" ".repeat(Math.max(o-1,0)),c=(a+u+e).split(/\r\n?|\n|\f/),l=Math.max(1,t-i)-1,d=Math.min(t+i,c.length+1),
|
|
5
|
-
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function Lu(e,t,n,r,o,i=1,s=1){return Object.assign(Yo("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment(u){return
|
|
6
|
-
`+Ly({source:t,line:r,column:o,baseLine:i,baseColumn:s},2)}})}var Pu,Ay,Py,My=_(()=>{"use strict";sl();Pu=100,Ay=60,Py=" "});function By(e){let t=this.createList(),n=!1,r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let o=e.getNode.call(this,r);if(o===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,o,t,r),n=!1),t.push(o)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var Dy=_(()=>{"use strict"});function BE(e){return function(){return this[e]()}}function Bu(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n],o=r.parse||r;o&&(t[n]=o)}return t}function DE(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Bu(e.atrule),pseudo:Bu(e.pseudo),node:Bu(e.node)};for(let[n,r]of Object.entries(e.parseContext))switch(typeof r){case"function":t.context[n]=r;break;case"string":t.context[n]=BE(r);break}return{config:t,...t,...t.node}}function Ny(e){let t="",n="<unknown>",r=!1,o=bi,i=!1,s=new nl,a=Object.assign(new rl,DE(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:By,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===Ry?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===Ry||l===Mu?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===AE||l===Mu?1:0},consumeUntilSemicolonIncluded(l){return l===Mu?2:0},createList:bi,createSingleNodeList:bi,getFirstListNode:bi,getLastListNode:bi,parseWithFallback(l,d){let f=this.tokenIndex;try{return l.call(this)}catch(p){if(i)throw p;this.skip(f-this.tokenIndex);let g=d.call(this);return i=!0,o(p,g),i=!1,g}},lookupNonWSType(l){let d;do if(d=this.lookupType(l++),d!==13&&d!==25)return d;while(d!==zy);return zy},charCodeAt(l){return l>=0&&l<t.length?t.charCodeAt(l):0},substring(l,d){return t.substring(l,d)},substrToCursor(l){return this.source.substring(l,this.tokenStart)},cmpChar(l,d){return Gr(t,l,d)},cmpStr(l,d,f){return qr(t,l,d,f)},consume(l){let d=this.tokenStart;return this.eat(l),this.substrToCursor(d)},consumeFunctionName(){let l=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),l},consumeNumber(l){let d=t.substring(this.tokenStart,Go(t,this.tokenStart));return this.eat(l),d},eat(l){if(this.tokenType!==l){let d=hi[l].slice(0,-6).replace(/-/g," ").replace(/^./,g=>g.toUpperCase()),f=`${/[[\](){}]/.test(d)?`"${d}"`:d} is expected`,p=this.tokenStart;switch(l){case 1:this.tokenType===2||this.tokenType===7?(p=this.tokenEnd-1,f="Identifier is expected but function found"):f="Identifier is expected";break;case 4:this.isDelim(PE)&&(this.next(),p++,f="Name is expected");break;case 11:this.tokenType===10&&(p=this.tokenEnd,f="Percent sign is expected");break}this.error(f,p)}this.next()},eatIdent(l){(this.tokenType!==1||this.lookupValue(0,l)===!1)&&this.error(`Identifier "${l}" is expected`),this.next()},eatDelim(l){this.isDelim(l)||this.error(`Delim "${String.fromCharCode(l)}" is expected`),this.next()},getLocation(l,d){return r?s.getLocationRange(l,d,n):null},getLocationFromList(l){if(r){let d=this.getFirstListNode(l),f=this.getLastListNode(l);return s.getLocationRange(d!==null?d.loc.start.offset-s.startOffset:this.tokenStart,f!==null?f.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(l,d){let f=typeof d<"u"&&d<t.length?s.getLocation(d):this.eof?s.getLocation(vy(t,t.length-1)):s.getLocation(this.tokenStart);throw new Lu(l||"Unexpected input",t,f.offset,f.line,f.column,s.startLine,s.startColumn)}}),u=()=>({filename:n,source:t,tokenCount:a.tokenCount,getTokenType:l=>a.getTokenType(l),getTokenTypeName:l=>hi[a.getTokenType(l)],getTokenStart:l=>a.getTokenStart(l),getTokenEnd:l=>a.getTokenEnd(l),getTokenValue:l=>a.source.substring(a.getTokenStart(l),a.getTokenEnd(l)),substring:(l,d)=>a.source.substring(l,d),balance:a.balance.subarray(0,a.tokenCount+1),isBlockOpenerTokenType:a.isBlockOpenerTokenType,isBlockCloserTokenType:a.isBlockCloserTokenType,getBlockTokenPairIndex:l=>a.getBlockTokenPairIndex(l),getLocation:l=>s.getLocation(l,n),getRangeLocation:(l,d)=>s.getLocationRange(l,d,n)});return Object.assign(function(l,d){t=l,d=d||{},a.setSource(t,wo),s.setSource(t,d.offset,d.line,d.column),n=d.filename||"<unknown>",r=!!d.positions,o=typeof d.onParseError=="function"?d.onParseError:bi,i=!1,a.parseAtrulePrelude="parseAtrulePrelude"in d?!!d.parseAtrulePrelude:!0,a.parseRulePrelude="parseRulePrelude"in d?!!d.parseRulePrelude:!0,a.parseValue="parseValue"in d?!!d.parseValue:!0,a.parseCustomProperty="parseCustomProperty"in d?!!d.parseCustomProperty:!1;let{context:f="default",list:p=!0,onComment:g,onToken:k}=d;if(!(f in a.context))throw new Error("Unknown context `"+f+"`");Object.assign(a,p?ME:LE),Array.isArray(k)?a.forEachToken((E,I,D)=>{k.push({type:E,start:I,end:D})}):typeof k=="function"&&a.forEachToken(k.bind(u())),typeof g=="function"&&a.forEachToken((E,I,D)=>{if(E===25){let R=a.getLocation(I,D),$=qr(t,D-2,D,"*/")?t.slice(I+2,D-2):t.slice(I+2,D);g($,R)}});let T=a.context[f].call(a,d);return a.eof||a.error(),T},{SyntaxError:Lu,config:a.config})}var bi,AE,PE,Mu,Ry,zy,LE,ME,Oy=_(()=>{"use strict";bs();My();sr();Dy();bi=()=>{},AE=33,PE=35,Mu=59,Ry=123,zy=0,LE={createList(){return[]},createSingleNodeList(e){return[e]},getFirstListNode(e){return e&&e[0]||null},getLastListNode(e){return e&&e.length>0?e[e.length-1]:null}},ME={createList(){return new Xn},createSingleNodeList(e){return new Xn().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}}});var $y=rr(Du=>{"use strict";var _y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Du.encode=function(e){if(0<=e&&e<_y.length)return _y[e];throw new TypeError("Must be between 0 and 63: "+e)};Du.decode=function(e){var t=65,n=90,r=97,o=122,i=48,s=57,a=43,u=47,c=26,l=52;return t<=e&&e<=n?e-t:r<=e&&e<=o?e-r+c:i<=e&&e<=s?e-i+l:e==a?62:e==u?63:-1}});var Vy=rr(zu=>{"use strict";var Uy=$y(),Ru=5,jy=1<<Ru,Hy=jy-1,Wy=jy;function RE(e){return e<0?(-e<<1)+1:(e<<1)+0}function zE(e){var t=(e&1)===1,n=e>>1;return t?-n:n}zu.encode=function(t){var n="",r,o=RE(t);do r=o&Hy,o>>>=Ru,o>0&&(r|=Wy),n+=Uy.encode(r);while(o>0);return n};zu.decode=function(t,n,r){var o=t.length,i=0,s=0,a,u;do{if(n>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(u=Uy.decode(t.charCodeAt(n++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(n-1));a=!!(u&Wy),u&=Hy,i=i+(u<<s),s+=Ru}while(a);r.value=zE(i),r.rest=n}});var al=rr(sn=>{"use strict";function NE(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}sn.getArg=NE;var Gy=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,OE=/^data:.+\,.+$/;function Ss(e){var t=e.match(Gy);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}sn.urlParse=Ss;function Si(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}sn.urlGenerate=Si;var _E=32;function $E(e){var t=[];return function(n){for(var r=0;r<t.length;r++)if(t[r].input===n){var o=t[0];return t[0]=t[r],t[r]=o,t[0].result}var i=e(n);return t.unshift({input:n,result:i}),t.length>_E&&t.pop(),i}}var Nu=$E(function(t){var n=t,r=Ss(t);if(r){if(!r.path)return t;n=r.path}for(var o=sn.isAbsolute(n),i=[],s=0,a=0;;)if(s=a,a=n.indexOf("/",s),a===-1){i.push(n.slice(s));break}else for(i.push(n.slice(s,a));a<n.length&&n[a]==="/";)a++;for(var u,c=0,a=i.length-1;a>=0;a--)u=i[a],u==="."?i.splice(a,1):u===".."?c++:c>0&&(u===""?(i.splice(a+1,c),c=0):(i.splice(a,2),c--));return n=i.join("/"),n===""&&(n=o?"/":"."),r?(r.path=n,Si(r)):n});sn.normalize=Nu;function qy(e,t){e===""&&(e="."),t===""&&(t=".");var n=Ss(t),r=Ss(e);if(r&&(e=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),Si(n);if(n||t.match(OE))return t;if(r&&!r.host&&!r.path)return r.host=t,Si(r);var o=t.charAt(0)==="/"?t:Nu(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=o,Si(r)):o}sn.join=qy;sn.isAbsolute=function(e){return e.charAt(0)==="/"||Gy.test(e)};function UE(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var n=0;t.indexOf(e+"/")!==0;){var r=e.lastIndexOf("/");if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)}sn.relative=UE;var Yy=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Ky(e){return e}function jE(e){return Xy(e)?"$"+e:e}sn.toSetString=Yy?Ky:jE;function HE(e){return Xy(e)?e.slice(1):e}sn.fromSetString=Yy?Ky:HE;function Xy(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function WE(e,t,n){var r=Kr(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Kr(e.name,t.name)}sn.compareByOriginalPositions=WE;function VE(e,t,n){var r;return r=e.originalLine-t.originalLine,r!==0||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Kr(e.name,t.name)}sn.compareByOriginalPositionsNoSource=VE;function GE(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=Kr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Kr(e.name,t.name)}sn.compareByGeneratedPositionsDeflated=GE;function qE(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=Kr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Kr(e.name,t.name)}sn.compareByGeneratedPositionsDeflatedNoLine=qE;function Kr(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function YE(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=Kr(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:Kr(e.name,t.name)}sn.compareByGeneratedPositionsInflated=YE;function KE(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}sn.parseSourceMapInput=KE;function XE(e,t,n){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),n){var r=Ss(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var o=r.path.lastIndexOf("/");o>=0&&(r.path=r.path.substring(0,o+1))}t=qy(Si(r),t)}return Nu(t)}sn.computeSourceURL=XE});var Jy=rr(Qy=>{"use strict";var Ou=al(),_u=Object.prototype.hasOwnProperty,Ko=typeof Map<"u";function Xr(){this._array=[],this._set=Ko?new Map:Object.create(null)}Xr.fromArray=function(t,n){for(var r=new Xr,o=0,i=t.length;o<i;o++)r.add(t[o],n);return r};Xr.prototype.size=function(){return Ko?this._set.size:Object.getOwnPropertyNames(this._set).length};Xr.prototype.add=function(t,n){var r=Ko?t:Ou.toSetString(t),o=Ko?this.has(t):_u.call(this._set,r),i=this._array.length;(!o||n)&&this._array.push(t),o||(Ko?this._set.set(t,i):this._set[r]=i)};Xr.prototype.has=function(t){if(Ko)return this._set.has(t);var n=Ou.toSetString(t);return _u.call(this._set,n)};Xr.prototype.indexOf=function(t){if(Ko){var n=this._set.get(t);if(n>=0)return n}else{var r=Ou.toSetString(t);if(_u.call(this._set,r))return this._set[r]}throw new Error('"'+t+'" is not in the set.')};Xr.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};Xr.prototype.toArray=function(){return this._array.slice()};Qy.ArraySet=Xr});var tb=rr(eb=>{"use strict";var Zy=al();function QE(e,t){var n=e.generatedLine,r=t.generatedLine,o=e.generatedColumn,i=t.generatedColumn;return r>n||r==n&&i>=o||Zy.compareByGeneratedPositionsInflated(e,t)<=0}function ll(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}ll.prototype.unsortedForEach=function(t,n){this._array.forEach(t,n)};ll.prototype.add=function(t){QE(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};ll.prototype.toArray=function(){return this._sorted||(this._array.sort(Zy.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};eb.MappingList=ll});var rb=rr(nb=>{"use strict";var ws=Vy(),jt=al(),cl=Jy().ArraySet,JE=tb().MappingList;function ar(e){e||(e={}),this._file=jt.getArg(e,"file",null),this._sourceRoot=jt.getArg(e,"sourceRoot",null),this._skipValidation=jt.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=jt.getArg(e,"ignoreInvalidMapping",!1),this._sources=new cl,this._names=new cl,this._mappings=new JE,this._sourcesContents=null}ar.prototype._version=3;ar.fromSourceMap=function(t,n){var r=t.sourceRoot,o=new ar(Object.assign(n||{},{file:t.file,sourceRoot:r}));return t.eachMapping(function(i){var s={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(s.source=i.source,r!=null&&(s.source=jt.relative(r,s.source)),s.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(s.name=i.name)),o.addMapping(s)}),t.sources.forEach(function(i){var s=i;r!==null&&(s=jt.relative(r,i)),o._sources.has(s)||o._sources.add(s);var a=t.sourceContentFor(i);a!=null&&o.setSourceContent(i,a)}),o};ar.prototype.addMapping=function(t){var n=jt.getArg(t,"generated"),r=jt.getArg(t,"original",null),o=jt.getArg(t,"source",null),i=jt.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(n,r,o,i)===!1||(o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:o,name:i}))};ar.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot!=null&&(r=jt.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[jt.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[jt.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ar.prototype.applySourceMap=function(t,n,r){var o=n;if(n==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=t.file}var i=this._sourceRoot;i!=null&&(o=jt.relative(i,o));var s=new cl,a=new cl;this._mappings.unsortedForEach(function(u){if(u.source===o&&u.originalLine!=null){var c=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});c.source!=null&&(u.source=c.source,r!=null&&(u.source=jt.join(r,u.source)),i!=null&&(u.source=jt.relative(i,u.source)),u.originalLine=c.line,u.originalColumn=c.column,c.name!=null&&(u.name=c.name))}var l=u.source;l!=null&&!s.has(l)&&s.add(l);var d=u.name;d!=null&&!a.has(d)&&a.add(d)},this),this._sources=s,this._names=a,t.sources.forEach(function(u){var c=t.sourceContentFor(u);c!=null&&(r!=null&&(u=jt.join(r,u)),i!=null&&(u=jt.relative(i,u)),this.setSourceContent(u,c))},this)};ar.prototype._validateMapping=function(t,n,r,o){if(n&&typeof n.line!="number"&&typeof n.column!="number"){var i="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!n&&!r&&!o)){if(t&&"line"in t&&"column"in t&&n&&"line"in n&&"column"in n&&t.line>0&&t.column>=0&&n.line>0&&n.column>=0&&r)return;var i="Invalid mapping: "+JSON.stringify({generated:t,source:r,original:n,name:o});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}};ar.prototype._serializeMappings=function(){for(var t=0,n=1,r=0,o=0,i=0,s=0,a="",u,c,l,d,f=this._mappings.toArray(),p=0,g=f.length;p<g;p++){if(c=f[p],u="",c.generatedLine!==n)for(t=0;c.generatedLine!==n;)u+=";",n++;else if(p>0){if(!jt.compareByGeneratedPositionsInflated(c,f[p-1]))continue;u+=","}u+=ws.encode(c.generatedColumn-t),t=c.generatedColumn,c.source!=null&&(d=this._sources.indexOf(c.source),u+=ws.encode(d-s),s=d,u+=ws.encode(c.originalLine-1-o),o=c.originalLine-1,u+=ws.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(l=this._names.indexOf(c.name),u+=ws.encode(l-i),i=l)),a+=u}return a};ar.prototype._generateSourcesContent=function(t,n){return t.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=jt.relative(n,r));var o=jt.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};ar.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};ar.prototype.toString=function(){return JSON.stringify(this.toJSON())};nb.SourceMapGenerator=ar});function sb(e){let t=new ib.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},o={line:1,column:0},i={generated:o},s=1,a=0,u=!1,c=e.node;e.node=function(f){if(f.loc&&f.loc.start&&ob.has(f.type)){let p=f.loc.start.line,g=f.loc.start.column-1;(r.line!==p||r.column!==g)&&(r.line=p,r.column=g,n.line=s,n.column=a,u&&(u=!1,(n.line!==o.line||n.column!==o.column)&&t.addMapping(i)),u=!0,t.addMapping({source:f.loc.source,original:r,generated:n}))}c.call(this,f),u&&ob.has(f.type)&&(o.line=s,o.column=a)};let l=e.emit;e.emit=function(f,p,g){for(let k=0;k<f.length;k++)f.charCodeAt(k)===10?(s++,a=0):a++;l(f,p,g)};let d=e.result;return e.result=function(){return u&&t.addMapping(i),{css:d(),map:t}},e}var ib,ob,ab=_(()=>{"use strict";ib=$a(rb(),1),ob=new Set(["Atrule","Selector","Declaration"])});var ul={};Se(ul,{safe:()=>Uu,spec:()=>nA});function cb(e){let t=new Set(e.map(([n,r])=>$u(n)<<16|$u(r)));return function(n,r,o){let i=$u(r,o),s=o.charCodeAt(0),a=s===eA&&r!==1&&r!==2&&r!==15||s===ZE?t.has((n&65534)<<16|s<<7):t.has((n&65534)<<16|i);return i|a}}var ZE,eA,$u,lb,tA,nA,Uu,ub=_(()=>{"use strict";ZE=43,eA=45,$u=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),lb=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],tA=lb.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);nA=cb(lb),Uu=cb(tA)});function oA(e,t){if(typeof t=="function"){let n=null;e.children.forEach(r=>{n!==null&&t.call(this,n),this.node(r),n=r});return}e.children.forEach(this.node,this)}function pb(e){let t=new Map;for(let[n,r]of Object.entries(e.node))typeof(r.generate||r)=="function"&&t.set(n,r.generate||r);return function(n,r){let o="",i=0,s={node(u){if(t.has(u.type))t.get(u.type).call(a,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Uu,token(u,c,l){i=this.tokenBefore(i,u,c),!l&&i&1&&this.emit(" ",13,!0),this.emit(c,u,!1),u===9&&c.charCodeAt(0)===rA&&this.emit(`
|
|
7
|
-
`,13,!0)},emit(u){o+=u},result(){return o}};r&&(typeof r.decorator=="function"&&(s=r.decorator(s)),r.sourceMap&&(s=
|
|
4
|
+
`.repeat(Math.max(r-1,0)),u=" ".repeat(Math.max(o-1,0)),c=(a+u+e).split(/\r\n?|\n|\f/),l=Math.max(1,t-i)-1,d=Math.min(t+i,c.length+1),g=Math.max(4,String(d).length)+1,p=0;n+=(Ly.length-1)*(c[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>Pu&&(p=n-Py+3,n=Py-2);for(let f=l;f<=d;f++)f>=0&&f<c.length&&(c[f]=c[f].replace(/\t/g,Ly),c[f]=(p>0&&c[f].length>p?"\u2026":"")+c[f].substr(p,Pu-2)+(c[f].length>p+Pu-1?"\u2026":""));return[s(l,t),new Array(n+g+2).join("-")+"^",s(t,d)].filter(Boolean).join(`
|
|
5
|
+
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function Lu(e,t,n,r,o,i=1,s=1){return Object.assign(Yo("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment(u){return My({source:t,line:r,column:o,baseLine:i,baseColumn:s},isNaN(u)?0:u)},get formattedMessage(){return`Parse error: ${e}
|
|
6
|
+
`+My({source:t,line:r,column:o,baseLine:i,baseColumn:s},2)}})}var Pu,Py,Ly,By=_(()=>{"use strict";al();Pu=100,Py=60,Ly=" "});function Dy(e){let t=this.createList(),n=!1,r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let o=e.getNode.call(this,r);if(o===void 0)break;n&&(e.onWhiteSpace&&e.onWhiteSpace.call(this,o,t,r),n=!1),t.push(o)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var Ry=_(()=>{"use strict"});function zE(e){return function(){return this[e]()}}function Bu(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n],o=r.parse||r;o&&(t[n]=o)}return t}function NE(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:Bu(e.atrule),pseudo:Bu(e.pseudo),node:Bu(e.node)};for(let[n,r]of Object.entries(e.parseContext))switch(typeof r){case"function":t.context[n]=r;break;case"string":t.context[n]=zE(r);break}return{config:t,...t,...t.node}}function Oy(e){let t="",n="<unknown>",r=!1,o=bi,i=!1,s=new rl,a=Object.assign(new ol,NE(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Dy,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===zy?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===zy||l===Mu?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===ME||l===Mu?1:0},consumeUntilSemicolonIncluded(l){return l===Mu?2:0},createList:bi,createSingleNodeList:bi,getFirstListNode:bi,getLastListNode:bi,parseWithFallback(l,d){let g=this.tokenIndex;try{return l.call(this)}catch(p){if(i)throw p;this.skip(g-this.tokenIndex);let f=d.call(this);return i=!0,o(p,f),i=!1,f}},lookupNonWSType(l){let d;do if(d=this.lookupType(l++),d!==13&&d!==25)return d;while(d!==Ny);return Ny},charCodeAt(l){return l>=0&&l<t.length?t.charCodeAt(l):0},substring(l,d){return t.substring(l,d)},substrToCursor(l){return this.source.substring(l,this.tokenStart)},cmpChar(l,d){return Gr(t,l,d)},cmpStr(l,d,g){return qr(t,l,d,g)},consume(l){let d=this.tokenStart;return this.eat(l),this.substrToCursor(d)},consumeFunctionName(){let l=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),l},consumeNumber(l){let d=t.substring(this.tokenStart,Go(t,this.tokenStart));return this.eat(l),d},eat(l){if(this.tokenType!==l){let d=hi[l].slice(0,-6).replace(/-/g," ").replace(/^./,f=>f.toUpperCase()),g=`${/[[\](){}]/.test(d)?`"${d}"`:d} is expected`,p=this.tokenStart;switch(l){case 1:this.tokenType===2||this.tokenType===7?(p=this.tokenEnd-1,g="Identifier is expected but function found"):g="Identifier is expected";break;case 4:this.isDelim(BE)&&(this.next(),p++,g="Name is expected");break;case 11:this.tokenType===10&&(p=this.tokenEnd,g="Percent sign is expected");break}this.error(g,p)}this.next()},eatIdent(l){(this.tokenType!==1||this.lookupValue(0,l)===!1)&&this.error(`Identifier "${l}" is expected`),this.next()},eatDelim(l){this.isDelim(l)||this.error(`Delim "${String.fromCharCode(l)}" is expected`),this.next()},getLocation(l,d){return r?s.getLocationRange(l,d,n):null},getLocationFromList(l){if(r){let d=this.getFirstListNode(l),g=this.getLastListNode(l);return s.getLocationRange(d!==null?d.loc.start.offset-s.startOffset:this.tokenStart,g!==null?g.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(l,d){let g=typeof d<"u"&&d<t.length?s.getLocation(d):this.eof?s.getLocation(ky(t,t.length-1)):s.getLocation(this.tokenStart);throw new Lu(l||"Unexpected input",t,g.offset,g.line,g.column,s.startLine,s.startColumn)}}),u=()=>({filename:n,source:t,tokenCount:a.tokenCount,getTokenType:l=>a.getTokenType(l),getTokenTypeName:l=>hi[a.getTokenType(l)],getTokenStart:l=>a.getTokenStart(l),getTokenEnd:l=>a.getTokenEnd(l),getTokenValue:l=>a.source.substring(a.getTokenStart(l),a.getTokenEnd(l)),substring:(l,d)=>a.source.substring(l,d),balance:a.balance.subarray(0,a.tokenCount+1),isBlockOpenerTokenType:a.isBlockOpenerTokenType,isBlockCloserTokenType:a.isBlockCloserTokenType,getBlockTokenPairIndex:l=>a.getBlockTokenPairIndex(l),getLocation:l=>s.getLocation(l,n),getRangeLocation:(l,d)=>s.getLocationRange(l,d,n)});return Object.assign(function(l,d){t=l,d=d||{},a.setSource(t,wo),s.setSource(t,d.offset,d.line,d.column),n=d.filename||"<unknown>",r=!!d.positions,o=typeof d.onParseError=="function"?d.onParseError:bi,i=!1,a.parseAtrulePrelude="parseAtrulePrelude"in d?!!d.parseAtrulePrelude:!0,a.parseRulePrelude="parseRulePrelude"in d?!!d.parseRulePrelude:!0,a.parseValue="parseValue"in d?!!d.parseValue:!0,a.parseCustomProperty="parseCustomProperty"in d?!!d.parseCustomProperty:!1;let{context:g="default",list:p=!0,onComment:f,onToken:k}=d;if(!(g in a.context))throw new Error("Unknown context `"+g+"`");Object.assign(a,p?RE:DE),Array.isArray(k)?a.forEachToken((E,I,D)=>{k.push({type:E,start:I,end:D})}):typeof k=="function"&&a.forEachToken(k.bind(u())),typeof f=="function"&&a.forEachToken((E,I,D)=>{if(E===25){let R=a.getLocation(I,D),$=qr(t,D-2,D,"*/")?t.slice(I+2,D-2):t.slice(I+2,D);f($,R)}});let T=a.context[g].call(a,d);return a.eof||a.error(),T},{SyntaxError:Lu,config:a.config})}var bi,ME,BE,Mu,zy,Ny,DE,RE,_y=_(()=>{"use strict";Ss();By();sr();Ry();bi=()=>{},ME=33,BE=35,Mu=59,zy=123,Ny=0,DE={createList(){return[]},createSingleNodeList(e){return[e]},getFirstListNode(e){return e&&e[0]||null},getLastListNode(e){return e&&e.length>0?e[e.length-1]:null}},RE={createList(){return new Xn},createSingleNodeList(e){return new Xn().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}}});var Uy=rr(Du=>{"use strict";var $y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");Du.encode=function(e){if(0<=e&&e<$y.length)return $y[e];throw new TypeError("Must be between 0 and 63: "+e)};Du.decode=function(e){var t=65,n=90,r=97,o=122,i=48,s=57,a=43,u=47,c=26,l=52;return t<=e&&e<=n?e-t:r<=e&&e<=o?e-r+c:i<=e&&e<=s?e-i+l:e==a?62:e==u?63:-1}});var Gy=rr(zu=>{"use strict";var jy=Uy(),Ru=5,Hy=1<<Ru,Wy=Hy-1,Vy=Hy;function OE(e){return e<0?(-e<<1)+1:(e<<1)+0}function _E(e){var t=(e&1)===1,n=e>>1;return t?-n:n}zu.encode=function(t){var n="",r,o=OE(t);do r=o&Wy,o>>>=Ru,o>0&&(r|=Vy),n+=jy.encode(r);while(o>0);return n};zu.decode=function(t,n,r){var o=t.length,i=0,s=0,a,u;do{if(n>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(u=jy.decode(t.charCodeAt(n++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(n-1));a=!!(u&Vy),u&=Wy,i=i+(u<<s),s+=Ru}while(a);r.value=_E(i),r.rest=n}});var ll=rr(sn=>{"use strict";function $E(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}sn.getArg=$E;var qy=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,UE=/^data:.+\,.+$/;function ws(e){var t=e.match(qy);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}sn.urlParse=ws;function Si(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}sn.urlGenerate=Si;var jE=32;function HE(e){var t=[];return function(n){for(var r=0;r<t.length;r++)if(t[r].input===n){var o=t[0];return t[0]=t[r],t[r]=o,t[0].result}var i=e(n);return t.unshift({input:n,result:i}),t.length>jE&&t.pop(),i}}var Nu=HE(function(t){var n=t,r=ws(t);if(r){if(!r.path)return t;n=r.path}for(var o=sn.isAbsolute(n),i=[],s=0,a=0;;)if(s=a,a=n.indexOf("/",s),a===-1){i.push(n.slice(s));break}else for(i.push(n.slice(s,a));a<n.length&&n[a]==="/";)a++;for(var u,c=0,a=i.length-1;a>=0;a--)u=i[a],u==="."?i.splice(a,1):u===".."?c++:c>0&&(u===""?(i.splice(a+1,c),c=0):(i.splice(a,2),c--));return n=i.join("/"),n===""&&(n=o?"/":"."),r?(r.path=n,Si(r)):n});sn.normalize=Nu;function Yy(e,t){e===""&&(e="."),t===""&&(t=".");var n=ws(t),r=ws(e);if(r&&(e=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),Si(n);if(n||t.match(UE))return t;if(r&&!r.host&&!r.path)return r.host=t,Si(r);var o=t.charAt(0)==="/"?t:Nu(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=o,Si(r)):o}sn.join=Yy;sn.isAbsolute=function(e){return e.charAt(0)==="/"||qy.test(e)};function WE(e,t){e===""&&(e="."),e=e.replace(/\/$/,"");for(var n=0;t.indexOf(e+"/")!==0;){var r=e.lastIndexOf("/");if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)}sn.relative=WE;var Ky=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Xy(e){return e}function VE(e){return Qy(e)?"$"+e:e}sn.toSetString=Ky?Xy:VE;function GE(e){return Qy(e)?e.slice(1):e}sn.fromSetString=Ky?Xy:GE;function Qy(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function qE(e,t,n){var r=Kr(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Kr(e.name,t.name)}sn.compareByOriginalPositions=qE;function YE(e,t,n){var r;return r=e.originalLine-t.originalLine,r!==0||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:Kr(e.name,t.name)}sn.compareByOriginalPositionsNoSource=YE;function KE(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=Kr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Kr(e.name,t.name)}sn.compareByGeneratedPositionsDeflated=KE;function XE(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=Kr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Kr(e.name,t.name)}sn.compareByGeneratedPositionsDeflatedNoLine=XE;function Kr(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function QE(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=Kr(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:Kr(e.name,t.name)}sn.compareByGeneratedPositionsInflated=QE;function JE(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}sn.parseSourceMapInput=JE;function ZE(e,t,n){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),n){var r=ws(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var o=r.path.lastIndexOf("/");o>=0&&(r.path=r.path.substring(0,o+1))}t=Yy(Si(r),t)}return Nu(t)}sn.computeSourceURL=ZE});var Zy=rr(Jy=>{"use strict";var Ou=ll(),_u=Object.prototype.hasOwnProperty,Ko=typeof Map<"u";function Xr(){this._array=[],this._set=Ko?new Map:Object.create(null)}Xr.fromArray=function(t,n){for(var r=new Xr,o=0,i=t.length;o<i;o++)r.add(t[o],n);return r};Xr.prototype.size=function(){return Ko?this._set.size:Object.getOwnPropertyNames(this._set).length};Xr.prototype.add=function(t,n){var r=Ko?t:Ou.toSetString(t),o=Ko?this.has(t):_u.call(this._set,r),i=this._array.length;(!o||n)&&this._array.push(t),o||(Ko?this._set.set(t,i):this._set[r]=i)};Xr.prototype.has=function(t){if(Ko)return this._set.has(t);var n=Ou.toSetString(t);return _u.call(this._set,n)};Xr.prototype.indexOf=function(t){if(Ko){var n=this._set.get(t);if(n>=0)return n}else{var r=Ou.toSetString(t);if(_u.call(this._set,r))return this._set[r]}throw new Error('"'+t+'" is not in the set.')};Xr.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};Xr.prototype.toArray=function(){return this._array.slice()};Jy.ArraySet=Xr});var nb=rr(tb=>{"use strict";var eb=ll();function eA(e,t){var n=e.generatedLine,r=t.generatedLine,o=e.generatedColumn,i=t.generatedColumn;return r>n||r==n&&i>=o||eb.compareByGeneratedPositionsInflated(e,t)<=0}function cl(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}cl.prototype.unsortedForEach=function(t,n){this._array.forEach(t,n)};cl.prototype.add=function(t){eA(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};cl.prototype.toArray=function(){return this._sorted||(this._array.sort(eb.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};tb.MappingList=cl});var ob=rr(rb=>{"use strict";var vs=Gy(),jt=ll(),ul=Zy().ArraySet,tA=nb().MappingList;function ar(e){e||(e={}),this._file=jt.getArg(e,"file",null),this._sourceRoot=jt.getArg(e,"sourceRoot",null),this._skipValidation=jt.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=jt.getArg(e,"ignoreInvalidMapping",!1),this._sources=new ul,this._names=new ul,this._mappings=new tA,this._sourcesContents=null}ar.prototype._version=3;ar.fromSourceMap=function(t,n){var r=t.sourceRoot,o=new ar(Object.assign(n||{},{file:t.file,sourceRoot:r}));return t.eachMapping(function(i){var s={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(s.source=i.source,r!=null&&(s.source=jt.relative(r,s.source)),s.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(s.name=i.name)),o.addMapping(s)}),t.sources.forEach(function(i){var s=i;r!==null&&(s=jt.relative(r,i)),o._sources.has(s)||o._sources.add(s);var a=t.sourceContentFor(i);a!=null&&o.setSourceContent(i,a)}),o};ar.prototype.addMapping=function(t){var n=jt.getArg(t,"generated"),r=jt.getArg(t,"original",null),o=jt.getArg(t,"source",null),i=jt.getArg(t,"name",null);!this._skipValidation&&this._validateMapping(n,r,o,i)===!1||(o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:o,name:i}))};ar.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot!=null&&(r=jt.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[jt.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[jt.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};ar.prototype.applySourceMap=function(t,n,r){var o=n;if(n==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=t.file}var i=this._sourceRoot;i!=null&&(o=jt.relative(i,o));var s=new ul,a=new ul;this._mappings.unsortedForEach(function(u){if(u.source===o&&u.originalLine!=null){var c=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});c.source!=null&&(u.source=c.source,r!=null&&(u.source=jt.join(r,u.source)),i!=null&&(u.source=jt.relative(i,u.source)),u.originalLine=c.line,u.originalColumn=c.column,c.name!=null&&(u.name=c.name))}var l=u.source;l!=null&&!s.has(l)&&s.add(l);var d=u.name;d!=null&&!a.has(d)&&a.add(d)},this),this._sources=s,this._names=a,t.sources.forEach(function(u){var c=t.sourceContentFor(u);c!=null&&(r!=null&&(u=jt.join(r,u)),i!=null&&(u=jt.relative(i,u)),this.setSourceContent(u,c))},this)};ar.prototype._validateMapping=function(t,n,r,o){if(n&&typeof n.line!="number"&&typeof n.column!="number"){var i="original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!n&&!r&&!o)){if(t&&"line"in t&&"column"in t&&n&&"line"in n&&"column"in n&&t.line>0&&t.column>=0&&n.line>0&&n.column>=0&&r)return;var i="Invalid mapping: "+JSON.stringify({generated:t,source:r,original:n,name:o});if(this._ignoreInvalidMapping)return typeof console<"u"&&console.warn&&console.warn(i),!1;throw new Error(i)}};ar.prototype._serializeMappings=function(){for(var t=0,n=1,r=0,o=0,i=0,s=0,a="",u,c,l,d,g=this._mappings.toArray(),p=0,f=g.length;p<f;p++){if(c=g[p],u="",c.generatedLine!==n)for(t=0;c.generatedLine!==n;)u+=";",n++;else if(p>0){if(!jt.compareByGeneratedPositionsInflated(c,g[p-1]))continue;u+=","}u+=vs.encode(c.generatedColumn-t),t=c.generatedColumn,c.source!=null&&(d=this._sources.indexOf(c.source),u+=vs.encode(d-s),s=d,u+=vs.encode(c.originalLine-1-o),o=c.originalLine-1,u+=vs.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(l=this._names.indexOf(c.name),u+=vs.encode(l-i),i=l)),a+=u}return a};ar.prototype._generateSourcesContent=function(t,n){return t.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=jt.relative(n,r));var o=jt.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};ar.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t};ar.prototype.toString=function(){return JSON.stringify(this.toJSON())};rb.SourceMapGenerator=ar});function ab(e){let t=new sb.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},o={line:1,column:0},i={generated:o},s=1,a=0,u=!1,c=e.node;e.node=function(g){if(g.loc&&g.loc.start&&ib.has(g.type)){let p=g.loc.start.line,f=g.loc.start.column-1;(r.line!==p||r.column!==f)&&(r.line=p,r.column=f,n.line=s,n.column=a,u&&(u=!1,(n.line!==o.line||n.column!==o.column)&&t.addMapping(i)),u=!0,t.addMapping({source:g.loc.source,original:r,generated:n}))}c.call(this,g),u&&ib.has(g.type)&&(o.line=s,o.column=a)};let l=e.emit;e.emit=function(g,p,f){for(let k=0;k<g.length;k++)g.charCodeAt(k)===10?(s++,a=0):a++;l(g,p,f)};let d=e.result;return e.result=function(){return u&&t.addMapping(i),{css:d(),map:t}},e}var sb,ib,lb=_(()=>{"use strict";sb=Ua(ob(),1),ib=new Set(["Atrule","Selector","Declaration"])});var pl={};Se(pl,{safe:()=>Uu,spec:()=>iA});function ub(e){let t=new Set(e.map(([n,r])=>$u(n)<<16|$u(r)));return function(n,r,o){let i=$u(r,o),s=o.charCodeAt(0),a=s===rA&&r!==1&&r!==2&&r!==15||s===nA?t.has((n&65534)<<16|s<<7):t.has((n&65534)<<16|i);return i|a}}var nA,rA,$u,cb,oA,iA,Uu,pb=_(()=>{"use strict";nA=43,rA=45,$u=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),cb=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],oA=cb.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);iA=ub(cb),Uu=ub(oA)});function aA(e,t){if(typeof t=="function"){let n=null;e.children.forEach(r=>{n!==null&&t.call(this,n),this.node(r),n=r});return}e.children.forEach(this.node,this)}function db(e){let t=new Map;for(let[n,r]of Object.entries(e.node))typeof(r.generate||r)=="function"&&t.set(n,r.generate||r);return function(n,r){let o="",i=0,s={node(u){if(t.has(u.type))t.get(u.type).call(a,u);else throw new Error("Unknown node type: "+u.type)},tokenBefore:Uu,token(u,c,l){i=this.tokenBefore(i,u,c),!l&&i&1&&this.emit(" ",13,!0),this.emit(c,u,!1),u===9&&c.charCodeAt(0)===sA&&this.emit(`
|
|
7
|
+
`,13,!0)},emit(u){o+=u},result(){return o}};r&&(typeof r.decorator=="function"&&(s=r.decorator(s)),r.sourceMap&&(s=ab(s)),r.mode in pl&&(s.tokenBefore=pl[r.mode]));let a={node:u=>s.node(u),children:aA,token:(u,c)=>s.token(u,c),tokenize:u=>wo(u,(c,l,d)=>{s.token(c,u.slice(l,d),l!==0)})};return s.node(n),s.result()}}var sA,gb=_(()=>{"use strict";sr();lb();pb();sA=92});function fb(e){return{fromPlainObject(t){return e(t,{enter(n){n.children&&!(n.children instanceof Xn)&&(n.children=new Xn().fromArray(n.children))}}),t},toPlainObject(t){return e(t,{leave(n){n.children&&n.children instanceof Xn&&(n.children=n.children.toArray())}}),t}}}var mb=_(()=>{"use strict";Ss()});function hb(e){return typeof e=="function"?e:ks}function xb(e,t){return function(n,r,o){n.type===t&&e.call(this,n,r,o)}}function lA(e,t){let n=t.structure,r=[];for(let o in n){if(ju.call(n,o)===!1)continue;let i=n[o],s={name:o,type:!1,nullable:!1};Array.isArray(i)||(i=[i]);for(let a of i)a===null?s.nullable=!0:typeof a=="string"?s.type="node":Array.isArray(a)&&(s.type="list");s.type&&r.push(s)}return r.length?{context:t.walkContext,fields:r}:null}function cA(e){let t={};for(let n in e.node)if(ju.call(e.node,n)){let r=e.node[n];if(!r.structure)throw new Error("Missed `structure` field in `"+n+"` node type definition");t[n]=lA(n,r)}return t}function yb(e,t){let n=e.fields.slice(),r=e.context,o=typeof r=="string";return t&&n.reverse(),function(i,s,a,u){let c;o&&(c=s[r],s[r]=i);for(let l of n){let d=i[l.name];if(!l.nullable||d){if(l.type==="list"){if(t?d.reduceRight(u,!1):d.reduce(u,!1))return!0}else if(a(d))return!0}}o&&(s[r]=c)}}function bb({StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:o}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:o}}}function Sb(e){let t=cA(e),n={},r={},o=Symbol("break-walk"),i=Symbol("skip-node");for(let c in t)ju.call(t,c)&&t[c]!==null&&(n[c]=yb(t[c],!1),r[c]=yb(t[c],!0));let s=bb(n),a=bb(r),u=function(c,l){function d(E,I,D){let R=g.call(T,E,I,D);return R===o?!0:R===i?!1:!!(f.hasOwnProperty(E.type)&&f[E.type](E,T,d,k)||p.call(T,E,I,D)===o)}let g=ks,p=ks,f=n,k=(E,I,D,R)=>E||d(I,D,R),T={break:o,skip:i,root:c,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof l=="function")g=l;else if(l&&(g=hb(l.enter),p=hb(l.leave),l.reverse&&(f=r),l.visit)){if(s.hasOwnProperty(l.visit))f=l.reverse?a[l.visit]:s[l.visit];else if(!t.hasOwnProperty(l.visit))throw new Error("Bad value `"+l.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(", ")+")");g=xb(g,l.visit),p=xb(p,l.visit)}if(g===ks&&p===ks)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");d(c)};return u.break=o,u.skip=i,u.find=function(c,l){let d=null;return u(c,function(g,p,f){if(l.call(this,g,p,f))return d=g,o}),d},u.findLast=function(c,l){let d=null;return u(c,{reverse:!0,enter(g,p,f){if(l.call(this,g,p,f))return d=g,o}}),d},u.findAll=function(c,l){let d=[];return u(c,function(g,p,f){l.call(this,g,p,f)&&d.push(g)}),d},u}var ju,ks,wb=_(()=>{"use strict";({hasOwnProperty:ju}=Object.prototype),ks=function(){}});function uA(e){return e}function pA(e){let{min:t,max:n,comma:r}=e;return t===0&&n===0?r?"#?":"*":t===0&&n===1?"?":t===1&&n===0?r?"#":"+":t===1&&n===1?"":(r?"#":"")+(t===n?"{"+t+"}":"{"+t+","+(n!==0?n:"")+"}")}function dA(e){if(e.type==="Range")return" ["+(e.min===null?"-\u221E":e.min)+","+(e.max===null?"\u221E":e.max)+"]";throw new Error("Unknown node type `"+e.type+"`")}function gA(e,t,n,r){let o=e.combinator===" "||r?e.combinator:" "+e.combinator+" ",i=e.terms.map(s=>dl(s,t,n,r)).join(o);return e.explicit||n?(r||i[0]===","?"[":"[ ")+i+(r?"]":" ]"):i}function dl(e,t,n,r){let o;switch(e.type){case"Group":o=gA(e,t,n,r)+(e.disallowEmpty?"!":"");break;case"Multiplier":return dl(e.term,t,n,r)+t(pA(e),e);case"Boolean":o="<boolean-expr["+dl(e.term,t,n,r)+"]>";break;case"Type":o="<"+e.name+(e.opts?t(dA(e.opts),e.opts):"")+">";break;case"Property":o="<'"+e.name+"'>";break;case"Keyword":o=e.name;break;case"AtKeyword":o="@"+e.name;break;case"Function":o=e.name+"(";break;case"String":case"Token":o=e.value;break;case"Comma":o=",";break;default:throw new Error("Unknown node type `"+e.type+"`")}return t(o,e)}function wi(e,t){let n=uA,r=!1,o=!1;return typeof t=="function"?n=t:t&&(r=!!t.forceBraces,o=!!t.compact,typeof t.decorate=="function"&&(n=t.decorate)),dl(e,n,r,o)}var Hu=_(()=>{"use strict"});function fA(e,t){let n=e.tokens,r=e.longestMatch,o=r<n.length&&n[r].node||null,i=o!==t?o:null,s=0,a=0,u=0,c="",l,d;for(let g=0;g<n.length;g++){let p=n[g].value;g===r&&(a=p.length,s=c.length),i!==null&&n[g].node===i&&(g<=r?u++:u=0),c+=p}return r===n.length||u>1?(l=gl(i||t,"end")||Cs(vb,c),d=Cs(l)):(l=gl(i,"start")||Cs(gl(t,"start")||vb,c.slice(0,s)),d=gl(i,"end")||Cs(l,c.substr(s,a))),{css:c,mismatchOffset:s,mismatchLength:a,start:l,end:d}}function gl(e,t){let n=e&&e.loc&&e.loc[t];return n?"line"in n?Cs(n):n:null}function Cs({offset:e,line:t,column:n},r){let o={offset:e,line:t,column:n};if(r){let i=r.split(/\n|\r\n?|\f/);o.offset+=r.length,o.line+=i.length-1,o.column=i.length===1?o.column+r.length:i.pop().length+1}return o}var vb,vi,kb,Cb=_(()=>{"use strict";al();Hu();vb={offset:0,line:1,column:1};vi=function(e,t){let n=Yo("SyntaxReferenceError",e+(t?" `"+t+"`":""));return n.reference=t,n},kb=function(e,t,n,r){let o=Yo("SyntaxMatchError",e),{css:i,mismatchOffset:s,mismatchLength:a,start:u,end:c}=fA(r,n);return o.rawMessage=e,o.syntax=t?wi(t):"<generic>",o.css=i,o.mismatchOffset=s,o.mismatchLength=a,o.message=e+`
|
|
8
8
|
syntax: `+o.syntax+`
|
|
9
9
|
value: `+(i||"<empty string>")+`
|
|
10
|
-
--------`+new Array(o.mismatchOffset+1).join("-")+"^",Object.assign(o,u),o.loc={source:n&&n.loc&&n.loc.source||"<unknown>",start:u,end:c},o}});function
|
|
10
|
+
--------`+new Array(o.mismatchOffset+1).join("-")+"^",Object.assign(o,u),o.loc={source:n&&n.loc&&n.loc.source||"<unknown>",start:u,end:c},o}});function xl(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===ml&&e.charCodeAt(t+1)===ml}function Tb(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===ml&&e.charCodeAt(t+1)!==ml){let n=e.indexOf("-",t+2);if(n!==-1)return e.substring(t,n+1)}return""}function mA(e){if(fl.has(e))return fl.get(e);let t=e.toLowerCase(),n=fl.get(t);if(n===void 0){let r=xl(t,0),o=r?"":Tb(t,0);n=Object.freeze({basename:t.substr(o.length),name:t,prefix:o,vendor:o,custom:r})}return fl.set(e,n),n}function hA(e){if(ki.has(e))return ki.get(e);let t=e,n=e[0];n==="/"?n=e[1]==="/"?"//":"/":n!=="_"&&n!=="*"&&n!=="$"&&n!=="#"&&n!=="+"&&n!=="&"&&(n="");let r=xl(t,n.length);if(!r&&(t=t.toLowerCase(),ki.has(t))){let a=ki.get(t);return ki.set(e,a),a}let o=r?"":Tb(t,n.length),i=t.substr(0,n.length+o.length),s=Object.freeze({basename:t.substr(i.length),name:t.substr(n.length),hack:n,vendor:o,prefix:i,custom:r});return ki.set(e,s),s}var fl,ki,ml,hl,Wu,yl=_(()=>{"use strict";fl=new Map,ki=new Map,ml=45,hl=mA,Wu=hA});var Ci,bl=_(()=>{"use strict";Ci=["initial","inherit","unset","revert","revert-layer"]});function qu(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function Ts(e,t,n){for(;e!==null&&(e.type===13||e.type===25);)e=n(++t);return t}function vo(e,t,n,r){if(!e)return 0;let o=e.value.charCodeAt(t);if(o===Is||o===Nr){if(n)return 0;t++}for(;t<e.value.length;t++)if(!Ut(e.value.charCodeAt(t)))return 0;return r+1}function Gu(e,t,n){let r=!1,o=Ts(e,t,n);if(e=n(o),e===null)return t;if(e.type!==10)if(qu(e,Is)||qu(e,Nr)){if(r=!0,o=Ts(n(++o),o,n),e=n(o),e===null||e.type!==10)return 0}else return t;if(!r){let i=e.value.charCodeAt(0);if(i!==Is&&i!==Nr)return 0}return vo(e,r?0:1,r,o)}function Yu(e,t){let n=0;if(!e)return 0;if(e.type===10)return vo(e,0,yA,n);if(e.type===1&&e.value.charCodeAt(0)===Nr){if(!Gr(e.value,1,Vu))return 0;switch(e.value.length){case 2:return Gu(t(++n),n,t);case 3:return e.value.charCodeAt(2)!==Nr?0:(n=Ts(t(++n),n,t),e=t(n),vo(e,0,Ti,n));default:return e.value.charCodeAt(2)!==Nr?0:vo(e,3,Ti,n)}}else if(e.type===1||qu(e,Is)&&t(n+1).type===1){if(e.type!==1&&(e=t(++n)),e===null||!Gr(e.value,0,Vu))return 0;switch(e.value.length){case 1:return Gu(t(++n),n,t);case 2:return e.value.charCodeAt(1)!==Nr?0:(n=Ts(t(++n),n,t),e=t(n),vo(e,0,Ti,n));default:return e.value.charCodeAt(1)!==Nr?0:vo(e,2,Ti,n)}}else if(e.type===12){let r=e.value.charCodeAt(0),o=r===Is||r===Nr?1:0,i=o;for(;i<e.value.length&&Ut(e.value.charCodeAt(i));i++);return i===o||!Gr(e.value,i,Vu)?0:i+1===e.value.length?Gu(t(++n),n,t):e.value.charCodeAt(i+1)!==Nr?0:i+2===e.value.length?(n=Ts(t(++n),n,t),e=t(n),vo(e,0,Ti,n)):vo(e,i+2,Ti,n)}return 0}var Is,Nr,Vu,Ti,yA,Ib=_(()=>{"use strict";sr();Is=43,Nr=45,Vu=110,Ti=!0,yA=!1});function Ku(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function wA(e,t){return e.value.charCodeAt(0)===t}function Fs(e,t,n){let r=0;for(let o=t;o<e.value.length;o++){let i=e.value.charCodeAt(o);if(i===Fb&&n&&r!==0)return Fs(e,t+r+1,!1),6;if(!Ln(i)||++r>6)return 0}return r}function Sl(e,t,n){if(!e)return 0;for(;Ku(n(t),Eb);){if(++e>6)return 0;t++}return t}function Xu(e,t){let n=0;if(e===null||e.type!==1||!Gr(e.value,0,SA)||(e=t(++n),e===null))return 0;if(Ku(e,bA))return e=t(++n),e===null?0:e.type===1?Sl(Fs(e,0,!0),++n,t):Ku(e,Eb)?Sl(1,++n,t):0;if(e.type===10){let r=Fs(e,1,!0);return r===0?0:(e=t(++n),e===null?n:e.type===12||e.type===10?!wA(e,Fb)||!Fs(e,1,!1)?0:n+1:Sl(r,n,t))}return e.type===12?Sl(Fs(e,1,!0),++n,t):0}var bA,Fb,Eb,SA,Ab=_(()=>{"use strict";sr();bA=43,Fb=45,Eb=63,SA=117});function vr(e,t){return t<e.length?e.charCodeAt(t):0}function Lb(e,t){return qr(e,0,e.length,t)}function Mb(e,t){for(let n=0;n<t.length;n++)if(Lb(e,t[n]))return!0;return!1}function Bb(e,t){return t!==e.length-2?!1:vr(e,t)===92&&Ut(vr(e,t+1))}function wl(e,t,n){if(e&&e.type==="Range"){let r=Number(n!==void 0&&n!==t.length?t.substr(0,n):t);if(isNaN(r)||e.min!==null&&r<e.min&&typeof e.min!="string"||e.max!==null&&r>e.max&&typeof e.max!="string")return!0}return!1}function IA(e,t){let n=0,r=[],o=0;e:do{switch(e.type){case 24:case 22:case 20:if(e.type!==n)break e;if(n=r.pop(),r.length===0){o++;break e}break;case 2:case 21:case 19:case 23:r.push(n),n=np.get(e.type);break}o++}while(e=t(o));return o}function lr(e,t){return function(n,r,o){return n===null?0:n.type===2&&Mb(n.value,t)?IA(n,r):e(n,r,o)}}function Et(e){return function(t){return t===null||t.type!==e?0:1}}function FA(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return Mb(t,Ci)||Lb(t,"default")?0:1}function Db(e){return e===null||e.type!==1||vr(e.value,0)!==45||vr(e.value,1)!==45?0:1}function EA(e){return!Db(e)||e.value==="--"?0:1}function AA(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 n=1;n<t;n++)if(!Ln(vr(e.value,n)))return 0;return 1}function PA(e){return e===null||e.type!==4||!fi(vr(e.value,1),vr(e.value,2),vr(e.value,3))?0:1}function LA(e,t){if(!e)return 0;let n=0,r=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==n)break e;n=r.pop();break;case 17:if(n===0)break e;break;case 9:if(n===0&&e.value==="!")break e;break;case 2:case 21:case 19:case 23:r.push(n),n=np.get(e.type);break}o++}while(e=t(o));return o}function MA(e,t){if(!e)return 0;let n=0,r=[],o=0;e:do{switch(e.type){case 6:case 8:break e;case 24:case 22:case 20:if(e.type!==n)break e;n=r.pop();break;case 2:case 21:case 19:case 23:r.push(n),n=np.get(e.type);break}o++}while(e=t(o));return o}function Jr(e){return e&&(e=new Set(e)),function(t,n,r){if(t===null||t.type!==12)return 0;let o=Go(t.value,0);if(e!==null){let i=t.value.indexOf("\\",o),s=i===-1||!Bb(t.value,i)?t.value.substr(o):t.value.substring(o,i);if(e.has(s.toLowerCase())===!1)return 0}return wl(r,t.value,o)?0:1}}function BA(e,t,n){return e===null||e.type!==11||wl(n,e.value,e.value.length-1)?0:1}function Rb(e){return typeof e!="function"&&(e=function(){return 0}),function(t,n,r){return t!==null&&t.type===10&&Number(t.value)===0?1:e(t,n,r)}}function DA(e,t,n){if(e===null)return 0;let r=Go(e.value,0);return!(r===e.value.length)&&!Bb(e.value,r)||wl(n,e.value,r)?0:1}function RA(e,t,n){if(e===null||e.type!==10)return 0;let r=vr(e.value,0)===43||vr(e.value,0)===45?1:0;for(;r<e.value.length;r++)if(!Ut(vr(e.value,r)))return 0;return wl(n,e.value,r)?0:1}function _A(e){let{angle:t,decibel:n,frequency:r,flex:o,length:i,resolution:s,semitones:a,time:u}=e||{};return{dimension:lr(Jr(null),Qr),angle:lr(Jr(t),Qr),decibel:lr(Jr(n),Qr),frequency:lr(Jr(r),Qr),flex:lr(Jr(o),Qr),length:lr(Rb(Jr(i)),Qr),resolution:lr(Jr(s),Qr),semitones:lr(Jr(a),Qr),time:lr(Jr(u),Qr)}}function $A(e){let t=new Set;for(let n of OA)if(Array.isArray(e[n]))for(let r of e[n])t.add(r.toLowerCase());return function(r){return r===null?0:r.type===9&&r.value==="%"||r.type===1&&t.has(r.value.toLowerCase())?1:0}}function zb(e){return{...zA,...NA,..._A(e),"attr-unit":$A(e)}}var Qu,Ju,Zu,vA,kA,CA,ep,tp,Pb,TA,Qr,np,zA,NA,OA,Nb=_(()=>{"use strict";bl();Ib();Ab();sr();Qu=["calc(","-moz-calc(","-webkit-calc("],Ju=["min(","max(","clamp("],Zu=["round(","mod(","rem("],vA=["sin(","cos(","tan("],kA=["asin(","acos(","atan(","atan2("],CA=["pow(","sqrt(","log(","exp(","sign("],ep=["hypot("],tp=["abs("],Pb=[...Qu,...Ju,...Zu,...vA,...CA,...ep,...tp],TA=[...Qu,...Ju,...Zu,...ep,...tp],Qr=[...Qu,...Ju,...Zu,...kA,...ep,...tp],np=new Map([[2,22],[21,22],[19,20],[23,24]]);zA={"ident-token":Et(1),"function-token":Et(2),"at-keyword-token":Et(3),"hash-token":Et(4),"string-token":Et(5),"bad-string-token":Et(6),"url-token":Et(7),"bad-url-token":Et(8),"delim-token":Et(9),"number-token":Et(10),"percentage-token":Et(11),"dimension-token":Et(12),"whitespace-token":Et(13),"CDO-token":Et(14),"CDC-token":Et(15),"colon-token":Et(16),"semicolon-token":Et(17),"comma-token":Et(18),"[-token":Et(19),"]-token":Et(20),"(-token":Et(21),")-token":Et(22),"{-token":Et(23),"}-token":Et(24)},NA={string:Et(5),ident:Et(1),percentage:lr(BA,TA),zero:Rb(),number:lr(DA,Pb),integer:lr(RA,Pb),"custom-ident":FA,"dashed-ident":Db,"custom-property-name":EA,"hex-color":AA,"id-selector":PA,"an-plus-b":Yu,urange:Xu,"declaration-value":LA,"any-value":MA},OA=["length","angle","time","frequency","resolution","flex","decibel","semitones"]});var vl={};Se(vl,{angle:()=>jA,decibel:()=>qA,flex:()=>GA,frequency:()=>WA,length:()=>UA,resolution:()=>VA,semitones:()=>YA,time:()=>HA});var UA,jA,HA,WA,VA,GA,qA,YA,Ob=_(()=>{"use strict";UA=["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"],jA=["deg","grad","rad","turn"],HA=["s","ms"],WA=["hz","khz"],VA=["dpi","dpcm","dppx","x"],GA=["fr"],qA=["db"],YA=["st"]});function _b(e,t,n){return Object.assign(Yo("SyntaxError",e),{input:t,offset:n,rawMessage:e,message:e+`
|
|
11
11
|
`+t+`
|
|
12
|
-
--`+new Array((n||t.length)+1).join("-")+"^"})}var _b=_(()=>{"use strict";sl()});var GA,qA,YA,KA,XA,$b,vl,Ub=_(()=>{"use strict";_b();GA=9,qA=10,YA=12,KA=13,XA=32,$b=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),vl=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&&$b[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 n=this.str.charCodeAt(t);if(n!==KA&&n!==qA&&n!==YA&&n!==XA&&n!==GA)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 Ob(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 n=this.str.charCodeAt(t);if(n>=128||$b[n]===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 n=this.str.charCodeAt(t);if(n<48||n>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 qb(e){let t=null,n=null;return e.eat(Tl),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===lp?(e.pos++,e.skipWs(),e.charCode()!==ip&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(ip),{min:Number(t),max:n?Number(n):0}}function rP(e){let t=null,n=!1;switch(e.charCode()){case Qb:e.pos++,t={min:0,max:0};break;case ap:e.pos++,t={min:1,max:0};break;case Cl:e.pos++,t={min:0,max:1};break;case sp:e.pos++,n=!0,e.charCode()===Tl?t=qb(e):e.charCode()===Cl?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case Tl:t=qb(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function Zr(e,t){let n=rP(e);return n!==null?(n.term=t,e.charCode()===sp&&e.charCodeAt(e.pos-1)===ap||e.charCode()===Cl&&e.charCodeAt(e.pos-1)===ip?Zr(e,n):n):t}function rp(e){let t=e.peek();return t===""?null:Zr(e,{type:"Token",value:t})}function oP(e){let t;return e.eat(cp),e.eat(kl),t=e.scanWord(),e.eat(kl),e.eat(op),Zr(e,{type:"Property",name:t})}function iP(e){let t=null,n=null,r=1;return e.eat(Fs),e.charCode()===Hb&&(e.peek(),r=-1),r==-1&&e.charCode()===Vb?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(lp),e.skipWs(),e.charCode()===Vb?e.peek():(r=1,e.charCode()===Hb&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(Ii),{type:"Range",min:t,max:n}}function sP(e){let t,n=null;if(e.eat(cp),t=e.scanWord(),t==="boolean-expr"){e.eat(Fs);let r=Il(e,Ii);return e.eat(Ii),e.eat(op),Zr(e,{type:"Boolean",term:r.terms.length===1?r.terms[0]:r})}return e.charCode()===Kb&&e.nextCharCode()===Xb&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Fs&&(e.skipWs(),n=iP(e)),e.eat(op),Zr(e,{type:"Type",name:t,opts:n})}function aP(e){let t=e.scanWord();return e.charCode()===Kb?(e.pos++,{type:"Function",name:t}):Zr(e,{type:"Keyword",name:t})}function lP(e,t){function n(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let r;for(t=Object.keys(t).sort((o,i)=>Gb[o]-Gb[i]);t.length>0;){r=t.shift();let o=0,i=0;for(;o<e.length;o++){let s=e[o];s.type==="Combinator"&&(s.value===r?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,n(e.slice(i,o),r)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,n(e.slice(i,o),r))}return r}function Il(e,t=-1){let n=Object.create(null),r=[],o=null,i=e.pos,s=!1;for(;e.charCode()!==t;){let a=s?Il(e,Xb):uP(e);if(!a)break;if(a.type!=="Spaces"){if(s){if(a.terms.length===0){s=!1;continue}if(a.combinator===" "){for(;a.terms.length>1;)n[" "]=!0,r.push({type:"Combinator",value:" "},a.terms.shift());a=a.terms[0]}}a.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),n[a.value]=!0):o!==null&&o.type!=="Combinator"&&(n[" "]=!0,r.push({type:"Combinator",value:" "})),r.push(a),o=a,i=e.pos,s=a.type==="Function"}}return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:r,combinator:lP(r,n)||" ",disallowEmpty:!1,explicit:!1}}function cP(e){let t;return e.eat(Fs),t=Il(e,Ii),e.eat(Ii),t.explicit=!0,e.charCode()===Yb&&(e.pos++,t.disallowEmpty=!0),t}function uP(e){let t=e.charCode();switch(t){case Ii:break;case Fs:return Zr(e,cP(e));case cp:return e.nextCharCode()===kl?oP(e):sP(e);case Wb:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===Wb?2:1))};case jb:return e.pos++,e.eat(jb),{type:"Combinator",value:"&&"};case lp:return e.pos++,{type:"Comma"};case kl:return Zr(e,{type:"String",value:e.scanString()});case tP:case QA:case JA:case eP:case ZA:return{type:"Spaces",value:e.scanSpaces()};case nP:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):rp(e);case Qb:case ap:case Cl:case sp:case Yb:break;case Tl:if(t=e.nextCharCode(),t<48||t>57)return rp(e);break;default:return e.isNameCharCode(t)?aP(e):rp(e)}}function Es(e){let t=new vl(e),n=Il(t);return t.pos!==e.length&&t.error("Unexpected input"),n.terms.length===1&&n.terms[0].type==="Group"?n.terms[0]:n}var QA,JA,ZA,eP,tP,Yb,sp,jb,kl,Kb,Xb,Qb,ap,lp,Hb,cp,op,Cl,nP,Fs,Ii,Tl,Wb,ip,Vb,Gb,up=_(()=>{"use strict";Ub();QA=9,JA=10,ZA=12,eP=13,tP=32,Yb=33,sp=35,jb=38,kl=39,Kb=40,Xb=41,Qb=42,ap=43,lp=44,Hb=45,cp=60,op=62,Cl=63,nP=64,Fs=91,Ii=93,Tl=123,Wb=124,ip=125,Vb=8734,Gb={" ":1,"&&":2,"||":3,"|":4}});function Jb(e){return typeof e=="function"?e:As}function pp(e,t,n){function r(s){switch(o.call(n,s),s.type){case"Group":s.terms.forEach(r);break;case"Multiplier":case"Boolean":r(s.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: "+s.type)}i.call(n,s)}let o=As,i=As;if(typeof t=="function"?o=t:t&&(o=Jb(t.enter),i=Jb(t.leave)),o===As&&i===As)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var As,Zb=_(()=>{"use strict";As=function(){}});var dp=_(()=>{"use strict";Hu();up();Zb()});function fP(e){let t=[];return wo(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function e0(e,t){return typeof e=="string"?fP(e):t.generate(e,dP)}var dP,t0=_(()=>{"use strict";sr();dP={decorator(e){let t=[],n=null;return{...e,node(r){let o=n;n=r,e.node.call(this,r),n=o},emit(r,o,i){t.push({type:o,value:r,node:i?null:n})},result(){return t}}}}});function bn(e,t,n){return t===pt&&n===St||e===pt&&t===pt&&n===pt?e:(e.type==="If"&&e.else===St&&t===pt&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function r0(e){return e.length>2&&e.charCodeAt(e.length-2)===gP&&e.charCodeAt(e.length-1)===mP}function n0(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&r0(e.name)}function ko(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function Ps(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=Ps(e.match,t,n),e.then=Ps(e.then,t,n),e.else=Ps(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function fp(e,t,n){switch(e){case" ":{let r=pt;for(let o=t.length-1;o>=0;o--){let i=t[o];r=bn(i,r,St)}return r}case"|":{let r=St,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(n0(s)&&(o===null&&i>0&&n0(t[i-1])&&(o=Object.create(null),r=bn({type:"Enum",map:o},pt,r)),o!==null)){let a=(r0(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=bn(s,pt,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=fp(e,t.filter(function(a){return a!==i}),!1):s=pt,r=bn(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?pt:St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=fp(e,t.filter(function(a){return a!==i}),!0):s=pt,r=bn(i,s,r)}return r}}}function hP(e){let t=pt,n=Fi(e.term);if(e.max===0)n=bn(n,Fl,St),t=bn(n,null,St),t.then=bn(pt,pt,t),e.comma&&(t.then.else=bn({type:"Comma",syntax:e},t,St));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,bn(pt,pt,t),St);if(e.min===0)t=bn(pt,pt,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,t,St);return t}function Fi(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=fp(e.combinator,e.terms.map(Fi),!1);return e.disallowEmpty&&(t=bn(t,Fl,St)),t}case"Multiplier":return hP(e);case"Boolean":{let t=Fi(e.term),n=Fi(ko([ko([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),ko([{type:"Type",name:"!boolean-group"},ko([{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),r=Fi(ko([{type:"Type",name:"!term"},ko([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return Ps(r,{"!term":t,"!self":n}),Ps(n,{"!boolean-group":r}),n}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 Ls(e,t){return typeof e=="string"&&(e=Es(e)),{type:"MatchGraph",match:Fi(e),syntax:t||null,source:e}}var pt,St,Fl,gP,mP,gp=_(()=>{"use strict";up();pt={type:"Match"},St={type:"Mismatch"},Fl={type:"DisallowEmpty"},gP=40,mP=41});function vP(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function mp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=t.charCodeAt(n),o=e.charCodeAt(n);if(o>=65&&o<=90&&(o=o|32),o!==r)return!1}return!0}function kP(e){return e.type!==9?!1:e.value!=="?"}function a0(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||kP(e)}function l0(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function CP(e,t,n){function r(){do I++,E=I<e.length?e[I]:null;while(E!==null&&(E.type===13||E.type===25))}function o($){let P=I+$;return P<e.length?e[P]:null}function i($,P){return{nextState:$,matchStack:R,syntaxStack:d,thenStack:f,tokenIndex:I,prev:P}}function s($){f={nextState:$,matchStack:R,syntaxStack:d,prev:f}}function a($){p=i($,p)}function u(){R={type:yP,syntax:t.syntax,token:E,prev:R},r(),g=null,I>D&&(D=I)}function c(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},R={type:hp,syntax:t.syntax,token:R.token,prev:R}}function l(){R.type===hp?R=R.prev:R={type:c0,syntax:d.syntax,token:R.token,prev:R},d=d.prev}let d=null,f=null,p=null,g=null,k=0,T=null,E=null,I=-1,D=0,R={type:xP,syntax:null,token:null,prev:null};for(r();T===null&&++k<s0;)switch(t.type){case"Match":if(f===null){if(E!==null&&(I!==e.length-1||E.value!=="\\0"&&E.value!=="\\9")){t=St;break}T=i0;break}if(t=f.nextState,t===Fl)if(f.matchStack===R){t=St;break}else t=pt;for(;f.syntaxStack!==d;)l();f=f.prev;break;case"Mismatch":if(g!==null&&g!==!1)(p===null||I>p.tokenIndex)&&(p=g,g=!1);else if(p===null){T=bP;break}t=p.nextState,f=p.thenStack,d=p.syntaxStack,R=p.matchStack,I=p.tokenIndex,E=I<e.length?e[I]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==St&&a(t.else),t.then!==pt&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let z=t.syntax.terms;if(t.index===z.length){if(t.mask===0||t.syntax.all){t=St;break}t=pt;break}if(t.mask===(1<<z.length)-1){t=pt;break}for(;t.index<z.length;t.index++){let x=1<<t.index;if((t.mask&x)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|x}),t=z[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(E!==null){let z=E.value.toLowerCase();if(z.indexOf("\\")!==-1&&(z=z.replace(/\\[09].*$/,"")),o0.call(t.map,z)){t=t.map[z];break}}t=St;break;case"Generic":{let z=d!==null?d.opts:null,x=I+Math.floor(t.fn(E,o,z));if(!isNaN(x)&&x>I){for(;I<x;)u();t=pt}else t=St;break}case"Type":case"Property":{let z=t.type==="Type"?"types":"properties",x=o0.call(n,z)?n[z][t.name]:null;if(!x||!x.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(g!==!1&&E!==null&&t.type==="Type"&&(t.name==="custom-ident"&&E.type===1||t.name==="length"&&E.value==="0")){g===null&&(g=i(t,p)),t=St;break}c(),t=x.matchRef||x.match;break}case"Keyword":{let z=t.name;if(E!==null){let x=E.value;if(x.indexOf("\\")!==-1&&(x=x.replace(/\\[09].*$/,"")),mp(x,z)){u(),t=pt;break}}t=St;break}case"AtKeyword":case"Function":if(E!==null&&mp(E.value,t.name)){u(),t=pt;break}t=St;break;case"Token":if(E!==null&&E.value===t.value){u(),t=pt;break}t=St;break;case"Comma":E!==null&&E.type===18?a0(R.token)?t=St:(u(),t=l0(E)?St:pt):t=a0(R.token)||l0(E)?pt:St;break;case"String":let $="",P=I;for(;P<e.length&&$.length<t.value.length;P++)$+=e[P].value;if(mp($,t.value)){for(;I<P;)u();t=pt}else t=St;break;default:throw new Error("Unknown node type: "+t.type)}switch(wP+=k,T){case null:console.warn("[csstree-match] BREAK after "+s0+" iterations"),T=SP,R=null;break;case i0:for(;d!==null;)l();break;default:R=null}return{tokens:e,reason:T,iterations:k,match:R,longestMatch:D}}function xp(e,t,n){let r=CP(e,t,n||{});if(r.match===null)return r;let o=r.match,i=r.match={syntax:t.syntax||null,match:[]},s=[i];for(o=vP(o).prev;o!==null;){switch(o.type){case hp:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case c0:s.pop(),i=s[s.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return r}var o0,xP,yP,hp,c0,i0,bP,SP,s0,wP,u0=_(()=>{"use strict";gp();({hasOwnProperty:o0}=Object.prototype),xP=0,yP=1,hp=2,c0=3,i0="Match",bP="Mismatch",SP="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",s0=15e3,wP=0});var bp={};Se(bp,{getTrace:()=>p0,isKeyword:()=>FP,isProperty:()=>IP,isType:()=>TP});function p0(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function n(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(n(o.match[i]))return t(o.syntax)&&r.unshift(o.syntax),!0}else if(o.node===e)return r=t(o.syntax)?[o.syntax]:[],!0;return!1}let r=null;return this.matched!==null&&n(this.matched),r}function TP(e,t){return yp(this,e,n=>n.type==="Type"&&n.name===t)}function IP(e,t){return yp(this,e,n=>n.type==="Property"&&n.name===t)}function FP(e){return yp(this,e,t=>t.type==="Keyword")}function yp(e,t,n){let r=p0.call(e,t);return r===null?!1:r.some(n)}var d0=_(()=>{"use strict"});function f0(e){return"node"in e?e.node:f0(e.match[0])}function g0(e){return"node"in e?e.node:g0(e.match[e.match.length-1])}function Sp(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){let u=f0(a),c=g0(a);e.syntax.walk(t,function(l,d,f){if(l===u){let p=new Xn;do{if(p.appendData(d.data),d.data===c)break;d=d.next}while(d!==null);s.push({parent:f,nodes:p})}})}Array.isArray(a.match)&&a.match.forEach(i)}let s=[];return n.matched!==null&&i(n.matched),s}var m0=_(()=>{"use strict";bs()});function wp(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function h0(e){return!!e&&wp(e.offset)&&wp(e.line)&&wp(e.column)}function EP(e,t){return function(r,o){if(!r||r.constructor!==Object)return o(r,"Type of node should be an Object");for(let i in r){let s=!0;if(Ms.call(r,i)!==!1){if(i==="type")r.type!==e&&o(r,"Wrong node type `"+r.type+"`, expected `"+e+"`");else if(i==="loc"){if(r.loc===null)continue;if(r.loc&&r.loc.constructor===Object)if(typeof r.loc.source!="string")i+=".source";else if(!h0(r.loc.start))i+=".start";else if(!h0(r.loc.end))i+=".end";else continue;s=!1}else if(t.hasOwnProperty(i)){s=!1;for(let a=0;!s&&a<t[i].length;a++){let u=t[i][a];switch(u){case String:s=typeof r[i]=="string";break;case Boolean:s=typeof r[i]=="boolean";break;case null:s=r[i]===null;break;default:typeof u=="string"?s=r[i]&&r[i].type===u:Array.isArray(u)&&(s=r[i]instanceof Xn)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(let i in t)Ms.call(t,i)&&Ms.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function x0(e,t){let n=[];for(let r=0;r<e.length;r++){let o=e[r];if(o===String||o===Boolean)n.push(o.name.toLowerCase());else if(o===null)n.push("null");else if(typeof o=="string")n.push(o);else if(Array.isArray(o))n.push("List<"+(x0(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return n.join(" | ")}function AP(e,t){let n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in n){if(Ms.call(n,i)===!1)continue;let s=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];o[i]=x0(s,e+"."+i)}return{docs:o,check:EP(e,r)}}function y0(e){let t={};if(e.node){for(let n in e.node)if(Ms.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=AP(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}var Ms,b0=_(()=>{"use strict";bs();({hasOwnProperty:Ms}=Object.prototype)});function vp(e,t,n){let r={};for(let o in e)e[o].syntax&&(r[o]=n?e[o].syntax:wi(e[o].syntax,{compact:t}));return r}function PP(e,t,n){let r={};for(let[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:wi(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&vp(i.descriptors,t,n)};return r}function LP(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function MP(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function kr(e,t,n){return{matched:e,iterations:n,error:t,...bp}}function Ei(e,t,n,r){let o=e0(n,e.syntax),i;return LP(o)?kr(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=xp(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=xp(o,t.match,e),!i.match)?kr(null,new vb(i.reason,t.syntax,n,i),i.iterations):kr(i.match,null,i.iterations))}var Bs,S0=_(()=>{"use strict";kb();xl();yl();zb();Nb();dp();t0();gp();u0();d0();m0();b0();Bs=class{constructor(t,n,r){if(this.cssWideKeywords=Ci,this.syntax=n,this.generic=!1,this.units={...wl},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=r||y0(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(wl))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(Rb(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=Ls(this.cssWideKeywords.join(" | "))}checkStructure(t){function n(i,s){o.push({node:i,message:s})}let r=this.structure,o=[];return this.syntax.walk(t,function(i){r.hasOwnProperty(i.type)?r[i.type].check(i,n):n(i,"Unknown node type `"+i.type+"`")}),o.length?o:!1}createDescriptor(t,n,r,o=null){let i={type:n,name:r},s={type:n,name:r,parent:o,serializable:typeof t=="string"||t&&typeof t.type=="string",syntax:null,match:null,matchRef:null};return typeof t=="function"?s.match=Ls(t,i):(typeof t=="string"?Object.defineProperty(s,"syntax",{get(){return Object.defineProperty(s,"syntax",{value:Es(t)}),s.syntax}}):s.syntax=t,Object.defineProperty(s,"match",{get(){return Object.defineProperty(s,"match",{value:Ls(s.syntax,i)}),s.match}}),n==="Property"&&Object.defineProperty(s,"matchRef",{get(){let a=s.syntax,u=MP(a)?Ls({...a,terms:[a.terms[0].term]},i):null;return Object.defineProperty(s,"matchRef",{value:u}),u}})),s}addAtrule_(t,n){n&&(this.atrules[t]={type:"Atrule",name:t,prelude:n.prelude?this.createDescriptor(n.prelude,"AtrulePrelude",t):null,descriptors:n.descriptors?Object.keys(n.descriptors).reduce((r,o)=>(r[o]=this.createDescriptor(n.descriptors[o],"AtruleDescriptor",o,t),r),Object.create(null)):null})}addProperty_(t,n){n&&(this.properties[t]=this.createDescriptor(n,"Property",t))}addType_(t,n){n&&(this.types[t]=this.createDescriptor(n,"Type",t))}checkAtruleName(t){if(!this.getAtrule(t))return new vi("Unknown at-rule","@"+t)}checkAtrulePrelude(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t);if(!o.prelude&&n)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(o.prelude&&!n&&!Ei(this,o.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t),i=ml(n);if(!o.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!o.descriptors[i.name]&&!o.descriptors[i.basename])return new vi("Unknown at-rule descriptor",n)}checkPropertyName(t){if(!this.getProperty(t))return new vi("Unknown property",t)}matchAtrulePrelude(t,n){let r=this.checkAtrulePrelude(t,n);if(r)return kr(null,r);let o=this.getAtrule(t);return o.prelude?Ei(this,o.prelude,n||"",!1):kr(null,null)}matchAtruleDescriptor(t,n,r){let o=this.checkAtruleDescriptorName(t,n);if(o)return kr(null,o);let i=this.getAtrule(t),s=ml(n);return Ei(this,i.descriptors[s.name]||i.descriptors[s.basename],r,!1)}matchDeclaration(t){return t.type!=="Declaration"?kr(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,n){if(Wu(t).custom)return kr(null,new Error("Lexer matching doesn't applicable for custom properties"));let r=this.checkPropertyName(t);return r?kr(null,r):Ei(this,this.getProperty(t),n,!0)}matchType(t,n){let r=this.getType(t);return r?Ei(this,r,n,!1):kr(null,new vi("Unknown type",t))}match(t,n){return typeof t!="string"&&(!t||!t.type)?kr(null,new vi("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),Ei(this,t,n,!1))}findValueFragments(t,n,r,o){return Sp(this,n,this.matchProperty(t,n),r,o)}findDeclarationValueFragments(t,n,r){return Sp(this,t.value,this.matchDeclaration(t),n,r)}findAllFragments(t,n,r){let o=[];return this.syntax.walk(t,{visit:"Declaration",enter:i=>{o.push.apply(o,this.findDeclarationValueFragments(i,n,r))}}),o}getAtrule(t,n=!0){let r=ml(t);return(r.vendor&&n?this.atrules[r.name]||this.atrules[r.basename]:this.atrules[r.name])||null}getAtrulePrelude(t,n=!0){let r=this.getAtrule(t,n);return r&&r.prelude||null}getAtruleDescriptor(t,n){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[n]||null}getProperty(t,n=!0){let r=Wu(t);return(r.vendor&&n?this.properties[r.name]||this.properties[r.basename]:this.properties[r.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(u,c){return c?`<${u}>`:`<'${u}'>`}function n(u,c,l,d){if(l.has(c))return l.get(c);l.set(c,!1),d.syntax!==null&&pp(d.syntax,function(f){if(f.type!=="Type"&&f.type!=="Property")return;let p=f.type==="Type"?u.types:u.properties,g=f.type==="Type"?o:i;hasOwnProperty.call(p,f.name)?n(u,f.name,g,p[f.name])&&(r.push(`${t(c,l===o)} used broken syntax definition ${t(f.name,f.type==="Type")}`),l.set(c,!0)):(r.push(`${t(c,l===o)} used missed syntax definition ${t(f.name,f.type==="Type")}`),l.set(c,!0))},this)}let r=[],o=new Map,i=new Map;for(let u in this.types)n(this,u,o,this.types[u]);for(let u in this.properties)n(this,u,i,this.properties[u]);let s=[...o.keys()].filter(u=>o.get(u)),a=[...i.keys()].filter(u=>i.get(u));return s.length||a.length?{errors:r,types:s,properties:a}:null}dump(t,n){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:vp(this.types,!n,t),properties:vp(this.properties,!n,t),atrules:PP(this.atrules,!n,t)}}toString(){return JSON.stringify(this.dump())}}});function kp(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function BP(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function Cp(e,t,n){let r={...e};for(let[o,i]of Object.entries(t))r[o]={...r[o],...n?BP(i,n):i};return r}function Ds(e,t){let n={...e};for(let[r,o]of Object.entries(t))switch(r){case"generic":n[r]=!!o;break;case"cssWideKeywords":n[r]=e[r]?[...e[r],...o]:o||[];break;case"units":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=Array.isArray(s)?s:[];break;case"atrules":n[r]={...e[r]};for(let[i,s]of Object.entries(o)){let a=n[r][i]||{},u=n[r][i]={prelude:a.prelude||null,descriptors:{...a.descriptors}};if(s){u.prelude=s.prelude?kp(u.prelude,s.prelude):u.prelude||null;for(let[c,l]of Object.entries(s.descriptors||{}))u.descriptors[c]=l?kp(u.descriptors[c],l):null;Object.keys(u.descriptors).length||(u.descriptors=null)}}break;case"types":case"properties":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=kp(n[r][i],s);break;case"parseContext":n[r]={...e[r],...o};break;case"scope":case"features":n[r]=Cp(e[r],o);break;case"atrule":case"pseudo":n[r]=Cp(e[r],o,["parse"]);break;case"node":n[r]=Cp(e[r],o,["name","structure","parse","generate","walkContext"]);break}return n}var w0=_(()=>{"use strict"});function v0(e){let t=Ny(e),n=bb(e),r=pb(e),{fromPlainObject:o,toPlainObject:i}=fb(n),s={lexer:null,createLexer:a=>new Bs(a,s,s.lexer.structure),tokenize:wo,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){let u=Ds({},e);return v0(typeof a=="function"?a(u):Ds(u,a))}};return s.lexer=new Bs({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var k0,C0=_(()=>{"use strict";sr();Oy();db();gb();Sb();S0();w0();k0=e=>v0(Ds({},e))});var T0,I0=_(()=>{"use strict";T0={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 Fp={};Se(Fp,{generate:()=>NP,name:()=>RP,parse:()=>Ip,structure:()=>zP});function Al(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Or||r===Qn)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)Ut(this.charCodeAt(n))||this.error("Integer is expected",n)}function Ai(e){return Al.call(this,0,e)}function Co(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case El:n="N is expected";break;case Qn:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function Tp(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim(Or,e)||this.isDelim(Qn,e)){t=this.isDelim(Or,e)?Or:Qn;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),Ai.call(this,Xo))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==Or&&n!==Qn&&this.error("Number sign is expected")),Ai.call(this,t!==0),t===Qn?"-"+this.consume(10):this.consume(10)}function Ip(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)Ai.call(this,DP),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Qn))switch(t="-1",Co.call(this,1,El),this.tokenEnd-this.tokenStart){case 2:this.next(),n=Tp.call(this);break;case 3:Co.call(this,2,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,2,Qn),Al.call(this,3,Xo),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(Or)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim(Or)&&(r=1,this.next()),Co.call(this,0,El),this.tokenEnd-this.tokenStart){case 1:this.next(),n=Tp.call(this);break;case 2:Co.call(this,1,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,1,Qn),Al.call(this,2,Xo),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),o=r===Or||r===Qn,i=this.tokenStart+o;for(;i<this.tokenEnd&&Ut(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),Co.call(this,i-this.tokenStart,El),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=Tp.call(this)):(Co.call(this,i-this.tokenStart+1,Qn),i+2===this.tokenEnd?(this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10)):(Al.call(this,i-this.tokenStart+2,Xo),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===Or&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===Or&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function NP(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 n=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}var Or,Qn,El,Xo,DP,RP,zP,Ep=_(()=>{"use strict";sr();Or=43,Qn=45,El=110,Xo=!0,DP=!1;RP="AnPlusB",zP={a:[String,null],b:[String,null]}});var Pp={};Se(Pp,{generate:()=>jP,name:()=>_P,parse:()=>Ap,structure:()=>UP,walkContext:()=>$P});function F0(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function OP(){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 Ap(e=!1){let t=this.tokenStart,n,r,o=null,i=null;switch(this.eat(3),n=this.substrToCursor(t+1),r=n.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?o=this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),F0):o=F0.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,r)&&typeof this.atrule[r].block=="function"?i=this.atrule[r].block.call(this,e):i=this.Block(OP.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:o,block:i}}function jP(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var _P,$P,UP,Lp=_(()=>{"use strict";_P="Atrule",$P="atrule",UP={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var Bp={};Se(Bp,{generate:()=>GP,name:()=>HP,parse:()=>Mp,structure:()=>VP,walkContext:()=>WP});function Mp(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 GP(e){this.children(e)}var HP,WP,VP,Dp=_(()=>{"use strict";HP="AtrulePrelude",WP="atrulePrelude",VP={children:[[]]}});var Np={};Se(Np,{generate:()=>e2,name:()=>JP,parse:()=>zp,structure:()=>ZP});function XP(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(E0)?(t=!0,this.next()):this.isDelim(Rp)||this.eat(1),this.isDelim(Rp)?this.charCodeAt(this.tokenStart+1)!==Pl?(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 QP(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Pl&&t!==KP&&t!==YP&&t!==qP&&t!==E0&&t!==Rp&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Pl&&(this.isDelim(Pl)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function zp(){let e=this.tokenStart,t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=XP.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=QP.call(this),this.skipSC(),r=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:n,value:r,flags:o}}function e2(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 qP,E0,Pl,YP,Rp,KP,JP,ZP,Op=_(()=>{"use strict";qP=36,E0=42,Pl=61,YP=94,Rp=124,KP=126;JP="AttributeSelector",ZP={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var $p={};Se($p,{generate:()=>s2,name:()=>r2,parse:()=>_p,structure:()=>i2,walkContext:()=>o2});function L0(){return this.Raw(null,!0)}function A0(){return this.parseWithFallback(this.Rule,L0)}function P0(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function n2(){if(this.tokenType===17)return P0.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,P0);return this.tokenType===17&&this.next(),e}function _p(e){let t=e?n2:A0,n=this.tokenStart,r=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:r.push(this.parseWithFallback(this.Atrule.bind(this,e),L0));break;default:e&&this.isDelim(t2)?r.push(A0.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function s2(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var t2,r2,o2,i2,Up=_(()=>{"use strict";t2=38;r2="Block",o2="block",i2={children:[["Atrule","Rule","Declaration"]]}});var Hp={};Se(Hp,{generate:()=>c2,name:()=>a2,parse:()=>jp,structure:()=>l2});function jp(e,t){let n=this.tokenStart,r=null;return this.eat(19),r=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:r}}function c2(e){this.token(9,"["),this.children(e),this.token(9,"]")}var a2,l2,Wp=_(()=>{"use strict";a2="Brackets",l2={children:[[]]}});var Gp={};Se(Gp,{generate:()=>d2,name:()=>u2,parse:()=>Vp,structure:()=>p2});function Vp(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function d2(){this.token(15,"-->")}var u2,p2,qp=_(()=>{"use strict";u2="CDC",p2=[]});var Kp={};Se(Kp,{generate:()=>m2,name:()=>f2,parse:()=>Yp,structure:()=>g2});function Yp(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function m2(){this.token(14,"<!--")}var f2,g2,Xp=_(()=>{"use strict";f2="CDO",g2=[]});var Jp={};Se(Jp,{generate:()=>b2,name:()=>x2,parse:()=>Qp,structure:()=>y2});function Qp(){return this.eatDelim(h2),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function b2(e){this.token(9,"."),this.token(1,e.name)}var h2,x2,y2,Zp=_(()=>{"use strict";h2=46,x2="ClassSelector",y2={name:String}});var td={};Se(td,{generate:()=>T2,name:()=>k2,parse:()=>ed,structure:()=>C2});function ed(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case w2:case S2:case v2:this.next();break;case M0:this.next(),this.eatIdent("deep"),this.eatDelim(M0);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function T2(e){this.tokenize(e.name)}var S2,M0,w2,v2,k2,C2,nd=_(()=>{"use strict";S2=43,M0=47,w2=62,v2=126,k2="Combinator",C2={name:String}});var od={};Se(od,{generate:()=>P2,name:()=>E2,parse:()=>rd,structure:()=>A2});function rd(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===I2&&this.charCodeAt(t-1)===F2&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function P2(e){this.token(25,"/*"+e.value+"*/")}var I2,F2,E2,A2,id=_(()=>{"use strict";I2=42,F2=47,E2="Comment",A2={value:String}});var ad={};Se(ad,{generate:()=>R2,name:()=>M2,parse:()=>sd,structure:()=>B2});function B0(e){return this.lookupTypeNonSC(1)===1&&L2.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function sd(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 n=this.parseWithFallback(()=>D2[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(21);let r=this.Condition(e);return this.eat(22),r},()=>this.GeneralEnclosed(e))),t.push(n);break}case 2:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||(n=this.GeneralEnclosed(e)),t.push(n);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function R2(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var L2,M2,B2,D2,ld=_(()=>{"use strict";L2=new Set([16,22,0]),M2="Condition",B2={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};D2={media:B0,container:B0,supports(){return this.SupportsDeclaration()}}});var ud={};Se(ud,{generate:()=>q2,name:()=>W2,parse:()=>cd,structure:()=>G2,walkContext:()=>V2});function U2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function j2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function H2(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(R0)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function cd(){let e=this.tokenStart,t=this.tokenIndex,n=Y2.call(this),r=hl(n),o=r?this.parseCustomProperty:this.parseValue,i=r?j2:U2,s=!1,a;this.skipSC(),this.eat(16);let u=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(H2,i):a=i.call(this,this.tokenIndex),r&&a.type==="Value"&&a.children.isEmpty){for(let c=u-this.tokenIndex;c<=0;c++)if(this.lookupType(c)===13){a.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(R0)&&(s=K2.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:s,property:n,value:a}}function q2(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 Y2(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case _2:case N2:case $2:case z2:case O2:this.next();break;case D0:this.next(),this.isDelim(D0)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function K2(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var R0,z2,N2,O2,_2,$2,D0,W2,V2,G2,pd=_(()=>{"use strict";xl();R0=33,z2=35,N2=36,O2=38,_2=42,$2=43,D0=47;W2="Declaration",V2="declaration",G2={important:[Boolean,String],property:String,value:["Value","Raw"]}});var gd={};Se(gd,{generate:()=>Z2,name:()=>Q2,parse:()=>fd,structure:()=>J2});function dd(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function fd(){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),dd));break;default:this.isDelim(X2)?e.push(this.parseWithFallback(this.Rule,dd)):e.push(this.parseWithFallback(this.Declaration,dd))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function Z2(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var X2,Q2,J2,md=_(()=>{"use strict";X2=38;Q2="DeclarationList",J2={children:[["Declaration","Atrule","Rule"]]}});var xd={};Se(xd,{generate:()=>nL,name:()=>eL,parse:()=>hd,structure:()=>tL});function hd(){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 nL(e){this.token(12,e.value+e.unit)}var eL,tL,yd=_(()=>{"use strict";eL="Dimension",tL={value:String,unit:String}});var Sd={};Se(Sd,{generate:()=>sL,name:()=>oL,parse:()=>bd,structure:()=>iL});function bd(e){let t=this.tokenStart,n,r=null;if(this.eat(21),this.skipSC(),n=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?r=this.Ratio():r=this.Number();break;case 12:r=this.Dimension();break;case 1:r=this.Identifier();break;case 2:r=this.parseWithFallback(()=>{let o=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(rL)&&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:n,value:r}}function sL(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var rL,oL,iL,wd=_(()=>{"use strict";rL=47,oL="Feature",iL={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var kd={};Se(kd,{generate:()=>uL,name:()=>aL,parse:()=>vd,structure:()=>lL});function cL(e,t){let r=(this.features[e]||{})[t];return typeof r!="function"&&this.error(`Unknown feature ${t}()`),r}function vd(e="unknown"){let t=this.tokenStart,n=this.consumeFunctionName(),r=cL.call(this,e,n.toLowerCase());this.skipSC();let o=this.parseWithFallback(()=>{let i=this.tokenIndex,s=r.call(this);return this.eof===!1&&this.isBalanceEdge(i)===!1&&this.error(),s},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:o}}function uL(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var aL,lL,Cd=_(()=>{"use strict";aL="FeatureFunction",lL={kind:String,feature:String,value:["Declaration","Selector"]}});var Fd={};Se(Fd,{generate:()=>mL,name:()=>fL,parse:()=>Id,structure:()=>gL});function Td(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(z0,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(z0)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function O0(e){if(this.skipSC(),this.isDelim(pL)||this.isDelim(dL)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(N0)?(this.next(),t+"="):t}if(this.isDelim(N0))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function Id(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=Td.call(this),r=O0.call(this,n.type==="Identifier"),o=Td.call(this),i=null,s=null;return this.lookupNonWSType(0)!==22&&(i=O0.call(this),s=Td.call(this)),this.skipSC(),this.eat(22),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:r,middle:o,rightComparison:i,right:s}}function mL(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 z0,pL,N0,dL,fL,gL,Ed=_(()=>{"use strict";z0=47,pL=60,N0=61,dL=62,fL="FeatureRange",gL={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 Pd={};Se(Pd,{generate:()=>bL,name:()=>hL,parse:()=>Ad,structure:()=>yL,walkContext:()=>xL});function Ad(e,t){let n=this.tokenStart,r=this.consumeFunctionName(),o=r.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(n,this.tokenStart),name:r,children:i}}function bL(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var hL,xL,yL,Ld=_(()=>{"use strict";hL="Function",xL="function",yL={name:String,children:[[]]}});var Bd={};Se(Bd,{generate:()=>vL,name:()=>SL,parse:()=>Md,structure:()=>wL});function Md(e){let t=this.tokenStart,n=null;this.tokenType===2?n=this.consumeFunctionName():this.eat(21);let r=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:n,children:r}}function vL(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var SL,wL,Dd=_(()=>{"use strict";SL="GeneralEnclosed",wL={kind:String,function:[String,null],children:[[]]}});var zd={};Se(zd,{generate:()=>IL,name:()=>CL,parse:()=>Rd,structure:()=>TL,xxx:()=>kL});function Rd(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function IL(e){this.token(4,"#"+e.value)}var kL,CL,TL,Nd=_(()=>{"use strict";kL="XXX",CL="Hash",TL={value:String}});var _d={};Se(_d,{generate:()=>AL,name:()=>FL,parse:()=>Od,structure:()=>EL});function Od(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function AL(e){this.token(1,e.name)}var FL,EL,$d=_(()=>{"use strict";FL="Identifier",EL={name:String}});var jd={};Se(jd,{generate:()=>ML,name:()=>PL,parse:()=>Ud,structure:()=>LL});function Ud(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function ML(e){this.token(9,"#"+e.name)}var PL,LL,Hd=_(()=>{"use strict";PL="IdSelector",LL={name:String}});var Vd={};Se(Vd,{generate:()=>zL,name:()=>DL,parse:()=>Wd,structure:()=>RL});function Wd(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(BL);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function zL(e){this.tokenize(e.name)}var BL,DL,RL,Gd=_(()=>{"use strict";BL=46,DL="Layer",RL={name:String}});var Yd={};Se(Yd,{generate:()=>_L,name:()=>NL,parse:()=>qd,structure:()=>OL});function qd(){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 _L(e){this.children(e,()=>this.token(18,","))}var NL,OL,Kd=_(()=>{"use strict";NL="LayerList",OL={children:[["Layer"]]}});var Qd={};Se(Qd,{generate:()=>jL,name:()=>$L,parse:()=>Xd,structure:()=>UL});function Xd(){let e=this.tokenStart,t=null,n=null,r=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,n=this.consume(1)):n=o,this.lookupTypeNonSC(0)){case 1:{this.skipSC(),this.eatIdent("and"),r=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:{r=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:n,condition:r}}function jL(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 $L,UL,Jd=_(()=>{"use strict";$L="MediaQuery",UL={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var ef={};Se(ef,{generate:()=>VL,name:()=>HL,parse:()=>Zd,structure:()=>WL});function Zd(){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 VL(e){this.children(e,()=>this.token(18,","))}var HL,WL,tf=_(()=>{"use strict";HL="MediaQueryList",WL={children:[["MediaQuery"]]}});var rf={};Se(rf,{generate:()=>KL,name:()=>qL,parse:()=>nf,structure:()=>YL});function nf(){let e=this.tokenStart;return this.eatDelim(GL),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function KL(){this.token(9,"&")}var GL,qL,YL,of=_(()=>{"use strict";GL=38,qL="NestingSelector",YL={}});var af={};Se(af,{generate:()=>JL,name:()=>XL,parse:()=>sf,structure:()=>QL});function sf(){this.skipSC();let e=this.tokenStart,t=e,n=null,r;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?r=this.Identifier():r=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:r,selector:n}}function JL(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var XL,QL,lf=_(()=>{"use strict";XL="Nth",QL={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var uf={};Se(uf,{generate:()=>tM,name:()=>ZL,parse:()=>cf,structure:()=>eM});function cf(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function tM(e){this.token(10,e.value)}var ZL,eM,pf=_(()=>{"use strict";ZL="Number",eM={value:String}});var ff={};Se(ff,{generate:()=>oM,name:()=>nM,parse:()=>df,structure:()=>rM});function df(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function oM(e){this.tokenize(e.value)}var nM,rM,gf=_(()=>{"use strict";nM="Operator",rM={value:String}});var hf={};Se(hf,{generate:()=>aM,name:()=>iM,parse:()=>mf,structure:()=>sM});function mf(e,t){let n=this.tokenStart,r=null;return this.eat(21),r=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:r}}function aM(e){this.token(21,"("),this.children(e),this.token(22,")")}var iM,sM,xf=_(()=>{"use strict";iM="Parentheses",sM={children:[[]]}});var bf={};Se(bf,{generate:()=>uM,name:()=>lM,parse:()=>yf,structure:()=>cM});function yf(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function uM(e){this.token(11,e.value+"%")}var lM,cM,Sf=_(()=>{"use strict";lM="Percentage",cM={value:String}});var vf={};Se(vf,{generate:()=>gM,name:()=>pM,parse:()=>wf,structure:()=>fM,walkContext:()=>dM});function wf(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function gM(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var pM,dM,fM,kf=_(()=>{"use strict";pM="PseudoClassSelector",dM="function",fM={name:String,children:[["Raw"],null]}});var Tf={};Se(Tf,{generate:()=>yM,name:()=>mM,parse:()=>Cf,structure:()=>xM,walkContext:()=>hM});function Cf(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function yM(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 mM,hM,xM,If=_(()=>{"use strict";mM="PseudoElementSelector",hM="function",xM={name:String,children:[["Raw"],null]}});var Ef={};Se(Ef,{generate:()=>wM,name:()=>bM,parse:()=>Ff,structure:()=>SM});function $0(){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 Ff(){let e=this.tokenStart,t=$0.call(this),n=null;return this.skipSC(),this.isDelim(_0)&&(this.eatDelim(_0),n=$0.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function wM(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var _0,bM,SM,Af=_(()=>{"use strict";_0=47;bM="Ratio",SM={left:["Number","Function"],right:["Number","Function",null]}});var Lf={};Se(Lf,{generate:()=>TM,name:()=>kM,parse:()=>Pf,structure:()=>CM});function vM(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function Pf(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?r=vM.call(this):r=this.tokenStart,{type:"Raw",loc:this.getLocation(n,r),value:this.substring(n,r)}}function TM(e){this.tokenize(e.value)}var kM,CM,Mf=_(()=>{"use strict";kM="Raw",CM={value:String}});var Df={};Se(Df,{generate:()=>PM,name:()=>FM,parse:()=>Bf,structure:()=>AM,walkContext:()=>EM});function U0(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function IM(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function Bf(){let e=this.tokenIndex,t=this.tokenStart,n,r;return this.parseRulePrelude?n=this.parseWithFallback(IM,U0):n=U0.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function PM(e){this.node(e.prelude),this.node(e.block)}var FM,EM,AM,Rf=_(()=>{"use strict";FM="Rule",EM="rule",AM={prelude:["SelectorList","Raw"],block:["Block"]}});var Nf={};Se(Nf,{generate:()=>BM,name:()=>LM,parse:()=>zf,structure:()=>MM});function zf(){let e=null,t=null;this.skipSC();let n=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(n,this.tokenStart),root:e,limit:t}}function BM(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 LM,MM,Of=_(()=>{"use strict";LM="Scope",MM={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var $f={};Se($f,{generate:()=>zM,name:()=>DM,parse:()=>_f,structure:()=>RM});function _f(){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 zM(e){this.children(e)}var DM,RM,Uf=_(()=>{"use strict";DM="Selector",RM={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var Hf={};Se(Hf,{generate:()=>$M,name:()=>NM,parse:()=>jf,structure:()=>_M,walkContext:()=>OM});function jf(){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 $M(e){this.children(e,()=>this.token(18,","))}var NM,OM,_M,Wf=_(()=>{"use strict";NM="SelectorList",OM="selector",_M={children:[["Selector","Raw"]]}});function Ll(e){let t=e.length,n=e.charCodeAt(0),r=n===j0||n===H0?1:0,o=r===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1,i="";for(let s=r;s<=o;s++){let a=e.charCodeAt(s);if(a===Vf){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),Pn(Vf,a)){let u=s-1,c=Yr(e,u);s=c-1,i+=el(e.substring(u+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function W0(e,t){let n=t?"'":'"',r=t?H0:j0,o="",i=!1;for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);if(a===0){o+="\uFFFD";continue}if(a<=31||a===127){o+="\\"+a.toString(16),i=!0;continue}a===r||a===Vf?(o+="\\"+e.charAt(s),i=!1):(i&&(Ln(a)||zr(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var Vf,j0,H0,Ml=_(()=>{"use strict";sr();Vf=92,j0=34,H0=39});var qf={};Se(qf,{generate:()=>HM,name:()=>UM,parse:()=>Gf,structure:()=>jM});function Gf(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:Ll(this.consume(5))}}function HM(e){this.token(5,W0(e.value))}var UM,jM,Yf=_(()=>{"use strict";Ml();UM="String",jM={value:String}});var Xf={};Se(Xf,{generate:()=>YM,name:()=>VM,parse:()=>Kf,structure:()=>qM,walkContext:()=>GM});function G0(){return this.Raw(null,!1)}function Kf(){let e=this.tokenStart,t=this.createList(),n;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==WM){this.next();continue}n=this.Comment();break;case 14:n=this.CDO();break;case 15:n=this.CDC();break;case 3:n=this.parseWithFallback(this.Atrule,G0);break;default:n=this.parseWithFallback(this.Rule,G0)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function YM(e){this.children(e)}var WM,VM,GM,qM,Qf=_(()=>{"use strict";WM=33;VM="StyleSheet",GM="stylesheet",qM={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var Zf={};Se(Zf,{generate:()=>QM,name:()=>KM,parse:()=>Jf,structure:()=>XM});function Jf(){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 QM(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var KM,XM,eg=_(()=>{"use strict";KM="SupportsDeclaration",XM={declaration:"Declaration"}});var rg={};Se(rg,{generate:()=>tB,name:()=>ZM,parse:()=>ng,structure:()=>eB});function tg(){this.tokenType!==1&&this.isDelim(JM)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function ng(){let e=this.tokenStart;return this.isDelim(q0)?(this.next(),tg.call(this)):(tg.call(this),this.isDelim(q0)&&(this.next(),tg.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function tB(e){this.tokenize(e.name)}var JM,q0,ZM,eB,og=_(()=>{"use strict";JM=42,q0=124;ZM="TypeSelector",eB={name:String}});var ag={};Se(ag,{generate:()=>sB,name:()=>oB,parse:()=>sg,structure:()=>iB});function Rs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let o=this.charCodeAt(r);if(o===K0&&t&&n!==0)return Rs.call(this,e+n+1,!1),-1;Ln(o)||this.error(t&&n!==0?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",r),++n>6&&this.error("Too many hex digits",r)}return this.next(),n}function Bl(e){let t=0;for(;this.isDelim(ig);)++t>e&&this.error("Too many question marks"),this.next()}function nB(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Y0?"Plus sign":"Hyphen minus")+" is expected")}function rB(){let e=0;switch(this.tokenType){case 10:if(e=Rs.call(this,1,!0),this.isDelim(ig)){Bl.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){nB.call(this,K0),Rs.call(this,1,!1);break}break;case 12:e=Rs.call(this,1,!0),e>0&&Bl.call(this,6-e);break;default:if(this.eatDelim(Y0),this.tokenType===1){e=Rs.call(this,0,!0),e>0&&Bl.call(this,6-e);break}if(this.isDelim(ig)){this.next(),Bl.call(this,5);break}this.error("Hex digit or question mark is expected")}}function sg(){let e=this.tokenStart;return this.eatIdent("u"),rB.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function sB(e){this.tokenize(e.value)}var Y0,K0,ig,oB,iB,lg=_(()=>{"use strict";sr();Y0=43,K0=45,ig=63;oB="UnicodeRange",iB={value:String}});function Q0(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===X0?t-2:t-1,o="";for(;n<r&&zr(e.charCodeAt(n));)n++;for(;n<r&&zr(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===cg){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),Pn(cg,s)){let a=i-1,u=Yr(e,a);i=u-1,o+=el(e.substring(a+1,u))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function J0(e){let t="",n=!1;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===0){t+="\uFFFD";continue}if(o<=31||o===127){t+="\\"+o.toString(16),n=!0;continue}o===aB||o===cg||o===lB||o===cB||o===uB||o===X0?(t+="\\"+e.charAt(r),n=!1):(n&&Ln(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var aB,cg,lB,cB,uB,X0,ug=_(()=>{"use strict";sr();aB=32,cg=92,lB=34,cB=39,uB=40,X0=41});var dg={};Se(dg,{generate:()=>fB,name:()=>pB,parse:()=>pg,structure:()=>dB});function pg(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=Q0(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=Ll(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 fB(e){this.token(7,J0(e.value))}var pB,dB,fg=_(()=>{"use strict";ug();Ml();pB="Url",dB={value:String}});var mg={};Se(mg,{generate:()=>hB,name:()=>gB,parse:()=>gg,structure:()=>mB});function gg(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function hB(e){this.children(e)}var gB,mB,hg=_(()=>{"use strict";gB="Value",mB={children:[[]]}});var yg={};Se(yg,{generate:()=>SB,name:()=>yB,parse:()=>xg,structure:()=>bB});function xg(){return this.eat(13),xB}function SB(e){this.token(13,e.value)}var xB,yB,bB,bg=_(()=>{"use strict";xB=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),yB="WhiteSpace",bB={value:String}});var zs={};Se(zs,{AnPlusB:()=>Fp,Atrule:()=>Pp,AtrulePrelude:()=>Bp,AttributeSelector:()=>Np,Block:()=>$p,Brackets:()=>Hp,CDC:()=>Gp,CDO:()=>Kp,ClassSelector:()=>Jp,Combinator:()=>td,Comment:()=>od,Condition:()=>ad,Declaration:()=>ud,DeclarationList:()=>gd,Dimension:()=>xd,Feature:()=>Sd,FeatureFunction:()=>kd,FeatureRange:()=>Fd,Function:()=>Pd,GeneralEnclosed:()=>Bd,Hash:()=>zd,IdSelector:()=>jd,Identifier:()=>_d,Layer:()=>Vd,LayerList:()=>Yd,MediaQuery:()=>Qd,MediaQueryList:()=>ef,NestingSelector:()=>rf,Nth:()=>af,Number:()=>uf,Operator:()=>ff,Parentheses:()=>hf,Percentage:()=>bf,PseudoClassSelector:()=>vf,PseudoElementSelector:()=>Tf,Ratio:()=>Ef,Raw:()=>Lf,Rule:()=>Df,Scope:()=>Nf,Selector:()=>$f,SelectorList:()=>Hf,String:()=>qf,StyleSheet:()=>Xf,SupportsDeclaration:()=>Zf,TypeSelector:()=>rg,UnicodeRange:()=>ag,Url:()=>dg,Value:()=>mg,WhiteSpace:()=>yg});var Sg=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tf();of();lf();pf();gf();xf();Sf();kf();If();Af();Mf();Rf();Of();Uf();Wf();Yf();Qf();eg();og();lg();fg();hg();bg()});var eS,tS=_(()=>{"use strict";yl();I0();Sg();eS={generic:!0,cssWideKeywords:Ci,...T0,node:zs}});function Ns(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,TB)&&this.cmpChar(this.tokenStart+1,nS)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===CB||t===vB||t===nS||t===kB)return this.Operator();t===wB&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var wB,vB,nS,kB,CB,TB,wg=_(()=>{"use strict";wB=35,vB=42,nS=43,kB=45,CB=47,TB=117});var rS,oS=_(()=>{"use strict";wg();rS={getNode:Ns}});function DB(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function RB(){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)===iS&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case AB:case LB:case BB:case PB:return this.Combinator();case iS:return this.ClassSelector();case EB:case MB:return this.TypeSelector();case IB:return this.IdSelector();case FB:return this.NestingSelector()}break}}}var IB,FB,EB,AB,PB,iS,LB,MB,BB,sS,aS=_(()=>{"use strict";IB=35,FB=38,EB=42,AB=43,PB=47,iS=46,LB=62,MB=124,BB=126;sS={onWhiteSpace:DB,getNode:RB}});function lS(){return this.createSingleNodeList(this.Raw(null,!1))}var cS=_(()=>{"use strict"});function uS(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type==="Value"&&n.children.isEmpty){for(let r=t-this.tokenIndex;r<=0;r++)if(this.lookupType(r)===13){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(n)}return e}var pS=_(()=>{"use strict"});function dS(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var fS,gS=_(()=>{"use strict";wg();cS();pS();fS={getNode:Ns,onWhiteSpace(e,t){dS(e)&&(e.value=" "+e.value),dS(t.last)&&(t.last.value+=" ")},expression:lS,var:uS}});var vg={};Se(vg,{AtrulePrelude:()=>rS,Selector:()=>sS,Value:()=>fS});var mS=_(()=>{"use strict";oS();aS();gS()});var zB,hS,xS=_(()=>{"use strict";zB=new Set(["none","and","not","or"]),hS={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);zB.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var yS,bS=_(()=>{"use strict";yS={parse:{prelude:null,block(){return this.Block(!0)}}}});function kg(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 SS,wS,vS=_(()=>{"use strict";SS={layer(){this.skipSC();let e=this.createList(),t=kg.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=kg.call(this,this.Declaration,()=>kg.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},wS={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,SS)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,SS)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var kS,CS=_(()=>{"use strict";kS={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var TS,IS=_(()=>{"use strict";TS={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var FS,ES=_(()=>{"use strict";FS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var AS,PS=_(()=>{"use strict";AS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var LS,MS=_(()=>{"use strict";LS={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var BS,DS=_(()=>{"use strict";BS={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var RS,zS=_(()=>{"use strict";RS={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var NS,OS=_(()=>{"use strict";xS();bS();vS();CS();IS();ES();PS();MS();DS();zS();NS={container:hS,"font-face":yS,import:wS,layer:kS,media:TS,nest:FS,page:AS,scope:LS,"starting-style":BS,supports:RS}});function _S(){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 $S=_(()=>{"use strict"});var Qo,Cg,NB,OB,Dl,US,jS=_(()=>{"use strict";$S();Qo={parse(){return this.createSingleNodeList(this.SelectorList())}},Cg={parse(){return this.createSingleNodeList(this.Selector())}},NB={parse(){return this.createSingleNodeList(this.Identifier())}},OB={parse:_S},Dl={parse(){return this.createSingleNodeList(this.Nth())}},US={dir:NB,has:Qo,lang:OB,matches:Qo,is:Qo,"-moz-any":Qo,"-webkit-any":Qo,where:Qo,not:Qo,"nth-child":Dl,"nth-last-child":Dl,"nth-last-of-type":Dl,"nth-of-type":Dl,slotted:Cg,host:Cg,"host-context":Cg}});var Tg={};Se(Tg,{AnPlusB:()=>Ip,Atrule:()=>Ap,AtrulePrelude:()=>Mp,AttributeSelector:()=>zp,Block:()=>_p,Brackets:()=>jp,CDC:()=>Vp,CDO:()=>Yp,ClassSelector:()=>Qp,Combinator:()=>ed,Comment:()=>rd,Condition:()=>sd,Declaration:()=>cd,DeclarationList:()=>fd,Dimension:()=>hd,Feature:()=>bd,FeatureFunction:()=>vd,FeatureRange:()=>Id,Function:()=>Ad,GeneralEnclosed:()=>Md,Hash:()=>Rd,IdSelector:()=>Ud,Identifier:()=>Od,Layer:()=>Wd,LayerList:()=>qd,MediaQuery:()=>Xd,MediaQueryList:()=>Zd,NestingSelector:()=>nf,Nth:()=>sf,Number:()=>cf,Operator:()=>df,Parentheses:()=>mf,Percentage:()=>yf,PseudoClassSelector:()=>wf,PseudoElementSelector:()=>Cf,Ratio:()=>Ff,Raw:()=>Pf,Rule:()=>Bf,Scope:()=>zf,Selector:()=>_f,SelectorList:()=>jf,String:()=>Gf,StyleSheet:()=>Kf,SupportsDeclaration:()=>Jf,TypeSelector:()=>ng,UnicodeRange:()=>sg,Url:()=>pg,Value:()=>gg,WhiteSpace:()=>xg});var HS=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tf();of();lf();pf();gf();xf();Sf();kf();If();Af();Mf();Rf();Of();Uf();Wf();Yf();Qf();eg();og();lg();fg();hg();bg()});var WS,VS=_(()=>{"use strict";mS();OS();jS();HS();WS={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:vg,atrule:NS,pseudo:US,node:Tg}});var GS,qS=_(()=>{"use strict";Sg();GS={node:zs}});var YS,KS=_(()=>{"use strict";C0();tS();VS();qS();YS=k0({...eS,...WS,...GS})});var XS=_(()=>{"use strict"});var QS=_(()=>{"use strict"});var Gq,JS,qq,Yq,Kq,ZS,Xq,Qq,Jq,Zq,eY,tY,ew=_(()=>{"use strict";KS();XS();dp();xl();QS();Ml();ug();({tokenize:Gq,parse:JS,generate:qq,lexer:Yq,createLexer:Kq,walk:ZS,find:Xq,findLast:Qq,findAll:Jq,toPlainObject:Zq,fromPlainObject:eY,fork:tY}=YS)});function jB(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function nw(e){try{let t=JS(e.trim(),{context:"value"}),n=[];return ZS(t,{enter(r){if(r.type==="Dimension"){let o=parseFloat(r.value);n.push(`${o}${r.unit}`)}else if(r.type==="Number"){let o=parseFloat(r.value);n.push(`${o}`)}else r.type==="Percentage"?n.push(`${parseFloat(r.value)}%`):r.type==="Identifier"?n.push(r.name.toLowerCase()):r.type==="Hash"?n.push(`#${r.value.toLowerCase()}`):r.type}}),n}catch{return[e.trim().toLowerCase()]}}function HB(e,t){let n=jB(e);if(!UB.has(n))return t;let r=nw(t);if(r.length<1||r.length>4)return t;let o=r.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 tw(e,t){let n=t.trim();if(!n)return"";let r=HB(e,n);return nw(r).map(i=>i==="0"?"0px":i).join(" ")}function rw(e,t,n){let r=tw(e,t),o=tw(e,n);return r!==""&&o!==""&&r===o}var UB,ow=_(()=>{"use strict";ew();UB=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"])});function WB(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function VB(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/);if(!t)return null;let n=parseInt(t[1],10).toString(16).padStart(2,"0"),r=parseInt(t[2],10).toString(16).padStart(2,"0"),o=parseInt(t[3],10).toString(16).padStart(2,"0");return`#${n}${r}${o}`}function iw(e){let t=typeof e=="string"?e:String(e??"");if(!t||t==="[object Object]")return"";let n=t.match(/rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/);if(n){let i=VB(n[0]);if(i)return i}let r=t.match(/#([0-9a-fA-F]{3,8})/);if(r)return WB(r[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 Jo(e,t,n){if(!e||!t)return!1;let r=String(e),o=String(t),i=r.toLowerCase(),s=o.toLowerCase(),a=i.includes("none"),u=s.includes("none");if(a!==u)return!1;let c=/\b(fill|stroke)\s*:/i,l=c.test(r),d=c.test(o);if(l!==d)return!1;let f=iw(r),p=iw(o);return!!(f===p||n&&rw(n,r,o))}var Ig=_(()=>{"use strict";ow()});function XB(e){let t=String(e.property||"").toLowerCase(),n=String(e.description||"").toLowerCase(),r=String(e.expected||e.suggestedValue||"").toLowerCase(),o=String(e.actual||e.currentValue||"").toLowerCase();if(t.includes("color")||t.includes("fill")||t.includes("background")||n.includes("color")||n.includes("fill"))return!0;let i=s=>/^#[0-9a-f]{3,8}$/i.test(s)||s.includes("rgb")||["white","black","red","blue","green","orange","yellow","transparent"].includes(s);return!!(i(r)||i(o)||e.relatedProperties?.some(s=>{let a=s.property?.toLowerCase()||"";return a.includes("color")||a.includes("fill")||a.includes("background")}))}function sw(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 QB(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase(),r=String(e.property||"").toLowerCase(),o=String(e.description||"").toLowerCase(),i=n.includes("margin")||t.includes("margin")||r==="margin",s=t.includes("gap")||o.includes("gap");return i&&s}function JB(e,t,n){if(!e||!t)return!1;let r=typeof e=="string"?e:String(e??""),o=typeof t=="string"?t:String(t??"");if(!r||!o||r==="[object Object]"||o==="[object Object]"||n&&XB(n)||sw(r)||sw(o)||n&&QB(n))return!1;let i=parseFloat(r),s=parseFloat(o);if(isNaN(i)||isNaN(s))return!1;let a=Math.abs(i-s);if(r.includes("px")||o.includes("px")){let u=n?.property?.toLowerCase()||"";return u==="width"||u==="height"||u.includes("width")||u.includes("height")?a<lw:a<aw}return r.includes("%")||o.includes("%")?a<1:!1}function ZB(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(KB.some(s=>t.includes(s))||!qB.some(s=>t.includes(s)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!Jo(o,i,e.property))}function eD(e){let t=(e.expected!==void 0?"fill":"").toLowerCase(),n=e.actual!==void 0||e.currentValue!==void 0?"fill":"";if(!(t==="fill"||n==="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 s=`${e.description||""} ${e.title||""}`.toLowerCase();return s.includes("container")||s.includes("svg ")||s.includes("<svg")||s.includes("wrapper")}function tD(e){let t=`${e.description||""} ${e.title||""}`.toLowerCase(),n=e.property?.toLowerCase()||"";if(!(t.includes("text ")||t.includes("text layer")||t.includes("text span")||t.includes("span ")||t.includes("label "))||!(n==="width"||n==="height"||n.includes("width")||n.includes("height")||t.includes("width")||t.includes("height")))return!1;let i=e.expected||e.suggestedValue||"",s=e.actual||e.currentValue||"",a=parseFloat(i),u=parseFloat(s);return isNaN(a)||isNaN(u)?!1:Math.abs(a-u)<cw}function nD(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase(),n=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase();if(!YB.some(d=>t.includes(d)||n.includes(d)))return!1;let i=`${t} ${n} ${r}`;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 a=n.includes("hug")||n.includes("auto"),u=/\d+\.?\d*px/.test(r);if(!a||!u)return!1;let c=n.match(/(\d+\.?\d*)px/),l=r.match(/(\d+\.?\d*)px/);return!(c&&l&&Math.abs(parseFloat(c[1])-parseFloat(l[1]))>GB)}function rD(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase();return(!n||!t||n.includes("see ")||t.includes("see ")||n.includes("image")||t.includes("image"))&&e.type==="visual"}function Os(e){if(e.programmaticallyVerified)return{dismissed:!1};let t=e.expected||e.suggestedValue,n=e.actual||e.currentValue;if(e.fixRequired===!1)return{dismissed:!0,dismissReason:"Auto-dismissed: FixRequired is false (no code change needed)",dismissedBy:"post-ai-validation"};if(Jo(t,n,e.property))return{dismissed:!0,dismissReason:"Auto-dismissed: expected equals actual (identical values)",dismissedBy:"post-ai-validation"};if(e.fixRequired===!0)return{dismissed:!1};if(tD(e))return{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${cw}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"};if(JB(t,n,e)){let r=e.property?.toLowerCase()||"";return{dismissed:!0,dismissReason:`Auto-dismissed: negligible difference (<${r==="width"||r==="height"||r.includes("width")||r.includes("height")?lw:aw}px)`,dismissedBy:"post-ai-validation"}}return rD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:ZB(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:nD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:eD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var aw,lw,cw,GB,qB,YB,KB,uw=_(()=>{"use strict";Ig();aw=.5,lw=2,cw=2,GB=5,qB=["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"],YB=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],KB=["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"]});function To(e,t,n){let r=100-n*1-t*3-e*10;return Math.max(0,Math.min(100,r))}var pw=_(()=>{"use strict"});var dw=_(()=>{"use strict"});var fw=_(()=>{"use strict"});var Fg=_(()=>{"use strict";Ig();uw();pw();dw();fw()});var dD,fD,yY,Eg=_(()=>{"use strict";dD=["flex","inline-flex"],fD=["grid","inline-grid"],yY=[...dD,...fD]});var mw=_(()=>{"use strict";Fg();Eg()});var hw=_(()=>{"use strict"});var Rn=_(()=>{"use strict";wu();Sy();wy();Fg();Eg();mw();hw()});function mD(e){let{aiPrompt:t,aiResponse:n,...r}=e;return r}function Jn(e){try{let t=e.map(mD),n=JSON.stringify(t,hD);sessionStorage.setItem(Ag,n)}catch(t){y.error("[SessionStorage] Failed to save review history:",t)}}function Pg(){try{let e=sessionStorage.getItem(Ag);if(!e)return[];let t=JSON.parse(e,xD);return Array.isArray(t)?t:[]}catch(e){return y.error("[SessionStorage] Failed to load review history:",e),[]}}function xw(){try{let e=Pg();if(e.length===0)return;let t=!1,n=e.map(r=>{if(r.aiPrompt!==void 0||r.aiResponse!==void 0){t=!0;let{aiPrompt:o,aiResponse:i,...s}=r;return s}return r});t&&(Jn(n),y.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){y.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function yw(){try{sessionStorage.removeItem(Ag),y.debug("[SessionStorage] Review history cleared")}catch(e){y.error("[SessionStorage] Failed to clear review history:",e)}}function hD(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function xD(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Ag,Lg=_(()=>{"use strict";Oe();Ag="uicopilot_review_history"});import yD,{createContext as bD,useContext as SD,useReducer as wD,useMemo as bw,useRef as vD,useEffect as kD}from"react";function Rl(e){let t=e.length>Sw?e.slice(e.length-Sw):e,n=Math.max(0,t.length-CD);return n===0?t:t.map((r,o)=>{if(o>=n)return r;let i=r.storybookImageData?.startsWith("data:"),s=r.figmaImageData?.startsWith("data:");return!i&&!s?r:{...r,storybookImageData:i?void 0:r.storybookImageData,figmaImageData:s?void 0:r.figmaImageData}})}function TD(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"ADD_STREAMING_MESSAGE":return{...e,streamingMessages:[...e.streamingMessages,t.payload]};case"UPDATE_STREAMING_MESSAGE":return{...e,streamingMessages:e.streamingMessages.map((n,r)=>r===t.payload.index?{...n,content:t.payload.content}:n)};case"CLEAR_STREAMING_MESSAGES":return{...e,streamingMessages:[]};case"TOGGLE_MODEL":{let n=e.selectedModels.includes(t.payload);return n&&e.selectedModels.length===1?e:{...e,selectedModels:n?e.selectedModels.filter(r=>r!==t.payload):[...e.selectedModels,t.payload]}}case"SET_REVIEW_RESULTS":{if(!t.payload)return{...e,reviewResults:null,currentReviewId:null};let n=e.userRole==="admin",r={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:e.storybookImageUrl||void 0,figmaImageData:e.figmaImageUrl||void 0,aiPrompt:n&&e.fullPrompt||void 0,aiResponse:n&&e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens},o=e.reviewHistory.findIndex(s=>s.id===t.payload.id),i;return o>=0?i=e.reviewHistory.map((s,a)=>a===o?r:s):i=[...e.reviewHistory,r],i=Rl(i),Jn(i),{...e,reviewResults:t.payload,reviewHistory:i,currentReviewId:t.payload.id}}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":{let n=new Set(e.reviewHistory.map(i=>i.id)),r=t.payload.filter(i=>!n.has(i.id));if(r.length===0)return e;let o=Rl([...e.reviewHistory,...r]);return Jn(o),{...e,reviewHistory:o}}case"ADD_REVIEW":{let n=Rl([...e.reviewHistory,t.payload]);return Jn(n),{...e,reviewHistory:n,currentReviewId:t.payload.id}}case"TOGGLE_ISSUE_SELECTION":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload?{...o,selectedForFix:!o.selectedForFix}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_STATUS":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload.issueId?{...o,status:t.payload.status,error:t.payload.error}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_GENERATED_FIX":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.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(n),{...e,reviewHistory:n}}case"BATCH_UPDATE_ISSUE_GENERATED_FIXES":{if(!e.currentReviewId)return e;let n=new Map(t.payload.map(o=>[o.issueId,o.generatedFix])),r=e.reviewHistory.map(o=>o.id!==e.currentReviewId?o:{...o,issues:o.issues.map(i=>{let s=n.get(i.id);return s?{...i,generatedFix:i.generatedFix?{...i.generatedFix,...s}:s,selectedForFix:s?.status==="failed"?!1:i.selectedForFix}:i})});return Jn(r),{...e,reviewHistory:r}}case"DISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload.issueId?{...c,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"UNDISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload?{...c,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"RECALCULATE_SCORE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.filter(c=>!c.dismissed),i=o.filter(c=>c.severity==="critical").length,s=o.filter(c=>c.severity==="major").length,a=o.filter(c=>c.severity==="minor").length,u=To(i,s,a);return y.debug(`[recalculateScore] Active: ${o.length}, score: ${u}`),{...r,complianceScore:u,issuesCount:o.length}});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_REVIEW_SCORE":{let n=e.reviewHistory.map(r=>r.id!==t.payload.reviewId?r:{...r,complianceScore:t.payload.newScore});return Jn(n),{...e,reviewHistory:n}}case"CLEAR_ALL_REVIEWS":return yw(),{...e,reviewHistory:[],currentReviewId:null};case"CLEAR_STALE_REVIEWS":return{...e,currentReviewId:null,reviewResults:null};case"RESET_REVIEW":{let n=e.isReviewing;return{...e,isReviewing:!1,reviewError:null,reviewResults:n?null:e.reviewResults,multiModelResults:null,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:n?"chat":e.reviewDetailTab,fullPrompt:"",fullResponse:"",figmaImageUrl:n?null:e.figmaImageUrl,storybookImageUrl:n?null:e.storybookImageUrl,currentReviewId:n?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 Bg({children:e}){let[t,n]=wD(TD,PD),r=vD(t);kD(()=>{r.current=t},[t]);let o=bw(()=>({setIsReviewing:s=>n({type:"SET_STATE",payload:{isReviewing:s}}),setReviewError:s=>n({type:"SET_STATE",payload:{reviewError:s}}),bulkAddReviews:s=>n({type:"BULK_ADD_REVIEWS",payload:s}),setReviewResults:s=>n({type:"SET_REVIEW_RESULTS",payload:s}),setMultiModelResults:s=>n({type:"SET_STATE",payload:{multiModelResults:s}}),updateMultiModelStreamingMessages:(s,a)=>n({type:"UPDATE_MULTI_MODEL_STREAMING",payload:{modelId:s,messages:a}}),setModelCompleted:s=>n({type:"SET_MODEL_COMPLETED",payload:s}),setActiveModelId:s=>{let a=r.current;a.multiModelResults&&n({type:"SET_STATE",payload:{multiModelResults:{...a.multiModelResults,activeModelId:s}}})},setShowReviewMenu:s=>n({type:"SET_STATE",payload:{showReviewMenu:s}}),setSeverityFilter:s=>n({type:"SET_STATE",payload:{severityFilter:s}}),setShowStreamingPanel:s=>n({type:"SET_STATE",payload:{showStreamingPanel:s}}),setStreamingPanelCollapsed:s=>n({type:"SET_STATE",payload:{streamingPanelCollapsed:s}}),addStreamingMessage:s=>n({type:"ADD_STREAMING_MESSAGE",payload:s}),updateStreamingMessage:(s,a)=>n({type:"UPDATE_STREAMING_MESSAGE",payload:{index:s,content:a}}),clearStreamingMessages:()=>n({type:"CLEAR_STREAMING_MESSAGES"}),setStreamingProgress:s=>n({type:"SET_STATE",payload:{streamingProgress:s}}),setStreamingStatus:s=>n({type:"SET_STATE",payload:{streamingStatus:s}}),setReviewDetailTab:s=>n({type:"SET_STATE",payload:{reviewDetailTab:s}}),setFullPrompt:s=>n({type:"SET_STATE",payload:{fullPrompt:s}}),setFullResponse:s=>n({type:"SET_STATE",payload:{fullResponse:s}}),setFigmaImageUrl:s=>n({type:"SET_STATE",payload:{figmaImageUrl:s}}),setStorybookImageUrl:s=>n({type:"SET_STATE",payload:{storybookImageUrl:s}}),setFigmaDimensions:s=>n({type:"SET_STATE",payload:{figmaDimensions:s}}),setSelectedModels:s=>n({type:"SET_STATE",payload:{selectedModels:s}}),toggleModel:s=>n({type:"TOGGLE_MODEL",payload:s}),setModelComparisonView:s=>n({type:"SET_STATE",payload:{modelComparisonView:s}}),resetReview:()=>n({type:"RESET_REVIEW"}),addReview:s=>n({type:"ADD_REVIEW",payload:s}),getCurrentReview:()=>{let s=r.current;return s.currentReviewId&&s.reviewHistory.find(a=>a.id===s.currentReviewId)||null},getReviewById:s=>r.current.reviewHistory.find(a=>a.id===s)||null,getParentReview:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return a?.parentReviewId&&s.reviewHistory.find(u=>u.id===a.parentReviewId)||null},hasAppliedFixes:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return!a||!Array.isArray(a.issues)||a.issues.length===0?!1:a.issues.some(u=>u.status==="applied"||u.generatedFix?.status==="applied")},toggleIssueSelection:s=>n({type:"TOGGLE_ISSUE_SELECTION",payload:s}),updateIssueStatus:(s,a,u)=>n({type:"UPDATE_ISSUE_STATUS",payload:{issueId:s,status:a,error:u}}),updateIssueGeneratedFix:(s,a)=>n({type:"UPDATE_ISSUE_GENERATED_FIX",payload:{issueId:s,generatedFix:a}}),batchUpdateIssueGeneratedFixes:s=>n({type:"BATCH_UPDATE_ISSUE_GENERATED_FIXES",payload:s}),dismissIssue:(s,a,u)=>n({type:"DISMISS_ISSUE",payload:{issueId:s,reason:a,dismissedBy:u}}),undismissIssue:s=>n({type:"UNDISMISS_ISSUE",payload:s}),recalculateScore:()=>n({type:"RECALCULATE_SCORE"}),updateReviewScore:(s,a)=>n({type:"UPDATE_REVIEW_SCORE",payload:{reviewId:s,newScore:a}}),clearAllReviews:()=>n({type:"CLEAR_ALL_REVIEWS"}),clearStaleReviewsForStory:s=>n({type:"CLEAR_STALE_REVIEWS",payload:s}),setIsApplying:s=>n({type:"SET_STATE",payload:{isApplying:s}}),setApplyFixesResult:s=>n({type:"SET_STATE",payload:{applyFixesResult:s}}),setIncludeComponentIssues:s=>n({type:"SET_STATE",payload:{includeComponentIssues:s}}),setIncludeTextComparison:s=>n({type:"SET_STATE",payload:{includeTextComparison:s}}),setUsePromptCache:s=>n({type:"SET_STATE",payload:{usePromptCache:s}}),setIsValidating:s=>n({type:"SET_STATE",payload:{isValidating:s}}),setValidationUsage:s=>n({type:"SET_STATE",payload:{validationUsage:s}}),setWorkspacePath:s=>n({type:"SET_STATE",payload:{workspacePath:s}}),triggerScreenshotRefresh:()=>n({type:"TRIGGER_SCREENSHOT_REFRESH"}),setHoveredIssueId:s=>n({type:"SET_STATE",payload:{hoveredIssueId:s}}),setFeatureFlags:s=>n({type:"SET_STATE",payload:{featureFlags:s}}),setUserRole:s=>n({type:"SET_STATE",payload:{userRole:s}}),setRoleOverride:s=>{try{s?localStorage.setItem("uicopilot_role_override",s):localStorage.removeItem("uicopilot_role_override")}catch{}n({type:"SET_STATE",payload:{roleOverride:s}})},setReviewAllConcurrency:s=>{let a=Math.max(1,Math.min(5,s));try{localStorage.setItem("uicopilot_review_all_concurrency",String(a))}catch{}n({type:"SET_STATE",payload:{reviewAllConcurrency:a}})},setIsGenerating:s=>n({type:"SET_STATE",payload:{isGenerating:s}}),setGeneratedPrompt:s=>n({type:"SET_STATE",payload:{generatedPrompt:s}}),setPromptError:s=>n({type:"SET_STATE",payload:{promptError:s}}),resetPrompt:()=>n({type:"RESET_PROMPT"})}),[]),i=bw(()=>({...t,...o}),[t,o]);return yD.createElement(ww.Provider,{value:i},e)}function ce(){let e=SD(ww);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var Sw,CD,ID,FD,Mg,ED,AD,PD,ww,Dg=_(()=>{"use strict";Rn();Lg();Oe();Sw=20,CD=5;ID=()=>{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},FD=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},Mg={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},ED=()=>{if(typeof localStorage>"u")return Mg;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return Mg;let t=JSON.parse(e);return{enableFixGeneration:!!t.enableFixGeneration,enableFixApply:!!t.enableFixApply,enableAutoMap:!!t.enableAutoMap,enableReviewBadges:!!t.enableReviewBadges,showCosts:!!t.showCosts,enableParallelReview:!!t.enableParallelReview,enableModelSelection:!!t.enableModelSelection}}catch{}return Mg},AD=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},PD={isReviewing:!1,reviewError:null,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-5-20250929"],modelComparisonView:"side-by-side",reviewHistory:Rl(Pg()),currentReviewId:null,includeComponentIssues:!0,includeTextComparison:!1,usePromptCache:!1,isApplying:!1,applyFixesResult:null,screenshotRefreshKey:0,isValidating:!1,validationUsage:null,lastAiCallTimestamp:null,aiRateLimitSeconds:0,isGenerating:!1,generatedPrompt:null,promptError:null,workspacePath:null,userRole:AD(),roleOverride:FD(),featureFlags:ED(),reviewAllConcurrency:ID(),hoveredIssueId:null},ww=bD(null)});import _s,{useMemo as LD}from"react";function zg({children:e}){return _s.createElement(mu,null,_s.createElement(xu,null,_s.createElement(bu,null,_s.createElement(Bg,null,_s.createElement(MD,null),e))))}function vw(e){let t=we(),n=Je(),r=nt(),o=ce(),i=LD(()=>({...t,...n,...r,...o}),[t,n,r,o]);return e?e(i):i}function MD(){return Rg=vw(),null}var Rg,ft,kw=_(()=>{"use strict";hu();yu();Su();Dg();Rg=null,ft=Object.assign(vw,{getState:()=>{if(!Rg)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return Rg}})});var Ce=_(()=>{"use strict";kw();hu();yu();Su();Dg()});function V(){return(process.env.STORYBOOK_UICOPILOT_URL||BD).replace(/\/$/,"")}var BD,Cw,je=_(()=>{"use strict";BD="https://app.uiparity.com";Cw=3.6});async function ne(e,t,n=3e4){let r=new AbortController,o=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${n}ms: ${e}`):i}finally{clearTimeout(o)}}var ct=_(()=>{"use strict"});import{useEffect as Zo,useState as Nl,useRef as $w,useCallback as $g}from"react";import{addons as Ug}from"storybook/manager-api";async function RR(e,t,n){let r=`${e}:${t}`,o=jg.get(r);if(o)return y.debug("[useReviewScreenshots] Reusing in-flight Figma image fetch for",r),o;let i=(async()=>{let s=await ne(`${Vw}/api/figma/image?projectId=${e}&nodeId=${t}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});return s.ok?s.json():{imageUrl:null}})().finally(()=>{jg.delete(r)});return jg.set(r,i),i}function zR(e,t,n){try{sessionStorage.setItem(`${Ol}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:n,timestamp:Date.now()}))}catch{}}function NR(e,t){try{let n=sessionStorage.getItem(`${Ol}${e}`);if(!n)return null;let r=JSON.parse(n);if(r.figmaNodeId===t&&Date.now()-r.timestamp<1800*1e3)return r.imageUrl;sessionStorage.removeItem(`${Ol}${e}`)}catch{}return null}function OR(e){try{let t=sessionStorage.getItem(`${Ol}${e}`);if(!t)return null;let n=JSON.parse(t);if(n.imageUrl&&Date.now()-n.timestamp<300*1e3)return n.imageUrl}catch{}return null}var Uw,jw,Hw,Ww,Bi,Vw,zn,Hg,jg,Ol,Gw,qw,ei,Di=_(()=>{"use strict";Ce();Wg();Oe();je();ct();Uw="storyArgsUpdated",jw="storyRendered",Hw="forceRemount",Ww=null,Bi=()=>Ww,Vw=V(),zn=new Map,Hg=null,jg=new Map;Ol="uicopilot-figma-image-";Gw=(e,t,n)=>{let r=zn.get(e);r?(r.storybookImageUrl=t,n&&(r.figmaImageUrl=n)):zn.set(e,{storybookImageUrl:t,figmaImageUrl:n??null}),y.debug("[useReviewScreenshots] Populated historical screenshots for story:",e)},qw=(e,t,n)=>{Hg=t;let r=zn.get(e);r?r.figmaImageUrl=n:zn.set(e,{storybookImageUrl:null,figmaImageUrl:n}),y.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:n.substring(0,50)+"..."})},ei=()=>{let[e,t]=Nl(!1),[n,r]=Nl(!1),[o,i]=Nl(!1),[s,a]=Nl(null),u=$w(null),{screenshotRefreshKey:c,triggerScreenshotRefresh:l}=ce(),d=$g(()=>{let P=ft.getState().currentStoryId;P&&(y.debug("[useReviewScreenshots] Refreshing screenshots for story:",P),zn.delete(P),u.current=null,i(!0),l())},[l]),f=$g(()=>{let P=ft.getState().currentStoryId;if(P){y.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",P);let z=zn.get(P);z&&(z.storybookImageUrl=null),u.current=null,i(!0),l()}},[l]),{sessionToken:p}=we(),{selectedProjectId:g}=Je(),{currentStoryId:k,currentMapping:T,loadingMapping:E}=nt(),{setStorybookImageUrl:I,setFigmaImageUrl:D}=ce(),R=$w(null);Zo(()=>{k&&R.current&&R.current!==k&&(y.debug("[useReviewScreenshots] Story switched, clearing images"),I(""),D("")),R.current=k},[k,I,D]),Zo(()=>{!k||E||T||D("")},[k,T,E,D]),Zo(()=>{if(!k)return;let P=OR(k);P&&(y.debug("[useReviewScreenshots] Quick-restored Figma image for:",k),D(P))},[k,D]),Zo(()=>{let P=!1;return(async()=>{if(!p||!g||!k){y.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}u.current&&u.current!==k&&(y.debug("[useReviewScreenshots] Story changed, clearing stale screenshots"),I(""),D(""));let x=ft.getState();if(u.current===k&&x.storybookImageUrl&&x.figmaImageUrl){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping capture");return}let w=T?.figmaNodeId??null;if(w!==Hg){y.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",k);let L=zn.get(k);L&&(L.figmaImageUrl=null),Hg=w,u.current=null}let v=T?.figmaNodeId;if(v&&!zn.get(k)?.figmaImageUrl){let L=NR(k,v);if(L){y.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",k),D(L);let B=zn.get(k);B?B.figmaImageUrl=L:zn.set(k,{storybookImageUrl:null,figmaImageUrl:L})}}let C=zn.get(k),m=C&&C.storybookImageUrl&&C.figmaImageUrl,F=C&&C.storybookImageUrl&&!C.figmaImageUrl,S=C&&!C.storybookImageUrl&&C.figmaImageUrl;if(m){y.debug("[useReviewScreenshots] Using fully cached screenshots for story:",k),I(C.storybookImageUrl),D(C.figmaImageUrl),u.current=k;return}let b=F&&T?.figmaNodeId;b&&(y.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",k),I(C.storybookImageUrl));let A=S;if(A&&(y.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",k),D(C.figmaImageUrl)),u.current===k&&T?.figmaNodeId){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{if(a(null),b?r(!0):(A||(t(!0),r(!0)),i(!0)),u.current=k,P)return;let L=A?C.figmaImageUrl:null,B;if(A)y.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),r(!1);else if(v){y.debug("[useReviewScreenshots] Found Figma node ID from mapping:",v);let h=null;try{y.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let j=await RR(g,v,p);h=j.imageUrl||null;let W=j.cached?"(cached)":"(fresh)";y.debug(`[useReviewScreenshots] Figma image fetched ${W}:`,h?"success":"not found")}catch(j){y.warn("[useReviewScreenshots] Failed to fetch Figma image:",j)}if(h)try{y.debug("[useReviewScreenshots] Fetching Figma image via proxy...");let j=`${Vw}/api/proxy/image?url=${encodeURIComponent(h)}`,W=await ne(j);if(W.ok){let M=await W.blob(),K=new FileReader,ee=await new Promise((xe,ae)=>{K.onloadend=()=>xe(K.result),K.onerror=ae,K.readAsDataURL(M)});L=ee,D(ee),y.debug("[useReviewScreenshots] Figma image loaded via proxy");let fe=new Image;await new Promise(xe=>{fe.onload=()=>{B={width:fe.naturalWidth,height:fe.naturalHeight},y.debug("[useReviewScreenshots] Figma dimensions:",B),xe()},fe.onerror=()=>xe(),fe.src=ee})}else L=h,D(h),y.warn("[useReviewScreenshots] Proxy failed, using direct URL as fallback")}catch(j){y.warn("[useReviewScreenshots] Proxy error, using direct URL as fallback:",j),L=h,D(h)}else y.warn("[useReviewScreenshots] No thumbnail found for node:",v),D(null);L&&v&&zR(k,v,L),r(!1)}else y.debug("[useReviewScreenshots] No Figma mapping exists for this component"),D(null),r(!1);let N=C?.storybookImageUrl||null;if(N)y.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{y.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",k);let h=await _l({storyId:k,sessionToken:p||void 0,...B&&{figmaWidth:B.width,figmaHeight:B.height}});h&&!P?(N=h,I(h),y.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",B||"natural")):y.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}zn.set(k,{storybookImageUrl:N,figmaImageUrl:L}),y.debug("[useReviewScreenshots] Screenshots cached for story:",k)}catch(L){y.error("[useReviewScreenshots] Error loading screenshots:",L),a(L instanceof Error?L.message:"Failed to load screenshots"),u.current=null,r(!1),i(!1)}finally{t(!1)}})(),()=>{P=!0}},[p,g,k,T?.figmaNodeId,c]),Zo(()=>{let P=Ug.getChannel(),z=null,x=w=>{Ww=w.args,y.debug("[useReviewScreenshots] Args updated for story:",w.storyId,"args:",w.args),z&&clearTimeout(z),z=setTimeout(()=>{y.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),d()},500)};return P.on(Uw,x),()=>{P.off(Uw,x),z&&clearTimeout(z)}},[d]),Zo(()=>{let P=Ug.getChannel(),z=!1,x=null,w=()=>{y.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),z=!0,i(!0)},v=()=>{z&&(y.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),x&&clearTimeout(x),x=setTimeout(()=>{z=!1,y.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),f()},500))};return P.on(Hw,w),P.on(jw,v),()=>{P.off(Hw,w),P.off(jw,v),x&&clearTimeout(x)}},[f]),Zo(()=>{let P=Ug.getChannel(),z=async x=>{if(!x?.snapshot?.html){y.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}y.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let w=ft.getState().currentStoryId,v=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...x.snapshot,storyId:w})});if(v.ok){let C=await v.json();if(C.screenshot){I(C.screenshot);let m=ft.getState().currentStoryId;if(m){let F=zn.get(m);F?F.storybookImageUrl=C.screenshot:zn.set(m,{storybookImageUrl:C.screenshot,figmaImageUrl:null})}}}else y.error("[useReviewScreenshots] Snapshot screenshot failed:",await v.text())}catch(w){y.error("[useReviewScreenshots] Snapshot screenshot error:",w)}finally{i(!1)}};return P.on("UICOPILOT/STORY_DOM_MUTATED",z),()=>{P.off("UICOPILOT/STORY_DOM_MUTATED",z)}},[]);let $=$g((P,z,x)=>{y.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),qw(P,z,x),D(x),r(!1),u.current=P},[D]);return{isLoadingScreenshots:e,isLoadingFigma:n,isLoadingStorybook:o,screenshotError:s,refreshScreenshots:d,refreshStorybookOnly:f,setFigmaImageDirect:$}}});function $R(){return!V().startsWith("http://localhost")}function UR(e,t,n){let r=t.createElement("div");r.style.color=e,t.body.appendChild(r);let o=n.getComputedStyle(r).color;return r.remove(),o}function Yw(e,t,n){let r=new Map;return e.replace(/(?:color|oklch|oklab|lab|lch)\([^)]+\)/g,o=>{if(r.has(o))return r.get(o);let i=UR(o,t,n);return r.set(o,i),i})}async function jR(){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 n=t.contentDocument.querySelector("#storybook-root > *")||t.contentDocument.querySelector("#root > *");if(!n)throw new Error("Story element not found in iframe");let r=t.contentWindow,o=t.contentDocument;return(await e(n,{useCORS:!0,logging:!1,backgroundColor:null,onclone:s=>{s.querySelectorAll("style").forEach(u=>{let c=u.textContent||"";/(?:color|oklch|oklab|lab|lch)\(/.test(c)&&(u.textContent=Yw(c,o,r))});let a=Array.from(o.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,l=a.find(d=>d.href===c);if(l)try{let d="";for(let f of Array.from(l.cssRules))d+=f.cssText+`
|
|
13
|
-
`;if(/(?:color|oklch|oklab|lab|lch)\(/.test(d)){let f=s.createElement("style");f.textContent=Yw(d,o,r),u.replaceWith(f)}}catch{}})}})).toDataURL("image/png")}function HR(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o;typeof r=="boolean"?o=`!${r}`:typeof r=="number"?o=String(r):typeof r=="string"?o=encodeURIComponent(r).replace(/%20/g,"+"):o=encodeURIComponent(JSON.stringify(r)),t.push(`${n}:${o}`)}return t.join(";")}async function WR(e,t){y.debug("[Screenshot] Using server-side Chrome capture for:",e);let n={"Content-Type":"application/json"};t?.sessionToken&&(n.Authorization=`Bearer ${t.sessionToken}`);let r=await ne(`${_R}/api/screenshot`,{method:"POST",headers:n,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(!r.ok){let i=await r.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Screenshot failed: ${r.status}`)}return(await r.json()).screenshot}function VR(e){let t={};if(!e)return t;let n=e.split(";");for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let i=r.slice(0,o),s=r.slice(o+1);typeof s=="string"&&(s==="!true"?s=!0:s==="!false"?s=!1:!isNaN(Number(s))&&s!==""?s=Number(s):s=decodeURIComponent(s.replace(/\+/g," "))),t[i]=s}return t}function GR(e){let t=new URLSearchParams(window.location.search),n=e;if(n||(n=(t.get("path")||"").replace("/story/","").replace("/docs/",""),y.debug("[Screenshot] Warning: Using story ID from URL (fallback):",n)),!n)throw new Error("Could not determine current story ID. Please select a story first.");let r=window.location.origin,o=Date.now(),i=`${r}/iframe.html?viewMode=story&id=${n}&globals=&_cb=${o}`,s=Bi();if(!s||Object.keys(s).length===0){let a=t.get("args");a&&(s=VR(a),y.debug("[Screenshot] Parsed args from URL:",s))}if(s&&Object.keys(s).length>0){let a=HR(s);i+=`&args=${a}`,y.debug("[Screenshot] Using URL with current args:",i)}else y.debug("[Screenshot] No current args, using default URL:",i);return i}async function qR(e){try{let t=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(t.status===501)return y.info("[Screenshot] Local Puppeteer not available, falling back"),null;if(!t.ok){let r=await t.json().catch(()=>({error:"Unknown"}));throw new Error(r.error||`Screenshot failed: ${t.status}`)}let n=await t.json();return y.info("[Screenshot] Captured via local Puppeteer (pixel-perfect)"),n.screenshot}catch(t){if(t instanceof TypeError&&t.message.includes("fetch"))return null;throw t}}async function _l(e){let t=e?.storyId||YR();if(t){let n=Vg.get(t);if(n)return y.debug("[Screenshot] Reusing in-flight capture for",t),n;let r=Kw(t,e).finally(()=>{Vg.delete(t)});return Vg.set(t,r),r}return Kw(void 0,e)}async function Kw(e,t){try{if(e){let n=await qR(e);if(n)return n}if(!$R()){let n=GR(t?.storyId);return await WR(n,{...t,selector:"#storybook-root > *"})}return y.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await jR()}catch(n){throw y.error("Error capturing screenshot:",n),new Error(`Failed to capture screenshot: ${n instanceof Error?n.message:"Unknown error"}`)}}function YR(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var _R,Vg,Wg=_(()=>{"use strict";je();Di();Oe();ct();_R=V();Vg=new Map});function Tn(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[,n,r,o,i]=t,s=i?parseFloat(i):1;return s<1?`rgba(${n}, ${r}, ${o}, ${s})`:`#${[n,r,o].map(u=>parseInt(u).toString(16).padStart(2,"0")).join("")}`}function Nn(e,t){let r={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 r?r.includes(t):!1}function Ws(e){return e.split(",").map(n=>n.trim().replace(/['"]/g,""))[0]||e}function Xw(e){let t=e.ownerDocument,r=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let T=r.fontSize||"16px",E=r.fontWeight||"400";if(r.fontFamily.includes("Roboto")){let I=t.fonts.check(`${E} ${T} Roboto`);if(y.debug("[computedStyles] Roboto check:",{cssFamily:r.fontFamily,robotoLoaded:I,fontWeight:E,fontSize:T,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(D=>({family:D.family,status:D.status}))}),I)return"Roboto"}}let o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",s=t.createElement("canvas").getContext("2d");if(!s)return"unknown";let a=r.fontSize,u=r.fontWeight,c=r.fontStyle,l=r.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([...l,...d])];s.font=`${c} ${u} ${a} monospace`;let p=s.measureText(o).width,g="unknown",k=new Map;for(let T of f){s.font=`${c} ${u} ${a} "${T}", monospace`;let E=s.measureText(o).width;if(k.set(T,E),E!==p){s.font=`${c} ${u} ${a} "${T}"`;let I=s.measureText(o).width;s.font=`${c} ${u} ${a} ${r.fontFamily}`;let D=s.measureText(o).width;if(Math.abs(I-D)<.1){g=T;break}}}return y.debug("[computedStyles] Font detection:",{declared:r.fontFamily,detected:g,declaredFonts:l,fontWidths:Array.from(k.entries()),isIframe:t!==document}),g}var Vs=_(()=>{"use strict";Oe()});function Ri(e,t){if(!t)return e;let n=t.split(" ").filter(i=>i.trim()),r=n.find(i=>!i.includes("--")),o=n.filter(i=>i.includes("--"));return r&&o.length>0?`${e}.${r}.${o[0]}`:r?`${e}.${r}`:n[0]?`${e}.${n[0]}`:e}function Gg(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e);return y.debug("[computedStyles] Extracting styles:",{fontFamily:n.fontFamily,fontWeight:n.fontWeight,borderRadius:n.borderRadius,backgroundColor:n.backgroundColor,padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},isIframeContext:e.ownerDocument!==document}),{color:Tn(n.color),backgroundColor:Tn(n.backgroundColor),borderColor:Tn(n.borderColor),padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},margin:{top:n.marginTop,right:n.marginRight,bottom:n.marginBottom,left:n.marginLeft},gap:n.gap,fontFamily:n.fontFamily,renderedFont:Xw(e),fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,textAlign:n.textAlign,textTransform:n.textTransform,width:n.width,height:n.height,minWidth:n.minWidth,minHeight:n.minHeight,maxWidth:n.maxWidth,maxHeight:n.maxHeight,borderWidth:n.borderWidth,borderStyle:n.borderStyle,borderRadius:n.borderRadius,boxShadow:n.boxShadow,textShadow:n.textShadow,display:n.display,flexDirection:n.display==="flex"?n.flexDirection:void 0,justifyContent:n.display==="flex"?n.justifyContent:void 0,alignItems:n.display==="flex"?n.alignItems:void 0,position:n.position,opacity:n.opacity,cursor:n.cursor}}function qg(e,t){let n={width:null,height:null,minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,display:null,flexGrow:null,flexShrink:null,flexBasis:null};try{let r=Array.from(t.styleSheets);for(let i of r)try{let s=i.cssRules||i.rules;if(!s)continue;for(let a of Array.from(s))if(a.type===1){let u=a;try{if(e.matches(u.selectorText)){let c=u.style;c.width&&(n.width=c.width),c.height&&(n.height=c.height),c.minWidth&&(n.minWidth=c.minWidth),c.minHeight&&(n.minHeight=c.minHeight),c.maxWidth&&(n.maxWidth=c.maxWidth),c.maxHeight&&(n.maxHeight=c.maxHeight),c.display&&(n.display=c.display),c.flexGrow&&(n.flexGrow=c.flexGrow),c.flexShrink&&(n.flexShrink=c.flexShrink),c.flexBasis&&(n.flexBasis=c.flexBasis)}}catch{continue}}}catch{continue}let o=e.style;o.width&&(n.width=o.width),o.height&&(n.height=o.height),o.minWidth&&(n.minWidth=o.minWidth),o.minHeight&&(n.minHeight=o.minHeight),o.maxWidth&&(n.maxWidth=o.maxWidth),o.maxHeight&&(n.maxHeight=o.maxHeight),o.display&&(n.display=o.display),o.flexGrow&&(n.flexGrow=o.flexGrow),o.flexShrink&&(n.flexShrink=o.flexShrink),o.flexBasis&&(n.flexBasis=o.flexBasis)}catch(r){y.error("Error extracting declared styles:",r)}return n}var $l=_(()=>{"use strict";Oe();Vs()});function KR(e){let t=[],n=new Set,r=Qw.join(", "),o=e.querySelectorAll(r);for(let i of Array.from(o)){let s=`${i.tagName.toLowerCase()}.${i.className}`;n.has(s)||(n.add(s),t.push(i))}if(Qw.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;n.has(i)||t.unshift(e)}return t}function XR(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"";return{selector:Ri(r,i),tagName:r,className:i,styles:{fontSize:n.fontSize,fontFamily:Ws(n.fontFamily),fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:Tn(n.color),textAlign:n.textAlign,textTransform:n.textTransform}}}function QR(e,t=2){let n=[e],r=new Set,o=s=>{let a=s.className;return typeof a=="string"?a:a?.baseVal||""};r.add(`${e.tagName}.${o(e)}`);function i(s,a){if(a>=t)return;let u=Array.from(s.children);for(let c of u){let l=c.tagName.toLowerCase();if(["script","style","link","meta","br","hr"].includes(l))continue;let d=`${c.tagName}.${o(c)}`;r.has(d)||(r.add(d),n.push(c),i(c,a+1))}}return i(e,0),n}function JR(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"",s=n.borderWidth!=="0px",a=n.backgroundColor!=="transparent"&&n.backgroundColor!=="rgba(0, 0, 0, 0)",u=n.borderRadius!=="0px",c=n.gap!=="normal"&&n.gap!=="0px";if(!s&&!a&&!u&&!c)return null;let l=n.borderWidth,d=n.borderStyle,f=Tn(n.borderColor),p=s?`${l} ${d} ${f}`:"none";return{selector:Ri(r,i),className:i,border:p,borderRadius:n.borderRadius,backgroundColor:Tn(n.backgroundColor),gap:n.gap}}function Gs(){y.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,n=t.getElementById("storybook-root");if(!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(!r)throw new Error("Component element not found in story root");let o=QR(r,2),i=o.map(JR).filter(a=>a!==null);y.debug("[computedStyles] Extracted visual styles from nested elements:",{total:o.length,withVisuals:i.length,elements:i.map(a=>({selector:a.selector,border:a.border,background:a.backgroundColor,borderRadius:a.borderRadius}))});let s=[];try{let a=KR(r);s=a.map(XR),y.debug("[computedStyles] Text elements found:",{count:a.length,elements:s.map(u=>({selector:u.selector,fontSize:u.styles.fontSize,fontWeight:u.styles.fontWeight}))})}catch(a){y.error("[computedStyles] Error extracting text elements:",a)}return{computed:Gg(r),declared:qg(r,t),markup:r.outerHTML,textElementStyles:s,nestedElementStyles:i}}catch(e){return y.error("Error extracting computed styles:",e),null}}var Qw,Jw=_(()=>{"use strict";Oe();Vs();$l();Qw=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function Yg(e,t,n,r){return e===t&&t===n&&n===r?e:e===n&&t===r?`${e} ${t}`:t===r?`${e} ${t} ${n}`:`${e} ${t} ${n} ${r}`}function ez(e,t,n){if(!(e==="0px"||t==="none"))return`${e} ${t} ${n}`}function tz(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r={},o=Tn(n.backgroundColor);Nn("backgroundColor",o)||(r.backgroundColor=o);let i=ez(n.borderWidth,n.borderStyle,Tn(n.borderColor));i&&(r.border=i),Nn("borderRadius",n.borderRadius)||(r.borderRadius=n.borderRadius),Nn("boxShadow",n.boxShadow)||(r.boxShadow=n.boxShadow),Nn("opacity",n.opacity)||(r.opacity=n.opacity);let s=e.tagName.toLowerCase(),a=["svg","circle","rect","ellipse","line","polyline","polygon","path","text","tspan","g","use","defs","clipPath","mask"];if(e instanceof SVGElement||a.includes(s)){for(let T=0;T<e.attributes.length;T++){let E=e.attributes[T];if(["class","style","id","xmlns","xmlns:xlink"].includes(E.name))continue;let I=E.name.replace(/-([a-z])/g,(R,$)=>$.toUpperCase()),D=E.value.startsWith("rgb")?Tn(E.value):E.value;I==="d"&&D.length>100?r[I]=D.substring(0,100)+"...":r[I]=D}let p=n.getPropertyValue("fill"),g=n.getPropertyValue("stroke");if(p&&p!=="none"&&(r.fill=p.startsWith("rgb")?Tn(p):p),g&&g!=="none"&&(r.stroke=g.startsWith("rgb")?Tn(g):g),["circle","ellipse","rect","path","line","polyline","polygon"].includes(s)){let T=e.getBoundingClientRect();T.width>0&&(r.width=`${Math.round(T.width*100)/100}px`),T.height>0&&(r.height=`${Math.round(T.height*100)/100}px`)}}let c=e.textContent&&e.textContent.trim().length>0,l=ZR.includes(e.tagName.toLowerCase());(c||l)&&(r.fontSize=n.fontSize,r.fontFamily=Ws(n.fontFamily),r.fontWeight=n.fontWeight,r.lineHeight=n.lineHeight,r.color=Tn(n.color),Nn("letterSpacing",n.letterSpacing)||(r.letterSpacing=n.letterSpacing),Nn("textAlign",n.textAlign)||(r.textAlign=n.textAlign)),r.display=n.display;let d=Yg(n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft);Nn("padding",d)||(r.padding=d);let f=Yg(n.marginTop,n.marginRight,n.marginBottom,n.marginLeft);return Nn("margin",f)||(r.margin=f),Nn("gap",n.gap)||(r.gap=n.gap),(n.display==="flex"||n.display==="inline-flex")&&(Nn("flexDirection",n.flexDirection)||(r.flexDirection=n.flexDirection),Nn("justifyContent",n.justifyContent)||(r.justifyContent=n.justifyContent),Nn("alignItems",n.alignItems)||(r.alignItems=n.alignItems)),r.width||(r.width=n.width),r.height||(r.height=n.height),r}function Zw(e){let t=1;for(let n of e.children)t+=Zw(n);return t}function ev(e,t=4){function n(o,i){let s=o.tagName.toLowerCase(),a=o.className,u=typeof a=="string"?a:a?.baseVal||"",c=o.id||void 0,l=o.getAttribute("role")||void 0,d;for(let k of Array.from(o.childNodes))if(k.nodeType===Node.TEXT_NODE){let T=k.textContent?.trim();if(T){d=T.length>50?T.substring(0,50)+"...":T;break}}let f=s;c?f=`${s}#${c}`:u&&(f=Ri(s,u));let p=tz(o),g=[];if(i<t){let k=Array.from(o.children);for(let T of k){let E=T.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(E))continue;let D=(T.ownerDocument.defaultView||window).getComputedStyle(T);D.display==="none"||D.visibility==="hidden"||g.push(n(T,i+1))}}return{selector:f,tagName:s,className:u,id:c,role:l,textContent:d,styles:p,children:g}}y.debug("[computedStyles] Extracting DOM tree with maxDepth:",t);let r=n(e,0);return y.debug("[computedStyles] DOM tree extracted:",{rootSelector:r.selector,childrenCount:r.children.length,totalNodes:Zw(r)}),r}function Kg(e=4){y.debug("[extractStoryDOMTree] Starting DOM tree extraction...");try{let t=document.getElementById("storybook-preview-iframe");if(y.debug("[extractStoryDOMTree] iframe found:",!!t),!t)throw new Error("Storybook preview iframe not found");if(y.debug("[extractStoryDOMTree] iframe.contentDocument:",!!t.contentDocument),!t.contentDocument)throw new Error("iframe.contentDocument is not accessible (possible cross-origin issue)");let n=t.contentDocument.getElementById("storybook-root");if(y.debug("[extractStoryDOMTree] storyRoot found:",!!n),!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(y.debug("[extractStoryDOMTree] componentElement found:",!!r,r?.tagName),!r)throw new Error("Component element not found in story root");let o=ev(r,e);return y.debug("[extractStoryDOMTree] DOM tree extracted successfully:",{selector:o.selector,childrenCount:o.children.length}),o}catch(t){return y.error("[extractStoryDOMTree] Error extracting DOM tree:",t),null}}var ZR,tv=_(()=>{"use strict";Oe();Vs();$l();ZR=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var Xg=_(()=>{"use strict";Vs();$l();Jw();tv()});var Fv=rr((iQ,Iv)=>{"use strict";Iv.exports={compareTwoStrings:Tv,findBestMatch:Iz};function Tv(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 n=new Map;for(let o=0;o<e.length-1;o++){let i=e.substring(o,o+2),s=n.has(i)?n.get(i)+1:1;n.set(i,s)}let r=0;for(let o=0;o<t.length-1;o++){let i=t.substring(o,o+2),s=n.has(i)?n.get(i):0;s>0&&(n.set(i,s-1),r++)}return 2*r/(e.length+t.length-2)}function Iz(e,t){if(!Fz(e,t))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");let n=[],r=0;for(let i=0;i<t.length;i++){let s=t[i],a=Tv(e,s);n.push({target:s,rating:a}),a>n[r].rating&&(r=i)}let o=n[r];return{ratings:n,bestMatch:o,bestMatchIndex:r}}function Fz(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(n){return typeof n!="string"}))}});var S1=rr((bse,b1)=>{"use strict";var m1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,C3=/\n/g,T3=/^\s*/,I3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,F3=/^:\s*/,E3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,A3=/^[;\s]*/,P3=/^\s+|\s+$/g,L3=`
|
|
14
|
-
`,h1="/",x1="*",ai="",M3="comment",B3="declaration";function D3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(g){var k=g.match(C3);k&&(n+=k.length);var T=g.lastIndexOf(L3);r=~T?g.length-T:r+g.length}function i(){var g={line:n,column:r};return function(k){return k.position=new s(g),c(),k}}function s(g){this.start=g,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function u(g){var k=g.exec(e);if(k){var T=k[0];return o(T),e=e.slice(T.length),k}}function c(){u(T3)}function l(g){var k;for(g=g||[];k=d();)k!==!1&&g.push(k);return g}function d(){var g=i();if(!(h1!=e.charAt(0)||x1!=e.charAt(1))){for(var k=2;ai!=e.charAt(k)&&(x1!=e.charAt(k)||h1!=e.charAt(k+1));)++k;if(k+=2,ai===e.charAt(k-1))return a("End of comment missing");var T=e.slice(2,k-2);return r+=2,o(T),e=e.slice(k),r+=2,g({type:M3,comment:T})}}function f(){var g=i(),k=u(I3);if(k){if(d(),!u(F3))return a("property missing ':'");var T=u(E3),E=g({type:B3,property:y1(k[0].replace(m1,ai)),value:T?y1(T[0].replace(m1,ai)):ai});return u(A3),E}}function p(){var g=[];l(g);for(var k;k=f();)k!==!1&&(g.push(k),l(g));return g}return c(),p()}function y1(e){return e?e.replace(P3,ai):ai}b1.exports=D3});var w1=rr(ga=>{"use strict";var R3=ga&&ga.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ga,"__esModule",{value:!0});ga.default=N3;var z3=R3(S1());function N3(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,z3.default)(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;let{property:s,value:a}=i;o?t(s,a,i):a&&(n=n||{},n[s]=a)}),n}});var k1=rr(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.camelCase=void 0;var O3=/^--[a-zA-Z0-9_-]+$/,_3=/-([a-z])/g,$3=/^[^-]+$/,U3=/^-(webkit|moz|ms|o|khtml)-/,j3=/^-(ms)-/,H3=function(e){return!e||$3.test(e)||O3.test(e)},W3=function(e,t){return t.toUpperCase()},v1=function(e,t){return"".concat(t,"-")},V3=function(e,t){return t===void 0&&(t={}),H3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(j3,v1):e=e.replace(U3,v1),e.replace(_3,W3))};kc.camelCase=V3});var T1=rr((Ph,C1)=>{"use strict";var G3=Ph&&Ph.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},q3=G3(w1()),Y3=k1();function Ah(e,t){var n={};return!e||typeof e!="string"||(0,q3.default)(e,function(r,o){r&&o&&(n[(0,Y3.camelCase)(r,t)]=o)}),n}Ah.default=Ah;C1.exports=Ah});var JT=rr((Ype,QT)=>{"use strict";var Gc=Object.prototype.hasOwnProperty,XT=Object.prototype.toString,WT=Object.defineProperty,VT=Object.getOwnPropertyDescriptor,GT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):XT.call(t)==="[object Array]"},qT=function(t){if(!t||XT.call(t)!=="[object Object]")return!1;var n=Gc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gc.call(t,o)},YT=function(t,n){WT&&n.name==="__proto__"?WT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},KT=function(t,n){if(n==="__proto__")if(Gc.call(t,n)){if(VT)return VT(t,n).value}else return;return t[n]};QT.exports=function e(){var t,n,r,o,i,s,a=arguments[0],u=1,c=arguments.length,l=!1;for(typeof a=="boolean"&&(l=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=KT(a,n),o=KT(t,n),a!==o&&(l&&o&&(qT(o)||(i=GT(o)))?(i?(i=!1,s=r&>(r)?r:[]):s=r&&qT(r)?r:{},YT(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&YT(a,{name:n,newValue:o}));return a}});import Na from"react";import{addons as lu,types as ty,experimental_getStatusStore as OF}from"storybook/manager-api";import{AddonPanel as gV}from"storybook/internal/components";import Dt,{useState as BW,useEffect as DW}from"react";import{styled as xr}from"storybook/theming";import uy from"react";import{styled as Mt}from"storybook/theming";var se="#ea580c",pu="#c2410c",Ua="#ff6b35";var oy=Mt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),iy=Mt.div({flex:1,overflow:"auto",padding:"6px 20px 20px"}),ho=Mt.div({marginBottom:"20px"}),xo=Mt.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})),us=Mt.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,backgroundColor:e.input.background,color:e.color.defaultText,"&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`}})),hn=Mt.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,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"}})),sy=Mt(hn)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),ja=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,cursor:"pointer",transition:"all 0.15s","&:disabled":{opacity:.5,cursor:"not-allowed"}}),kn=Mt.button(({theme:e})=>({...ja(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Yt=Mt.button(({theme:e})=>({...ja(e),backgroundColor:se,color:e.color.inverseText,boxShadow:`0 2px 4px ${se}4d`,"&:hover:not(:disabled)":{backgroundColor:pu,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${se}66`}})),Rr=Mt.button(({theme:e})=>({...ja(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),ay=Mt.button(({theme:e})=>({...ja(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Cn=Mt.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"}})),du=Mt.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"}})),yo=Mt.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}})),bo=Mt(us)(({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"})),vV=Mt.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),ly=Mt.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})),kV=Mt.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})),ps=Mt.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})),CV=Mt.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,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%)"}}})),cy=Mt.span(({theme:e,variant:t="default"})=>{let n={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:n[t].bg,color:n[t].color}}),TV=Mt.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),IV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),FV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var fu=({header:e,children:t,footer:n})=>uy.createElement(oy,null,e,uy.createElement(iy,null,t),n);import qF from"react";import{styled as YF}from"storybook/theming";var KF=YF.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})),gu=({toolbar:e})=>qF.createElement(KF,null,e);import NV from"react";import{styled as Ha}from"storybook/theming";var $V=Ha.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})),UV=Ha.div({display:"flex",flex:1}),jV=Ha(yo)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),HV=Ha.div({display:"flex",gap:"8px",alignItems:"center"});import Zt,{useState as Og,useCallback as zw,useEffect as Nw}from"react";import{styled as eo}from"storybook/theming";import ve,{useEffect as Tw}from"react";import{styled as lt}from"storybook/theming";Ce();je();Oe();ct();var Iw=lt.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),Fw=lt.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})),DD=lt.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),RD=lt.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),zD=lt.div({display:"flex",flexDirection:"column",gap:"4px"}),ND=lt.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),OD=lt.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"}),_D=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),$D=lt.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),UD=lt.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),jD=lt.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"})),HD=lt.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${se} 100%)`,transition:"width 0.3s ease"})),WD=lt.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),VD=lt.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),GD=lt.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:se,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),Ew=lt.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}})),qD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),YD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),KD=lt.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),XD=lt.div({display:"flex",gap:"8px"}),Aw=lt(Cn)({fontSize:"18px"}),QD=lt.div({padding:"20px 16px"}),JD=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),ZD=lt.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),eR=lt.div({fontSize:"28px",fontWeight:700}),tR=lt.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),nR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),rR=lt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),oR=lt.div({display:"flex",alignItems:"center",gap:"8px"}),iR=lt.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),sR=lt.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:se,color:e.color.inverseText})),aR=lt.button(({theme:e})=>({background:"none",border:"none",color:se,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),lR=lt.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),cR=lt.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"?se:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),uR=30*1e3,Pw=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=we(),{featureFlags:s}=ce(),a=s.showCosts,u=r,c=!r&&t,l=async(g=!1)=>{if(!t)return;let k=o&&Date.now()-o<uR;if(!(!g&&k&&r))try{let T=V(),E=await ne(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){let I=await E.json();i(I)}}catch(T){y.error("Failed to fetch usage:",T)}};Tw(()=>{l()},[t]),Tw(()=>{let g=()=>{document.visibilityState==="visible"&&(y.debug("[TokenUsageModal] Tab visible, refreshing balance..."),l(!0))};return document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[t]);let d=()=>{if(t){let g=V();fetch(`${g}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}n(),e()},f=()=>{let g=V();window.open(`${g}/pricing`,"_blank")},p=()=>{let g=V();window.open(`${g}/pricing#add-credits`,"_blank")};if(t&&!a&&!c){let g=Math.floor(u?.creditBalance??0),T=Math.max(g,10),E=Math.max(0,T-g),I=T>0?g/T*100:0;return ve.createElement(ve.Fragment,null,ve.createElement(Iw,{onClick:e}),ve.createElement(Fw,{onClick:D=>D.stopPropagation(),style:{width:"320px"}},ve.createElement(DD,null,ve.createElement(RD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement(zD,null,ve.createElement(ND,null,"UI Review"),ve.createElement(OD,null,(u?.plan||"BETA").toUpperCase())),ve.createElement("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"2px"}},ve.createElement(Ew,{onClick:d,title:"Sign out",style:{position:"static"}},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Ew,{onClick:e,title:"Close",style:{position:"static"}},"\xD7"))),ve.createElement(_D,null,ve.createElement($D,null,"Credits"),ve.createElement(UD,null,g," left")),ve.createElement(jD,null,ve.createElement(HD,{percent:I})),ve.createElement(WD,null,E," used \xB7 ",g," remaining"),ve.createElement(VD,null),ve.createElement(GD,{onClick:()=>window.open("mailto:hello@uiparity.com?subject=Credits request","_blank")},"Contact us for credits \u2192")))}return ve.createElement(ve.Fragment,null,ve.createElement(Iw,{onClick:e}),ve.createElement(Fw,{onClick:g=>g.stopPropagation()},ve.createElement(qD,null,ve.createElement(YD,null,ve.createElement(KD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement("span",null,u?.email||"Loading...")),ve.createElement(XD,null,ve.createElement(Aw,{onClick:d,title:"Sign out"},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Aw,{onClick:e,title:"Close"},"\xD7"))),ve.createElement(QD,null,c?ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?ve.createElement(ve.Fragment,null,ve.createElement(JD,null,ve.createElement(ZD,null,"Credit Balance"),ve.createElement(eR,null,"$",(u?.creditBalance??0).toFixed(2)),ve.createElement(tR,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ve.createElement(nR,null,ve.createElement(rR,null,ve.createElement(oR,null,ve.createElement(iR,null,"Current Plan"),ve.createElement(sR,null,u?.plan||"Free")),ve.createElement(aR,{onClick:f},"View detail >")),ve.createElement(lR,null,"~$0.02-0.05 per review depending on complexity"),ve.createElement(cR,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};Ce();import Pi from"react";import{styled as Lw}from"storybook/theming";je();Ce();ct();Oe();var pR=Lw.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),dR=Lw.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),fR={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}},Mw=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=ce(),{sessionToken:o}=we();return e!=="admin"?null:Pi.createElement(pR,null,Pi.createElement(dR,null,"View as:"),Pi.createElement(sy,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&ne(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(c=>c.json()).then(c=>{let l={enableFixGeneration:!!c.enableFixGeneration,enableFixApply:!!c.enableFixApply,enableAutoMap:!!c.enableAutoMap,enableReviewBadges:!!c.enableReviewBadges,showCosts:!!c.showCosts,enableParallelReview:!!c.enableParallelReview,enableModelSelection:!!c.enableModelSelection};r(l);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(l))}catch{}}).catch(c=>y.warn("[RoleSwitcher] Failed to re-fetch flags:",c.message));else{n(u);let c=fR[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},Pi.createElement("option",{value:"admin"},"Admin"),Pi.createElement("option",{value:"beta"},"Beta Tester")),t&&Pi.createElement(cy,{variant:"warning"},"Previewing as ",t))};je();Ce();ct();import ht,{useState as $s,useCallback as Ng}from"react";import{styled as Cr}from"storybook/theming";var gR="0.5.7",mR=[{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"}],hR=Cr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"}),xR=Cr.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)"})),yR=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",borderBottom:`1px solid ${e.appBorderColor}`})),bR=Cr.h3(({theme:e})=>({margin:0,fontSize:"15px",fontWeight:600,color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),SR=Cr.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}})),wR=Cr.div({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"14px"}),vR=Cr.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:se}})),Bw=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px 16px",borderTop:`1px solid ${e.appBorderColor}`,gap:"8px"})),Dw=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4})),kR=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.negative})),CR=Cr.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 Rw({isOpen:e,onClose:t}){let{sessionToken:n,isConnected:r}=we(),{selectedProjectId:o}=Je(),{currentStoryId:i}=nt(),[s,a]=$s("other"),[u,c]=$s(""),[l,d]=$s(!1),[f,p]=$s(!1),[g,k]=$s(null),T=Ng(()=>{c(""),a("other"),p(!1),k(null),d(!1)},[]),E=Ng(()=>{T(),t()},[T,t]),I=Ng(async D=>{if(D.preventDefault(),!u.trim()){k("Please write a message.");return}if(!r||!n){k("Sign in to send feedback.");return}d(!0),k(null);try{let R=await ne(`${V()}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({message:u.trim(),severity:s,projectId:o||void 0,storyId:i||void 0,addonVersion:gR})});if(!R.ok){let $=await R.json().catch(()=>({}));throw new Error($.error||`Request failed (${R.status})`)}p(!0)}catch(R){k(R instanceof Error?R.message:"Something went wrong")}finally{d(!1)}},[u,s,n,r,o,i]);return e?ht.createElement(hR,{onClick:E},ht.createElement(xR,{onClick:D=>D.stopPropagation()},ht.createElement(yR,null,ht.createElement(bR,null,ht.createElement("span",null,"\u{1F4AC}"),"Send feedback"),ht.createElement(SR,{onClick:E,"aria-label":"Close"},"\xD7")),f?ht.createElement(ht.Fragment,null,ht.createElement(CR,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(Bw,null,ht.createElement("span",null),ht.createElement(kn,{onClick:E},"Close"))):ht.createElement("form",{onSubmit:I},ht.createElement(wR,null,ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-severity"},"Type"),ht.createElement(hn,{id:"feedback-severity",value:s,onChange:D=>a(D.target.value),disabled:l},mR.map(D=>ht.createElement("option",{key:D.value,value:D.value},D.label)))),ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-message"},"What happened?"),ht.createElement(vR,{id:"feedback-message",value:u,onChange:D=>c(D.target.value),placeholder:"Tell us what you were doing, what you expected, and what happened.",disabled:l,autoFocus:!0,maxLength:5e3})),ht.createElement(Dw,null,"We auto-attach your current story and project so we can reproduce it. No screenshots sent."),g&&ht.createElement(kR,null,g)),ht.createElement(Bw,null,ht.createElement(Dw,null,i?`Context: ${i}`:"No story selected"),ht.createElement("div",{style:{display:"flex",gap:"8px"}},ht.createElement(kn,{type:"button",onClick:E,disabled:l},"Cancel"),ht.createElement(Yt,{type:"submit",disabled:l||!u.trim()},l?"Sending\u2026":"Send")))))):null}Ce();je();ct();var TR=eo.div({display:"flex",alignItems:"center"}),Li=eo.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),IR=eo.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),FR=eo.div({position:"relative"}),ER=eo.button(({theme:e})=>({width:"26px",height:"26px",padding:0,background:`linear-gradient(135deg, ${e.color.secondary} 0%, ${e.color.secondary}cc 100%)`,border:"none",borderRadius:"50%",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{transform:"scale(1.05)",boxShadow:`0 2px 8px ${e.color.secondary}66`}})),Ow=eo.button(({isLow:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:e?"#FEF3C7":"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",border:"none",borderRadius:"12px",color:e?"#92400E":"#fff",cursor:"pointer",fontSize:"12px",fontWeight:600,transition:"all 0.2s",minWidth:"60px",justifyContent:"center","&:hover":{transform:"scale(1.02)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})),AR=eo.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)"}}}),PR=eo.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 10px",height:"28px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.mediumdark}})),LR=eo.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:se,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${se}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 ${se}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),MR=30*1e3,_g=({onOpenSettings:e})=>{let[t,n]=Og(!1),[r,o]=Og(!1),[i,s]=Og(!1),{usageData:a,usageLastFetched:u,setUsageData:c,sessionToken:l}=we(),{userRole:d,roleOverride:f,featureFlags:p}=ce(),g=f??d;Nw(()=>{(async()=>{if(!(!l||u&&Date.now()-u<MR&&a)){s(!0);try{let $=V(),P=await ne(`${$}/api/addon/account`,{headers:{Authorization:`Bearer ${l}`}});if(P.ok){let z=await P.json();c(z)}}catch($){console.error("Failed to fetch balance:",$)}finally{s(!1)}}})()},[l,u,a,c]),Nw(()=>{let D=()=>{document.visibilityState==="visible"&&t&&n(!1)},R=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",R),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",R)}},[t]);let k=zw(()=>{n(!0)},[]),T=zw(()=>{n(!1)},[]),E=a?.creditBalance??0,I=E<2&&!i;return Zt.createElement(TR,null,e&&Zt.createElement(Li,null,Zt.createElement(PR,{onClick:e,title:"Settings"},Zt.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),l&&d==="admin"&&g==="admin"&&Zt.createElement(Li,null,Zt.createElement(Mw,null)),Zt.createElement(Li,null,Zt.createElement(IR,null,"v","0.5.15")),l&&p.showCosts&&Zt.createElement(Li,null,Zt.createElement(Ow,{onClick:k,isLow:I,title:i?"Loading...":a?I?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},i?Zt.createElement(AR,null):a?`$${E.toFixed(2)}`:"...")),l&&!p.showCosts&&a&&Zt.createElement(Li,null,Zt.createElement(Ow,{onClick:k,isLow:Math.floor(E)<=3,title:`${Math.floor(E)} review credits \u2014 click for details`},"\u26A1 ",Math.floor(E))),Zt.createElement(Li,null,Zt.createElement(FR,null,Zt.createElement(ER,{title:"Account & Usage",onClick:k},a?.email?a.email[0].toUpperCase():"?"),t&&Zt.createElement(Pw,{onClose:T}))),l&&Zt.createElement(LR,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),Zt.createElement(Rw,{isOpen:r,onClose:()=>o(!1)}))};import Lt,{useEffect as x4,useRef as y4}from"react";import{styled as fr}from"storybook/theming";import rt from"react";Ce();Oe();je();ct();Rn();import{useState as BR,useCallback as Mi,useRef as _w,useEffect as DR}from"react";var to=V();y.debug("[useAuth] Module loaded, APP_URL:",to);var Us=()=>{let e=_w(null),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setSessionToken:c,setApiKey:l,setAuthMethod:d,setDeviceCode:f,setUserCode:p,setVerificationUri:g,setPollingInterval:k,setAuthError:T,resetAuth:E}=we(),I=_w(null),[D,R]=BR(!1),$=Mi(async()=>{try{y.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let C;try{C=await ne(`${to}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(A){let B=A instanceof Error&&A.message.includes("timed out")?`Cannot reach ${Ft.NAME} server at ${to}. Is the dashboard running?`:`Connection failed: ${to} is not responding.`;T(B),y.error("[useAuth]",B);return}if(!C.ok){let A=`Cannot reach ${Ft.NAME} server. Is the dashboard running?`;T(A),y.error("[useAuth]",A);return}let{poll_code:m}=await C.json();y.debug("[useAuth] Got poll_code:",m.substring(0,15)+"...");let F=localStorage.getItem("uicopilot_force_sign_in")==="true";F&&localStorage.removeItem("uicopilot_force_sign_in");let S=`${to}/addon/auth?poll_code=${m}${F?"&force_sign_in=true":""}`;R(!0),window.open(S,"uiparity-auth","width=520,height=620,left=300,top=150"),y.debug("[useAuth] Starting OAuth poll for token..."),I.current&&clearInterval(I.current);let b=async()=>{try{let L=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:m})})).json();L.status==="authorized"&&L.session_token?(y.debug("[useAuth] \u2705 OAuth poll successful! Got token."),I.current&&(clearInterval(I.current),I.current=null),localStorage.setItem("uicopilot_session_token",L.session_token),c(L.session_token),R(!1)):L.status==="expired"&&(y.debug("[useAuth] OAuth poll_code expired"),I.current&&(clearInterval(I.current),I.current=null),R(!1))}catch(A){y.error("[useAuth] OAuth poll error:",A)}};I.current=setInterval(b,2e3),setTimeout(b,1e3)}catch(C){y.error("[useAuth] OAuth flow error:",C),T(`Connection failed. Is the dashboard running at ${to}?`),R(!1)}},[c,T]),P=Mi(async()=>{try{let C=await fetch(`${to}/api/addon/auth/device`,{method:"POST"});if(!C.ok)throw new Error("Failed to start device code flow");let m=await C.json();f(m.device_code),p(m.user_code),g(m.verification_uri),window.open(m.verification_uri,"_blank"),z(m.device_code,m.interval*1e3)}catch(C){throw y.error("[useAuth] Device code flow error:",C),C}},[f,p,g]),z=Mi((C,m)=>{y.debug("[useAuth] Starting polling. Device code:",C,"Interval:",m),e.current&&clearInterval(e.current);let F=async()=>{try{let b=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:C})})).json();b.status==="authorized"?(y.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),f(null),p(null),g(null),localStorage.setItem("uicopilot_session_token",b.session_token),c(b.session_token),setOauthUrl(null)):(b.status==="expired"||b.status==="denied")&&(y.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),f(null),p(null),g(null))}catch(S){y.error("[useAuth] Polling error:",S)}};e.current=setInterval(F,m),k(m)},[f,p,g,c,k]),x=Mi(()=>{e.current&&(clearInterval(e.current),e.current=null),f(null),p(null),g(null),k(null)},[f,p,g,k]),w=Mi(C=>{l(C),c(C),localStorage.setItem("uicopilot_api_key",C)},[l,c]),v=Mi(()=>{E(),setOauthUrl(null),e.current&&(clearInterval(e.current),e.current=null),I.current&&(clearInterval(I.current),I.current=null)},[E]);return DR(()=>()=>{e.current&&clearInterval(e.current),I.current&&clearInterval(I.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,oauthPending:D,setAuthMethod:d,startOAuth:$,startDeviceCode:P,cancelDeviceCode:x,saveApiKey:w,logout:v}};Ce();Oe();je();ct();import{useCallback as zl}from"react";var js=V(),no=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Je(),{sessionToken:a}=we(),u=zl(async()=>{if(!a){y.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),y.debug("[useProjects] Fetching from:",`${js}/api/projects`);let f=await ne(`${js}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}});if(f.ok){let p=await f.json();y.debug("[useProjects] Projects:",p.projects),r(p.projects||[])}else y.error("[useProjects] Failed to fetch projects:",f.status,f.statusText)}catch(f){y.error("[useProjects] Error fetching projects:",f)}finally{i(!1)}},[a,r,i]),c=zl(async f=>{if(!a)throw new Error("Not authenticated");let p=await ne(`${js}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(f)});if(!p.ok)throw new Error("Failed to create project");let g=await p.json();return await u(),g.project},[a,u]),l=zl(async(f,p)=>{if(!a)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||void 0),!(await ne(`${js}/api/projects/${f}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(g)})).ok)throw new Error("Failed to update project");await u()},[a,u]),d=zl(async f=>{if(!a)throw new Error("Not authenticated");if(!(await ne(`${js}/api/projects/${f}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok)throw new Error("Failed to delete project");await u(),t===f&&o(null)},[a,t,u,o]);return{projects:e,selectedProjectId:t,selectedProject:s(),loadingProjects:n,setSelectedProjectId:o,fetchProjects:u,createProject:c,updateProject:l,deleteProject:d}};Ce();var Hs=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d}=nt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d,openComponentBrowser:()=>s(!0),closeComponentBrowser:()=>s(!1)}};Ce();Wg();Xg();import{useCallback as Qs,useRef as Yl}from"react";Oe();function Ul(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){y.warn("[iframeReload] No preview iframe found"),e();return}let n=t.contentWindow.location.href,r=new URL(n);r.searchParams.set("_cb",Date.now().toString());let o=r.toString();y.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{y.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",s),e()},5e3),s=()=>{clearTimeout(i),t.removeEventListener("load",s),y.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{y.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",s),t.contentWindow.location.href=o})}var jl=BigInt(4294967295),nv=BigInt(32);function nz(e,t=!1){return t?{h:Number(e&jl),l:Number(e>>nv&jl)}:{h:Number(e>>nv&jl)|0,l:Number(e&jl)|0}}function rv(e,t=!1){let n=e.length,r=new Uint32Array(n),o=new Uint32Array(n);for(let i=0;i<n;i++){let{h:s,l:a}=nz(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var ov=(e,t,n)=>e<<n|t>>>32-n,iv=(e,t,n)=>t<<n|e>>>32-n,sv=(e,t,n)=>t<<n-32|e>>>64-n,av=(e,t,n)=>e<<n-32|t>>>64-n;function rz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qg(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Hl(e,t,n=""){let r=rz(e),o=e?.length,i=t!==void 0;if(!r||i&&o!==t){let s=n&&`"${n}" `,a=i?` of length ${t}`:"",u=r?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function Jg(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 lv(e,t){Hl(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function cv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Zg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var oz=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function iz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function sz(e){for(let t=0;t<e.length;t++)e[t]=iz(e[t]);return e}var em=oz?e=>e:sz;function uv(e,t={}){let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var pv=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var az=BigInt(0),qs=BigInt(1),lz=BigInt(2),cz=BigInt(7),uz=BigInt(256),pz=BigInt(113),gv=[],mv=[],hv=[];for(let e=0,t=qs,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],gv.push(2*(5*r+n)),mv.push((e+1)*(e+2)/2%64);let o=az;for(let i=0;i<7;i++)t=(t<<qs^(t>>cz)*pz)%uz,t&lz&&(o^=qs<<(qs<<BigInt(i))-qs);hv.push(o)}var xv=rv(hv,!0),dz=xv[0],fz=xv[1],dv=(e,t,n)=>n>32?sv(e,t,n):ov(e,t,n),fv=(e,t,n)=>n>32?av(e,t,n):iv(e,t,n);function gz(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,c=n[u],l=n[u+1],d=dv(c,l,1)^n[a],f=fv(c,l,1)^n[a+1];for(let p=0;p<50;p+=10)e[s+p]^=d,e[s+p+1]^=f}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=mv[s],u=dv(o,i,a),c=fv(o,i,a),l=gv[s];o=e[l],i=e[l+1],e[l]=u,e[l+1]=c}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=dz[r],e[1]^=fz[r]}Zg(n)}var tm=class e{constructor(t,n,r,o=!1,i=24){or(this,"state");or(this,"pos",0);or(this,"posOut",0);or(this,"finished",!1);or(this,"state32");or(this,"destroyed",!1);or(this,"blockLen");or(this,"suffix");or(this,"outputLen");or(this,"enableXOF",!1);or(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Qg(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=cv(this.state)}clone(){return this._cloneInto()}keccak(){em(this.state32),gz(this.state32,this.rounds),em(this.state32),this.posOut=0,this.pos=0}update(t){Jg(this),Hl(t);let{blockLen:n,state:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Jg(this,!1),Hl(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qg(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lv(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,Zg(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},mz=(e,t,n,r={})=>uv(()=>new tm(t,e,n),r);var yv=mz(6,72,64,pv(10));var hz=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,nm=Math.ceil,ur=Math.floor,On="[BigNumber Error] ",bv=On+"Number primitive has more than 15 significant digits: ",Tr=1e14,Ve=14,rm=9007199254740991,om=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Io=1e7,an=1e9;function Sv(e){var t,n,r,o=I.prototype={constructor:I,toString:null,valueOf:null},i=new I(1),s=20,a=4,u=-7,c=21,l=-1e7,d=1e7,f=!1,p=1,g=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function I(x,w){var v,C,m,F,S,b,A,L,B=this;if(!(B instanceof I))return new I(x,w);if(w==null){if(x&&x._isBigNumber===!0){B.s=x.s,!x.c||x.e>d?B.c=B.e=null:x.e<l?B.c=[B.e=0]:(B.e=x.e,B.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(B.s=1/x<0?(x=-x,-1):1,x===~~x){for(F=0,S=x;S>=10;S/=10,F++);F>d?B.c=B.e=null:(B.e=F,B.c=[x]);return}L=String(x)}else{if(!hz.test(L=String(x)))return r(B,L,b);B.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(F=L.indexOf("."))>-1&&(L=L.replace(".","")),(S=L.search(/e/i))>0?(F<0&&(F=S),F+=+L.slice(S+1),L=L.substring(0,S)):F<0&&(F=L.length)}else{if(zt(w,2,T.length,"Base"),w==10&&E)return B=new I(x),P(B,s+B.e+1,a);if(L=String(x),b=typeof x=="number"){if(x*0!=0)return r(B,L,b,w);if(B.s=1/x<0?(L=L.slice(1),-1):1,I.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(bv+x)}else B.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(v=T.slice(0,w),F=S=0,A=L.length;S<A;S++)if(v.indexOf(C=L.charAt(S))<0){if(C=="."){if(S>F){F=A;continue}}else if(!m&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){m=!0,S=-1,F=0;continue}return r(B,String(x),b,w)}b=!1,L=n(L,w,10,B.s),(F=L.indexOf("."))>-1?L=L.replace(".",""):F=L.length}for(S=0;L.charCodeAt(S)===48;S++);for(A=L.length;L.charCodeAt(--A)===48;);if(L=L.slice(S,++A)){if(A-=S,b&&I.DEBUG&&A>15&&(x>rm||x!==ur(x)))throw Error(bv+B.s*x);if((F=F-S-1)>d)B.c=B.e=null;else if(F<l)B.c=[B.e=0];else{if(B.e=F,B.c=[],S=(F+1)%Ve,F<0&&(S+=Ve),S<A){for(S&&B.c.push(+L.slice(0,S)),A-=Ve;S<A;)B.c.push(+L.slice(S,S+=Ve));S=Ve-(L=L.slice(S)).length}else S-=A;for(;S--;L+="0");B.c.push(+L)}}else B.c=[B.e=0]}I.clone=Sv,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(x){var w,v;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(w="DECIMAL_PLACES")&&(v=x[w],zt(v,0,an,w),s=v),x.hasOwnProperty(w="ROUNDING_MODE")&&(v=x[w],zt(v,0,8,w),a=v),x.hasOwnProperty(w="EXPONENTIAL_AT")&&(v=x[w],v&&v.pop?(zt(v[0],-an,0,w),zt(v[1],0,an,w),u=v[0],c=v[1]):(zt(v,-an,an,w),u=-(c=v<0?-v:v))),x.hasOwnProperty(w="RANGE"))if(v=x[w],v&&v.pop)zt(v[0],-an,-1,w),zt(v[1],1,an,w),l=v[0],d=v[1];else if(zt(v,-an,an,w),v)l=-(d=v<0?-v:v);else throw Error(On+w+" cannot be zero: "+v);if(x.hasOwnProperty(w="CRYPTO"))if(v=x[w],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=v;else throw f=!v,Error(On+"crypto unavailable");else f=v;else throw Error(On+w+" not true or false: "+v);if(x.hasOwnProperty(w="MODULO_MODE")&&(v=x[w],zt(v,0,9,w),p=v),x.hasOwnProperty(w="POW_PRECISION")&&(v=x[w],zt(v,0,an,w),g=v),x.hasOwnProperty(w="FORMAT"))if(v=x[w],typeof v=="object")k=v;else throw Error(On+w+" not an object: "+v);if(x.hasOwnProperty(w="ALPHABET"))if(v=x[w],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))E=v.slice(0,10)=="0123456789",T=v;else throw Error(On+w+" invalid: "+v)}else throw Error(On+"Object expected: "+x);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:g,FORMAT:k,ALPHABET:T}},I.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!I.DEBUG)return!0;var w,v,C=x.c,m=x.e,F=x.s;e:if({}.toString.call(C)=="[object Array]"){if((F===1||F===-1)&&m>=-an&&m<=an&&m===ur(m)){if(C[0]===0){if(m===0&&C.length===1)return!0;break e}if(w=(m+1)%Ve,w<1&&(w+=Ve),String(C[0]).length==w){for(w=0;w<C.length;w++)if(v=C[w],v<0||v>=Tr||v!==ur(v))break e;if(v!==0)return!0}}}else if(C===null&&m===null&&(F===null||F===1||F===-1))return!0;throw Error(On+"Invalid BigNumber: "+x)},I.maximum=I.max=function(){return R(arguments,-1)},I.minimum=I.min=function(){return R(arguments,1)},I.random=(function(){var x=9007199254740992,w=Math.random()*x&2097151?function(){return ur(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,m,F,S,b,A=0,L=[],B=new I(i);if(v==null?v=s:zt(v,0,an),S=nm(v/Ve),f)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(S*=2));A<S;)b=C[A]*131072+(C[A+1]>>>11),b>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),C[A]=m[0],C[A+1]=m[1]):(L.push(b%1e14),A+=2);A=S/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(S*=7);A<S;)b=(C[A]&31)*281474976710656+C[A+1]*1099511627776+C[A+2]*4294967296+C[A+3]*16777216+(C[A+4]<<16)+(C[A+5]<<8)+C[A+6],b>=9e15?crypto.randomBytes(7).copy(C,A):(L.push(b%1e14),A+=7);A=S/7}else throw f=!1,Error(On+"crypto unavailable");if(!f)for(;A<S;)b=w(),b<9e15&&(L[A++]=b%1e14);for(S=L[--A],v%=Ve,S&&v&&(b=om[Ve-v],L[A]=ur(S/b)*b);L[A]===0;L.pop(),A--);if(A<0)L=[F=0];else{for(F=-1;L[0]===0;L.splice(0,1),F-=Ve);for(A=1,b=L[0];b>=10;b/=10,A++);A<Ve&&(F-=Ve-A)}return B.e=F,B.c=L,B}})(),I.sum=function(){for(var x=1,w=arguments,v=new I(w[0]);x<w.length;)v=v.plus(w[x++]);return v},n=(function(){var x="0123456789";function w(v,C,m,F){for(var S,b=[0],A,L=0,B=v.length;L<B;){for(A=b.length;A--;b[A]*=C);for(b[0]+=F.indexOf(v.charAt(L++)),S=0;S<b.length;S++)b[S]>m-1&&(b[S+1]==null&&(b[S+1]=0),b[S+1]+=b[S]/m|0,b[S]%=m)}return b.reverse()}return function(v,C,m,F,S){var b,A,L,B,N,h,j,W,M=v.indexOf("."),K=s,ee=a;for(M>=0&&(B=g,g=0,v=v.replace(".",""),W=new I(C),h=W.pow(v.length-M),g=B,W.c=w(ro(cr(h.c),h.e,"0"),10,m,x),W.e=W.c.length),j=w(v,C,m,S?(b=T,x):(b=x,T)),L=B=j.length;j[--B]==0;j.pop());if(!j[0])return b.charAt(0);if(M<0?--L:(h.c=j,h.e=L,h.s=F,h=t(h,W,K,ee,m),j=h.c,N=h.r,L=h.e),A=L+K+1,M=j[A],B=m/2,N=N||A<0||j[A+1]!=null,N=ee<4?(M!=null||N)&&(ee==0||ee==(h.s<0?3:2)):M>B||M==B&&(ee==4||N||ee==6&&j[A-1]&1||ee==(h.s<0?8:7)),A<1||!j[0])v=N?ro(b.charAt(1),-K,b.charAt(0)):b.charAt(0);else{if(j.length=A,N)for(--m;++j[--A]>m;)j[A]=0,A||(++L,j=[1].concat(j));for(B=j.length;!j[--B];);for(M=0,v="";M<=B;v+=b.charAt(j[M++]));v=ro(v,L,b.charAt(0))}return v}})(),t=(function(){function x(C,m,F){var S,b,A,L,B=0,N=C.length,h=m%Io,j=m/Io|0;for(C=C.slice();N--;)A=C[N]%Io,L=C[N]/Io|0,S=j*A+L*h,b=h*A+S%Io*Io+B,B=(b/F|0)+(S/Io|0)+j*L,C[N]=b%F;return B&&(C=[B].concat(C)),C}function w(C,m,F,S){var b,A;if(F!=S)A=F>S?1:-1;else for(b=A=0;b<F;b++)if(C[b]!=m[b]){A=C[b]>m[b]?1:-1;break}return A}function v(C,m,F,S){for(var b=0;F--;)C[F]-=b,b=C[F]<m[F]?1:0,C[F]=b*S+C[F]-m[F];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,m,F,S,b){var A,L,B,N,h,j,W,M,K,ee,fe,xe,ae,Ke,be,Te,te,Me=C.s==m.s?1:-1,Ae=C.c,pe=m.c;if(!Ae||!Ae[0]||!pe||!pe[0])return new I(!C.s||!m.s||(Ae?pe&&Ae[0]==pe[0]:!pe)?NaN:Ae&&Ae[0]==0||!pe?Me*0:Me/0);for(M=new I(Me),K=M.c=[],L=C.e-m.e,Me=F+L+1,b||(b=Tr,L=pr(C.e/Ve)-pr(m.e/Ve),Me=Me/Ve|0),B=0;pe[B]==(Ae[B]||0);B++);if(pe[B]>(Ae[B]||0)&&L--,Me<0)K.push(1),N=!0;else{for(Ke=Ae.length,Te=pe.length,B=0,Me+=2,h=ur(b/(pe[0]+1)),h>1&&(pe=x(pe,h,b),Ae=x(Ae,h,b),Te=pe.length,Ke=Ae.length),ae=Te,ee=Ae.slice(0,Te),fe=ee.length;fe<Te;ee[fe++]=0);te=pe.slice(),te=[0].concat(te),be=pe[0],pe[1]>=b/2&&be++;do{if(h=0,A=w(pe,ee,Te,fe),A<0){if(xe=ee[0],Te!=fe&&(xe=xe*b+(ee[1]||0)),h=ur(xe/be),h>1)for(h>=b&&(h=b-1),j=x(pe,h,b),W=j.length,fe=ee.length;w(j,ee,W,fe)==1;)h--,v(j,Te<W?te:pe,W,b),W=j.length,A=1;else h==0&&(A=h=1),j=pe.slice(),W=j.length;if(W<fe&&(j=[0].concat(j)),v(ee,j,fe,b),fe=ee.length,A==-1)for(;w(pe,ee,Te,fe)<1;)h++,v(ee,Te<fe?te:pe,fe,b),fe=ee.length}else A===0&&(h++,ee=[0]);K[B++]=h,ee[0]?ee[fe++]=Ae[ae]||0:(ee=[Ae[ae]],fe=1)}while((ae++<Ke||ee[0]!=null)&&Me--);N=ee[0]!=null,K[0]||K.splice(0,1)}if(b==Tr){for(B=1,Me=K[0];Me>=10;Me/=10,B++);P(M,F+(M.e=B+L*Ve-1)+1,S,N)}else M.e=L,M.r=+N;return M}})();function D(x,w,v,C){var m,F,S,b,A;if(v==null?v=a:zt(v,0,8),!x.c)return x.toString();if(m=x.c[0],S=x.e,w==null)A=cr(x.c),A=C==1||C==2&&(S<=u||S>=c)?Vl(A,S):ro(A,S,"0");else if(x=P(new I(x),w,v),F=x.e,A=cr(x.c),b=A.length,C==1||C==2&&(w<=F||F<=u)){for(;b<w;A+="0",b++);A=Vl(A,F)}else if(w-=S+(C===2&&F>S),A=ro(A,F,"0"),F+1>b){if(--w>0)for(A+=".";w--;A+="0");}else if(w+=F-b,w>0)for(F+1==b&&(A+=".");w--;A+="0");return x.s<0&&m?"-"+A:A}function R(x,w){for(var v,C,m=1,F=new I(x[0]);m<x.length;m++)C=new I(x[m]),(!C.s||(v=ti(F,C))===w||v===0&&F.s===w)&&(F=C);return F}function $(x,w,v){for(var C=1,m=w.length;!w[--m];w.pop());for(m=w[0];m>=10;m/=10,C++);return(v=C+v*Ve-1)>d?x.c=x.e=null:v<l?x.c=[x.e=0]:(x.e=v,x.c=w),x}r=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,S,b,A){var L,B=b?S:S.replace(m,"");if(C.test(B))F.s=isNaN(B)?null:B<0?-1:1;else{if(!b&&(B=B.replace(x,function(N,h,j){return L=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!A||A==L?h:N}),A&&(L=A,B=B.replace(w,"$1").replace(v,"0.$1")),S!=B))return new I(B,L);if(I.DEBUG)throw Error(On+"Not a"+(A?" base "+A:"")+" number: "+S);F.s=null}F.c=F.e=null}})();function P(x,w,v,C){var m,F,S,b,A,L,B,N=x.c,h=om;if(N){e:{for(m=1,b=N[0];b>=10;b/=10,m++);if(F=w-m,F<0)F+=Ve,S=w,A=N[L=0],B=ur(A/h[m-S-1]%10);else if(L=nm((F+1)/Ve),L>=N.length)if(C){for(;N.length<=L;N.push(0));A=B=0,m=1,F%=Ve,S=F-Ve+1}else break e;else{for(A=b=N[L],m=1;b>=10;b/=10,m++);F%=Ve,S=F-Ve+m,B=S<0?0:ur(A/h[m-S-1]%10)}if(C=C||w<0||N[L+1]!=null||(S<0?A:A%h[m-S-1]),C=v<4?(B||C)&&(v==0||v==(x.s<0?3:2)):B>5||B==5&&(v==4||C||v==6&&(F>0?S>0?A/h[m-S]:0:N[L-1])%10&1||v==(x.s<0?8:7)),w<1||!N[0])return N.length=0,C?(w-=x.e+1,N[0]=h[(Ve-w%Ve)%Ve],x.e=-w||0):N[0]=x.e=0,x;if(F==0?(N.length=L,b=1,L--):(N.length=L+1,b=h[Ve-F],N[L]=S>0?ur(A/h[m-S]%h[S])*b:0),C)for(;;)if(L==0){for(F=1,S=N[0];S>=10;S/=10,F++);for(S=N[0]+=b,b=1;S>=10;S/=10,b++);F!=b&&(x.e++,N[0]==Tr&&(N[0]=1));break}else{if(N[L]+=b,N[L]!=Tr)break;N[L--]=0,b=1}for(F=N.length;N[--F]===0;N.pop());}x.e>d?x.c=x.e=null:x.e<l&&(x.c=[x.e=0])}return x}function z(x){var w,v=x.e;return v===null?x.toString():(w=cr(x.c),w=v<=u||v>=c?Vl(w,v):ro(w,v,"0"),x.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var x=new I(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,w){return ti(this,new I(x,w))},o.decimalPlaces=o.dp=function(x,w){var v,C,m,F=this;if(x!=null)return zt(x,0,an),w==null?w=a:zt(w,0,8),P(new I(F),x+F.e+1,w);if(!(v=F.c))return null;if(C=((m=v.length-1)-pr(this.e/Ve))*Ve,m=v[m])for(;m%10==0;m/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(x,w){return t(this,new I(x,w),s,a)},o.dividedToIntegerBy=o.idiv=function(x,w){return t(this,new I(x,w),0,1)},o.exponentiatedBy=o.pow=function(x,w){var v,C,m,F,S,b,A,L,B,N=this;if(x=new I(x),x.c&&!x.isInteger())throw Error(On+"Exponent not an integer: "+z(x));if(w!=null&&(w=new I(w)),b=x.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!x.c||!x.c[0])return B=new I(Math.pow(+z(N),b?x.s*(2-Wl(x)):+z(x))),w?B.mod(w):B;if(A=x.s<0,w){if(w.c?!w.c[0]:!w.s)return new I(NaN);C=!A&&N.isInteger()&&w.isInteger(),C&&(N=N.mod(w))}else{if(x.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||b&&N.c[1]>=24e7:N.c[0]<8e13||b&&N.c[0]<=9999975e7)))return F=N.s<0&&Wl(x)?-0:0,N.e>-1&&(F=1/F),new I(A?1/F:F);g&&(F=nm(g/Ve+2))}for(b?(v=new I(.5),A&&(x.s=1),L=Wl(x)):(m=Math.abs(+z(x)),L=m%2),B=new I(i);;){if(L){if(B=B.times(N),!B.c)break;F?B.c.length>F&&(B.c.length=F):C&&(B=B.mod(w))}if(m){if(m=ur(m/2),m===0)break;L=m%2}else if(x=x.times(v),P(x,x.e+1,1),x.e>14)L=Wl(x);else{if(m=+z(x),m===0)break;L=m%2}N=N.times(N),F?N.c&&N.c.length>F&&(N.c.length=F):C&&(N=N.mod(w))}return C?B:(A&&(B=i.div(B)),w?B.mod(w):F?P(B,g,a,S):B)},o.integerValue=function(x){var w=new I(this);return x==null?x=a:zt(x,0,8),P(w,w.e+1,x)},o.isEqualTo=o.eq=function(x,w){return ti(this,new I(x,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,w){return ti(this,new I(x,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,w){return(w=ti(this,new I(x,w)))===1||w===0},o.isInteger=function(){return!!this.c&&pr(this.e/Ve)>this.c.length-2},o.isLessThan=o.lt=function(x,w){return ti(this,new I(x,w))<0},o.isLessThanOrEqualTo=o.lte=function(x,w){return(w=ti(this,new I(x,w)))===-1||w===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,w){var v,C,m,F,S=this,b=S.s;if(x=new I(x,w),w=x.s,!b||!w)return new I(NaN);if(b!=w)return x.s=-w,S.plus(x);var A=S.e/Ve,L=x.e/Ve,B=S.c,N=x.c;if(!A||!L){if(!B||!N)return B?(x.s=-w,x):new I(N?S:NaN);if(!B[0]||!N[0])return N[0]?(x.s=-w,x):new I(B[0]?S:a==3?-0:0)}if(A=pr(A),L=pr(L),B=B.slice(),b=A-L){for((F=b<0)?(b=-b,m=B):(L=A,m=N),m.reverse(),w=b;w--;m.push(0));m.reverse()}else for(C=(F=(b=B.length)<(w=N.length))?b:w,b=w=0;w<C;w++)if(B[w]!=N[w]){F=B[w]<N[w];break}if(F&&(m=B,B=N,N=m,x.s=-x.s),w=(C=N.length)-(v=B.length),w>0)for(;w--;B[v++]=0);for(w=Tr-1;C>b;){if(B[--C]<N[C]){for(v=C;v&&!B[--v];B[v]=w);--B[v],B[C]+=Tr}B[C]-=N[C]}for(;B[0]==0;B.splice(0,1),--L);return B[0]?$(x,B,L):(x.s=a==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,w){var v,C,m=this;return x=new I(x,w),!m.c||!x.s||x.c&&!x.c[0]?new I(NaN):!x.c||m.c&&!m.c[0]?new I(m):(p==9?(C=x.s,x.s=1,v=t(m,x,0,3),x.s=C,v.s*=C):v=t(m,x,0,p),x=m.minus(v.times(x)),!x.c[0]&&p==1&&(x.s=m.s),x)},o.multipliedBy=o.times=function(x,w){var v,C,m,F,S,b,A,L,B,N,h,j,W,M,K,ee=this,fe=ee.c,xe=(x=new I(x,w)).c;if(!fe||!xe||!fe[0]||!xe[0])return!ee.s||!x.s||fe&&!fe[0]&&!xe||xe&&!xe[0]&&!fe?x.c=x.e=x.s=null:(x.s*=ee.s,!fe||!xe?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(C=pr(ee.e/Ve)+pr(x.e/Ve),x.s*=ee.s,A=fe.length,N=xe.length,A<N&&(W=fe,fe=xe,xe=W,m=A,A=N,N=m),m=A+N,W=[];m--;W.push(0));for(M=Tr,K=Io,m=N;--m>=0;){for(v=0,h=xe[m]%K,j=xe[m]/K|0,S=A,F=m+S;F>m;)L=fe[--S]%K,B=fe[S]/K|0,b=j*L+B*h,L=h*L+b%K*K+W[F]+v,v=(L/M|0)+(b/K|0)+j*B,W[F--]=L%M;W[F]=v}return v?++C:W.splice(0,1),$(x,W,C)},o.negated=function(){var x=new I(this);return x.s=-x.s||null,x},o.plus=function(x,w){var v,C=this,m=C.s;if(x=new I(x,w),w=x.s,!m||!w)return new I(NaN);if(m!=w)return x.s=-w,C.minus(x);var F=C.e/Ve,S=x.e/Ve,b=C.c,A=x.c;if(!F||!S){if(!b||!A)return new I(m/0);if(!b[0]||!A[0])return A[0]?x:new I(b[0]?C:m*0)}if(F=pr(F),S=pr(S),b=b.slice(),m=F-S){for(m>0?(S=F,v=A):(m=-m,v=b),v.reverse();m--;v.push(0));v.reverse()}for(m=b.length,w=A.length,m-w<0&&(v=A,A=b,b=v,w=m),m=0;w;)m=(b[--w]=b[w]+A[w]+m)/Tr|0,b[w]=Tr===b[w]?0:b[w]%Tr;return m&&(b=[m].concat(b),++S),$(x,b,S)},o.precision=o.sd=function(x,w){var v,C,m,F=this;if(x!=null&&x!==!!x)return zt(x,1,an),w==null?w=a:zt(w,0,8),P(new I(F),x,w);if(!(v=F.c))return null;if(m=v.length-1,C=m*Ve+1,m=v[m]){for(;m%10==0;m/=10,C--);for(m=v[0];m>=10;m/=10,C++);}return x&&F.e+1>C&&(C=F.e+1),C},o.shiftedBy=function(x){return zt(x,-rm,rm),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,w,v,C,m,F=this,S=F.c,b=F.s,A=F.e,L=s+4,B=new I("0.5");if(b!==1||!S||!S[0])return new I(!b||b<0&&(!S||S[0])?NaN:S?F:1/0);if(b=Math.sqrt(+z(F)),b==0||b==1/0?(w=cr(S),(w.length+A)%2==0&&(w+="0"),b=Math.sqrt(+w),A=pr((A+1)/2)-(A<0||A%2),b==1/0?w="5e"+A:(w=b.toExponential(),w=w.slice(0,w.indexOf("e")+1)+A),v=new I(w)):v=new I(b+""),v.c[0]){for(A=v.e,b=A+L,b<3&&(b=0);;)if(m=v,v=B.times(m.plus(t(F,m,L,1))),cr(m.c).slice(0,b)===(w=cr(v.c)).slice(0,b))if(v.e<A&&--b,w=w.slice(b-3,b+1),w=="9999"||!C&&w=="4999"){if(!C&&(P(m,m.e+s+2,0),m.times(m).eq(F))){v=m;break}L+=4,b+=4,C=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(P(v,v.e+s+2,1),x=!v.times(v).eq(F));break}}return P(v,v.e+s+1,a,x)},o.toExponential=function(x,w){return x!=null&&(zt(x,0,an),x++),D(this,x,w,1)},o.toFixed=function(x,w){return x!=null&&(zt(x,0,an),x=x+this.e+1),D(this,x,w)},o.toFormat=function(x,w,v){var C,m=this;if(v==null)x!=null&&w&&typeof w=="object"?(v=w,w=null):x&&typeof x=="object"?(v=x,x=w=null):v=k;else if(typeof v!="object")throw Error(On+"Argument not an object: "+v);if(C=m.toFixed(x,w),m.c){var F,S=C.split("."),b=+v.groupSize,A=+v.secondaryGroupSize,L=v.groupSeparator||"",B=S[0],N=S[1],h=m.s<0,j=h?B.slice(1):B,W=j.length;if(A&&(F=b,b=A,A=F,W-=F),b>0&&W>0){for(F=W%b||b,B=j.substr(0,F);F<W;F+=b)B+=L+j.substr(F,b);A>0&&(B+=L+j.slice(F)),h&&(B="-"+B)}C=N?B+(v.decimalSeparator||"")+((A=+v.fractionGroupSize)?N.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):N):B}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(x){var w,v,C,m,F,S,b,A,L,B,N,h,j=this,W=j.c;if(x!=null&&(b=new I(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(On+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+z(b));if(!W)return new I(j);for(w=new I(i),L=v=new I(i),C=A=new I(i),h=cr(W),F=w.e=h.length-j.e-1,w.c[0]=om[(S=F%Ve)<0?Ve+S:S],x=!x||b.comparedTo(w)>0?F>0?w:L:b,S=d,d=1/0,b=new I(h),A.c[0]=0;B=t(b,w,0,1),m=v.plus(B.times(C)),m.comparedTo(x)!=1;)v=C,C=m,L=A.plus(B.times(m=L)),A=m,w=b.minus(B.times(m=w)),b=m;return m=t(x.minus(v),C,0,1),A=A.plus(m.times(L)),v=v.plus(m.times(C)),A.s=L.s=j.s,F=F*2,N=t(L,C,F,a).minus(j).abs().comparedTo(t(A,v,F,a).minus(j).abs())<1?[L,C]:[A,v],d=S,N},o.toNumber=function(){return+z(this)},o.toPrecision=function(x,w){return x!=null&&zt(x,1,an),D(this,x,w,2)},o.toString=function(x){var w,v=this,C=v.s,m=v.e;return m===null?C?(w="Infinity",C<0&&(w="-"+w)):w="NaN":(x==null?w=m<=u||m>=c?Vl(cr(v.c),m):ro(cr(v.c),m,"0"):x===10&&E?(v=P(new I(v),s+m+1,a),w=ro(cr(v.c),v.e,"0")):(zt(x,2,T.length,"Base"),w=n(ro(cr(v.c),m,"0"),10,x,C,!0)),C<0&&v.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return z(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&I.set(e),I}function pr(e){var t=e|0;return e>0||e===t?t:t-1}function cr(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Ve-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ti(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(a=(u=o.length)<(c=i.length)?u:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function zt(e,t,n,r){if(e<t||e>n||e!==ur(e))throw Error(On+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Wl(e){var t=e.c.length-1;return pr(e.e/Ve)==t&&e.c[t]%2!=0}function Vl(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ro(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var xz=Sv(),wv=xz;var yz=24,Ys=32,bz=()=>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,sm=bz(),im=(e=4,t=sm)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function Sz(e){let t=new wv(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var kv=(e="")=>{let t=new TextEncoder;return Sz(yv(t.encode(e))).toString(36).slice(1)},vv=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),wz=e=>vv[Math.floor(e()*vv.length)],vz=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=sm}={})=>{let n=Object.keys(e).toString(),r=n.length?n+im(Ys,t):im(Ys,t);return kv(r).substring(0,Ys)},kz=e=>()=>e++,Cz=476782367,Cv=({random:e=sm,counter:t=kz(Math.floor(e()*Cz)),length:n=yz,fingerprint:r=vz({random:e})}={})=>{if(n>Ys)throw new Error(`Length must be between 2 and ${Ys}. Received: ${n}`);return function(){let i=wz(e),s=Date.now().toString(36),a=t().toString(36),u=im(n,e),c=`${s+u+a+r}`;return`${i+kv(c).substring(1,n)}`}},Fo=Tz(Cv);function Tz(e){let t;return()=>(t||(t=e()),t())}var Ez=$a(Fv());Rn();Oe();var Gl=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function Az(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function am(e,t){let n=[],r=e.split(`
|
|
15
|
-
`);for(let s=0;s<r.length;s++){let a=
|
|
16
|
-
`)}else r.push(i)}return n.description=r.join(" ").trim(),n}Oe();var Ks=null,Ev=0,Mz=3e4;async function Bz(){let e=Date.now();if(Ks&&e-Ev<Mz)return Ks;try{let t=await fetch("/index.json");if(!t.ok)throw new Error(`Failed to fetch index.json: ${t.status}`);let n=await t.json();return Ks=n.entries||n.stories||{},Ev=e,y.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(Ks).length),Ks}catch(t){throw y.error("[storyFilePaths] Error fetching index.json:",t),t}}async function Xs(e){try{let n=(await Bz())[e];if(!n?.importPath)return y.warn("[storyFilePaths] No importPath found for story:",e),null;let r=n.importPath;y.debug("[storyFilePaths] Found importPath:",r);let o=r.replace(/^\.\//,""),i;n.componentPath?(i=n.componentPath.replace(/^\.\//,""),y.debug("[storyFilePaths] Using Storybook componentPath:",i)):(i=`${o.replace(/\.stories\.tsx$/,"").replace(/\.stories\.ts$/,"").replace(/\.stories\.jsx$/,"").replace(/\.stories\.js$/,"")}.tsx`,y.debug("[storyFilePaths] Derived componentFile:",i));let s=i.replace(/\.tsx$/,".css").replace(/\.ts$/,".css").replace(/\.jsx$/,".css").replace(/\.js$/,".css"),a=i.substring(0,i.lastIndexOf("/")),u={storyFile:o,componentFile:i,cssFile:s,baseDir:a};return y.debug("[storyFilePaths] Final paths:",u),u}catch(t){return y.error("[storyFilePaths] Error getting file paths:",t),null}}function lm(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function Dz(e,t){let n=e.toLowerCase().trim();return["color","spacing","typography","dimension","border","shadow","layout","background","font","size","margin","padding"].some(i=>n.includes(i))?t.cssFile:t.componentFile}function cm(e,t){let n=e.property?.toLowerCase()||"",r=e.domElement?.toLowerCase()||"",o=r.startsWith("svg"),i=r.startsWith("img"),s=n==="width"||n==="height",a=/\[(?:width|height)=/.test(r);return(o||i)&&s||a?(y.debug(`[storyFilePaths] \u{1F50D} INLINE ATTRIBUTE: domElement="${e.domElement}", property="${e.property}" \u2192 component file`),t.componentFile):Dz(e.type,t)}Oe();function Rz(e){let t=(e.description||"").toLowerCase(),n=(e.title||"").toLowerCase(),r=`${t} ${n}`;return r.includes("inner icon")||r.includes("inner vector")?"inner-icon":r.includes("second icon")?"icon-2":r.includes("first icon")?"icon-1":r.includes("icon")||r.includes("vector")||r.includes("svg")?"icon":r.includes("button")?"button":r.includes("text")||r.includes("label")?"text":r.includes("container")||r.includes("wrapper")?"container":"other"}function zz(e){let t=(e.property||"").toLowerCase(),n=(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":n.includes("overall")||n.includes("visual fidelity")||n.includes("pixel similarity")||t.includes("overall")?"summary":"other"}function Nz(e){let t=(e.property||"").toLowerCase(),n=(e.description||"").toLowerCase();return t.includes("overall")||t.includes("visual fidelity")||n.includes("pixel similarity score")||n.includes("primarily explained by")||n.includes("visual discrepancy")}function Oz(e,t,n){let r={critical:3,major:2,minor:1},i=[...e].sort((c,l)=>(r[l.severity]||0)-(r[c.severity]||0))[0],s=e.length,a,u;if(t.includes("icon")&&n==="dimensions"){let c=e.map(d=>d.currentValue).filter(Boolean),l=e.map(d=>d.suggestedValue).filter(Boolean);a=`Icon sizing is incorrect (${s} related issues)`,u=`Icons are rendered at wrong dimensions. Current: ${c[0]||"10px"}, Expected: ${l[0]||"20px"}. This single CSS fix will resolve all ${s} icon dimension issues.`}else a=`${t} ${n} issues (${s} related)`,u=`${s} related ${n} issues for ${t}. ${i.description}`;return{...i,id:`merged-${t}-${n}-${i.id}`,title:a,description:u,currentValue:i.currentValue,suggestedValue:i.suggestedValue,mergedCount:s,mergedIssueIds:e.map(c=>c.id)}}function um(e){if(!e||e.length===0)return[];let t=e.filter(i=>!Nz(i)),n=[],r=[];for(let i of t){let s=Rz(i),a=zz(i);s.includes("icon")&&a==="dimensions"?n.push(i):r.push(i)}let o=[];return n.length>0&&(n.length===1?o.push(n[0]):o.push(Oz(n,"icon","dimensions"))),o.push(...r),y.debug("[deduplicateIssues] Input:",e.length,"issues, Output:",o.length,"issues"),y.debug("[deduplicateIssues] Removed",e.length-t.length,"summary issues"),y.debug("[deduplicateIssues] Merged",n.length,"icon issues into",n.length>0?1:0),o}Oe();Rn();var _z=[/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],$z=[/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 Av(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"Review failed";return $z.some(n=>n.test(t))?t:_z.some(n=>n.test(t))?`Can't reach ${Ft.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)?`${Ft.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}. Try again, or send feedback if this keeps happening.`}je();import{addons as ql}from"storybook/manager-api";var pm="uireview/badge",zi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error"};function Uz(e){return e.criticalCount>0||e.score<70?"status-value:error":e.majorCount>0||e.score<90?"status-value:warning":"status-value:success"}function jz(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 Hz(e){return e.score>=90?`\u2713 Score ${e.score}`:e.score>=70?`\u26A0 Score ${e.score}`:`\u2717 Score ${e.score}`}function Ni(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function Mv(e){if(Ni())try{ql.getChannel().emit(zi.REVIEW_START,{storyId:e})}catch{}}function Eo(e,t){if(Ni())try{ql.getChannel().emit(zi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function Bv(e){if(Ni())try{ql.getChannel().emit(zi.REVIEW_ERROR,{storyId:e})}catch{}}function Pv(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}}var Lv=null;function Dv(e){if(Lv!==null)return;let t=ql.getChannel(),n=o=>i=>{Ni()&&o(i)};t.on(zi.REVIEW_START,n(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:pm,storyId:o,title:"Reviewing...",description:"AI review in progress"}])})),t.on(zi.REVIEW_COMPLETE,n(({storyId:o,summary:i})=>{e.set([{value:Uz(i),typeId:pm,storyId:o,title:Hz(i),description:jz(i)}])})),t.on(zi.REVIEW_ERROR,n(({storyId:o})=>{e.set([{value:"status-value:error",typeId:pm,storyId:o,title:"Review Failed",description:"An error occurred during review"}])}));let r=Ni();r||Pv(e),Lv=setInterval(()=>{let o=Ni();o!==r&&(r=o,o||Pv(e))},1500)}var dm=V(),fm=180;function Ao(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 n=[t.top,t.right,t.bottom,t.left].filter(Boolean);if(n.length>0)return n.join(" ")}return JSON.stringify(e)}return String(e)}var gm=()=>{let{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,selectedModels:l,setIsReviewing:d,setReviewError:f,setReviewResults:p,setShowReviewMenu:g,setSeverityFilter:k,setShowStreamingPanel:T,setStreamingPanelCollapsed:E,addStreamingMessage:I,updateStreamingMessage:D,clearStreamingMessages:R,setStreamingProgress:$,setStreamingStatus:P,setFullPrompt:z,setFullResponse:x,setFigmaImageUrl:w,storybookImageUrl:v,setStorybookImageUrl:C,setFigmaDimensions:m,setMultiModelResults:F,updateMultiModelStreamingMessages:S,setModelCompleted:b,setActiveModelId:A,resetReview:L,addReview:B,setReviewDetailTab:N,includeTextComparison:h,usePromptCache:j,setApplyFixesResult:W,featureFlags:M}=ce(),{sessionToken:K,usageData:ee,setUsageData:fe}=we(),{selectedProjectId:xe}=Je(),{currentStoryId:ae,currentStoryName:Ke}=nt(),be=Yl(ee);be.current=ee;let Te=Yl(null),te=Yl(null),Me=Yl({}),Ae=Qs((ge,tt)=>{I({role:ge,content:tt})},[I]),pe=Qs((ge,tt)=>{$(ge),P(tt)},[$,P]),Pt=Qs(async ge=>{let{isIteration:tt=!1,parentReviewId:he=null}=ge||{};if(!K)throw new Error("Not authenticated");if(!xe)throw new Error("No project selected");if(!ae||!Ke)throw new Error("No story is currently selected in Storybook");if(e){y.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let oe=Date.now();try{d(!0),f(null),p(null),N("issues"),W(null),ae&&M.enableReviewBadges&&Mv(ae),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{y.debug(`[useAIReview] Auto-stopping review after ${fm}s timeout`),Te.current&&Te.current.abort(),I({role:"system",content:`Review auto-stopped after ${fm} seconds timeout.`})},fm*1e3),z(""),x(""),T(!0),E(!1),R(),pe(0,"Starting review..."),pe(5,"Refreshing component preview..."),y.debug("[Review] Forcing iframe reload for fresh styles..."),await Ul(),y.debug("[Review] Iframe reloaded, styles should be fresh"),pe(20,"Capturing screenshot & extracting styles..."),y.debug("[Review] Starting parallel data collection...");let[Y,me,ie]=await Promise.all([_l({sessionToken:K||void 0}),Promise.resolve(Gs()),Promise.resolve(Kg())]);if(Y&&Y!==v&&(C(Y),y.debug("[Review] Storybook screenshot captured and set")),!me)throw new Error("Failed to extract styles from component");let{computed:O,declared:U,markup:H,textElementStyles:Be,nestedElementStyles:_e}=me;ie?y.debug("[Review] DOM tree extracted:",{selector:ie.selector,childrenCount:ie.children.length}):(y.error("[Review] DOM tree extraction FAILED - domTree is null"),y.error("[Review] This will cause AI to use comparison table instead of tree comparison")),pe(50,"Preparing metadata..."),y.debug("[Review] Current story:",{id:ae,name:Ke});let bt=ft.getState().currentMapping?.figmaNodeId??null,Gn=ft.getState().figmaImageUrl;if(bt&&(y.debug("[Review] Using Figma node ID from store:",bt),Gn&&(pe(65,"Using existing Figma design..."),y.debug("[Review] Reusing already-loaded Figma image"))),!bt)try{let Qe=await fetch(`${dm}/api/mappings?projectId=${xe}&storyId=${ae}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let Rt=await Qe.json();Rt.mapping?.figmaNodeId?(bt=Rt.mapping.figmaNodeId,y.debug("[Review] Found Figma node ID from API:",bt)):y.debug("[Review] No mapping found for story:",ae)}else y.debug("[Review] Failed to fetch mapping:",Qe.status)}catch(Qe){y.error("[Review] Error fetching mapping:",Qe)}if(bt&&!Gn){pe(65,"Fetching Figma design...");try{let Qe=await fetch(`${dm}/api/figma/frames?projectId=${xe}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let $t=(await Qe.json()).thumbnails?.[bt];$t?(w($t),y.debug("[Review] Figma thumbnail fetched and displayed:",$t)):y.warn("[Review] No thumbnail found for node:",bt)}else y.warn("[Review] Failed to fetch Figma frames:",Qe.status)}catch(Qe){y.error("[Review] Error fetching Figma frames:",Qe)}}if(!bt)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');pe(80,"AI is analyzing your component..."),y.debug("[Review] Sending to streaming API...");let nr={projectId:xe,storyId:ae,storyName:Ke,storybookScreenshot:Y,computedStyles:O,declaredStyles:U,textElementStyles:Be,nestedElementStyles:_e,componentMarkup:H,domTree:ie,figmaNodeId:bt,figmaImageUrl:Gn||void 0,aiModels:l,includeTextComparison:h,usePromptCache:j,parentReviewId:tt?he:void 0,isIteration:tt};y.debug("[Review] Request payload:",{...nr,storybookScreenshot:Y?`${Y.substring(0,50)}...`:null,domTree:ie?{selector:ie.selector,childrenCount:ie.children.length}:null}),Te.current=new AbortController;let En=await fetch(`${dm}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:JSON.stringify(nr),signal:Te.current.signal});if(y.debug("[Review] Response status:",En.status,En.statusText),!En.ok){let Qe=await En.json();if(y.error("[Review] API error response:",Qe),En.status===429){let Rt=Qe.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${Rt} seconds before trying again.`)}if(En.status===402){if(Qe.code==="INSUFFICIENT_CREDITS"){let Rt=Qe.details?.required??1,$t=Qe.details?.balance??0;throw new Error(`Not enough credits. This review requires ${Rt} credit(s) but you have ${$t}. Visit Settings to add more.`)}throw Qe.code==="SUBSCRIPTION_LIMIT_EXCEEDED"?new Error(Qe.message||"Monthly review limit reached. Upgrade your plan to continue."):new Error(Qe.message||"Payment required")}throw En.status===401&&Qe.code==="FIGMA_AUTH_EXPIRED"?new Error("Figma connection expired. Open Settings \u2192 Disconnect \u2192 Reconnect Figma to continue."):new Error(Qe.error||Qe.message||"Review request failed")}let mo=En.body?.getReader(),wn=new TextDecoder,Br="",rn="",$e=null,uu=null,ny=l.length>1,Vo={},ls={},xV={};if(!mo)throw new Error("Response body is not readable");let ry=ft.getState().streamingMessages.length;for(Ae("assistant","");;){let{done:Qe,value:Rt}=await mo.read();if(Qe)break;Br+=wn.decode(Rt,{stream:!0});let $t=Br.split(`
|
|
17
|
-
`);Br=$t.pop()||"";for(let qn of $t)if(qn.startsWith("data: ")){let pn=qn.slice(6);if(pn==="[DONE]")continue;try{let re=JSON.parse(pn);if(re.type!=="text"&&re.type!=="content"&&y.debug("[Review] SSE Event received:",re.type),re.type==="prompt")re.prompt&&(z(re.prompt),y.debug("[Review] Prompt received early"));else if(re.type==="model_started")y.debug("[Review] Model started:",re.modelId),Vo[re.modelId]||(Vo[re.modelId]="",
|
|
12
|
+
--`+new Array((n||t.length)+1).join("-")+"^"})}var $b=_(()=>{"use strict";al()});var KA,XA,QA,JA,ZA,Ub,kl,jb=_(()=>{"use strict";$b();KA=9,XA=10,QA=12,JA=13,ZA=32,Ub=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),kl=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&&Ub[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 n=this.str.charCodeAt(t);if(n!==JA&&n!==XA&&n!==QA&&n!==ZA&&n!==KA)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 _b(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 n=this.str.charCodeAt(t);if(n>=128||Ub[n]===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 n=this.str.charCodeAt(t);if(n<48||n>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 Yb(e){let t=null,n=null;return e.eat(Il),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===lp?(e.pos++,e.skipWs(),e.charCode()!==ip&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(ip),{min:Number(t),max:n?Number(n):0}}function sP(e){let t=null,n=!1;switch(e.charCode()){case Jb:e.pos++,t={min:0,max:0};break;case ap:e.pos++,t={min:1,max:0};break;case Tl:e.pos++,t={min:0,max:1};break;case sp:e.pos++,n=!0,e.charCode()===Il?t=Yb(e):e.charCode()===Tl?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case Il:t=Yb(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function Zr(e,t){let n=sP(e);return n!==null?(n.term=t,e.charCode()===sp&&e.charCodeAt(e.pos-1)===ap||e.charCode()===Tl&&e.charCodeAt(e.pos-1)===ip?Zr(e,n):n):t}function rp(e){let t=e.peek();return t===""?null:Zr(e,{type:"Token",value:t})}function aP(e){let t;return e.eat(cp),e.eat(Cl),t=e.scanWord(),e.eat(Cl),e.eat(op),Zr(e,{type:"Property",name:t})}function lP(e){let t=null,n=null,r=1;return e.eat(Es),e.charCode()===Wb&&(e.peek(),r=-1),r==-1&&e.charCode()===Gb?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(lp),e.skipWs(),e.charCode()===Gb?e.peek():(r=1,e.charCode()===Wb&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(Ii),{type:"Range",min:t,max:n}}function cP(e){let t,n=null;if(e.eat(cp),t=e.scanWord(),t==="boolean-expr"){e.eat(Es);let r=Fl(e,Ii);return e.eat(Ii),e.eat(op),Zr(e,{type:"Boolean",term:r.terms.length===1?r.terms[0]:r})}return e.charCode()===Xb&&e.nextCharCode()===Qb&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===Es&&(e.skipWs(),n=lP(e)),e.eat(op),Zr(e,{type:"Type",name:t,opts:n})}function uP(e){let t=e.scanWord();return e.charCode()===Xb?(e.pos++,{type:"Function",name:t}):Zr(e,{type:"Keyword",name:t})}function pP(e,t){function n(o,i){return{type:"Group",terms:o,combinator:i,disallowEmpty:!1,explicit:!1}}let r;for(t=Object.keys(t).sort((o,i)=>qb[o]-qb[i]);t.length>0;){r=t.shift();let o=0,i=0;for(;o<e.length;o++){let s=e[o];s.type==="Combinator"&&(s.value===r?(i===-1&&(i=o-1),e.splice(o,1),o--):(i!==-1&&o-i>1&&(e.splice(i,o-i,n(e.slice(i,o),r)),o=i+1),i=-1))}i!==-1&&t.length&&e.splice(i,o-i,n(e.slice(i,o),r))}return r}function Fl(e,t=-1){let n=Object.create(null),r=[],o=null,i=e.pos,s=!1;for(;e.charCode()!==t;){let a=s?Fl(e,Qb):gP(e);if(!a)break;if(a.type!=="Spaces"){if(s){if(a.terms.length===0){s=!1;continue}if(a.combinator===" "){for(;a.terms.length>1;)n[" "]=!0,r.push({type:"Combinator",value:" "},a.terms.shift());a=a.terms[0]}}a.type==="Combinator"?((o===null||o.type==="Combinator")&&(e.pos=i,e.error("Unexpected combinator")),n[a.value]=!0):o!==null&&o.type!=="Combinator"&&(n[" "]=!0,r.push({type:"Combinator",value:" "})),r.push(a),o=a,i=e.pos,s=a.type==="Function"}}return o!==null&&o.type==="Combinator"&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:r,combinator:pP(r,n)||" ",disallowEmpty:!1,explicit:!1}}function dP(e){let t;return e.eat(Es),t=Fl(e,Ii),e.eat(Ii),t.explicit=!0,e.charCode()===Kb&&(e.pos++,t.disallowEmpty=!0),t}function gP(e){let t=e.charCode();switch(t){case Ii:break;case Es:return Zr(e,dP(e));case cp:return e.nextCharCode()===Cl?aP(e):cP(e);case Vb:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===Vb?2:1))};case Hb:return e.pos++,e.eat(Hb),{type:"Combinator",value:"&&"};case lp:return e.pos++,{type:"Comma"};case Cl:return Zr(e,{type:"String",value:e.scanString()});case oP:case eP:case tP:case rP:case nP:return{type:"Spaces",value:e.scanSpaces()};case iP:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):rp(e);case Jb:case ap:case Tl:case sp:case Kb:break;case Il:if(t=e.nextCharCode(),t<48||t>57)return rp(e);break;default:return e.isNameCharCode(t)?uP(e):rp(e)}}function As(e){let t=new kl(e),n=Fl(t);return t.pos!==e.length&&t.error("Unexpected input"),n.terms.length===1&&n.terms[0].type==="Group"?n.terms[0]:n}var eP,tP,nP,rP,oP,Kb,sp,Hb,Cl,Xb,Qb,Jb,ap,lp,Wb,cp,op,Tl,iP,Es,Ii,Il,Vb,ip,Gb,qb,up=_(()=>{"use strict";jb();eP=9,tP=10,nP=12,rP=13,oP=32,Kb=33,sp=35,Hb=38,Cl=39,Xb=40,Qb=41,Jb=42,ap=43,lp=44,Wb=45,cp=60,op=62,Tl=63,iP=64,Es=91,Ii=93,Il=123,Vb=124,ip=125,Gb=8734,qb={" ":1,"&&":2,"||":3,"|":4}});function Zb(e){return typeof e=="function"?e:Ps}function pp(e,t,n){function r(s){switch(o.call(n,s),s.type){case"Group":s.terms.forEach(r);break;case"Multiplier":case"Boolean":r(s.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: "+s.type)}i.call(n,s)}let o=Ps,i=Ps;if(typeof t=="function"?o=t:t&&(o=Zb(t.enter),i=Zb(t.leave)),o===Ps&&i===Ps)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var Ps,e0=_(()=>{"use strict";Ps=function(){}});var dp=_(()=>{"use strict";Hu();up();e0()});function hP(e){let t=[];return wo(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function t0(e,t){return typeof e=="string"?hP(e):t.generate(e,mP)}var mP,n0=_(()=>{"use strict";sr();mP={decorator(e){let t=[],n=null;return{...e,node(r){let o=n;n=r,e.node.call(this,r),n=o},emit(r,o,i){t.push({type:o,value:r,node:i?null:n})},result(){return t}}}}});function bn(e,t,n){return t===pt&&n===St||e===pt&&t===pt&&n===pt?e:(e.type==="If"&&e.else===St&&t===pt&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function o0(e){return e.length>2&&e.charCodeAt(e.length-2)===xP&&e.charCodeAt(e.length-1)===yP}function r0(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&o0(e.name)}function ko(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function Ls(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=Ls(e.match,t,n),e.then=Ls(e.then,t,n),e.else=Ls(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function gp(e,t,n){switch(e){case" ":{let r=pt;for(let o=t.length-1;o>=0;o--){let i=t[o];r=bn(i,r,St)}return r}case"|":{let r=St,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(r0(s)&&(o===null&&i>0&&r0(t[i-1])&&(o=Object.create(null),r=bn({type:"Enum",map:o},pt,r)),o!==null)){let a=(o0(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=bn(s,pt,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=gp(e,t.filter(function(a){return a!==i}),!1):s=pt,r=bn(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?pt:St;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=gp(e,t.filter(function(a){return a!==i}),!0):s=pt,r=bn(i,s,r)}return r}}}function bP(e){let t=pt,n=Fi(e.term);if(e.max===0)n=bn(n,El,St),t=bn(n,null,St),t.then=bn(pt,pt,t),e.comma&&(t.then.else=bn({type:"Comma",syntax:e},t,St));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,bn(pt,pt,t),St);if(e.min===0)t=bn(pt,pt,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==pt&&(t=bn({type:"Comma",syntax:e},t,St)),t=bn(n,t,St);return t}function Fi(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=gp(e.combinator,e.terms.map(Fi),!1);return e.disallowEmpty&&(t=bn(t,El,St)),t}case"Multiplier":return bP(e);case"Boolean":{let t=Fi(e.term),n=Fi(ko([ko([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),ko([{type:"Type",name:"!boolean-group"},ko([{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:ko([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),r=Fi(ko([{type:"Type",name:"!term"},ko([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return Ls(r,{"!term":t,"!self":n}),Ls(n,{"!boolean-group":r}),n}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 Ms(e,t){return typeof e=="string"&&(e=As(e)),{type:"MatchGraph",match:Fi(e),syntax:t||null,source:e}}var pt,St,El,xP,yP,fp=_(()=>{"use strict";up();pt={type:"Match"},St={type:"Mismatch"},El={type:"DisallowEmpty"},xP=40,yP=41});function TP(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function mp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=t.charCodeAt(n),o=e.charCodeAt(n);if(o>=65&&o<=90&&(o=o|32),o!==r)return!1}return!0}function IP(e){return e.type!==9?!1:e.value!=="?"}function l0(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||IP(e)}function c0(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function FP(e,t,n){function r(){do I++,E=I<e.length?e[I]:null;while(E!==null&&(E.type===13||E.type===25))}function o($){let P=I+$;return P<e.length?e[P]:null}function i($,P){return{nextState:$,matchStack:R,syntaxStack:d,thenStack:g,tokenIndex:I,prev:P}}function s($){g={nextState:$,matchStack:R,syntaxStack:d,prev:g}}function a($){p=i($,p)}function u(){R={type:wP,syntax:t.syntax,token:E,prev:R},r(),f=null,I>D&&(D=I)}function c(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},R={type:hp,syntax:t.syntax,token:R.token,prev:R}}function l(){R.type===hp?R=R.prev:R={type:u0,syntax:d.syntax,token:R.token,prev:R},d=d.prev}let d=null,g=null,p=null,f=null,k=0,T=null,E=null,I=-1,D=0,R={type:SP,syntax:null,token:null,prev:null};for(r();T===null&&++k<a0;)switch(t.type){case"Match":if(g===null){if(E!==null&&(I!==e.length-1||E.value!=="\\0"&&E.value!=="\\9")){t=St;break}T=s0;break}if(t=g.nextState,t===El)if(g.matchStack===R){t=St;break}else t=pt;for(;g.syntaxStack!==d;)l();g=g.prev;break;case"Mismatch":if(f!==null&&f!==!1)(p===null||I>p.tokenIndex)&&(p=f,f=!1);else if(p===null){T=vP;break}t=p.nextState,g=p.thenStack,d=p.syntaxStack,R=p.matchStack,I=p.tokenIndex,E=I<e.length?e[I]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==St&&a(t.else),t.then!==pt&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let z=t.syntax.terms;if(t.index===z.length){if(t.mask===0||t.syntax.all){t=St;break}t=pt;break}if(t.mask===(1<<z.length)-1){t=pt;break}for(;t.index<z.length;t.index++){let x=1<<t.index;if((t.mask&x)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|x}),t=z[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(E!==null){let z=E.value.toLowerCase();if(z.indexOf("\\")!==-1&&(z=z.replace(/\\[09].*$/,"")),i0.call(t.map,z)){t=t.map[z];break}}t=St;break;case"Generic":{let z=d!==null?d.opts:null,x=I+Math.floor(t.fn(E,o,z));if(!isNaN(x)&&x>I){for(;I<x;)u();t=pt}else t=St;break}case"Type":case"Property":{let z=t.type==="Type"?"types":"properties",x=i0.call(n,z)?n[z][t.name]:null;if(!x||!x.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(f!==!1&&E!==null&&t.type==="Type"&&(t.name==="custom-ident"&&E.type===1||t.name==="length"&&E.value==="0")){f===null&&(f=i(t,p)),t=St;break}c(),t=x.matchRef||x.match;break}case"Keyword":{let z=t.name;if(E!==null){let x=E.value;if(x.indexOf("\\")!==-1&&(x=x.replace(/\\[09].*$/,"")),mp(x,z)){u(),t=pt;break}}t=St;break}case"AtKeyword":case"Function":if(E!==null&&mp(E.value,t.name)){u(),t=pt;break}t=St;break;case"Token":if(E!==null&&E.value===t.value){u(),t=pt;break}t=St;break;case"Comma":E!==null&&E.type===18?l0(R.token)?t=St:(u(),t=c0(E)?St:pt):t=l0(R.token)||c0(E)?pt:St;break;case"String":let $="",P=I;for(;P<e.length&&$.length<t.value.length;P++)$+=e[P].value;if(mp($,t.value)){for(;I<P;)u();t=pt}else t=St;break;default:throw new Error("Unknown node type: "+t.type)}switch(CP+=k,T){case null:console.warn("[csstree-match] BREAK after "+a0+" iterations"),T=kP,R=null;break;case s0:for(;d!==null;)l();break;default:R=null}return{tokens:e,reason:T,iterations:k,match:R,longestMatch:D}}function xp(e,t,n){let r=FP(e,t,n||{});if(r.match===null)return r;let o=r.match,i=r.match={syntax:t.syntax||null,match:[]},s=[i];for(o=TP(o).prev;o!==null;){switch(o.type){case hp:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case u0:s.pop(),i=s[s.length-1];break;default:i.match.push({syntax:o.syntax||null,token:o.token.value,node:o.token.node})}o=o.prev}return r}var i0,SP,wP,hp,u0,s0,vP,kP,a0,CP,p0=_(()=>{"use strict";fp();({hasOwnProperty:i0}=Object.prototype),SP=0,wP=1,hp=2,u0=3,s0="Match",vP="Mismatch",kP="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",a0=15e3,CP=0});var bp={};Se(bp,{getTrace:()=>d0,isKeyword:()=>PP,isProperty:()=>AP,isType:()=>EP});function d0(e){function t(o){return o===null?!1:o.type==="Type"||o.type==="Property"||o.type==="Keyword"}function n(o){if(Array.isArray(o.match)){for(let i=0;i<o.match.length;i++)if(n(o.match[i]))return t(o.syntax)&&r.unshift(o.syntax),!0}else if(o.node===e)return r=t(o.syntax)?[o.syntax]:[],!0;return!1}let r=null;return this.matched!==null&&n(this.matched),r}function EP(e,t){return yp(this,e,n=>n.type==="Type"&&n.name===t)}function AP(e,t){return yp(this,e,n=>n.type==="Property"&&n.name===t)}function PP(e){return yp(this,e,t=>t.type==="Keyword")}function yp(e,t,n){let r=d0.call(e,t);return r===null?!1:r.some(n)}var g0=_(()=>{"use strict"});function f0(e){return"node"in e?e.node:f0(e.match[0])}function m0(e){return"node"in e?e.node:m0(e.match[e.match.length-1])}function Sp(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){let u=f0(a),c=m0(a);e.syntax.walk(t,function(l,d,g){if(l===u){let p=new Xn;do{if(p.appendData(d.data),d.data===c)break;d=d.next}while(d!==null);s.push({parent:g,nodes:p})}})}Array.isArray(a.match)&&a.match.forEach(i)}let s=[];return n.matched!==null&&i(n.matched),s}var h0=_(()=>{"use strict";Ss()});function wp(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function x0(e){return!!e&&wp(e.offset)&&wp(e.line)&&wp(e.column)}function LP(e,t){return function(r,o){if(!r||r.constructor!==Object)return o(r,"Type of node should be an Object");for(let i in r){let s=!0;if(Bs.call(r,i)!==!1){if(i==="type")r.type!==e&&o(r,"Wrong node type `"+r.type+"`, expected `"+e+"`");else if(i==="loc"){if(r.loc===null)continue;if(r.loc&&r.loc.constructor===Object)if(typeof r.loc.source!="string")i+=".source";else if(!x0(r.loc.start))i+=".start";else if(!x0(r.loc.end))i+=".end";else continue;s=!1}else if(t.hasOwnProperty(i)){s=!1;for(let a=0;!s&&a<t[i].length;a++){let u=t[i][a];switch(u){case String:s=typeof r[i]=="string";break;case Boolean:s=typeof r[i]=="boolean";break;case null:s=r[i]===null;break;default:typeof u=="string"?s=r[i]&&r[i].type===u:Array.isArray(u)&&(s=r[i]instanceof Xn)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(let i in t)Bs.call(t,i)&&Bs.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function y0(e,t){let n=[];for(let r=0;r<e.length;r++){let o=e[r];if(o===String||o===Boolean)n.push(o.name.toLowerCase());else if(o===null)n.push("null");else if(typeof o=="string")n.push(o);else if(Array.isArray(o))n.push("List<"+(y0(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return n.join(" | ")}function MP(e,t){let n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in n){if(Bs.call(n,i)===!1)continue;let s=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];o[i]=y0(s,e+"."+i)}return{docs:o,check:LP(e,r)}}function b0(e){let t={};if(e.node){for(let n in e.node)if(Bs.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=MP(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}var Bs,S0=_(()=>{"use strict";Ss();({hasOwnProperty:Bs}=Object.prototype)});function vp(e,t,n){let r={};for(let o in e)e[o].syntax&&(r[o]=n?e[o].syntax:wi(e[o].syntax,{compact:t}));return r}function BP(e,t,n){let r={};for(let[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:wi(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&vp(i.descriptors,t,n)};return r}function DP(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function RP(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function kr(e,t,n){return{matched:e,iterations:n,error:t,...bp}}function Ei(e,t,n,r){let o=t0(n,e.syntax),i;return DP(o)?kr(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=xp(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=xp(o,t.match,e),!i.match)?kr(null,new kb(i.reason,t.syntax,n,i),i.iterations):kr(i.match,null,i.iterations))}var Ds,w0=_(()=>{"use strict";Cb();yl();bl();Nb();Ob();dp();n0();fp();p0();g0();h0();S0();Ds=class{constructor(t,n,r){if(this.cssWideKeywords=Ci,this.syntax=n,this.generic=!1,this.units={...vl},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=r||b0(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(vl))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(zb(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=Ms(this.cssWideKeywords.join(" | "))}checkStructure(t){function n(i,s){o.push({node:i,message:s})}let r=this.structure,o=[];return this.syntax.walk(t,function(i){r.hasOwnProperty(i.type)?r[i.type].check(i,n):n(i,"Unknown node type `"+i.type+"`")}),o.length?o:!1}createDescriptor(t,n,r,o=null){let i={type:n,name:r},s={type:n,name:r,parent:o,serializable:typeof t=="string"||t&&typeof t.type=="string",syntax:null,match:null,matchRef:null};return typeof t=="function"?s.match=Ms(t,i):(typeof t=="string"?Object.defineProperty(s,"syntax",{get(){return Object.defineProperty(s,"syntax",{value:As(t)}),s.syntax}}):s.syntax=t,Object.defineProperty(s,"match",{get(){return Object.defineProperty(s,"match",{value:Ms(s.syntax,i)}),s.match}}),n==="Property"&&Object.defineProperty(s,"matchRef",{get(){let a=s.syntax,u=RP(a)?Ms({...a,terms:[a.terms[0].term]},i):null;return Object.defineProperty(s,"matchRef",{value:u}),u}})),s}addAtrule_(t,n){n&&(this.atrules[t]={type:"Atrule",name:t,prelude:n.prelude?this.createDescriptor(n.prelude,"AtrulePrelude",t):null,descriptors:n.descriptors?Object.keys(n.descriptors).reduce((r,o)=>(r[o]=this.createDescriptor(n.descriptors[o],"AtruleDescriptor",o,t),r),Object.create(null)):null})}addProperty_(t,n){n&&(this.properties[t]=this.createDescriptor(n,"Property",t))}addType_(t,n){n&&(this.types[t]=this.createDescriptor(n,"Type",t))}checkAtruleName(t){if(!this.getAtrule(t))return new vi("Unknown at-rule","@"+t)}checkAtrulePrelude(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t);if(!o.prelude&&n)return new SyntaxError("At-rule `@"+t+"` should not contain a prelude");if(o.prelude&&!n&&!Ei(this,o.prelude,"",!1).matched)return new SyntaxError("At-rule `@"+t+"` should contain a prelude")}checkAtruleDescriptorName(t,n){let r=this.checkAtruleName(t);if(r)return r;let o=this.getAtrule(t),i=hl(n);if(!o.descriptors)return new SyntaxError("At-rule `@"+t+"` has no known descriptors");if(!o.descriptors[i.name]&&!o.descriptors[i.basename])return new vi("Unknown at-rule descriptor",n)}checkPropertyName(t){if(!this.getProperty(t))return new vi("Unknown property",t)}matchAtrulePrelude(t,n){let r=this.checkAtrulePrelude(t,n);if(r)return kr(null,r);let o=this.getAtrule(t);return o.prelude?Ei(this,o.prelude,n||"",!1):kr(null,null)}matchAtruleDescriptor(t,n,r){let o=this.checkAtruleDescriptorName(t,n);if(o)return kr(null,o);let i=this.getAtrule(t),s=hl(n);return Ei(this,i.descriptors[s.name]||i.descriptors[s.basename],r,!1)}matchDeclaration(t){return t.type!=="Declaration"?kr(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,n){if(Wu(t).custom)return kr(null,new Error("Lexer matching doesn't applicable for custom properties"));let r=this.checkPropertyName(t);return r?kr(null,r):Ei(this,this.getProperty(t),n,!0)}matchType(t,n){let r=this.getType(t);return r?Ei(this,r,n,!1):kr(null,new vi("Unknown type",t))}match(t,n){return typeof t!="string"&&(!t||!t.type)?kr(null,new vi("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),Ei(this,t,n,!1))}findValueFragments(t,n,r,o){return Sp(this,n,this.matchProperty(t,n),r,o)}findDeclarationValueFragments(t,n,r){return Sp(this,t.value,this.matchDeclaration(t),n,r)}findAllFragments(t,n,r){let o=[];return this.syntax.walk(t,{visit:"Declaration",enter:i=>{o.push.apply(o,this.findDeclarationValueFragments(i,n,r))}}),o}getAtrule(t,n=!0){let r=hl(t);return(r.vendor&&n?this.atrules[r.name]||this.atrules[r.basename]:this.atrules[r.name])||null}getAtrulePrelude(t,n=!0){let r=this.getAtrule(t,n);return r&&r.prelude||null}getAtruleDescriptor(t,n){return this.atrules.hasOwnProperty(t)&&this.atrules.declarators&&this.atrules[t].declarators[n]||null}getProperty(t,n=!0){let r=Wu(t);return(r.vendor&&n?this.properties[r.name]||this.properties[r.basename]:this.properties[r.name])||null}getType(t){return hasOwnProperty.call(this.types,t)?this.types[t]:null}validate(){function t(u,c){return c?`<${u}>`:`<'${u}'>`}function n(u,c,l,d){if(l.has(c))return l.get(c);l.set(c,!1),d.syntax!==null&&pp(d.syntax,function(g){if(g.type!=="Type"&&g.type!=="Property")return;let p=g.type==="Type"?u.types:u.properties,f=g.type==="Type"?o:i;hasOwnProperty.call(p,g.name)?n(u,g.name,f,p[g.name])&&(r.push(`${t(c,l===o)} used broken syntax definition ${t(g.name,g.type==="Type")}`),l.set(c,!0)):(r.push(`${t(c,l===o)} used missed syntax definition ${t(g.name,g.type==="Type")}`),l.set(c,!0))},this)}let r=[],o=new Map,i=new Map;for(let u in this.types)n(this,u,o,this.types[u]);for(let u in this.properties)n(this,u,i,this.properties[u]);let s=[...o.keys()].filter(u=>o.get(u)),a=[...i.keys()].filter(u=>i.get(u));return s.length||a.length?{errors:r,types:s,properties:a}:null}dump(t,n){return{generic:this.generic,cssWideKeywords:this.cssWideKeywords,units:this.units,types:vp(this.types,!n,t),properties:vp(this.properties,!n,t),atrules:BP(this.atrules,!n,t)}}toString(){return JSON.stringify(this.dump())}}});function kp(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function zP(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function Cp(e,t,n){let r={...e};for(let[o,i]of Object.entries(t))r[o]={...r[o],...n?zP(i,n):i};return r}function Rs(e,t){let n={...e};for(let[r,o]of Object.entries(t))switch(r){case"generic":n[r]=!!o;break;case"cssWideKeywords":n[r]=e[r]?[...e[r],...o]:o||[];break;case"units":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=Array.isArray(s)?s:[];break;case"atrules":n[r]={...e[r]};for(let[i,s]of Object.entries(o)){let a=n[r][i]||{},u=n[r][i]={prelude:a.prelude||null,descriptors:{...a.descriptors}};if(s){u.prelude=s.prelude?kp(u.prelude,s.prelude):u.prelude||null;for(let[c,l]of Object.entries(s.descriptors||{}))u.descriptors[c]=l?kp(u.descriptors[c],l):null;Object.keys(u.descriptors).length||(u.descriptors=null)}}break;case"types":case"properties":n[r]={...e[r]};for(let[i,s]of Object.entries(o))n[r][i]=kp(n[r][i],s);break;case"parseContext":n[r]={...e[r],...o};break;case"scope":case"features":n[r]=Cp(e[r],o);break;case"atrule":case"pseudo":n[r]=Cp(e[r],o,["parse"]);break;case"node":n[r]=Cp(e[r],o,["name","structure","parse","generate","walkContext"]);break}return n}var v0=_(()=>{"use strict"});function k0(e){let t=Oy(e),n=Sb(e),r=db(e),{fromPlainObject:o,toPlainObject:i}=fb(n),s={lexer:null,createLexer:a=>new Ds(a,s,s.lexer.structure),tokenize:wo,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){let u=Rs({},e);return k0(typeof a=="function"?a(u):Rs(u,a))}};return s.lexer=new Ds({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var C0,T0=_(()=>{"use strict";sr();_y();gb();mb();wb();w0();v0();C0=e=>k0(Rs({},e))});var I0,F0=_(()=>{"use strict";I0={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 Fp={};Se(Fp,{generate:()=>$P,name:()=>OP,parse:()=>Ip,structure:()=>_P});function Pl(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Or||r===Qn)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)Ut(this.charCodeAt(n))||this.error("Integer is expected",n)}function Ai(e){return Pl.call(this,0,e)}function Co(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case Al:n="N is expected";break;case Qn:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function Tp(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim(Or,e)||this.isDelim(Qn,e)){t=this.isDelim(Or,e)?Or:Qn;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),Ai.call(this,Xo))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==Or&&n!==Qn&&this.error("Number sign is expected")),Ai.call(this,t!==0),t===Qn?"-"+this.consume(10):this.consume(10)}function Ip(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)Ai.call(this,NP),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Qn))switch(t="-1",Co.call(this,1,Al),this.tokenEnd-this.tokenStart){case 2:this.next(),n=Tp.call(this);break;case 3:Co.call(this,2,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,2,Qn),Pl.call(this,3,Xo),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(Or)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim(Or)&&(r=1,this.next()),Co.call(this,0,Al),this.tokenEnd-this.tokenStart){case 1:this.next(),n=Tp.call(this);break;case 2:Co.call(this,1,Qn),this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10);break;default:Co.call(this,1,Qn),Pl.call(this,2,Xo),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),o=r===Or||r===Qn,i=this.tokenStart+o;for(;i<this.tokenEnd&&Ut(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),Co.call(this,i-this.tokenStart,Al),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=Tp.call(this)):(Co.call(this,i-this.tokenStart+1,Qn),i+2===this.tokenEnd?(this.next(),this.skipSC(),Ai.call(this,Xo),n="-"+this.consume(10)):(Pl.call(this,i-this.tokenStart+2,Xo),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===Or&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===Or&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function $P(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 n=e.b[0]==="-"||e.b[0]==="+"?e.b:"+"+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}var Or,Qn,Al,Xo,NP,OP,_P,Ep=_(()=>{"use strict";sr();Or=43,Qn=45,Al=110,Xo=!0,NP=!1;OP="AnPlusB",_P={a:[String,null],b:[String,null]}});var Pp={};Se(Pp,{generate:()=>VP,name:()=>jP,parse:()=>Ap,structure:()=>WP,walkContext:()=>HP});function E0(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function UP(){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 Ap(e=!1){let t=this.tokenStart,n,r,o=null,i=null;switch(this.eat(3),n=this.substrToCursor(t+1),r=n.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(this.parseAtrulePrelude?o=this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),E0):o=E0.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:hasOwnProperty.call(this.atrule,r)&&typeof this.atrule[r].block=="function"?i=this.atrule[r].block.call(this,e):i=this.Block(UP.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:o,block:i}}function VP(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var jP,HP,WP,Lp=_(()=>{"use strict";jP="Atrule",HP="atrule",WP={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var Bp={};Se(Bp,{generate:()=>KP,name:()=>GP,parse:()=>Mp,structure:()=>YP,walkContext:()=>qP});function Mp(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 KP(e){this.children(e)}var GP,qP,YP,Dp=_(()=>{"use strict";GP="AtrulePrelude",qP="atrulePrelude",YP={children:[[]]}});var Np={};Se(Np,{generate:()=>r2,name:()=>t2,parse:()=>zp,structure:()=>n2});function ZP(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(A0)?(t=!0,this.next()):this.isDelim(Rp)||this.eat(1),this.isDelim(Rp)?this.charCodeAt(this.tokenStart+1)!==Ll?(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 e2(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==Ll&&t!==JP&&t!==QP&&t!==XP&&t!==A0&&t!==Rp&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==Ll&&(this.isDelim(Ll)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function zp(){let e=this.tokenStart,t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=ZP.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=e2.call(this),this.skipSC(),r=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:n,value:r,flags:o}}function r2(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 XP,A0,Ll,QP,Rp,JP,t2,n2,Op=_(()=>{"use strict";XP=36,A0=42,Ll=61,QP=94,Rp=124,JP=126;t2="AttributeSelector",n2={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var $p={};Se($p,{generate:()=>c2,name:()=>s2,parse:()=>_p,structure:()=>l2,walkContext:()=>a2});function M0(){return this.Raw(null,!0)}function P0(){return this.parseWithFallback(this.Rule,M0)}function L0(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function i2(){if(this.tokenType===17)return L0.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,L0);return this.tokenType===17&&this.next(),e}function _p(e){let t=e?i2:P0,n=this.tokenStart,r=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:r.push(this.parseWithFallback(this.Atrule.bind(this,e),M0));break;default:e&&this.isDelim(o2)?r.push(P0.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function c2(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var o2,s2,a2,l2,Up=_(()=>{"use strict";o2=38;s2="Block",a2="block",l2={children:[["Atrule","Rule","Declaration"]]}});var Hp={};Se(Hp,{generate:()=>d2,name:()=>u2,parse:()=>jp,structure:()=>p2});function jp(e,t){let n=this.tokenStart,r=null;return this.eat(19),r=e.call(this,t),this.eof||this.eat(20),{type:"Brackets",loc:this.getLocation(n,this.tokenStart),children:r}}function d2(e){this.token(9,"["),this.children(e),this.token(9,"]")}var u2,p2,Wp=_(()=>{"use strict";u2="Brackets",p2={children:[[]]}});var Gp={};Se(Gp,{generate:()=>m2,name:()=>g2,parse:()=>Vp,structure:()=>f2});function Vp(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function m2(){this.token(15,"-->")}var g2,f2,qp=_(()=>{"use strict";g2="CDC",f2=[]});var Kp={};Se(Kp,{generate:()=>y2,name:()=>h2,parse:()=>Yp,structure:()=>x2});function Yp(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function y2(){this.token(14,"<!--")}var h2,x2,Xp=_(()=>{"use strict";h2="CDO",x2=[]});var Jp={};Se(Jp,{generate:()=>v2,name:()=>S2,parse:()=>Qp,structure:()=>w2});function Qp(){return this.eatDelim(b2),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function v2(e){this.token(9,"."),this.token(1,e.name)}var b2,S2,w2,Zp=_(()=>{"use strict";b2=46,S2="ClassSelector",w2={name:String}});var td={};Se(td,{generate:()=>E2,name:()=>I2,parse:()=>ed,structure:()=>F2});function ed(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case C2:case k2:case T2:this.next();break;case B0:this.next(),this.eatIdent("deep"),this.eatDelim(B0);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function E2(e){this.tokenize(e.name)}var k2,B0,C2,T2,I2,F2,nd=_(()=>{"use strict";k2=43,B0=47,C2=62,T2=126,I2="Combinator",F2={name:String}});var od={};Se(od,{generate:()=>B2,name:()=>L2,parse:()=>rd,structure:()=>M2});function rd(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===A2&&this.charCodeAt(t-1)===P2&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function B2(e){this.token(25,"/*"+e.value+"*/")}var A2,P2,L2,M2,id=_(()=>{"use strict";A2=42,P2=47,L2="Comment",M2={value:String}});var ad={};Se(ad,{generate:()=>O2,name:()=>R2,parse:()=>sd,structure:()=>z2});function D0(e){return this.lookupTypeNonSC(1)===1&&D2.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function sd(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 n=this.parseWithFallback(()=>N2[e].call(this,e),()=>null);n||(n=this.parseWithFallback(()=>{this.eat(21);let r=this.Condition(e);return this.eat(22),r},()=>this.GeneralEnclosed(e))),t.push(n);break}case 2:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||(n=this.GeneralEnclosed(e)),t.push(n);break}default:break e}return t.isEmpty&&this.error("Condition is expected"),{type:"Condition",loc:this.getLocationFromList(t),kind:e,children:t}}function O2(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var D2,R2,z2,N2,ld=_(()=>{"use strict";D2=new Set([16,22,0]),R2="Condition",z2={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};N2={media:D0,container:D0,supports(){return this.SupportsDeclaration()}}});var ud={};Se(ud,{generate:()=>X2,name:()=>q2,parse:()=>cd,structure:()=>K2,walkContext:()=>Y2});function W2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function V2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function G2(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(z0)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function cd(){let e=this.tokenStart,t=this.tokenIndex,n=Q2.call(this),r=xl(n),o=r?this.parseCustomProperty:this.parseValue,i=r?V2:W2,s=!1,a;this.skipSC(),this.eat(16);let u=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(G2,i):a=i.call(this,this.tokenIndex),r&&a.type==="Value"&&a.children.isEmpty){for(let c=u-this.tokenIndex;c<=0;c++)if(this.lookupType(c)===13){a.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}return this.isDelim(z0)&&(s=J2.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:s,property:n,value:a}}function X2(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 Q2(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case j2:case $2:case H2:case _2:case U2:this.next();break;case R0:this.next(),this.isDelim(R0)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function J2(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var z0,_2,$2,U2,j2,H2,R0,q2,Y2,K2,pd=_(()=>{"use strict";yl();z0=33,_2=35,$2=36,U2=38,j2=42,H2=43,R0=47;q2="Declaration",Y2="declaration",K2={important:[Boolean,String],property:String,value:["Value","Raw"]}});var fd={};Se(fd,{generate:()=>nL,name:()=>eL,parse:()=>gd,structure:()=>tL});function dd(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function gd(){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),dd));break;default:this.isDelim(Z2)?e.push(this.parseWithFallback(this.Rule,dd)):e.push(this.parseWithFallback(this.Declaration,dd))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function nL(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var Z2,eL,tL,md=_(()=>{"use strict";Z2=38;eL="DeclarationList",tL={children:[["Declaration","Atrule","Rule"]]}});var xd={};Se(xd,{generate:()=>iL,name:()=>rL,parse:()=>hd,structure:()=>oL});function hd(){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 iL(e){this.token(12,e.value+e.unit)}var rL,oL,yd=_(()=>{"use strict";rL="Dimension",oL={value:String,unit:String}});var Sd={};Se(Sd,{generate:()=>cL,name:()=>aL,parse:()=>bd,structure:()=>lL});function bd(e){let t=this.tokenStart,n,r=null;if(this.eat(21),this.skipSC(),n=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:this.lookupNonWSType(1)===9?r=this.Ratio():r=this.Number();break;case 12:r=this.Dimension();break;case 1:r=this.Identifier();break;case 2:r=this.parseWithFallback(()=>{let o=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(sL)&&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:n,value:r}}function cL(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var sL,aL,lL,wd=_(()=>{"use strict";sL=47,aL="Feature",lL={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var kd={};Se(kd,{generate:()=>gL,name:()=>uL,parse:()=>vd,structure:()=>pL});function dL(e,t){let r=(this.features[e]||{})[t];return typeof r!="function"&&this.error(`Unknown feature ${t}()`),r}function vd(e="unknown"){let t=this.tokenStart,n=this.consumeFunctionName(),r=dL.call(this,e,n.toLowerCase());this.skipSC();let o=this.parseWithFallback(()=>{let i=this.tokenIndex,s=r.call(this);return this.eof===!1&&this.isBalanceEdge(i)===!1&&this.error(),s},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:"FeatureFunction",loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:o}}function gL(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var uL,pL,Cd=_(()=>{"use strict";uL="FeatureFunction",pL={kind:String,feature:String,value:["Declaration","Selector"]}});var Fd={};Se(Fd,{generate:()=>yL,name:()=>hL,parse:()=>Id,structure:()=>xL});function Td(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(N0,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(N0)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function _0(e){if(this.skipSC(),this.isDelim(fL)||this.isDelim(mL)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(O0)?(this.next(),t+"="):t}if(this.isDelim(O0))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function Id(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=Td.call(this),r=_0.call(this,n.type==="Identifier"),o=Td.call(this),i=null,s=null;return this.lookupNonWSType(0)!==22&&(i=_0.call(this),s=Td.call(this)),this.skipSC(),this.eat(22),{type:"FeatureRange",loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:r,middle:o,rightComparison:i,right:s}}function yL(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 N0,fL,O0,mL,hL,xL,Ed=_(()=>{"use strict";N0=47,fL=60,O0=61,mL=62,hL="FeatureRange",xL={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 Pd={};Se(Pd,{generate:()=>vL,name:()=>bL,parse:()=>Ad,structure:()=>wL,walkContext:()=>SL});function Ad(e,t){let n=this.tokenStart,r=this.consumeFunctionName(),o=r.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(n,this.tokenStart),name:r,children:i}}function vL(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var bL,SL,wL,Ld=_(()=>{"use strict";bL="Function",SL="function",wL={name:String,children:[[]]}});var Bd={};Se(Bd,{generate:()=>TL,name:()=>kL,parse:()=>Md,structure:()=>CL});function Md(e){let t=this.tokenStart,n=null;this.tokenType===2?n=this.consumeFunctionName():this.eat(21);let r=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:n,children:r}}function TL(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var kL,CL,Dd=_(()=>{"use strict";kL="GeneralEnclosed",CL={kind:String,function:[String,null],children:[[]]}});var zd={};Se(zd,{generate:()=>AL,name:()=>FL,parse:()=>Rd,structure:()=>EL,xxx:()=>IL});function Rd(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function AL(e){this.token(4,"#"+e.value)}var IL,FL,EL,Nd=_(()=>{"use strict";IL="XXX",FL="Hash",EL={value:String}});var _d={};Se(_d,{generate:()=>ML,name:()=>PL,parse:()=>Od,structure:()=>LL});function Od(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function ML(e){this.token(1,e.name)}var PL,LL,$d=_(()=>{"use strict";PL="Identifier",LL={name:String}});var jd={};Se(jd,{generate:()=>RL,name:()=>BL,parse:()=>Ud,structure:()=>DL});function Ud(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function RL(e){this.token(9,"#"+e.name)}var BL,DL,Hd=_(()=>{"use strict";BL="IdSelector",DL={name:String}});var Vd={};Se(Vd,{generate:()=>_L,name:()=>NL,parse:()=>Wd,structure:()=>OL});function Wd(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(zL);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function _L(e){this.tokenize(e.name)}var zL,NL,OL,Gd=_(()=>{"use strict";zL=46,NL="Layer",OL={name:String}});var Yd={};Se(Yd,{generate:()=>jL,name:()=>$L,parse:()=>qd,structure:()=>UL});function qd(){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 jL(e){this.children(e,()=>this.token(18,","))}var $L,UL,Kd=_(()=>{"use strict";$L="LayerList",UL={children:[["Layer"]]}});var Qd={};Se(Qd,{generate:()=>VL,name:()=>HL,parse:()=>Xd,structure:()=>WL});function Xd(){let e=this.tokenStart,t=null,n=null,r=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,n=this.consume(1)):n=o,this.lookupTypeNonSC(0)){case 1:{this.skipSC(),this.eatIdent("and"),r=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:{r=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:n,condition:r}}function VL(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 HL,WL,Jd=_(()=>{"use strict";HL="MediaQuery",WL={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var eg={};Se(eg,{generate:()=>YL,name:()=>GL,parse:()=>Zd,structure:()=>qL});function Zd(){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 YL(e){this.children(e,()=>this.token(18,","))}var GL,qL,tg=_(()=>{"use strict";GL="MediaQueryList",qL={children:[["MediaQuery"]]}});var rg={};Se(rg,{generate:()=>JL,name:()=>XL,parse:()=>ng,structure:()=>QL});function ng(){let e=this.tokenStart;return this.eatDelim(KL),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function JL(){this.token(9,"&")}var KL,XL,QL,og=_(()=>{"use strict";KL=38,XL="NestingSelector",QL={}});var sg={};Se(sg,{generate:()=>tM,name:()=>ZL,parse:()=>ig,structure:()=>eM});function ig(){this.skipSC();let e=this.tokenStart,t=e,n=null,r;return this.lookupValue(0,"odd")||this.lookupValue(0,"even")?r=this.Identifier():r=this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:"Nth",loc:this.getLocation(e,t),nth:r,selector:n}}function tM(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var ZL,eM,ag=_(()=>{"use strict";ZL="Nth",eM={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var cg={};Se(cg,{generate:()=>oM,name:()=>nM,parse:()=>lg,structure:()=>rM});function lg(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function oM(e){this.token(10,e.value)}var nM,rM,ug=_(()=>{"use strict";nM="Number",rM={value:String}});var dg={};Se(dg,{generate:()=>aM,name:()=>iM,parse:()=>pg,structure:()=>sM});function pg(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function aM(e){this.tokenize(e.value)}var iM,sM,gg=_(()=>{"use strict";iM="Operator",sM={value:String}});var mg={};Se(mg,{generate:()=>uM,name:()=>lM,parse:()=>fg,structure:()=>cM});function fg(e,t){let n=this.tokenStart,r=null;return this.eat(21),r=e.call(this,t),this.eof||this.eat(22),{type:"Parentheses",loc:this.getLocation(n,this.tokenStart),children:r}}function uM(e){this.token(21,"("),this.children(e),this.token(22,")")}var lM,cM,hg=_(()=>{"use strict";lM="Parentheses",cM={children:[[]]}});var yg={};Se(yg,{generate:()=>gM,name:()=>pM,parse:()=>xg,structure:()=>dM});function xg(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function gM(e){this.token(11,e.value+"%")}var pM,dM,bg=_(()=>{"use strict";pM="Percentage",dM={value:String}});var wg={};Se(wg,{generate:()=>xM,name:()=>fM,parse:()=>Sg,structure:()=>hM,walkContext:()=>mM});function Sg(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function xM(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var fM,mM,hM,vg=_(()=>{"use strict";fM="PseudoClassSelector",mM="function",hM={name:String,children:[["Raw"],null]}});var Cg={};Se(Cg,{generate:()=>wM,name:()=>yM,parse:()=>kg,structure:()=>SM,walkContext:()=>bM});function kg(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function wM(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 yM,bM,SM,Tg=_(()=>{"use strict";yM="PseudoElementSelector",bM="function",SM={name:String,children:[["Raw"],null]}});var Fg={};Se(Fg,{generate:()=>CM,name:()=>vM,parse:()=>Ig,structure:()=>kM});function U0(){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 Ig(){let e=this.tokenStart,t=U0.call(this),n=null;return this.skipSC(),this.isDelim($0)&&(this.eatDelim($0),n=U0.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function CM(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var $0,vM,kM,Eg=_(()=>{"use strict";$0=47;vM="Ratio",kM={left:["Number","Function"],right:["Number","Function",null]}});var Pg={};Se(Pg,{generate:()=>EM,name:()=>IM,parse:()=>Ag,structure:()=>FM});function TM(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function Ag(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?r=TM.call(this):r=this.tokenStart,{type:"Raw",loc:this.getLocation(n,r),value:this.substring(n,r)}}function EM(e){this.tokenize(e.value)}var IM,FM,Lg=_(()=>{"use strict";IM="Raw",FM={value:String}});var Bg={};Se(Bg,{generate:()=>BM,name:()=>PM,parse:()=>Mg,structure:()=>MM,walkContext:()=>LM});function j0(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function AM(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function Mg(){let e=this.tokenIndex,t=this.tokenStart,n,r;return this.parseRulePrelude?n=this.parseWithFallback(AM,j0):n=j0.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function BM(e){this.node(e.prelude),this.node(e.block)}var PM,LM,MM,Dg=_(()=>{"use strict";PM="Rule",LM="rule",MM={prelude:["SelectorList","Raw"],block:["Block"]}});var zg={};Se(zg,{generate:()=>zM,name:()=>DM,parse:()=>Rg,structure:()=>RM});function Rg(){let e=null,t=null;this.skipSC();let n=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(n,this.tokenStart),root:e,limit:t}}function zM(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 DM,RM,Ng=_(()=>{"use strict";DM="Scope",RM={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var _g={};Se(_g,{generate:()=>_M,name:()=>NM,parse:()=>Og,structure:()=>OM});function Og(){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 _M(e){this.children(e)}var NM,OM,$g=_(()=>{"use strict";NM="Selector",OM={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var jg={};Se(jg,{generate:()=>HM,name:()=>$M,parse:()=>Ug,structure:()=>jM,walkContext:()=>UM});function Ug(){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 HM(e){this.children(e,()=>this.token(18,","))}var $M,UM,jM,Hg=_(()=>{"use strict";$M="SelectorList",UM="selector",jM={children:[["Selector","Raw"]]}});function Ml(e){let t=e.length,n=e.charCodeAt(0),r=n===H0||n===W0?1:0,o=r===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1,i="";for(let s=r;s<=o;s++){let a=e.charCodeAt(s);if(a===Wg){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),Pn(Wg,a)){let u=s-1,c=Yr(e,u);s=c-1,i+=tl(e.substring(u+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function V0(e,t){let n=t?"'":'"',r=t?W0:H0,o="",i=!1;for(let s=0;s<e.length;s++){let a=e.charCodeAt(s);if(a===0){o+="\uFFFD";continue}if(a<=31||a===127){o+="\\"+a.toString(16),i=!0;continue}a===r||a===Wg?(o+="\\"+e.charAt(s),i=!1):(i&&(Ln(a)||zr(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var Wg,H0,W0,Bl=_(()=>{"use strict";sr();Wg=92,H0=34,W0=39});var Gg={};Se(Gg,{generate:()=>GM,name:()=>WM,parse:()=>Vg,structure:()=>VM});function Vg(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:Ml(this.consume(5))}}function GM(e){this.token(5,V0(e.value))}var WM,VM,qg=_(()=>{"use strict";Bl();WM="String",VM={value:String}});var Kg={};Se(Kg,{generate:()=>QM,name:()=>YM,parse:()=>Yg,structure:()=>XM,walkContext:()=>KM});function q0(){return this.Raw(null,!1)}function Yg(){let e=this.tokenStart,t=this.createList(),n;for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==qM){this.next();continue}n=this.Comment();break;case 14:n=this.CDO();break;case 15:n=this.CDC();break;case 3:n=this.parseWithFallback(this.Atrule,q0);break;default:n=this.parseWithFallback(this.Rule,q0)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function QM(e){this.children(e)}var qM,YM,KM,XM,Xg=_(()=>{"use strict";qM=33;YM="StyleSheet",KM="stylesheet",XM={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var Jg={};Se(Jg,{generate:()=>eB,name:()=>JM,parse:()=>Qg,structure:()=>ZM});function Qg(){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 eB(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var JM,ZM,Zg=_(()=>{"use strict";JM="SupportsDeclaration",ZM={declaration:"Declaration"}});var nf={};Se(nf,{generate:()=>oB,name:()=>nB,parse:()=>tf,structure:()=>rB});function ef(){this.tokenType!==1&&this.isDelim(tB)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function tf(){let e=this.tokenStart;return this.isDelim(Y0)?(this.next(),ef.call(this)):(ef.call(this),this.isDelim(Y0)&&(this.next(),ef.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function oB(e){this.tokenize(e.name)}var tB,Y0,nB,rB,rf=_(()=>{"use strict";tB=42,Y0=124;nB="TypeSelector",rB={name:String}});var af={};Se(af,{generate:()=>cB,name:()=>aB,parse:()=>sf,structure:()=>lB});function zs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let o=this.charCodeAt(r);if(o===X0&&t&&n!==0)return zs.call(this,e+n+1,!1),-1;Ln(o)||this.error(t&&n!==0?"Hyphen minus"+(n<6?" or hex digit":"")+" is expected":n<6?"Hex digit is expected":"Unexpected input",r),++n>6&&this.error("Too many hex digits",r)}return this.next(),n}function Dl(e){let t=0;for(;this.isDelim(of);)++t>e&&this.error("Too many question marks"),this.next()}function iB(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===K0?"Plus sign":"Hyphen minus")+" is expected")}function sB(){let e=0;switch(this.tokenType){case 10:if(e=zs.call(this,1,!0),this.isDelim(of)){Dl.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){iB.call(this,X0),zs.call(this,1,!1);break}break;case 12:e=zs.call(this,1,!0),e>0&&Dl.call(this,6-e);break;default:if(this.eatDelim(K0),this.tokenType===1){e=zs.call(this,0,!0),e>0&&Dl.call(this,6-e);break}if(this.isDelim(of)){this.next(),Dl.call(this,5);break}this.error("Hex digit or question mark is expected")}}function sf(){let e=this.tokenStart;return this.eatIdent("u"),sB.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function cB(e){this.tokenize(e.value)}var K0,X0,of,aB,lB,lf=_(()=>{"use strict";sr();K0=43,X0=45,of=63;aB="UnicodeRange",lB={value:String}});function J0(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===Q0?t-2:t-1,o="";for(;n<r&&zr(e.charCodeAt(n));)n++;for(;n<r&&zr(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===cf){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),Pn(cf,s)){let a=i-1,u=Yr(e,a);i=u-1,o+=tl(e.substring(a+1,u))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function Z0(e){let t="",n=!1;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===0){t+="\uFFFD";continue}if(o<=31||o===127){t+="\\"+o.toString(16),n=!0;continue}o===uB||o===cf||o===pB||o===dB||o===gB||o===Q0?(t+="\\"+e.charAt(r),n=!1):(n&&Ln(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var uB,cf,pB,dB,gB,Q0,uf=_(()=>{"use strict";sr();uB=32,cf=92,pB=34,dB=39,gB=40,Q0=41});var df={};Se(df,{generate:()=>hB,name:()=>fB,parse:()=>pf,structure:()=>mB});function pf(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=J0(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=Ml(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 hB(e){this.token(7,Z0(e.value))}var fB,mB,gf=_(()=>{"use strict";uf();Bl();fB="Url",mB={value:String}});var mf={};Se(mf,{generate:()=>bB,name:()=>xB,parse:()=>ff,structure:()=>yB});function ff(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function bB(e){this.children(e)}var xB,yB,hf=_(()=>{"use strict";xB="Value",yB={children:[[]]}});var yf={};Se(yf,{generate:()=>kB,name:()=>wB,parse:()=>xf,structure:()=>vB});function xf(){return this.eat(13),SB}function kB(e){this.token(13,e.value)}var SB,wB,vB,bf=_(()=>{"use strict";SB=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),wB="WhiteSpace",vB={value:String}});var Ns={};Se(Ns,{AnPlusB:()=>Fp,Atrule:()=>Pp,AtrulePrelude:()=>Bp,AttributeSelector:()=>Np,Block:()=>$p,Brackets:()=>Hp,CDC:()=>Gp,CDO:()=>Kp,ClassSelector:()=>Jp,Combinator:()=>td,Comment:()=>od,Condition:()=>ad,Declaration:()=>ud,DeclarationList:()=>fd,Dimension:()=>xd,Feature:()=>Sd,FeatureFunction:()=>kd,FeatureRange:()=>Fd,Function:()=>Pd,GeneralEnclosed:()=>Bd,Hash:()=>zd,IdSelector:()=>jd,Identifier:()=>_d,Layer:()=>Vd,LayerList:()=>Yd,MediaQuery:()=>Qd,MediaQueryList:()=>eg,NestingSelector:()=>rg,Nth:()=>sg,Number:()=>cg,Operator:()=>dg,Parentheses:()=>mg,Percentage:()=>yg,PseudoClassSelector:()=>wg,PseudoElementSelector:()=>Cg,Ratio:()=>Fg,Raw:()=>Pg,Rule:()=>Bg,Scope:()=>zg,Selector:()=>_g,SelectorList:()=>jg,String:()=>Gg,StyleSheet:()=>Kg,SupportsDeclaration:()=>Jg,TypeSelector:()=>nf,UnicodeRange:()=>af,Url:()=>df,Value:()=>mf,WhiteSpace:()=>yf});var Sf=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tg();og();ag();ug();gg();hg();bg();vg();Tg();Eg();Lg();Dg();Ng();$g();Hg();qg();Xg();Zg();rf();lf();gf();hf();bf()});var tS,nS=_(()=>{"use strict";bl();F0();Sf();tS={generic:!0,cssWideKeywords:Ci,...I0,node:Ns}});function Os(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,EB)&&this.cmpChar(this.tokenStart+1,rS)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===FB||t===TB||t===rS||t===IB)return this.Operator();t===CB&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var CB,TB,rS,IB,FB,EB,wf=_(()=>{"use strict";CB=35,TB=42,rS=43,IB=45,FB=47,EB=117});var oS,iS=_(()=>{"use strict";wf();oS={getNode:Os}});function NB(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function OB(){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)===sS&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case MB:case DB:case zB:case BB:return this.Combinator();case sS:return this.ClassSelector();case LB:case RB:return this.TypeSelector();case AB:return this.IdSelector();case PB:return this.NestingSelector()}break}}}var AB,PB,LB,MB,BB,sS,DB,RB,zB,aS,lS=_(()=>{"use strict";AB=35,PB=38,LB=42,MB=43,BB=47,sS=46,DB=62,RB=124,zB=126;aS={onWhiteSpace:NB,getNode:OB}});function cS(){return this.createSingleNodeList(this.Raw(null,!1))}var uS=_(()=>{"use strict"});function pS(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type==="Value"&&n.children.isEmpty){for(let r=t-this.tokenIndex;r<=0;r++)if(this.lookupType(r)===13){n.children.appendData({type:"WhiteSpace",loc:null,value:" "});break}}e.push(n)}return e}var dS=_(()=>{"use strict"});function gS(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var fS,mS=_(()=>{"use strict";wf();uS();dS();fS={getNode:Os,onWhiteSpace(e,t){gS(e)&&(e.value=" "+e.value),gS(t.last)&&(t.last.value+=" ")},expression:cS,var:pS}});var vf={};Se(vf,{AtrulePrelude:()=>oS,Selector:()=>aS,Value:()=>fS});var hS=_(()=>{"use strict";iS();lS();mS()});var _B,xS,yS=_(()=>{"use strict";_B=new Set(["none","and","not","or"]),xS={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);_B.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var bS,SS=_(()=>{"use strict";bS={parse:{prelude:null,block(){return this.Block(!0)}}}});function kf(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 wS,vS,kS=_(()=>{"use strict";wS={layer(){this.skipSC();let e=this.createList(),t=kf.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=kf.call(this,this.Declaration,()=>kf.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},vS={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,wS)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,wS)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var CS,TS=_(()=>{"use strict";CS={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var IS,FS=_(()=>{"use strict";IS={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var ES,AS=_(()=>{"use strict";ES={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var PS,LS=_(()=>{"use strict";PS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var MS,BS=_(()=>{"use strict";MS={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var DS,RS=_(()=>{"use strict";DS={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var zS,NS=_(()=>{"use strict";zS={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var OS,_S=_(()=>{"use strict";yS();SS();kS();TS();FS();AS();LS();BS();RS();NS();OS={container:xS,"font-face":bS,import:vS,layer:CS,media:IS,nest:ES,page:PS,scope:MS,"starting-style":DS,supports:zS}});function $S(){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 US=_(()=>{"use strict"});var Qo,Cf,$B,UB,Rl,jS,HS=_(()=>{"use strict";US();Qo={parse(){return this.createSingleNodeList(this.SelectorList())}},Cf={parse(){return this.createSingleNodeList(this.Selector())}},$B={parse(){return this.createSingleNodeList(this.Identifier())}},UB={parse:$S},Rl={parse(){return this.createSingleNodeList(this.Nth())}},jS={dir:$B,has:Qo,lang:UB,matches:Qo,is:Qo,"-moz-any":Qo,"-webkit-any":Qo,where:Qo,not:Qo,"nth-child":Rl,"nth-last-child":Rl,"nth-last-of-type":Rl,"nth-of-type":Rl,slotted:Cf,host:Cf,"host-context":Cf}});var Tf={};Se(Tf,{AnPlusB:()=>Ip,Atrule:()=>Ap,AtrulePrelude:()=>Mp,AttributeSelector:()=>zp,Block:()=>_p,Brackets:()=>jp,CDC:()=>Vp,CDO:()=>Yp,ClassSelector:()=>Qp,Combinator:()=>ed,Comment:()=>rd,Condition:()=>sd,Declaration:()=>cd,DeclarationList:()=>gd,Dimension:()=>hd,Feature:()=>bd,FeatureFunction:()=>vd,FeatureRange:()=>Id,Function:()=>Ad,GeneralEnclosed:()=>Md,Hash:()=>Rd,IdSelector:()=>Ud,Identifier:()=>Od,Layer:()=>Wd,LayerList:()=>qd,MediaQuery:()=>Xd,MediaQueryList:()=>Zd,NestingSelector:()=>ng,Nth:()=>ig,Number:()=>lg,Operator:()=>pg,Parentheses:()=>fg,Percentage:()=>xg,PseudoClassSelector:()=>Sg,PseudoElementSelector:()=>kg,Ratio:()=>Ig,Raw:()=>Ag,Rule:()=>Mg,Scope:()=>Rg,Selector:()=>Og,SelectorList:()=>Ug,String:()=>Vg,StyleSheet:()=>Yg,SupportsDeclaration:()=>Qg,TypeSelector:()=>tf,UnicodeRange:()=>sf,Url:()=>pf,Value:()=>ff,WhiteSpace:()=>xf});var WS=_(()=>{"use strict";Ep();Lp();Dp();Op();Up();Wp();qp();Xp();Zp();nd();id();ld();pd();md();yd();wd();Cd();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tg();og();ag();ug();gg();hg();bg();vg();Tg();Eg();Lg();Dg();Ng();$g();Hg();qg();Xg();Zg();rf();lf();gf();hf();bf()});var VS,GS=_(()=>{"use strict";hS();_S();HS();WS();VS={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:vf,atrule:OS,pseudo:jS,node:Tf}});var qS,YS=_(()=>{"use strict";Sf();qS={node:Ns}});var KS,XS=_(()=>{"use strict";T0();nS();GS();YS();KS=C0({...tS,...VS,...qS})});var QS=_(()=>{"use strict"});var JS=_(()=>{"use strict"});var Xq,ZS,Qq,Jq,Zq,ew,eY,tY,nY,rY,oY,iY,tw=_(()=>{"use strict";XS();QS();dp();yl();JS();Bl();uf();({tokenize:Xq,parse:ZS,generate:Qq,lexer:Jq,createLexer:Zq,walk:ew,find:eY,findLast:tY,findAll:nY,toPlainObject:rY,fromPlainObject:oY,fork:iY}=KS)});function VB(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function rw(e){try{let t=ZS(e.trim(),{context:"value"}),n=[];return ew(t,{enter(r){if(r.type==="Dimension"){let o=parseFloat(r.value);n.push(`${o}${r.unit}`)}else if(r.type==="Number"){let o=parseFloat(r.value);n.push(`${o}`)}else r.type==="Percentage"?n.push(`${parseFloat(r.value)}%`):r.type==="Identifier"?n.push(r.name.toLowerCase()):r.type==="Hash"?n.push(`#${r.value.toLowerCase()}`):r.type}}),n}catch{return[e.trim().toLowerCase()]}}function GB(e,t){let n=VB(e);if(!WB.has(n))return t;let r=rw(t);if(r.length<1||r.length>4)return t;let o=r.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 nw(e,t){let n=t.trim();if(!n)return"";let r=GB(e,n);return rw(r).map(i=>i==="0"?"0px":i).join(" ")}function ow(e,t,n){let r=nw(e,t),o=nw(e,n);return r!==""&&o!==""&&r===o}var WB,iw=_(()=>{"use strict";tw();WB=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"])});function qB(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function YB(e){let t=e.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*[\d.]+)?\s*\)/);if(!t)return null;let n=parseInt(t[1],10).toString(16).padStart(2,"0"),r=parseInt(t[2],10).toString(16).padStart(2,"0"),o=parseInt(t[3],10).toString(16).padStart(2,"0");return`#${n}${r}${o}`}function sw(e){let t=typeof e=="string"?e:String(e??"");if(!t||t==="[object Object]")return"";let n=t.match(/rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/);if(n){let i=YB(n[0]);if(i)return i}let r=t.match(/#([0-9a-fA-F]{3,8})/);if(r)return qB(r[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 Jo(e,t,n){if(!e||!t)return!1;let r=String(e),o=String(t),i=r.toLowerCase(),s=o.toLowerCase(),a=i.includes("none"),u=s.includes("none");if(a!==u)return!1;let c=/\b(fill|stroke)\s*:/i,l=c.test(r),d=c.test(o);if(l!==d)return!1;let g=sw(r),p=sw(o);return!!(g===p||n&&ow(n,r,o))}var If=_(()=>{"use strict";iw()});function ZB(e){let t=String(e.property||"").toLowerCase(),n=String(e.description||"").toLowerCase(),r=String(e.expected||e.suggestedValue||"").toLowerCase(),o=String(e.actual||e.currentValue||"").toLowerCase();if(t.includes("color")||t.includes("fill")||t.includes("background")||n.includes("color")||n.includes("fill"))return!0;let i=s=>/^#[0-9a-f]{3,8}$/i.test(s)||s.includes("rgb")||["white","black","red","blue","green","orange","yellow","transparent"].includes(s);return!!(i(r)||i(o)||e.relatedProperties?.some(s=>{let a=s.property?.toLowerCase()||"";return a.includes("color")||a.includes("fill")||a.includes("background")}))}function aw(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 eD(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase(),r=String(e.property||"").toLowerCase(),o=String(e.description||"").toLowerCase(),i=n.includes("margin")||t.includes("margin")||r==="margin",s=t.includes("gap")||o.includes("gap");return i&&s}function tD(e,t,n){if(!e||!t)return!1;let r=typeof e=="string"?e:String(e??""),o=typeof t=="string"?t:String(t??"");if(!r||!o||r==="[object Object]"||o==="[object Object]"||n&&ZB(n)||aw(r)||aw(o)||n&&eD(n))return!1;let i=parseFloat(r),s=parseFloat(o);if(isNaN(i)||isNaN(s))return!1;let a=Math.abs(i-s);if(r.includes("px")||o.includes("px")){let u=n?.property?.toLowerCase()||"";return u==="width"||u==="height"||u.includes("width")||u.includes("height")?a<cw:a<lw}return r.includes("%")||o.includes("%")?a<1:!1}function nD(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(JB.some(s=>t.includes(s))||!XB.some(s=>t.includes(s)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!Jo(o,i,e.property))}function rD(e){let t=(e.expected!==void 0?"fill":"").toLowerCase(),n=e.actual!==void 0||e.currentValue!==void 0?"fill":"";if(!(t==="fill"||n==="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 s=`${e.description||""} ${e.title||""}`.toLowerCase();return s.includes("container")||s.includes("svg ")||s.includes("<svg")||s.includes("wrapper")}function oD(e){let t=`${e.description||""} ${e.title||""}`.toLowerCase(),n=e.property?.toLowerCase()||"";if(!(t.includes("text ")||t.includes("text layer")||t.includes("text span")||t.includes("span ")||t.includes("label "))||!(n==="width"||n==="height"||n.includes("width")||n.includes("height")||t.includes("width")||t.includes("height")))return!1;let i=e.expected||e.suggestedValue||"",s=e.actual||e.currentValue||"",a=parseFloat(i),u=parseFloat(s);return isNaN(a)||isNaN(u)?!1:Math.abs(a-u)<uw}function iD(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase(),n=String(e.expected||e.suggestedValue||"").toLowerCase(),r=String(e.actual||e.currentValue||"").toLowerCase();if(!QB.some(d=>t.includes(d)||n.includes(d)))return!1;let i=`${t} ${n} ${r}`;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 a=n.includes("hug")||n.includes("auto"),u=/\d+\.?\d*px/.test(r);if(!a||!u)return!1;let c=n.match(/(\d+\.?\d*)px/),l=r.match(/(\d+\.?\d*)px/);return!(c&&l&&Math.abs(parseFloat(c[1])-parseFloat(l[1]))>KB)}function sD(e){let t=String(e.expected||e.suggestedValue||"").toLowerCase(),n=String(e.actual||e.currentValue||"").toLowerCase();return(!n||!t||n.includes("see ")||t.includes("see ")||n.includes("image")||t.includes("image"))&&e.type==="visual"}function _s(e){if(e.programmaticallyVerified)return{dismissed:!1};let t=e.expected||e.suggestedValue,n=e.actual||e.currentValue;if(e.fixRequired===!1)return{dismissed:!0,dismissReason:"Auto-dismissed: FixRequired is false (no code change needed)",dismissedBy:"post-ai-validation"};if(Jo(t,n,e.property))return{dismissed:!0,dismissReason:"Auto-dismissed: expected equals actual (identical values)",dismissedBy:"post-ai-validation"};if(e.fixRequired===!0)return{dismissed:!1};if(oD(e))return{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${uw}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"};if(tD(t,n,e)){let r=e.property?.toLowerCase()||"";return{dismissed:!0,dismissReason:`Auto-dismissed: negligible difference (<${r==="width"||r==="height"||r.includes("width")||r.includes("height")?cw:lw}px)`,dismissedBy:"post-ai-validation"}}return sD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:nD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:iD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:rD(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var lw,cw,uw,KB,XB,QB,JB,pw=_(()=>{"use strict";If();lw=.5,cw=2,uw=2,KB=5,XB=["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"],QB=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],JB=["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"]});function To(e,t,n){let r=100-n*1-t*3-e*10;return Math.max(0,Math.min(100,r))}var dw=_(()=>{"use strict"});var gw=_(()=>{"use strict"});var fw=_(()=>{"use strict"});var Ff=_(()=>{"use strict";If();pw();dw();gw();fw()});var mD,hD,vY,Ef=_(()=>{"use strict";mD=["flex","inline-flex"],hD=["grid","inline-grid"],vY=[...mD,...hD]});var hw=_(()=>{"use strict";Ff();Ef()});var xw=_(()=>{"use strict"});var Rn=_(()=>{"use strict";wu();wy();vy();Ff();Ef();hw();xw()});function yD(e){let{aiPrompt:t,aiResponse:n,...r}=e;return r}function Jn(e){try{let t=e.map(yD),n=JSON.stringify(t,bD);sessionStorage.setItem(Af,n)}catch(t){y.error("[SessionStorage] Failed to save review history:",t)}}function Pf(){try{let e=sessionStorage.getItem(Af);if(!e)return[];let t=JSON.parse(e,SD);return Array.isArray(t)?t:[]}catch(e){return y.error("[SessionStorage] Failed to load review history:",e),[]}}function yw(){try{let e=Pf();if(e.length===0)return;let t=!1,n=e.map(r=>{if(r.aiPrompt!==void 0||r.aiResponse!==void 0){t=!0;let{aiPrompt:o,aiResponse:i,...s}=r;return s}return r});t&&(Jn(n),y.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){y.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function bw(){try{sessionStorage.removeItem(Af),y.debug("[SessionStorage] Review history cleared")}catch(e){y.error("[SessionStorage] Failed to clear review history:",e)}}function bD(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function SD(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Af,Lf=_(()=>{"use strict";Oe();Af="uicopilot_review_history"});import wD,{createContext as vD,useContext as kD,useReducer as CD,useMemo as Sw,useRef as TD,useEffect as ID}from"react";function zl(e){let t=e.length>ww?e.slice(e.length-ww):e,n=Math.max(0,t.length-FD);return n===0?t:t.map((r,o)=>{if(o>=n)return r;let i=r.storybookImageData?.startsWith("data:"),s=r.figmaImageData?.startsWith("data:");return!i&&!s?r:{...r,storybookImageData:i?void 0:r.storybookImageData,figmaImageData:s?void 0:r.figmaImageData}})}function ED(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"ADD_STREAMING_MESSAGE":return{...e,streamingMessages:[...e.streamingMessages,t.payload]};case"UPDATE_STREAMING_MESSAGE":return{...e,streamingMessages:e.streamingMessages.map((n,r)=>r===t.payload.index?{...n,content:t.payload.content}:n)};case"CLEAR_STREAMING_MESSAGES":return{...e,streamingMessages:[]};case"TOGGLE_MODEL":{let n=e.selectedModels.includes(t.payload);return n&&e.selectedModels.length===1?e:{...e,selectedModels:n?e.selectedModels.filter(r=>r!==t.payload):[...e.selectedModels,t.payload]}}case"SET_REVIEW_RESULTS":{if(!t.payload)return{...e,reviewResults:null,currentReviewId:null};let n=e.userRole==="admin",r={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:e.storybookImageUrl||void 0,figmaImageData:e.figmaImageUrl||void 0,aiPrompt:n&&e.fullPrompt||void 0,aiResponse:n&&e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens},o=e.reviewHistory.findIndex(s=>s.id===t.payload.id),i;return o>=0?i=e.reviewHistory.map((s,a)=>a===o?r:s):i=[...e.reviewHistory,r],i=zl(i),Jn(i),{...e,reviewResults:t.payload,reviewHistory:i,currentReviewId:t.payload.id}}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":{let n=new Set(e.reviewHistory.map(i=>i.id)),r=t.payload.filter(i=>!n.has(i.id));if(r.length===0)return e;let o=zl([...e.reviewHistory,...r]);return Jn(o),{...e,reviewHistory:o}}case"ADD_REVIEW":{let n=zl([...e.reviewHistory,t.payload]);return Jn(n),{...e,reviewHistory:n,currentReviewId:t.payload.id}}case"TOGGLE_ISSUE_SELECTION":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload?{...o,selectedForFix:!o.selectedForFix}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_STATUS":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.issues.map(o=>o.id===t.payload.issueId?{...o,status:t.payload.status,error:t.payload.error}:o)});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_ISSUE_GENERATED_FIX":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>r.id!==e.currentReviewId?r:{...r,issues:r.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(n),{...e,reviewHistory:n}}case"BATCH_UPDATE_ISSUE_GENERATED_FIXES":{if(!e.currentReviewId)return e;let n=new Map(t.payload.map(o=>[o.issueId,o.generatedFix])),r=e.reviewHistory.map(o=>o.id!==e.currentReviewId?o:{...o,issues:o.issues.map(i=>{let s=n.get(i.id);return s?{...i,generatedFix:i.generatedFix?{...i.generatedFix,...s}:s,selectedForFix:s?.status==="failed"?!1:i.selectedForFix}:i})});return Jn(r),{...e,reviewHistory:r}}case"DISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload.issueId?{...c,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"UNDISMISS_ISSUE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.map(c=>c.id===t.payload?{...c,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:c),i=o.filter(c=>!c.dismissed),s=i.filter(c=>c.severity==="critical").length,a=i.filter(c=>c.severity==="major").length,u=i.filter(c=>c.severity==="minor").length;return{...r,issues:o,complianceScore:To(s,a,u),issuesCount:i.length}});return Jn(n),{...e,reviewHistory:n}}case"RECALCULATE_SCORE":{if(!e.currentReviewId)return e;let n=e.reviewHistory.map(r=>{if(r.id!==e.currentReviewId)return r;let o=r.issues.filter(c=>!c.dismissed),i=o.filter(c=>c.severity==="critical").length,s=o.filter(c=>c.severity==="major").length,a=o.filter(c=>c.severity==="minor").length,u=To(i,s,a);return y.debug(`[recalculateScore] Active: ${o.length}, score: ${u}`),{...r,complianceScore:u,issuesCount:o.length}});return Jn(n),{...e,reviewHistory:n}}case"UPDATE_REVIEW_SCORE":{let n=e.reviewHistory.map(r=>r.id!==t.payload.reviewId?r:{...r,complianceScore:t.payload.newScore});return Jn(n),{...e,reviewHistory:n}}case"CLEAR_ALL_REVIEWS":return bw(),{...e,reviewHistory:[],currentReviewId:null};case"CLEAR_STALE_REVIEWS":return{...e,currentReviewId:null,reviewResults:null};case"RESET_REVIEW":{let n=e.isReviewing;return{...e,isReviewing:!1,reviewError:null,reviewResults:n?null:e.reviewResults,multiModelResults:null,streamingMessages:[],streamingProgress:0,streamingStatus:"",reviewDetailTab:n?"chat":e.reviewDetailTab,fullPrompt:"",fullResponse:"",figmaImageUrl:n?null:e.figmaImageUrl,storybookImageUrl:n?null:e.storybookImageUrl,currentReviewId:n?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 Bf({children:e}){let[t,n]=CD(ED,BD),r=TD(t);ID(()=>{r.current=t},[t]);let o=Sw(()=>({setIsReviewing:s=>n({type:"SET_STATE",payload:{isReviewing:s}}),setReviewError:s=>n({type:"SET_STATE",payload:{reviewError:s}}),bulkAddReviews:s=>n({type:"BULK_ADD_REVIEWS",payload:s}),setReviewResults:s=>n({type:"SET_REVIEW_RESULTS",payload:s}),setMultiModelResults:s=>n({type:"SET_STATE",payload:{multiModelResults:s}}),updateMultiModelStreamingMessages:(s,a)=>n({type:"UPDATE_MULTI_MODEL_STREAMING",payload:{modelId:s,messages:a}}),setModelCompleted:s=>n({type:"SET_MODEL_COMPLETED",payload:s}),setActiveModelId:s=>{let a=r.current;a.multiModelResults&&n({type:"SET_STATE",payload:{multiModelResults:{...a.multiModelResults,activeModelId:s}}})},setShowReviewMenu:s=>n({type:"SET_STATE",payload:{showReviewMenu:s}}),setSeverityFilter:s=>n({type:"SET_STATE",payload:{severityFilter:s}}),setShowStreamingPanel:s=>n({type:"SET_STATE",payload:{showStreamingPanel:s}}),setStreamingPanelCollapsed:s=>n({type:"SET_STATE",payload:{streamingPanelCollapsed:s}}),addStreamingMessage:s=>n({type:"ADD_STREAMING_MESSAGE",payload:s}),updateStreamingMessage:(s,a)=>n({type:"UPDATE_STREAMING_MESSAGE",payload:{index:s,content:a}}),clearStreamingMessages:()=>n({type:"CLEAR_STREAMING_MESSAGES"}),setStreamingProgress:s=>n({type:"SET_STATE",payload:{streamingProgress:s}}),setStreamingStatus:s=>n({type:"SET_STATE",payload:{streamingStatus:s}}),setReviewDetailTab:s=>n({type:"SET_STATE",payload:{reviewDetailTab:s}}),setFullPrompt:s=>n({type:"SET_STATE",payload:{fullPrompt:s}}),setFullResponse:s=>n({type:"SET_STATE",payload:{fullResponse:s}}),setFigmaImageUrl:s=>n({type:"SET_STATE",payload:{figmaImageUrl:s}}),setStorybookImageUrl:s=>n({type:"SET_STATE",payload:{storybookImageUrl:s}}),setFigmaDimensions:s=>n({type:"SET_STATE",payload:{figmaDimensions:s}}),setSelectedModels:s=>n({type:"SET_STATE",payload:{selectedModels:s}}),toggleModel:s=>n({type:"TOGGLE_MODEL",payload:s}),setModelComparisonView:s=>n({type:"SET_STATE",payload:{modelComparisonView:s}}),resetReview:()=>n({type:"RESET_REVIEW"}),addReview:s=>n({type:"ADD_REVIEW",payload:s}),getCurrentReview:()=>{let s=r.current;return s.currentReviewId&&s.reviewHistory.find(a=>a.id===s.currentReviewId)||null},getReviewById:s=>r.current.reviewHistory.find(a=>a.id===s)||null,getParentReview:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return a?.parentReviewId&&s.reviewHistory.find(u=>u.id===a.parentReviewId)||null},hasAppliedFixes:()=>{let s=r.current,a=s.reviewHistory.find(u=>u.id===s.currentReviewId);return!a||!Array.isArray(a.issues)||a.issues.length===0?!1:a.issues.some(u=>u.status==="applied"||u.generatedFix?.status==="applied")},toggleIssueSelection:s=>n({type:"TOGGLE_ISSUE_SELECTION",payload:s}),updateIssueStatus:(s,a,u)=>n({type:"UPDATE_ISSUE_STATUS",payload:{issueId:s,status:a,error:u}}),updateIssueGeneratedFix:(s,a)=>n({type:"UPDATE_ISSUE_GENERATED_FIX",payload:{issueId:s,generatedFix:a}}),batchUpdateIssueGeneratedFixes:s=>n({type:"BATCH_UPDATE_ISSUE_GENERATED_FIXES",payload:s}),dismissIssue:(s,a,u)=>n({type:"DISMISS_ISSUE",payload:{issueId:s,reason:a,dismissedBy:u}}),undismissIssue:s=>n({type:"UNDISMISS_ISSUE",payload:s}),recalculateScore:()=>n({type:"RECALCULATE_SCORE"}),updateReviewScore:(s,a)=>n({type:"UPDATE_REVIEW_SCORE",payload:{reviewId:s,newScore:a}}),clearAllReviews:()=>n({type:"CLEAR_ALL_REVIEWS"}),clearStaleReviewsForStory:s=>n({type:"CLEAR_STALE_REVIEWS",payload:s}),setIsApplying:s=>n({type:"SET_STATE",payload:{isApplying:s}}),setApplyFixesResult:s=>n({type:"SET_STATE",payload:{applyFixesResult:s}}),setIncludeComponentIssues:s=>n({type:"SET_STATE",payload:{includeComponentIssues:s}}),setIncludeTextComparison:s=>n({type:"SET_STATE",payload:{includeTextComparison:s}}),setUsePromptCache:s=>n({type:"SET_STATE",payload:{usePromptCache:s}}),setIsValidating:s=>n({type:"SET_STATE",payload:{isValidating:s}}),setValidationUsage:s=>n({type:"SET_STATE",payload:{validationUsage:s}}),setWorkspacePath:s=>n({type:"SET_STATE",payload:{workspacePath:s}}),triggerScreenshotRefresh:()=>n({type:"TRIGGER_SCREENSHOT_REFRESH"}),setHoveredIssueId:s=>n({type:"SET_STATE",payload:{hoveredIssueId:s}}),setFeatureFlags:s=>n({type:"SET_STATE",payload:{featureFlags:s}}),setUserRole:s=>n({type:"SET_STATE",payload:{userRole:s}}),setRoleOverride:s=>{try{s?localStorage.setItem("uicopilot_role_override",s):localStorage.removeItem("uicopilot_role_override")}catch{}n({type:"SET_STATE",payload:{roleOverride:s}})},setReviewAllConcurrency:s=>{let a=Math.max(1,Math.min(5,s));try{localStorage.setItem("uicopilot_review_all_concurrency",String(a))}catch{}n({type:"SET_STATE",payload:{reviewAllConcurrency:a}})},setIsGenerating:s=>n({type:"SET_STATE",payload:{isGenerating:s}}),setGeneratedPrompt:s=>n({type:"SET_STATE",payload:{generatedPrompt:s}}),setPromptError:s=>n({type:"SET_STATE",payload:{promptError:s}}),resetPrompt:()=>n({type:"RESET_PROMPT"})}),[]),i=Sw(()=>({...t,...o}),[t,o]);return wD.createElement(vw.Provider,{value:i},e)}function ce(){let e=kD(vw);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var ww,FD,AD,PD,Mf,LD,MD,BD,vw,Df=_(()=>{"use strict";Rn();Lf();Oe();ww=20,FD=5;AD=()=>{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},PD=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},Mf={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},LD=()=>{if(typeof localStorage>"u")return Mf;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return Mf;let t=JSON.parse(e);return{enableFixGeneration:!!t.enableFixGeneration,enableFixApply:!!t.enableFixApply,enableAutoMap:!!t.enableAutoMap,enableReviewBadges:!!t.enableReviewBadges,showCosts:!!t.showCosts,enableParallelReview:!!t.enableParallelReview,enableModelSelection:!!t.enableModelSelection}}catch{}return Mf},MD=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},BD={isReviewing:!1,reviewError:null,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-5-20250929"],modelComparisonView:"side-by-side",reviewHistory:zl(Pf()),currentReviewId:null,includeComponentIssues:!0,includeTextComparison:!1,usePromptCache:!1,isApplying:!1,applyFixesResult:null,screenshotRefreshKey:0,isValidating:!1,validationUsage:null,lastAiCallTimestamp:null,aiRateLimitSeconds:0,isGenerating:!1,generatedPrompt:null,promptError:null,workspacePath:null,userRole:MD(),roleOverride:PD(),featureFlags:LD(),reviewAllConcurrency:AD(),hoveredIssueId:null},vw=vD(null)});import $s,{useMemo as DD}from"react";function zf({children:e}){return $s.createElement(mu,null,$s.createElement(xu,null,$s.createElement(bu,null,$s.createElement(Bf,null,$s.createElement(RD,null),e))))}function kw(e){let t=we(),n=Je(),r=nt(),o=ce(),i=DD(()=>({...t,...n,...r,...o}),[t,n,r,o]);return e?e(i):i}function RD(){return Rf=kw(),null}var Rf,gt,Cw=_(()=>{"use strict";hu();yu();Su();Df();Rf=null,gt=Object.assign(kw,{getState:()=>{if(!Rf)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return Rf}})});var Ce=_(()=>{"use strict";Cw();hu();yu();Su();Df()});function V(){return(process.env.STORYBOOK_UICOPILOT_URL||zD).replace(/\/$/,"")}var zD,Tw,je=_(()=>{"use strict";zD="https://app.uiparity.com";Tw=3.6});async function ne(e,t,n=3e4){let r=new AbortController,o=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}catch(i){throw i instanceof DOMException&&i.name==="AbortError"?new Error(`Request timed out after ${n}ms: ${e}`):i}finally{clearTimeout(o)}}var ct=_(()=>{"use strict"});import{useEffect as Zo,useState as Ol,useRef as Uw,useCallback as $f}from"react";import{addons as Uf}from"storybook/manager-api";async function OR(e,t,n){let r=`${e}:${t}`,o=jf.get(r);if(o)return y.debug("[useReviewScreenshots] Reusing in-flight Figma image fetch for",r),o;let i=(async()=>{let s=await ne(`${Gw}/api/figma/image?projectId=${e}&nodeId=${t}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});return s.ok?s.json():{imageUrl:null}})().finally(()=>{jf.delete(r)});return jf.set(r,i),i}function _R(e,t,n){try{sessionStorage.setItem(`${_l}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:n,timestamp:Date.now()}))}catch{}}function $R(e,t){try{let n=sessionStorage.getItem(`${_l}${e}`);if(!n)return null;let r=JSON.parse(n);if(r.figmaNodeId===t&&Date.now()-r.timestamp<1800*1e3)return r.imageUrl;sessionStorage.removeItem(`${_l}${e}`)}catch{}return null}function UR(e){try{let t=sessionStorage.getItem(`${_l}${e}`);if(!t)return null;let n=JSON.parse(t);if(n.imageUrl&&Date.now()-n.timestamp<300*1e3)return n.imageUrl}catch{}return null}var jw,Hw,Ww,Vw,Bi,Gw,zn,Hf,jf,_l,qw,Yw,ei,Di=_(()=>{"use strict";Ce();Wf();Oe();je();ct();jw="storyArgsUpdated",Hw="storyRendered",Ww="forceRemount",Vw=null,Bi=()=>Vw,Gw=V(),zn=new Map,Hf=null,jf=new Map;_l="uicopilot-figma-image-";qw=(e,t,n)=>{let r=zn.get(e);r?(r.storybookImageUrl=t,n&&(r.figmaImageUrl=n)):zn.set(e,{storybookImageUrl:t,figmaImageUrl:n??null}),y.debug("[useReviewScreenshots] Populated historical screenshots for story:",e)},Yw=(e,t,n)=>{Hf=t;let r=zn.get(e);r?r.figmaImageUrl=n:zn.set(e,{storybookImageUrl:null,figmaImageUrl:n}),y.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:n.substring(0,50)+"..."})},ei=()=>{let[e,t]=Ol(!1),[n,r]=Ol(!1),[o,i]=Ol(!1),[s,a]=Ol(null),u=Uw(null),{screenshotRefreshKey:c,triggerScreenshotRefresh:l}=ce(),d=$f(()=>{let P=gt.getState().currentStoryId;P&&(y.debug("[useReviewScreenshots] Refreshing screenshots for story:",P),zn.delete(P),u.current=null,i(!0),l())},[l]),g=$f(()=>{let P=gt.getState().currentStoryId;if(P){y.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",P);let z=zn.get(P);z&&(z.storybookImageUrl=null),u.current=null,i(!0),l()}},[l]),{sessionToken:p}=we(),{selectedProjectId:f}=Je(),{currentStoryId:k,currentMapping:T,loadingMapping:E}=nt(),{setStorybookImageUrl:I,setFigmaImageUrl:D}=ce(),R=Uw(null);Zo(()=>{k&&R.current&&R.current!==k&&(y.debug("[useReviewScreenshots] Story switched, clearing images"),I(""),D("")),R.current=k},[k,I,D]),Zo(()=>{!k||E||T||D("")},[k,T,E,D]),Zo(()=>{if(!k)return;let P=UR(k);P&&(y.debug("[useReviewScreenshots] Quick-restored Figma image for:",k),D(P))},[k,D]),Zo(()=>{let P=!1;return(async()=>{if(!p||!f||!k){y.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}u.current&&u.current!==k&&(y.debug("[useReviewScreenshots] Story changed, clearing stale screenshots"),I(""),D(""));let x=gt.getState();if(u.current===k&&x.storybookImageUrl&&x.figmaImageUrl){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping capture");return}let w=T?.figmaNodeId??null;if(w!==Hf){y.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",k);let L=zn.get(k);L&&(L.figmaImageUrl=null),Hf=w,u.current=null}let v=T?.figmaNodeId;if(v&&!zn.get(k)?.figmaImageUrl){let L=$R(k,v);if(L){y.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",k),D(L);let B=zn.get(k);B?B.figmaImageUrl=L:zn.set(k,{storybookImageUrl:null,figmaImageUrl:L})}}let C=zn.get(k),m=C&&C.storybookImageUrl&&C.figmaImageUrl,F=C&&C.storybookImageUrl&&!C.figmaImageUrl,S=C&&!C.storybookImageUrl&&C.figmaImageUrl;if(m){y.debug("[useReviewScreenshots] Using fully cached screenshots for story:",k),I(C.storybookImageUrl),D(C.figmaImageUrl),u.current=k;return}let b=F&&T?.figmaNodeId;b&&(y.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",k),I(C.storybookImageUrl));let A=S;if(A&&(y.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",k),D(C.figmaImageUrl)),u.current===k&&T?.figmaNodeId){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{if(a(null),b?r(!0):(A||(t(!0),r(!0)),i(!0)),u.current=k,P)return;let L=A?C.figmaImageUrl:null,B;if(A)y.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),r(!1);else if(v){y.debug("[useReviewScreenshots] Found Figma node ID from mapping:",v);let h=null;try{y.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let j=await OR(f,v,p);h=j.imageUrl||null;let W=j.cached?"(cached)":"(fresh)";y.debug(`[useReviewScreenshots] Figma image fetched ${W}:`,h?"success":"not found")}catch(j){y.warn("[useReviewScreenshots] Failed to fetch Figma image:",j)}if(h)try{y.debug("[useReviewScreenshots] Fetching Figma image via proxy...");let j=`${Gw}/api/proxy/image?url=${encodeURIComponent(h)}`,W=await ne(j);if(W.ok){let M=await W.blob(),K=new FileReader,ee=await new Promise((xe,ae)=>{K.onloadend=()=>xe(K.result),K.onerror=ae,K.readAsDataURL(M)});L=ee,D(ee),y.debug("[useReviewScreenshots] Figma image loaded via proxy");let ge=new Image;await new Promise(xe=>{ge.onload=()=>{B={width:ge.naturalWidth,height:ge.naturalHeight},y.debug("[useReviewScreenshots] Figma dimensions:",B),xe()},ge.onerror=()=>xe(),ge.src=ee})}else L=h,D(h),y.warn("[useReviewScreenshots] Proxy failed, using direct URL as fallback")}catch(j){y.warn("[useReviewScreenshots] Proxy error, using direct URL as fallback:",j),L=h,D(h)}else y.warn("[useReviewScreenshots] No thumbnail found for node:",v),D(null);L&&v&&_R(k,v,L),r(!1)}else y.debug("[useReviewScreenshots] No Figma mapping exists for this component"),D(null),r(!1);let N=C?.storybookImageUrl||null;if(N)y.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{y.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",k);let h=await $l({storyId:k,sessionToken:p||void 0,...B&&{figmaWidth:B.width,figmaHeight:B.height}});h&&!P?(N=h,I(h),y.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",B||"natural")):y.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}zn.set(k,{storybookImageUrl:N,figmaImageUrl:L}),y.debug("[useReviewScreenshots] Screenshots cached for story:",k)}catch(L){y.error("[useReviewScreenshots] Error loading screenshots:",L),a(L instanceof Error?L.message:"Failed to load screenshots"),u.current=null,r(!1),i(!1)}finally{t(!1)}})(),()=>{P=!0}},[p,f,k,T?.figmaNodeId,c]),Zo(()=>{let P=Uf.getChannel(),z=null,x=w=>{Vw=w.args,y.debug("[useReviewScreenshots] Args updated for story:",w.storyId,"args:",w.args),z&&clearTimeout(z),z=setTimeout(()=>{y.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),d()},500)};return P.on(jw,x),()=>{P.off(jw,x),z&&clearTimeout(z)}},[d]),Zo(()=>{let P=Uf.getChannel(),z=!1,x=null,w=()=>{y.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),z=!0,i(!0)},v=()=>{z&&(y.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),x&&clearTimeout(x),x=setTimeout(()=>{z=!1,y.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),g()},500))};return P.on(Ww,w),P.on(Hw,v),()=>{P.off(Ww,w),P.off(Hw,v),x&&clearTimeout(x)}},[g]),Zo(()=>{let P=Uf.getChannel(),z=async x=>{if(!x?.snapshot?.html){y.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}y.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let w=gt.getState().currentStoryId,v=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...x.snapshot,storyId:w})});if(v.ok){let C=await v.json();if(C.screenshot){I(C.screenshot);let m=gt.getState().currentStoryId;if(m){let F=zn.get(m);F?F.storybookImageUrl=C.screenshot:zn.set(m,{storybookImageUrl:C.screenshot,figmaImageUrl:null})}}}else y.error("[useReviewScreenshots] Snapshot screenshot failed:",await v.text())}catch(w){y.error("[useReviewScreenshots] Snapshot screenshot error:",w)}finally{i(!1)}};return P.on("UICOPILOT/STORY_DOM_MUTATED",z),()=>{P.off("UICOPILOT/STORY_DOM_MUTATED",z)}},[]);let $=$f((P,z,x)=>{y.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),Yw(P,z,x),D(x),r(!1),u.current=P},[D]);return{isLoadingScreenshots:e,isLoadingFigma:n,isLoadingStorybook:o,screenshotError:s,refreshScreenshots:d,refreshStorybookOnly:g,setFigmaImageDirect:$}}});function HR(){return!V().startsWith("http://localhost")}function WR(e,t,n){let r=t.createElement("div");r.style.color=e,t.body.appendChild(r);let o=n.getComputedStyle(r).color;return r.remove(),o}function Kw(e,t,n){let r=new Map;return e.replace(/(?:color|oklch|oklab|lab|lch)\([^)]+\)/g,o=>{if(r.has(o))return r.get(o);let i=WR(o,t,n);return r.set(o,i),i})}async function VR(){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 n=t.contentDocument.querySelector("#storybook-root > *")||t.contentDocument.querySelector("#root > *");if(!n)throw new Error("Story element not found in iframe");let r=t.contentWindow,o=t.contentDocument;return(await e(n,{useCORS:!0,logging:!1,backgroundColor:null,onclone:s=>{s.querySelectorAll("style").forEach(u=>{let c=u.textContent||"";/(?:color|oklch|oklab|lab|lch)\(/.test(c)&&(u.textContent=Kw(c,o,r))});let a=Array.from(o.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,l=a.find(d=>d.href===c);if(l)try{let d="";for(let g of Array.from(l.cssRules))d+=g.cssText+`
|
|
13
|
+
`;if(/(?:color|oklch|oklab|lab|lch)\(/.test(d)){let g=s.createElement("style");g.textContent=Kw(d,o,r),u.replaceWith(g)}}catch{}})}})).toDataURL("image/png")}function GR(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o;typeof r=="boolean"?o=`!${r}`:typeof r=="number"?o=String(r):typeof r=="string"?o=encodeURIComponent(r).replace(/%20/g,"+"):o=encodeURIComponent(JSON.stringify(r)),t.push(`${n}:${o}`)}return t.join(";")}async function qR(e,t){y.debug("[Screenshot] Using server-side Chrome capture for:",e);let n={"Content-Type":"application/json"};t?.sessionToken&&(n.Authorization=`Bearer ${t.sessionToken}`);let r=await ne(`${jR}/api/screenshot`,{method:"POST",headers:n,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(!r.ok){let i=await r.json().catch(()=>({error:"Unknown error"}));throw new Error(i.error||`Screenshot failed: ${r.status}`)}return(await r.json()).screenshot}function YR(e){let t={};if(!e)return t;let n=e.split(";");for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let i=r.slice(0,o),s=r.slice(o+1);typeof s=="string"&&(s==="!true"?s=!0:s==="!false"?s=!1:!isNaN(Number(s))&&s!==""?s=Number(s):s=decodeURIComponent(s.replace(/\+/g," "))),t[i]=s}return t}function KR(e){let t=new URLSearchParams(window.location.search),n=e;if(n||(n=(t.get("path")||"").replace("/story/","").replace("/docs/",""),y.debug("[Screenshot] Warning: Using story ID from URL (fallback):",n)),!n)throw new Error("Could not determine current story ID. Please select a story first.");let r=window.location.origin,o=Date.now(),i=`${r}/iframe.html?viewMode=story&id=${n}&globals=&_cb=${o}`,s=Bi();if(!s||Object.keys(s).length===0){let a=t.get("args");a&&(s=YR(a),y.debug("[Screenshot] Parsed args from URL:",s))}if(s&&Object.keys(s).length>0){let a=GR(s);i+=`&args=${a}`,y.debug("[Screenshot] Using URL with current args:",i)}else y.debug("[Screenshot] No current args, using default URL:",i);return i}async function XR(e){try{let t=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(t.status===501)return y.info("[Screenshot] Local Puppeteer not available, falling back"),null;if(!t.ok){let r=await t.json().catch(()=>({error:"Unknown"}));throw new Error(r.error||`Screenshot failed: ${t.status}`)}let n=await t.json();return y.info("[Screenshot] Captured via local Puppeteer (pixel-perfect)"),n.screenshot}catch(t){if(t instanceof TypeError&&t.message.includes("fetch"))return null;throw t}}async function $l(e){let t=e?.storyId||QR();if(t){let n=Vf.get(t);if(n)return y.debug("[Screenshot] Reusing in-flight capture for",t),n;let r=Xw(t,e).finally(()=>{Vf.delete(t)});return Vf.set(t,r),r}return Xw(void 0,e)}async function Xw(e,t){try{if(e){let n=await XR(e);if(n)return n}if(!HR()){let n=KR(t?.storyId);return await qR(n,{...t,selector:"#storybook-root > *"})}return y.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await VR()}catch(n){throw y.error("Error capturing screenshot:",n),new Error(`Failed to capture screenshot: ${n instanceof Error?n.message:"Unknown error"}`)}}function QR(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var jR,Vf,Wf=_(()=>{"use strict";je();Di();Oe();ct();jR=V();Vf=new Map});function Tn(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[,n,r,o,i]=t,s=i?parseFloat(i):1;return s<1?`rgba(${n}, ${r}, ${o}, ${s})`:`#${[n,r,o].map(u=>parseInt(u).toString(16).padStart(2,"0")).join("")}`}function Nn(e,t){let r={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 r?r.includes(t):!1}function Vs(e){return e.split(",").map(n=>n.trim().replace(/['"]/g,""))[0]||e}function Qw(e){let t=e.ownerDocument,r=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let T=r.fontSize||"16px",E=r.fontWeight||"400";if(r.fontFamily.includes("Roboto")){let I=t.fonts.check(`${E} ${T} Roboto`);if(y.debug("[computedStyles] Roboto check:",{cssFamily:r.fontFamily,robotoLoaded:I,fontWeight:E,fontSize:T,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(D=>({family:D.family,status:D.status}))}),I)return"Roboto"}}let o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",s=t.createElement("canvas").getContext("2d");if(!s)return"unknown";let a=r.fontSize,u=r.fontWeight,c=r.fontStyle,l=r.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"],g=[...new Set([...l,...d])];s.font=`${c} ${u} ${a} monospace`;let p=s.measureText(o).width,f="unknown",k=new Map;for(let T of g){s.font=`${c} ${u} ${a} "${T}", monospace`;let E=s.measureText(o).width;if(k.set(T,E),E!==p){s.font=`${c} ${u} ${a} "${T}"`;let I=s.measureText(o).width;s.font=`${c} ${u} ${a} ${r.fontFamily}`;let D=s.measureText(o).width;if(Math.abs(I-D)<.1){f=T;break}}}return y.debug("[computedStyles] Font detection:",{declared:r.fontFamily,detected:f,declaredFonts:l,fontWidths:Array.from(k.entries()),isIframe:t!==document}),f}var Gs=_(()=>{"use strict";Oe()});function Ri(e,t){if(!t)return e;let n=t.split(" ").filter(i=>i.trim()),r=n.find(i=>!i.includes("--")),o=n.filter(i=>i.includes("--"));return r&&o.length>0?`${e}.${r}.${o[0]}`:r?`${e}.${r}`:n[0]?`${e}.${n[0]}`:e}function Gf(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e);return y.debug("[computedStyles] Extracting styles:",{fontFamily:n.fontFamily,fontWeight:n.fontWeight,borderRadius:n.borderRadius,backgroundColor:n.backgroundColor,padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},isIframeContext:e.ownerDocument!==document}),{color:Tn(n.color),backgroundColor:Tn(n.backgroundColor),borderColor:Tn(n.borderColor),padding:{top:n.paddingTop,right:n.paddingRight,bottom:n.paddingBottom,left:n.paddingLeft},margin:{top:n.marginTop,right:n.marginRight,bottom:n.marginBottom,left:n.marginLeft},gap:n.gap,fontFamily:n.fontFamily,renderedFont:Qw(e),fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,textAlign:n.textAlign,textTransform:n.textTransform,width:n.width,height:n.height,minWidth:n.minWidth,minHeight:n.minHeight,maxWidth:n.maxWidth,maxHeight:n.maxHeight,borderWidth:n.borderWidth,borderStyle:n.borderStyle,borderRadius:n.borderRadius,boxShadow:n.boxShadow,textShadow:n.textShadow,display:n.display,flexDirection:n.display==="flex"?n.flexDirection:void 0,justifyContent:n.display==="flex"?n.justifyContent:void 0,alignItems:n.display==="flex"?n.alignItems:void 0,position:n.position,opacity:n.opacity,cursor:n.cursor}}function qf(e,t){let n={width:null,height:null,minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,display:null,flexGrow:null,flexShrink:null,flexBasis:null};try{let r=Array.from(t.styleSheets);for(let i of r)try{let s=i.cssRules||i.rules;if(!s)continue;for(let a of Array.from(s))if(a.type===1){let u=a;try{if(e.matches(u.selectorText)){let c=u.style;c.width&&(n.width=c.width),c.height&&(n.height=c.height),c.minWidth&&(n.minWidth=c.minWidth),c.minHeight&&(n.minHeight=c.minHeight),c.maxWidth&&(n.maxWidth=c.maxWidth),c.maxHeight&&(n.maxHeight=c.maxHeight),c.display&&(n.display=c.display),c.flexGrow&&(n.flexGrow=c.flexGrow),c.flexShrink&&(n.flexShrink=c.flexShrink),c.flexBasis&&(n.flexBasis=c.flexBasis)}}catch{continue}}}catch{continue}let o=e.style;o.width&&(n.width=o.width),o.height&&(n.height=o.height),o.minWidth&&(n.minWidth=o.minWidth),o.minHeight&&(n.minHeight=o.minHeight),o.maxWidth&&(n.maxWidth=o.maxWidth),o.maxHeight&&(n.maxHeight=o.maxHeight),o.display&&(n.display=o.display),o.flexGrow&&(n.flexGrow=o.flexGrow),o.flexShrink&&(n.flexShrink=o.flexShrink),o.flexBasis&&(n.flexBasis=o.flexBasis)}catch(r){y.error("Error extracting declared styles:",r)}return n}var Ul=_(()=>{"use strict";Oe();Gs()});function JR(e){let t=[],n=new Set,r=Jw.join(", "),o=e.querySelectorAll(r);for(let i of Array.from(o)){let s=`${i.tagName.toLowerCase()}.${i.className}`;n.has(s)||(n.add(s),t.push(i))}if(Jw.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;n.has(i)||t.unshift(e)}return t}function ZR(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"";return{selector:Ri(r,i),tagName:r,className:i,styles:{fontSize:n.fontSize,fontFamily:Vs(n.fontFamily),fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:Tn(n.color),textAlign:n.textAlign,textTransform:n.textTransform}}}function ez(e,t=2){let n=[e],r=new Set,o=s=>{let a=s.className;return typeof a=="string"?a:a?.baseVal||""};r.add(`${e.tagName}.${o(e)}`);function i(s,a){if(a>=t)return;let u=Array.from(s.children);for(let c of u){let l=c.tagName.toLowerCase();if(["script","style","link","meta","br","hr"].includes(l))continue;let d=`${c.tagName}.${o(c)}`;r.has(d)||(r.add(d),n.push(c),i(c,a+1))}}return i(e,0),n}function tz(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r=e.tagName.toLowerCase(),o=e.className,i=typeof o=="string"?o:o?.baseVal||"",s=n.borderWidth!=="0px",a=n.backgroundColor!=="transparent"&&n.backgroundColor!=="rgba(0, 0, 0, 0)",u=n.borderRadius!=="0px",c=n.gap!=="normal"&&n.gap!=="0px";if(!s&&!a&&!u&&!c)return null;let l=n.borderWidth,d=n.borderStyle,g=Tn(n.borderColor),p=s?`${l} ${d} ${g}`:"none";return{selector:Ri(r,i),className:i,border:p,borderRadius:n.borderRadius,backgroundColor:Tn(n.backgroundColor),gap:n.gap}}function qs(){y.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,n=t.getElementById("storybook-root");if(!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(!r)throw new Error("Component element not found in story root");let o=ez(r,2),i=o.map(tz).filter(a=>a!==null);y.debug("[computedStyles] Extracted visual styles from nested elements:",{total:o.length,withVisuals:i.length,elements:i.map(a=>({selector:a.selector,border:a.border,background:a.backgroundColor,borderRadius:a.borderRadius}))});let s=[];try{let a=JR(r);s=a.map(ZR),y.debug("[computedStyles] Text elements found:",{count:a.length,elements:s.map(u=>({selector:u.selector,fontSize:u.styles.fontSize,fontWeight:u.styles.fontWeight}))})}catch(a){y.error("[computedStyles] Error extracting text elements:",a)}return{computed:Gf(r),declared:qf(r,t),markup:r.outerHTML,textElementStyles:s,nestedElementStyles:i}}catch(e){return y.error("Error extracting computed styles:",e),null}}var Jw,Zw=_(()=>{"use strict";Oe();Gs();Ul();Jw=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function Yf(e,t,n,r){return e===t&&t===n&&n===r?e:e===n&&t===r?`${e} ${t}`:t===r?`${e} ${t} ${n}`:`${e} ${t} ${n} ${r}`}function rz(e,t,n){if(!(e==="0px"||t==="none"))return`${e} ${t} ${n}`}function oz(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r={},o=Tn(n.backgroundColor);Nn("backgroundColor",o)||(r.backgroundColor=o);let i=rz(n.borderWidth,n.borderStyle,Tn(n.borderColor));i&&(r.border=i),Nn("borderRadius",n.borderRadius)||(r.borderRadius=n.borderRadius),Nn("boxShadow",n.boxShadow)||(r.boxShadow=n.boxShadow),Nn("opacity",n.opacity)||(r.opacity=n.opacity);let s=e.tagName.toLowerCase(),a=["svg","circle","rect","ellipse","line","polyline","polygon","path","text","tspan","g","use","defs","clipPath","mask"];if(e instanceof SVGElement||a.includes(s)){for(let T=0;T<e.attributes.length;T++){let E=e.attributes[T];if(["class","style","id","xmlns","xmlns:xlink"].includes(E.name))continue;let I=E.name.replace(/-([a-z])/g,(R,$)=>$.toUpperCase()),D=E.value.startsWith("rgb")?Tn(E.value):E.value;I==="d"&&D.length>100?r[I]=D.substring(0,100)+"...":r[I]=D}let p=n.getPropertyValue("fill"),f=n.getPropertyValue("stroke");if(p&&p!=="none"&&(r.fill=p.startsWith("rgb")?Tn(p):p),f&&f!=="none"&&(r.stroke=f.startsWith("rgb")?Tn(f):f),["circle","ellipse","rect","path","line","polyline","polygon"].includes(s)){let T=e.getBoundingClientRect();T.width>0&&(r.width=`${Math.round(T.width*100)/100}px`),T.height>0&&(r.height=`${Math.round(T.height*100)/100}px`)}}let c=e.textContent&&e.textContent.trim().length>0,l=nz.includes(e.tagName.toLowerCase());(c||l)&&(r.fontSize=n.fontSize,r.fontFamily=Vs(n.fontFamily),r.fontWeight=n.fontWeight,r.lineHeight=n.lineHeight,r.color=Tn(n.color),Nn("letterSpacing",n.letterSpacing)||(r.letterSpacing=n.letterSpacing),Nn("textAlign",n.textAlign)||(r.textAlign=n.textAlign)),r.display=n.display;let d=Yf(n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft);Nn("padding",d)||(r.padding=d);let g=Yf(n.marginTop,n.marginRight,n.marginBottom,n.marginLeft);return Nn("margin",g)||(r.margin=g),Nn("gap",n.gap)||(r.gap=n.gap),(n.display==="flex"||n.display==="inline-flex")&&(Nn("flexDirection",n.flexDirection)||(r.flexDirection=n.flexDirection),Nn("justifyContent",n.justifyContent)||(r.justifyContent=n.justifyContent),Nn("alignItems",n.alignItems)||(r.alignItems=n.alignItems)),r.width||(r.width=n.width),r.height||(r.height=n.height),r}function ev(e){let t=1;for(let n of e.children)t+=ev(n);return t}function tv(e,t=4){function n(o,i){let s=o.tagName.toLowerCase(),a=o.className,u=typeof a=="string"?a:a?.baseVal||"",c=o.id||void 0,l=o.getAttribute("role")||void 0,d;for(let k of Array.from(o.childNodes))if(k.nodeType===Node.TEXT_NODE){let T=k.textContent?.trim();if(T){d=T.length>50?T.substring(0,50)+"...":T;break}}let g=s;c?g=`${s}#${c}`:u&&(g=Ri(s,u));let p=oz(o),f=[];if(i<t){let k=Array.from(o.children);for(let T of k){let E=T.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(E))continue;let D=(T.ownerDocument.defaultView||window).getComputedStyle(T);D.display==="none"||D.visibility==="hidden"||f.push(n(T,i+1))}}return{selector:g,tagName:s,className:u,id:c,role:l,textContent:d,styles:p,children:f}}y.debug("[computedStyles] Extracting DOM tree with maxDepth:",t);let r=n(e,0);return y.debug("[computedStyles] DOM tree extracted:",{rootSelector:r.selector,childrenCount:r.children.length,totalNodes:ev(r)}),r}function Kf(e=4){y.debug("[extractStoryDOMTree] Starting DOM tree extraction...");try{let t=document.getElementById("storybook-preview-iframe");if(y.debug("[extractStoryDOMTree] iframe found:",!!t),!t)throw new Error("Storybook preview iframe not found");if(y.debug("[extractStoryDOMTree] iframe.contentDocument:",!!t.contentDocument),!t.contentDocument)throw new Error("iframe.contentDocument is not accessible (possible cross-origin issue)");let n=t.contentDocument.getElementById("storybook-root");if(y.debug("[extractStoryDOMTree] storyRoot found:",!!n),!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(y.debug("[extractStoryDOMTree] componentElement found:",!!r,r?.tagName),!r)throw new Error("Component element not found in story root");let o=tv(r,e);return y.debug("[extractStoryDOMTree] DOM tree extracted successfully:",{selector:o.selector,childrenCount:o.children.length}),o}catch(t){return y.error("[extractStoryDOMTree] Error extracting DOM tree:",t),null}}var nz,nv=_(()=>{"use strict";Oe();Gs();Ul();nz=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var Xf=_(()=>{"use strict";Gs();Ul();Zw();nv()});var Ev=rr((cQ,Fv)=>{"use strict";Fv.exports={compareTwoStrings:Iv,findBestMatch:Az};function Iv(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 n=new Map;for(let o=0;o<e.length-1;o++){let i=e.substring(o,o+2),s=n.has(i)?n.get(i)+1:1;n.set(i,s)}let r=0;for(let o=0;o<t.length-1;o++){let i=t.substring(o,o+2),s=n.has(i)?n.get(i):0;s>0&&(n.set(i,s-1),r++)}return 2*r/(e.length+t.length-2)}function Az(e,t){if(!Pz(e,t))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");let n=[],r=0;for(let i=0;i<t.length;i++){let s=t[i],a=Iv(e,s);n.push({target:s,rating:a}),a>n[r].rating&&(r=i)}let o=n[r];return{ratings:n,bestMatch:o,bestMatchIndex:r}}function Pz(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(n){return typeof n!="string"}))}});var C1=rr((kse,k1)=>{"use strict";var b1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,E3=/\n/g,A3=/^\s*/,P3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,L3=/^:\s*/,M3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,B3=/^[;\s]*/,D3=/^\s+|\s+$/g,R3=`
|
|
14
|
+
`,S1="/",w1="*",ai="",z3="comment",N3="declaration";function O3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(f){var k=f.match(E3);k&&(n+=k.length);var T=f.lastIndexOf(R3);r=~T?f.length-T:r+f.length}function i(){var f={line:n,column:r};return function(k){return k.position=new s(f),c(),k}}function s(f){this.start=f,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(f){var k=new Error(t.source+":"+n+":"+r+": "+f);if(k.reason=f,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function u(f){var k=f.exec(e);if(k){var T=k[0];return o(T),e=e.slice(T.length),k}}function c(){u(A3)}function l(f){var k;for(f=f||[];k=d();)k!==!1&&f.push(k);return f}function d(){var f=i();if(!(S1!=e.charAt(0)||w1!=e.charAt(1))){for(var k=2;ai!=e.charAt(k)&&(w1!=e.charAt(k)||S1!=e.charAt(k+1));)++k;if(k+=2,ai===e.charAt(k-1))return a("End of comment missing");var T=e.slice(2,k-2);return r+=2,o(T),e=e.slice(k),r+=2,f({type:z3,comment:T})}}function g(){var f=i(),k=u(P3);if(k){if(d(),!u(L3))return a("property missing ':'");var T=u(M3),E=f({type:N3,property:v1(k[0].replace(b1,ai)),value:T?v1(T[0].replace(b1,ai)):ai});return u(B3),E}}function p(){var f=[];l(f);for(var k;k=g();)k!==!1&&(f.push(k),l(f));return f}return c(),p()}function v1(e){return e?e.replace(D3,ai):ai}k1.exports=O3});var T1=rr(ma=>{"use strict";var _3=ma&&ma.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ma,"__esModule",{value:!0});ma.default=U3;var $3=_3(C1());function U3(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,$3.default)(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;let{property:s,value:a}=i;o?t(s,a,i):a&&(n=n||{},n[s]=a)}),n}});var F1=rr(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.camelCase=void 0;var j3=/^--[a-zA-Z0-9_-]+$/,H3=/-([a-z])/g,W3=/^[^-]+$/,V3=/^-(webkit|moz|ms|o|khtml)-/,G3=/^-(ms)-/,q3=function(e){return!e||W3.test(e)||j3.test(e)},Y3=function(e,t){return t.toUpperCase()},I1=function(e,t){return"".concat(t,"-")},K3=function(e,t){return t===void 0&&(t={}),q3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(G3,I1):e=e.replace(V3,I1),e.replace(H3,Y3))};kc.camelCase=K3});var A1=rr((Ph,E1)=>{"use strict";var X3=Ph&&Ph.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Q3=X3(T1()),J3=F1();function Ah(e,t){var n={};return!e||typeof e!="string"||(0,Q3.default)(e,function(r,o){r&&o&&(n[(0,J3.camelCase)(r,t)]=o)}),n}Ah.default=Ah;E1.exports=Ah});var nI=rr((Jpe,tI)=>{"use strict";var Gc=Object.prototype.hasOwnProperty,eI=Object.prototype.toString,YT=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,XT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):eI.call(t)==="[object Array]"},QT=function(t){if(!t||eI.call(t)!=="[object Object]")return!1;var n=Gc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gc.call(t,o)},JT=function(t,n){YT&&n.name==="__proto__"?YT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ZT=function(t,n){if(n==="__proto__")if(Gc.call(t,n)){if(KT)return KT(t,n).value}else return;return t[n]};tI.exports=function e(){var t,n,r,o,i,s,a=arguments[0],u=1,c=arguments.length,l=!1;for(typeof a=="boolean"&&(l=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});u<c;++u)if(t=arguments[u],t!=null)for(n in t)r=ZT(a,n),o=ZT(t,n),a!==o&&(l&&o&&(QT(o)||(i=XT(o)))?(i?(i=!1,s=r&&XT(r)?r:[]):s=r&&QT(r)?r:{},JT(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&JT(a,{name:n,newValue:o}));return a}});import Oa from"react";import{addons as lu,types as ty,experimental_getStatusStore as ny}from"storybook/manager-api";import{AddonPanel as yV}from"storybook/internal/components";import Dt,{useState as NW,useEffect as OW}from"react";import{styled as xr}from"storybook/theming";import py from"react";import{styled as Mt}from"storybook/theming";var se="#ea580c",pu="#c2410c",ja="#ff6b35";var iy=Mt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),sy=Mt.div({flex:1,overflow:"auto",padding:"6px 20px 20px"}),ho=Mt.div({marginBottom:"20px"}),xo=Mt.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})),ps=Mt.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,backgroundColor:e.input.background,color:e.color.defaultText,"&:focus":{outline:"none",borderColor:e.color.secondary,boxShadow:`0 0 0 2px ${e.color.secondary}20`}})),hn=Mt.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,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"}})),ay=Mt(hn)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),Ha=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,cursor:"pointer",transition:"all 0.15s","&:disabled":{opacity:.5,cursor:"not-allowed"}}),kn=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Yt=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:se,color:e.color.inverseText,boxShadow:`0 2px 4px ${se}4d`,"&:hover:not(:disabled)":{backgroundColor:pu,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${se}66`}})),Rr=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),ly=Mt.button(({theme:e})=>({...Ha(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),Cn=Mt.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"}})),du=Mt.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"}})),yo=Mt.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}})),bo=Mt(ps)(({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"})),IV=Mt.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),cy=Mt.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})),FV=Mt.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})),ds=Mt.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})),EV=Mt.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,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%)"}}})),uy=Mt.span(({theme:e,variant:t="default"})=>{let n={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:n[t].bg,color:n[t].color}}),AV=Mt.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),PV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),LV=Mt.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var gu=({header:e,children:t,footer:n})=>py.createElement(iy,null,e,py.createElement(sy,null,t),n);import XF from"react";import{styled as QF}from"storybook/theming";var JF=QF.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})),fu=({toolbar:e})=>XF.createElement(JF,null,e);import UV from"react";import{styled as Wa}from"storybook/theming";var WV=Wa.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})),VV=Wa.div({display:"flex",flex:1}),GV=Wa(yo)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),qV=Wa.div({display:"flex",gap:"8px",alignItems:"center"});import Zt,{useState as Of,useCallback as Nw,useEffect as Ow}from"react";import{styled as eo}from"storybook/theming";import ve,{useEffect as Iw}from"react";import{styled as lt}from"storybook/theming";Ce();je();Oe();ct();var Fw=lt.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),Ew=lt.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})),ND=lt.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),OD=lt.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),_D=lt.div({display:"flex",flexDirection:"column",gap:"4px"}),$D=lt.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),UD=lt.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"}),jD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),HD=lt.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),WD=lt.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),VD=lt.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"})),GD=lt.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${se} 100%)`,transition:"width 0.3s ease"})),qD=lt.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),YD=lt.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),KD=lt.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:se,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),Aw=lt.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}})),XD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),QD=lt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),JD=lt.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:se,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),ZD=lt.div({display:"flex",gap:"8px"}),Pw=lt(Cn)({fontSize:"18px"}),eR=lt.div({padding:"20px 16px"}),tR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),nR=lt.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),rR=lt.div({fontSize:"28px",fontWeight:700}),oR=lt.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),iR=lt.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),sR=lt.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),aR=lt.div({display:"flex",alignItems:"center",gap:"8px"}),lR=lt.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),cR=lt.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:se,color:e.color.inverseText})),uR=lt.button(({theme:e})=>({background:"none",border:"none",color:se,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),pR=lt.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),dR=lt.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"?se:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),gR=30*1e3,Lw=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=we(),{featureFlags:s}=ce(),a=s.showCosts,u=r,c=!r&&t,l=async(f=!1)=>{if(!t)return;let k=o&&Date.now()-o<gR;if(!(!f&&k&&r))try{let T=V(),E=await ne(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(E.ok){let I=await E.json();i(I)}}catch(T){y.error("Failed to fetch usage:",T)}};Iw(()=>{l()},[t]),Iw(()=>{let f=()=>{document.visibilityState==="visible"&&(y.debug("[TokenUsageModal] Tab visible, refreshing balance..."),l(!0))};return document.addEventListener("visibilitychange",f),()=>document.removeEventListener("visibilitychange",f)},[t]);let d=()=>{if(t){let f=V();fetch(`${f}/api/addon/auth/sign-out`,{method:"POST",headers:{Authorization:`Bearer ${t}`}}).catch(()=>{})}n(),e()},g=()=>{let f=V();window.open(`${f}/pricing`,"_blank")},p=()=>{let f=V();window.open(`${f}/pricing#add-credits`,"_blank")};if(t&&!a&&!c){let f=Math.floor(u?.creditBalance??0),T=Math.max(f,10),E=Math.max(0,T-f),I=T>0?f/T*100:0;return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:D=>D.stopPropagation(),style:{width:"320px"}},ve.createElement(ND,null,ve.createElement(OD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement(_D,null,ve.createElement($D,null,"UI Review"),ve.createElement(UD,null,(u?.plan||"BETA").toUpperCase())),ve.createElement("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"2px"}},ve.createElement(Aw,{onClick:d,title:"Sign out",style:{position:"static"}},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Aw,{onClick:e,title:"Close",style:{position:"static"}},"\xD7"))),ve.createElement(jD,null,ve.createElement(HD,null,"Credits"),ve.createElement(WD,null,f," left")),ve.createElement(VD,null,ve.createElement(GD,{percent:I})),ve.createElement(qD,null,E," used \xB7 ",f," remaining"),ve.createElement(YD,null),ve.createElement(KD,{onClick:()=>window.open("mailto:hello@uiparity.com?subject=Credits request","_blank")},"Contact us for credits \u2192")))}return ve.createElement(ve.Fragment,null,ve.createElement(Fw,{onClick:e}),ve.createElement(Ew,{onClick:f=>f.stopPropagation()},ve.createElement(XD,null,ve.createElement(QD,null,ve.createElement(JD,null,u?.email?u.email[0].toUpperCase():"U"),ve.createElement("span",null,u?.email||"Loading...")),ve.createElement(ZD,null,ve.createElement(Pw,{onClick:d,title:"Sign out"},ve.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),ve.createElement("polyline",{points:"16 17 21 12 16 7"}),ve.createElement("line",{x1:"21",y1:"12",x2:"9",y2:"12"}))),ve.createElement(Pw,{onClick:e,title:"Close"},"\xD7"))),ve.createElement(eR,null,c?ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?ve.createElement(ve.Fragment,null,ve.createElement(tR,null,ve.createElement(nR,null,"Credit Balance"),ve.createElement(rR,null,"$",(u?.creditBalance??0).toFixed(2)),ve.createElement(oR,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ve.createElement(iR,null,ve.createElement(sR,null,ve.createElement(aR,null,ve.createElement(lR,null,"Current Plan"),ve.createElement(cR,null,u?.plan||"Free")),ve.createElement(uR,{onClick:g},"View detail >")),ve.createElement(pR,null,"~$0.02-0.05 per review depending on complexity"),ve.createElement(dR,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):ve.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};Ce();import Pi from"react";import{styled as Mw}from"storybook/theming";je();Ce();ct();Oe();var fR=Mw.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),mR=Mw.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),hR={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}},Bw=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=ce(),{sessionToken:o}=we();return e!=="admin"?null:Pi.createElement(fR,null,Pi.createElement(mR,null,"View as:"),Pi.createElement(ay,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&ne(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(c=>c.json()).then(c=>{let l={enableFixGeneration:!!c.enableFixGeneration,enableFixApply:!!c.enableFixApply,enableAutoMap:!!c.enableAutoMap,enableReviewBadges:!!c.enableReviewBadges,showCosts:!!c.showCosts,enableParallelReview:!!c.enableParallelReview,enableModelSelection:!!c.enableModelSelection};r(l);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(l))}catch{}}).catch(c=>y.warn("[RoleSwitcher] Failed to re-fetch flags:",c.message));else{n(u);let c=hR[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},Pi.createElement("option",{value:"admin"},"Admin"),Pi.createElement("option",{value:"beta"},"Beta Tester")),t&&Pi.createElement(uy,{variant:"warning"},"Previewing as ",t))};je();Ce();ct();import ht,{useState as Us,useCallback as Nf}from"react";import{styled as Cr}from"storybook/theming";var xR="0.5.7",yR=[{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"}],bR=Cr.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center"}),SR=Cr.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)"})),wR=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",borderBottom:`1px solid ${e.appBorderColor}`})),vR=Cr.h3(({theme:e})=>({margin:0,fontSize:"15px",fontWeight:600,color:e.color.defaultText,display:"flex",alignItems:"center",gap:"8px"})),kR=Cr.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}})),CR=Cr.div({padding:"16px 20px",display:"flex",flexDirection:"column",gap:"14px"}),TR=Cr.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:se}})),Dw=Cr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px 16px",borderTop:`1px solid ${e.appBorderColor}`,gap:"8px"})),Rw=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4})),IR=Cr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s1,color:e.color.negative})),FR=Cr.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 zw({isOpen:e,onClose:t}){let{sessionToken:n,isConnected:r}=we(),{selectedProjectId:o}=Je(),{currentStoryId:i}=nt(),[s,a]=Us("other"),[u,c]=Us(""),[l,d]=Us(!1),[g,p]=Us(!1),[f,k]=Us(null),T=Nf(()=>{c(""),a("other"),p(!1),k(null),d(!1)},[]),E=Nf(()=>{T(),t()},[T,t]),I=Nf(async D=>{if(D.preventDefault(),!u.trim()){k("Please write a message.");return}if(!r||!n){k("Sign in to send feedback.");return}d(!0),k(null);try{let R=await ne(`${V()}/api/feedback`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({message:u.trim(),severity:s,projectId:o||void 0,storyId:i||void 0,addonVersion:xR})});if(!R.ok){let $=await R.json().catch(()=>({}));throw new Error($.error||`Request failed (${R.status})`)}p(!0)}catch(R){k(R instanceof Error?R.message:"Something went wrong")}finally{d(!1)}},[u,s,n,r,o,i]);return e?ht.createElement(bR,{onClick:E},ht.createElement(SR,{onClick:D=>D.stopPropagation()},ht.createElement(wR,null,ht.createElement(vR,null,ht.createElement("span",null,"\u{1F4AC}"),"Send feedback"),ht.createElement(kR,{onClick:E,"aria-label":"Close"},"\xD7")),g?ht.createElement(ht.Fragment,null,ht.createElement(FR,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(Dw,null,ht.createElement("span",null),ht.createElement(kn,{onClick:E},"Close"))):ht.createElement("form",{onSubmit:I},ht.createElement(CR,null,ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-severity"},"Type"),ht.createElement(hn,{id:"feedback-severity",value:s,onChange:D=>a(D.target.value),disabled:l},yR.map(D=>ht.createElement("option",{key:D.value,value:D.value},D.label)))),ht.createElement(ho,null,ht.createElement(xo,{htmlFor:"feedback-message"},"What happened?"),ht.createElement(TR,{id:"feedback-message",value:u,onChange:D=>c(D.target.value),placeholder:"Tell us what you were doing, what you expected, and what happened.",disabled:l,autoFocus:!0,maxLength:5e3})),ht.createElement(Rw,null,"We auto-attach your current story and project so we can reproduce it. No screenshots sent."),f&&ht.createElement(IR,null,f)),ht.createElement(Dw,null,ht.createElement(Rw,null,i?`Context: ${i}`:"No story selected"),ht.createElement("div",{style:{display:"flex",gap:"8px"}},ht.createElement(kn,{type:"button",onClick:E,disabled:l},"Cancel"),ht.createElement(Yt,{type:"submit",disabled:l||!u.trim()},l?"Sending\u2026":"Send")))))):null}Ce();je();ct();var ER=eo.div({display:"flex",alignItems:"center"}),Li=eo.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),AR=eo.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),PR=eo.div({position:"relative"}),LR=eo.button(({theme:e})=>({width:"26px",height:"26px",padding:0,background:`linear-gradient(135deg, ${e.color.secondary} 0%, ${e.color.secondary}cc 100%)`,border:"none",borderRadius:"50%",color:e.color.inverseText,cursor:"pointer",fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s","&:hover":{transform:"scale(1.05)",boxShadow:`0 2px 8px ${e.color.secondary}66`}})),_w=eo.button(({isLow:e})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",background:e?"#FEF3C7":"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",border:"none",borderRadius:"12px",color:e?"#92400E":"#fff",cursor:"pointer",fontSize:"12px",fontWeight:600,transition:"all 0.2s",minWidth:"60px",justifyContent:"center","&:hover":{transform:"scale(1.02)",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})),MR=eo.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)"}}}),BR=eo.button(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"4px 10px",height:"28px",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,backgroundColor:"transparent",color:e.color.mediumdark,fontSize:"12px",fontWeight:500,cursor:"pointer",transition:"all 0.15s","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.mediumdark}})),DR=eo.button({position:"fixed",bottom:"20px",right:"20px",width:"48px",height:"48px",borderRadius:"50%",backgroundColor:se,color:"white",border:"none",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",cursor:"pointer",boxShadow:`0 4px 14px ${se}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 ${se}88, 0 3px 6px rgba(0,0,0,0.15)`},"&:active":{transform:"scale(0.96)"}}),RR=30*1e3,_f=({onOpenSettings:e})=>{let[t,n]=Of(!1),[r,o]=Of(!1),[i,s]=Of(!1),{usageData:a,usageLastFetched:u,setUsageData:c,sessionToken:l}=we(),{userRole:d,roleOverride:g,featureFlags:p}=ce(),f=g??d;Ow(()=>{(async()=>{if(!(!l||u&&Date.now()-u<RR&&a)){s(!0);try{let $=V(),P=await ne(`${$}/api/addon/account`,{headers:{Authorization:`Bearer ${l}`}});if(P.ok){let z=await P.json();c(z)}}catch($){console.error("Failed to fetch balance:",$)}finally{s(!1)}}})()},[l,u,a,c]),Ow(()=>{let D=()=>{document.visibilityState==="visible"&&t&&n(!1)},R=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",D),window.addEventListener("focus",R),()=>{document.removeEventListener("visibilitychange",D),window.removeEventListener("focus",R)}},[t]);let k=Nw(()=>{n(!0)},[]),T=Nw(()=>{n(!1)},[]),E=a?.creditBalance??0,I=E<2&&!i;return Zt.createElement(ER,null,e&&Zt.createElement(Li,null,Zt.createElement(BR,{onClick:e,title:"Settings"},Zt.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),l&&d==="admin"&&f==="admin"&&Zt.createElement(Li,null,Zt.createElement(Bw,null)),Zt.createElement(Li,null,Zt.createElement(AR,null,"v","0.5.16")),l&&p.showCosts&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:I,title:i?"Loading...":a?I?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},i?Zt.createElement(MR,null):a?`$${E.toFixed(2)}`:"...")),l&&!p.showCosts&&a&&Zt.createElement(Li,null,Zt.createElement(_w,{onClick:k,isLow:Math.floor(E)<=3,title:`${Math.floor(E)} review credits \u2014 click for details`},"\u26A1 ",Math.floor(E))),Zt.createElement(Li,null,Zt.createElement(PR,null,Zt.createElement(LR,{title:"Account & Usage",onClick:k},a?.email?a.email[0].toUpperCase():"?"),t&&Zt.createElement(Lw,{onClose:T}))),l&&Zt.createElement(DR,{onClick:()=>o(!0),title:"Send feedback","aria-label":"Send feedback"},"\u{1F4AC}"),Zt.createElement(zw,{isOpen:r,onClose:()=>o(!1)}))};import Lt,{useEffect as w4,useRef as v4}from"react";import{styled as gr}from"storybook/theming";import rt from"react";Ce();Oe();je();ct();Rn();import{useState as zR,useCallback as Mi,useRef as $w,useEffect as NR}from"react";var to=V();y.debug("[useAuth] Module loaded, APP_URL:",to);var js=()=>{let e=$w(null),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setSessionToken:c,setApiKey:l,setAuthMethod:d,setDeviceCode:g,setUserCode:p,setVerificationUri:f,setPollingInterval:k,setAuthError:T,resetAuth:E}=we(),I=$w(null),[D,R]=zR(!1),$=Mi(async()=>{try{y.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let C;try{C=await ne(`${to}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(A){let B=A instanceof Error&&A.message.includes("timed out")?`Cannot reach ${Ft.NAME} server at ${to}. Is the dashboard running?`:`Connection failed: ${to} is not responding.`;T(B),y.error("[useAuth]",B);return}if(!C.ok){let A=`Cannot reach ${Ft.NAME} server. Is the dashboard running?`;T(A),y.error("[useAuth]",A);return}let{poll_code:m}=await C.json();y.debug("[useAuth] Got poll_code:",m.substring(0,15)+"...");let F=localStorage.getItem("uicopilot_force_sign_in")==="true";F&&localStorage.removeItem("uicopilot_force_sign_in");let S=`${to}/addon/auth?poll_code=${m}${F?"&force_sign_in=true":""}`;R(!0),window.open(S,"uiparity-auth","width=520,height=620,left=300,top=150"),y.debug("[useAuth] Starting OAuth poll for token..."),I.current&&clearInterval(I.current);let b=async()=>{try{let L=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:m})})).json();L.status==="authorized"&&L.session_token?(y.debug("[useAuth] \u2705 OAuth poll successful! Got token."),I.current&&(clearInterval(I.current),I.current=null),localStorage.setItem("uicopilot_session_token",L.session_token),c(L.session_token),R(!1)):L.status==="expired"&&(y.debug("[useAuth] OAuth poll_code expired"),I.current&&(clearInterval(I.current),I.current=null),R(!1))}catch(A){y.error("[useAuth] OAuth poll error:",A)}};I.current=setInterval(b,2e3),setTimeout(b,1e3)}catch(C){y.error("[useAuth] OAuth flow error:",C),T(`Connection failed. Is the dashboard running at ${to}?`),R(!1)}},[c,T]),P=Mi(async()=>{try{let C=await fetch(`${to}/api/addon/auth/device`,{method:"POST"});if(!C.ok)throw new Error("Failed to start device code flow");let m=await C.json();g(m.device_code),p(m.user_code),f(m.verification_uri),window.open(m.verification_uri,"_blank"),z(m.device_code,m.interval*1e3)}catch(C){throw y.error("[useAuth] Device code flow error:",C),C}},[g,p,f]),z=Mi((C,m)=>{y.debug("[useAuth] Starting polling. Device code:",C,"Interval:",m),e.current&&clearInterval(e.current);let F=async()=>{try{let b=await(await fetch(`${to}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:C})})).json();b.status==="authorized"?(y.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),localStorage.setItem("uicopilot_session_token",b.session_token),c(b.session_token),setOauthUrl(null)):(b.status==="expired"||b.status==="denied")&&(y.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null))}catch(S){y.error("[useAuth] Polling error:",S)}};e.current=setInterval(F,m),k(m)},[g,p,f,c,k]),x=Mi(()=>{e.current&&(clearInterval(e.current),e.current=null),g(null),p(null),f(null),k(null)},[g,p,f,k]),w=Mi(C=>{l(C),c(C),localStorage.setItem("uicopilot_api_key",C)},[l,c]),v=Mi(()=>{E(),setOauthUrl(null),e.current&&(clearInterval(e.current),e.current=null),I.current&&(clearInterval(I.current),I.current=null)},[E]);return NR(()=>()=>{e.current&&clearInterval(e.current),I.current&&clearInterval(I.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,oauthPending:D,setAuthMethod:d,startOAuth:$,startDeviceCode:P,cancelDeviceCode:x,saveApiKey:w,logout:v}};Ce();Oe();je();ct();import{useCallback as Nl}from"react";var Hs=V(),no=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Je(),{sessionToken:a}=we(),u=Nl(async()=>{if(!a){y.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),y.debug("[useProjects] Fetching from:",`${Hs}/api/projects`);let g=await ne(`${Hs}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}});if(g.ok){let p=await g.json();y.debug("[useProjects] Projects:",p.projects),r(p.projects||[])}else y.error("[useProjects] Failed to fetch projects:",g.status,g.statusText)}catch(g){y.error("[useProjects] Error fetching projects:",g)}finally{i(!1)}},[a,r,i]),c=Nl(async g=>{if(!a)throw new Error("Not authenticated");let p=await ne(`${Hs}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(g)});if(!p.ok)throw new Error("Failed to create project");let f=await p.json();return await u(),f.project},[a,u]),l=Nl(async(g,p)=>{if(!a)throw new Error("Not authenticated");let f={};if(p.name!==void 0&&(f.name=p.name),p.description!==void 0&&(f.description=p.description),p.figmaFileUrl!==void 0&&(f.figmaFileId=p.figmaFileUrl||void 0),!(await ne(`${Hs}/api/projects/${g}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(f)})).ok)throw new Error("Failed to update project");await u()},[a,u]),d=Nl(async g=>{if(!a)throw new Error("Not authenticated");if(!(await ne(`${Hs}/api/projects/${g}`,{method:"DELETE",headers:{Authorization:`Bearer ${a}`}})).ok)throw new Error("Failed to delete project");await u(),t===g&&o(null)},[a,t,u,o]);return{projects:e,selectedProjectId:t,selectedProject:s(),loadingProjects:n,setSelectedProjectId:o,fetchProjects:u,createProject:c,updateProject:l,deleteProject:d}};Ce();var Ws=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d}=nt();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:d,openComponentBrowser:()=>s(!0),closeComponentBrowser:()=>s(!1)}};Ce();Wf();Xf();import{useCallback as Js,useRef as Yl}from"react";Oe();function jl(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){y.warn("[iframeReload] No preview iframe found"),e();return}let n=t.contentWindow.location.href,r=new URL(n);r.searchParams.set("_cb",Date.now().toString());let o=r.toString();y.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{y.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",s),e()},5e3),s=()=>{clearTimeout(i),t.removeEventListener("load",s),y.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{y.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",s),t.contentWindow.location.href=o})}var Hl=BigInt(4294967295),rv=BigInt(32);function iz(e,t=!1){return t?{h:Number(e&Hl),l:Number(e>>rv&Hl)}:{h:Number(e>>rv&Hl)|0,l:Number(e&Hl)|0}}function ov(e,t=!1){let n=e.length,r=new Uint32Array(n),o=new Uint32Array(n);for(let i=0;i<n;i++){let{h:s,l:a}=iz(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var iv=(e,t,n)=>e<<n|t>>>32-n,sv=(e,t,n)=>t<<n|e>>>32-n,av=(e,t,n)=>t<<n-32|e>>>64-n,lv=(e,t,n)=>e<<n-32|t>>>64-n;function sz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Qf(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Wl(e,t,n=""){let r=sz(e),o=e?.length,i=t!==void 0;if(!r||i&&o!==t){let s=n&&`"${n}" `,a=i?` of length ${t}`:"",u=r?`length=${o}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function Jf(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 cv(e,t){Wl(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function uv(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Zf(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var az=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function lz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function cz(e){for(let t=0;t<e.length;t++)e[t]=lz(e[t]);return e}var em=az?e=>e:cz;function pv(e,t={}){let n=(o,i)=>e(i).update(o).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=o=>e(o),Object.assign(n,t),Object.freeze(n)}var dv=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var uz=BigInt(0),Ys=BigInt(1),pz=BigInt(2),dz=BigInt(7),gz=BigInt(256),fz=BigInt(113),mv=[],hv=[],xv=[];for(let e=0,t=Ys,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mv.push(2*(5*r+n)),hv.push((e+1)*(e+2)/2%64);let o=uz;for(let i=0;i<7;i++)t=(t<<Ys^(t>>dz)*fz)%gz,t&pz&&(o^=Ys<<(Ys<<BigInt(i))-Ys);xv.push(o)}var yv=ov(xv,!0),mz=yv[0],hz=yv[1],gv=(e,t,n)=>n>32?av(e,t,n):iv(e,t,n),fv=(e,t,n)=>n>32?lv(e,t,n):sv(e,t,n);function xz(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,c=n[u],l=n[u+1],d=gv(c,l,1)^n[a],g=fv(c,l,1)^n[a+1];for(let p=0;p<50;p+=10)e[s+p]^=d,e[s+p+1]^=g}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=hv[s],u=gv(o,i,a),c=fv(o,i,a),l=mv[s];o=e[l],i=e[l+1],e[l]=u,e[l+1]=c}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=mz[r],e[1]^=hz[r]}Zf(n)}var tm=class e{constructor(t,n,r,o=!1,i=24){or(this,"state");or(this,"pos",0);or(this,"posOut",0);or(this,"finished",!1);or(this,"state32");or(this,"destroyed",!1);or(this,"blockLen");or(this,"suffix");or(this,"outputLen");or(this,"enableXOF",!1);or(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Qf(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=uv(this.state)}clone(){return this._cloneInto()}keccak(){em(this.state32),xz(this.state32,this.rounds),em(this.state32),this.posOut=0,this.pos=0}update(t){Jf(this),Wl(t);let{blockLen:n,state:r}=this,o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Jf(this,!1),Wl(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Qf(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(cv(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,Zf(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},yz=(e,t,n,r={})=>pv(()=>new tm(t,e,n),r);var bv=yz(6,72,64,dv(10));var bz=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,nm=Math.ceil,ur=Math.floor,On="[BigNumber Error] ",Sv=On+"Number primitive has more than 15 significant digits: ",Tr=1e14,Ve=14,rm=9007199254740991,om=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Io=1e7,an=1e9;function wv(e){var t,n,r,o=I.prototype={constructor:I,toString:null,valueOf:null},i=new I(1),s=20,a=4,u=-7,c=21,l=-1e7,d=1e7,g=!1,p=1,f=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function I(x,w){var v,C,m,F,S,b,A,L,B=this;if(!(B instanceof I))return new I(x,w);if(w==null){if(x&&x._isBigNumber===!0){B.s=x.s,!x.c||x.e>d?B.c=B.e=null:x.e<l?B.c=[B.e=0]:(B.e=x.e,B.c=x.c.slice());return}if((b=typeof x=="number")&&x*0==0){if(B.s=1/x<0?(x=-x,-1):1,x===~~x){for(F=0,S=x;S>=10;S/=10,F++);F>d?B.c=B.e=null:(B.e=F,B.c=[x]);return}L=String(x)}else{if(!bz.test(L=String(x)))return r(B,L,b);B.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(F=L.indexOf("."))>-1&&(L=L.replace(".","")),(S=L.search(/e/i))>0?(F<0&&(F=S),F+=+L.slice(S+1),L=L.substring(0,S)):F<0&&(F=L.length)}else{if(zt(w,2,T.length,"Base"),w==10&&E)return B=new I(x),P(B,s+B.e+1,a);if(L=String(x),b=typeof x=="number"){if(x*0!=0)return r(B,L,b,w);if(B.s=1/x<0?(L=L.slice(1),-1):1,I.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(Sv+x)}else B.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(v=T.slice(0,w),F=S=0,A=L.length;S<A;S++)if(v.indexOf(C=L.charAt(S))<0){if(C=="."){if(S>F){F=A;continue}}else if(!m&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){m=!0,S=-1,F=0;continue}return r(B,String(x),b,w)}b=!1,L=n(L,w,10,B.s),(F=L.indexOf("."))>-1?L=L.replace(".",""):F=L.length}for(S=0;L.charCodeAt(S)===48;S++);for(A=L.length;L.charCodeAt(--A)===48;);if(L=L.slice(S,++A)){if(A-=S,b&&I.DEBUG&&A>15&&(x>rm||x!==ur(x)))throw Error(Sv+B.s*x);if((F=F-S-1)>d)B.c=B.e=null;else if(F<l)B.c=[B.e=0];else{if(B.e=F,B.c=[],S=(F+1)%Ve,F<0&&(S+=Ve),S<A){for(S&&B.c.push(+L.slice(0,S)),A-=Ve;S<A;)B.c.push(+L.slice(S,S+=Ve));S=Ve-(L=L.slice(S)).length}else S-=A;for(;S--;L+="0");B.c.push(+L)}}else B.c=[B.e=0]}I.clone=wv,I.ROUND_UP=0,I.ROUND_DOWN=1,I.ROUND_CEIL=2,I.ROUND_FLOOR=3,I.ROUND_HALF_UP=4,I.ROUND_HALF_DOWN=5,I.ROUND_HALF_EVEN=6,I.ROUND_HALF_CEIL=7,I.ROUND_HALF_FLOOR=8,I.EUCLID=9,I.config=I.set=function(x){var w,v;if(x!=null)if(typeof x=="object"){if(x.hasOwnProperty(w="DECIMAL_PLACES")&&(v=x[w],zt(v,0,an,w),s=v),x.hasOwnProperty(w="ROUNDING_MODE")&&(v=x[w],zt(v,0,8,w),a=v),x.hasOwnProperty(w="EXPONENTIAL_AT")&&(v=x[w],v&&v.pop?(zt(v[0],-an,0,w),zt(v[1],0,an,w),u=v[0],c=v[1]):(zt(v,-an,an,w),u=-(c=v<0?-v:v))),x.hasOwnProperty(w="RANGE"))if(v=x[w],v&&v.pop)zt(v[0],-an,-1,w),zt(v[1],1,an,w),l=v[0],d=v[1];else if(zt(v,-an,an,w),v)l=-(d=v<0?-v:v);else throw Error(On+w+" cannot be zero: "+v);if(x.hasOwnProperty(w="CRYPTO"))if(v=x[w],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))g=v;else throw g=!v,Error(On+"crypto unavailable");else g=v;else throw Error(On+w+" not true or false: "+v);if(x.hasOwnProperty(w="MODULO_MODE")&&(v=x[w],zt(v,0,9,w),p=v),x.hasOwnProperty(w="POW_PRECISION")&&(v=x[w],zt(v,0,an,w),f=v),x.hasOwnProperty(w="FORMAT"))if(v=x[w],typeof v=="object")k=v;else throw Error(On+w+" not an object: "+v);if(x.hasOwnProperty(w="ALPHABET"))if(v=x[w],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))E=v.slice(0,10)=="0123456789",T=v;else throw Error(On+w+" invalid: "+v)}else throw Error(On+"Object expected: "+x);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,d],CRYPTO:g,MODULO_MODE:p,POW_PRECISION:f,FORMAT:k,ALPHABET:T}},I.isBigNumber=function(x){if(!x||x._isBigNumber!==!0)return!1;if(!I.DEBUG)return!0;var w,v,C=x.c,m=x.e,F=x.s;e:if({}.toString.call(C)=="[object Array]"){if((F===1||F===-1)&&m>=-an&&m<=an&&m===ur(m)){if(C[0]===0){if(m===0&&C.length===1)return!0;break e}if(w=(m+1)%Ve,w<1&&(w+=Ve),String(C[0]).length==w){for(w=0;w<C.length;w++)if(v=C[w],v<0||v>=Tr||v!==ur(v))break e;if(v!==0)return!0}}}else if(C===null&&m===null&&(F===null||F===1||F===-1))return!0;throw Error(On+"Invalid BigNumber: "+x)},I.maximum=I.max=function(){return R(arguments,-1)},I.minimum=I.min=function(){return R(arguments,1)},I.random=(function(){var x=9007199254740992,w=Math.random()*x&2097151?function(){return ur(Math.random()*x)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var C,m,F,S,b,A=0,L=[],B=new I(i);if(v==null?v=s:zt(v,0,an),S=nm(v/Ve),g)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(S*=2));A<S;)b=C[A]*131072+(C[A+1]>>>11),b>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),C[A]=m[0],C[A+1]=m[1]):(L.push(b%1e14),A+=2);A=S/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(S*=7);A<S;)b=(C[A]&31)*281474976710656+C[A+1]*1099511627776+C[A+2]*4294967296+C[A+3]*16777216+(C[A+4]<<16)+(C[A+5]<<8)+C[A+6],b>=9e15?crypto.randomBytes(7).copy(C,A):(L.push(b%1e14),A+=7);A=S/7}else throw g=!1,Error(On+"crypto unavailable");if(!g)for(;A<S;)b=w(),b<9e15&&(L[A++]=b%1e14);for(S=L[--A],v%=Ve,S&&v&&(b=om[Ve-v],L[A]=ur(S/b)*b);L[A]===0;L.pop(),A--);if(A<0)L=[F=0];else{for(F=-1;L[0]===0;L.splice(0,1),F-=Ve);for(A=1,b=L[0];b>=10;b/=10,A++);A<Ve&&(F-=Ve-A)}return B.e=F,B.c=L,B}})(),I.sum=function(){for(var x=1,w=arguments,v=new I(w[0]);x<w.length;)v=v.plus(w[x++]);return v},n=(function(){var x="0123456789";function w(v,C,m,F){for(var S,b=[0],A,L=0,B=v.length;L<B;){for(A=b.length;A--;b[A]*=C);for(b[0]+=F.indexOf(v.charAt(L++)),S=0;S<b.length;S++)b[S]>m-1&&(b[S+1]==null&&(b[S+1]=0),b[S+1]+=b[S]/m|0,b[S]%=m)}return b.reverse()}return function(v,C,m,F,S){var b,A,L,B,N,h,j,W,M=v.indexOf("."),K=s,ee=a;for(M>=0&&(B=f,f=0,v=v.replace(".",""),W=new I(C),h=W.pow(v.length-M),f=B,W.c=w(ro(cr(h.c),h.e,"0"),10,m,x),W.e=W.c.length),j=w(v,C,m,S?(b=T,x):(b=x,T)),L=B=j.length;j[--B]==0;j.pop());if(!j[0])return b.charAt(0);if(M<0?--L:(h.c=j,h.e=L,h.s=F,h=t(h,W,K,ee,m),j=h.c,N=h.r,L=h.e),A=L+K+1,M=j[A],B=m/2,N=N||A<0||j[A+1]!=null,N=ee<4?(M!=null||N)&&(ee==0||ee==(h.s<0?3:2)):M>B||M==B&&(ee==4||N||ee==6&&j[A-1]&1||ee==(h.s<0?8:7)),A<1||!j[0])v=N?ro(b.charAt(1),-K,b.charAt(0)):b.charAt(0);else{if(j.length=A,N)for(--m;++j[--A]>m;)j[A]=0,A||(++L,j=[1].concat(j));for(B=j.length;!j[--B];);for(M=0,v="";M<=B;v+=b.charAt(j[M++]));v=ro(v,L,b.charAt(0))}return v}})(),t=(function(){function x(C,m,F){var S,b,A,L,B=0,N=C.length,h=m%Io,j=m/Io|0;for(C=C.slice();N--;)A=C[N]%Io,L=C[N]/Io|0,S=j*A+L*h,b=h*A+S%Io*Io+B,B=(b/F|0)+(S/Io|0)+j*L,C[N]=b%F;return B&&(C=[B].concat(C)),C}function w(C,m,F,S){var b,A;if(F!=S)A=F>S?1:-1;else for(b=A=0;b<F;b++)if(C[b]!=m[b]){A=C[b]>m[b]?1:-1;break}return A}function v(C,m,F,S){for(var b=0;F--;)C[F]-=b,b=C[F]<m[F]?1:0,C[F]=b*S+C[F]-m[F];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,m,F,S,b){var A,L,B,N,h,j,W,M,K,ee,ge,xe,ae,Ke,be,Te,te,Me=C.s==m.s?1:-1,Ae=C.c,pe=m.c;if(!Ae||!Ae[0]||!pe||!pe[0])return new I(!C.s||!m.s||(Ae?pe&&Ae[0]==pe[0]:!pe)?NaN:Ae&&Ae[0]==0||!pe?Me*0:Me/0);for(M=new I(Me),K=M.c=[],L=C.e-m.e,Me=F+L+1,b||(b=Tr,L=pr(C.e/Ve)-pr(m.e/Ve),Me=Me/Ve|0),B=0;pe[B]==(Ae[B]||0);B++);if(pe[B]>(Ae[B]||0)&&L--,Me<0)K.push(1),N=!0;else{for(Ke=Ae.length,Te=pe.length,B=0,Me+=2,h=ur(b/(pe[0]+1)),h>1&&(pe=x(pe,h,b),Ae=x(Ae,h,b),Te=pe.length,Ke=Ae.length),ae=Te,ee=Ae.slice(0,Te),ge=ee.length;ge<Te;ee[ge++]=0);te=pe.slice(),te=[0].concat(te),be=pe[0],pe[1]>=b/2&&be++;do{if(h=0,A=w(pe,ee,Te,ge),A<0){if(xe=ee[0],Te!=ge&&(xe=xe*b+(ee[1]||0)),h=ur(xe/be),h>1)for(h>=b&&(h=b-1),j=x(pe,h,b),W=j.length,ge=ee.length;w(j,ee,W,ge)==1;)h--,v(j,Te<W?te:pe,W,b),W=j.length,A=1;else h==0&&(A=h=1),j=pe.slice(),W=j.length;if(W<ge&&(j=[0].concat(j)),v(ee,j,ge,b),ge=ee.length,A==-1)for(;w(pe,ee,Te,ge)<1;)h++,v(ee,Te<ge?te:pe,ge,b),ge=ee.length}else A===0&&(h++,ee=[0]);K[B++]=h,ee[0]?ee[ge++]=Ae[ae]||0:(ee=[Ae[ae]],ge=1)}while((ae++<Ke||ee[0]!=null)&&Me--);N=ee[0]!=null,K[0]||K.splice(0,1)}if(b==Tr){for(B=1,Me=K[0];Me>=10;Me/=10,B++);P(M,F+(M.e=B+L*Ve-1)+1,S,N)}else M.e=L,M.r=+N;return M}})();function D(x,w,v,C){var m,F,S,b,A;if(v==null?v=a:zt(v,0,8),!x.c)return x.toString();if(m=x.c[0],S=x.e,w==null)A=cr(x.c),A=C==1||C==2&&(S<=u||S>=c)?Gl(A,S):ro(A,S,"0");else if(x=P(new I(x),w,v),F=x.e,A=cr(x.c),b=A.length,C==1||C==2&&(w<=F||F<=u)){for(;b<w;A+="0",b++);A=Gl(A,F)}else if(w-=S+(C===2&&F>S),A=ro(A,F,"0"),F+1>b){if(--w>0)for(A+=".";w--;A+="0");}else if(w+=F-b,w>0)for(F+1==b&&(A+=".");w--;A+="0");return x.s<0&&m?"-"+A:A}function R(x,w){for(var v,C,m=1,F=new I(x[0]);m<x.length;m++)C=new I(x[m]),(!C.s||(v=ti(F,C))===w||v===0&&F.s===w)&&(F=C);return F}function $(x,w,v){for(var C=1,m=w.length;!w[--m];w.pop());for(m=w[0];m>=10;m/=10,C++);return(v=C+v*Ve-1)>d?x.c=x.e=null:v<l?x.c=[x.e=0]:(x.e=v,x.c=w),x}r=(function(){var x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,v=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,S,b,A){var L,B=b?S:S.replace(m,"");if(C.test(B))F.s=isNaN(B)?null:B<0?-1:1;else{if(!b&&(B=B.replace(x,function(N,h,j){return L=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!A||A==L?h:N}),A&&(L=A,B=B.replace(w,"$1").replace(v,"0.$1")),S!=B))return new I(B,L);if(I.DEBUG)throw Error(On+"Not a"+(A?" base "+A:"")+" number: "+S);F.s=null}F.c=F.e=null}})();function P(x,w,v,C){var m,F,S,b,A,L,B,N=x.c,h=om;if(N){e:{for(m=1,b=N[0];b>=10;b/=10,m++);if(F=w-m,F<0)F+=Ve,S=w,A=N[L=0],B=ur(A/h[m-S-1]%10);else if(L=nm((F+1)/Ve),L>=N.length)if(C){for(;N.length<=L;N.push(0));A=B=0,m=1,F%=Ve,S=F-Ve+1}else break e;else{for(A=b=N[L],m=1;b>=10;b/=10,m++);F%=Ve,S=F-Ve+m,B=S<0?0:ur(A/h[m-S-1]%10)}if(C=C||w<0||N[L+1]!=null||(S<0?A:A%h[m-S-1]),C=v<4?(B||C)&&(v==0||v==(x.s<0?3:2)):B>5||B==5&&(v==4||C||v==6&&(F>0?S>0?A/h[m-S]:0:N[L-1])%10&1||v==(x.s<0?8:7)),w<1||!N[0])return N.length=0,C?(w-=x.e+1,N[0]=h[(Ve-w%Ve)%Ve],x.e=-w||0):N[0]=x.e=0,x;if(F==0?(N.length=L,b=1,L--):(N.length=L+1,b=h[Ve-F],N[L]=S>0?ur(A/h[m-S]%h[S])*b:0),C)for(;;)if(L==0){for(F=1,S=N[0];S>=10;S/=10,F++);for(S=N[0]+=b,b=1;S>=10;S/=10,b++);F!=b&&(x.e++,N[0]==Tr&&(N[0]=1));break}else{if(N[L]+=b,N[L]!=Tr)break;N[L--]=0,b=1}for(F=N.length;N[--F]===0;N.pop());}x.e>d?x.c=x.e=null:x.e<l&&(x.c=[x.e=0])}return x}function z(x){var w,v=x.e;return v===null?x.toString():(w=cr(x.c),w=v<=u||v>=c?Gl(w,v):ro(w,v,"0"),x.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var x=new I(this);return x.s<0&&(x.s=1),x},o.comparedTo=function(x,w){return ti(this,new I(x,w))},o.decimalPlaces=o.dp=function(x,w){var v,C,m,F=this;if(x!=null)return zt(x,0,an),w==null?w=a:zt(w,0,8),P(new I(F),x+F.e+1,w);if(!(v=F.c))return null;if(C=((m=v.length-1)-pr(this.e/Ve))*Ve,m=v[m])for(;m%10==0;m/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(x,w){return t(this,new I(x,w),s,a)},o.dividedToIntegerBy=o.idiv=function(x,w){return t(this,new I(x,w),0,1)},o.exponentiatedBy=o.pow=function(x,w){var v,C,m,F,S,b,A,L,B,N=this;if(x=new I(x),x.c&&!x.isInteger())throw Error(On+"Exponent not an integer: "+z(x));if(w!=null&&(w=new I(w)),b=x.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!x.c||!x.c[0])return B=new I(Math.pow(+z(N),b?x.s*(2-Vl(x)):+z(x))),w?B.mod(w):B;if(A=x.s<0,w){if(w.c?!w.c[0]:!w.s)return new I(NaN);C=!A&&N.isInteger()&&w.isInteger(),C&&(N=N.mod(w))}else{if(x.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||b&&N.c[1]>=24e7:N.c[0]<8e13||b&&N.c[0]<=9999975e7)))return F=N.s<0&&Vl(x)?-0:0,N.e>-1&&(F=1/F),new I(A?1/F:F);f&&(F=nm(f/Ve+2))}for(b?(v=new I(.5),A&&(x.s=1),L=Vl(x)):(m=Math.abs(+z(x)),L=m%2),B=new I(i);;){if(L){if(B=B.times(N),!B.c)break;F?B.c.length>F&&(B.c.length=F):C&&(B=B.mod(w))}if(m){if(m=ur(m/2),m===0)break;L=m%2}else if(x=x.times(v),P(x,x.e+1,1),x.e>14)L=Vl(x);else{if(m=+z(x),m===0)break;L=m%2}N=N.times(N),F?N.c&&N.c.length>F&&(N.c.length=F):C&&(N=N.mod(w))}return C?B:(A&&(B=i.div(B)),w?B.mod(w):F?P(B,f,a,S):B)},o.integerValue=function(x){var w=new I(this);return x==null?x=a:zt(x,0,8),P(w,w.e+1,x)},o.isEqualTo=o.eq=function(x,w){return ti(this,new I(x,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(x,w){return ti(this,new I(x,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(x,w){return(w=ti(this,new I(x,w)))===1||w===0},o.isInteger=function(){return!!this.c&&pr(this.e/Ve)>this.c.length-2},o.isLessThan=o.lt=function(x,w){return ti(this,new I(x,w))<0},o.isLessThanOrEqualTo=o.lte=function(x,w){return(w=ti(this,new I(x,w)))===-1||w===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,w){var v,C,m,F,S=this,b=S.s;if(x=new I(x,w),w=x.s,!b||!w)return new I(NaN);if(b!=w)return x.s=-w,S.plus(x);var A=S.e/Ve,L=x.e/Ve,B=S.c,N=x.c;if(!A||!L){if(!B||!N)return B?(x.s=-w,x):new I(N?S:NaN);if(!B[0]||!N[0])return N[0]?(x.s=-w,x):new I(B[0]?S:a==3?-0:0)}if(A=pr(A),L=pr(L),B=B.slice(),b=A-L){for((F=b<0)?(b=-b,m=B):(L=A,m=N),m.reverse(),w=b;w--;m.push(0));m.reverse()}else for(C=(F=(b=B.length)<(w=N.length))?b:w,b=w=0;w<C;w++)if(B[w]!=N[w]){F=B[w]<N[w];break}if(F&&(m=B,B=N,N=m,x.s=-x.s),w=(C=N.length)-(v=B.length),w>0)for(;w--;B[v++]=0);for(w=Tr-1;C>b;){if(B[--C]<N[C]){for(v=C;v&&!B[--v];B[v]=w);--B[v],B[C]+=Tr}B[C]-=N[C]}for(;B[0]==0;B.splice(0,1),--L);return B[0]?$(x,B,L):(x.s=a==3?-1:1,x.c=[x.e=0],x)},o.modulo=o.mod=function(x,w){var v,C,m=this;return x=new I(x,w),!m.c||!x.s||x.c&&!x.c[0]?new I(NaN):!x.c||m.c&&!m.c[0]?new I(m):(p==9?(C=x.s,x.s=1,v=t(m,x,0,3),x.s=C,v.s*=C):v=t(m,x,0,p),x=m.minus(v.times(x)),!x.c[0]&&p==1&&(x.s=m.s),x)},o.multipliedBy=o.times=function(x,w){var v,C,m,F,S,b,A,L,B,N,h,j,W,M,K,ee=this,ge=ee.c,xe=(x=new I(x,w)).c;if(!ge||!xe||!ge[0]||!xe[0])return!ee.s||!x.s||ge&&!ge[0]&&!xe||xe&&!xe[0]&&!ge?x.c=x.e=x.s=null:(x.s*=ee.s,!ge||!xe?x.c=x.e=null:(x.c=[0],x.e=0)),x;for(C=pr(ee.e/Ve)+pr(x.e/Ve),x.s*=ee.s,A=ge.length,N=xe.length,A<N&&(W=ge,ge=xe,xe=W,m=A,A=N,N=m),m=A+N,W=[];m--;W.push(0));for(M=Tr,K=Io,m=N;--m>=0;){for(v=0,h=xe[m]%K,j=xe[m]/K|0,S=A,F=m+S;F>m;)L=ge[--S]%K,B=ge[S]/K|0,b=j*L+B*h,L=h*L+b%K*K+W[F]+v,v=(L/M|0)+(b/K|0)+j*B,W[F--]=L%M;W[F]=v}return v?++C:W.splice(0,1),$(x,W,C)},o.negated=function(){var x=new I(this);return x.s=-x.s||null,x},o.plus=function(x,w){var v,C=this,m=C.s;if(x=new I(x,w),w=x.s,!m||!w)return new I(NaN);if(m!=w)return x.s=-w,C.minus(x);var F=C.e/Ve,S=x.e/Ve,b=C.c,A=x.c;if(!F||!S){if(!b||!A)return new I(m/0);if(!b[0]||!A[0])return A[0]?x:new I(b[0]?C:m*0)}if(F=pr(F),S=pr(S),b=b.slice(),m=F-S){for(m>0?(S=F,v=A):(m=-m,v=b),v.reverse();m--;v.push(0));v.reverse()}for(m=b.length,w=A.length,m-w<0&&(v=A,A=b,b=v,w=m),m=0;w;)m=(b[--w]=b[w]+A[w]+m)/Tr|0,b[w]=Tr===b[w]?0:b[w]%Tr;return m&&(b=[m].concat(b),++S),$(x,b,S)},o.precision=o.sd=function(x,w){var v,C,m,F=this;if(x!=null&&x!==!!x)return zt(x,1,an),w==null?w=a:zt(w,0,8),P(new I(F),x,w);if(!(v=F.c))return null;if(m=v.length-1,C=m*Ve+1,m=v[m]){for(;m%10==0;m/=10,C--);for(m=v[0];m>=10;m/=10,C++);}return x&&F.e+1>C&&(C=F.e+1),C},o.shiftedBy=function(x){return zt(x,-rm,rm),this.times("1e"+x)},o.squareRoot=o.sqrt=function(){var x,w,v,C,m,F=this,S=F.c,b=F.s,A=F.e,L=s+4,B=new I("0.5");if(b!==1||!S||!S[0])return new I(!b||b<0&&(!S||S[0])?NaN:S?F:1/0);if(b=Math.sqrt(+z(F)),b==0||b==1/0?(w=cr(S),(w.length+A)%2==0&&(w+="0"),b=Math.sqrt(+w),A=pr((A+1)/2)-(A<0||A%2),b==1/0?w="5e"+A:(w=b.toExponential(),w=w.slice(0,w.indexOf("e")+1)+A),v=new I(w)):v=new I(b+""),v.c[0]){for(A=v.e,b=A+L,b<3&&(b=0);;)if(m=v,v=B.times(m.plus(t(F,m,L,1))),cr(m.c).slice(0,b)===(w=cr(v.c)).slice(0,b))if(v.e<A&&--b,w=w.slice(b-3,b+1),w=="9999"||!C&&w=="4999"){if(!C&&(P(m,m.e+s+2,0),m.times(m).eq(F))){v=m;break}L+=4,b+=4,C=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(P(v,v.e+s+2,1),x=!v.times(v).eq(F));break}}return P(v,v.e+s+1,a,x)},o.toExponential=function(x,w){return x!=null&&(zt(x,0,an),x++),D(this,x,w,1)},o.toFixed=function(x,w){return x!=null&&(zt(x,0,an),x=x+this.e+1),D(this,x,w)},o.toFormat=function(x,w,v){var C,m=this;if(v==null)x!=null&&w&&typeof w=="object"?(v=w,w=null):x&&typeof x=="object"?(v=x,x=w=null):v=k;else if(typeof v!="object")throw Error(On+"Argument not an object: "+v);if(C=m.toFixed(x,w),m.c){var F,S=C.split("."),b=+v.groupSize,A=+v.secondaryGroupSize,L=v.groupSeparator||"",B=S[0],N=S[1],h=m.s<0,j=h?B.slice(1):B,W=j.length;if(A&&(F=b,b=A,A=F,W-=F),b>0&&W>0){for(F=W%b||b,B=j.substr(0,F);F<W;F+=b)B+=L+j.substr(F,b);A>0&&(B+=L+j.slice(F)),h&&(B="-"+B)}C=N?B+(v.decimalSeparator||"")+((A=+v.fractionGroupSize)?N.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):N):B}return(v.prefix||"")+C+(v.suffix||"")},o.toFraction=function(x){var w,v,C,m,F,S,b,A,L,B,N,h,j=this,W=j.c;if(x!=null&&(b=new I(x),!b.isInteger()&&(b.c||b.s!==1)||b.lt(i)))throw Error(On+"Argument "+(b.isInteger()?"out of range: ":"not an integer: ")+z(b));if(!W)return new I(j);for(w=new I(i),L=v=new I(i),C=A=new I(i),h=cr(W),F=w.e=h.length-j.e-1,w.c[0]=om[(S=F%Ve)<0?Ve+S:S],x=!x||b.comparedTo(w)>0?F>0?w:L:b,S=d,d=1/0,b=new I(h),A.c[0]=0;B=t(b,w,0,1),m=v.plus(B.times(C)),m.comparedTo(x)!=1;)v=C,C=m,L=A.plus(B.times(m=L)),A=m,w=b.minus(B.times(m=w)),b=m;return m=t(x.minus(v),C,0,1),A=A.plus(m.times(L)),v=v.plus(m.times(C)),A.s=L.s=j.s,F=F*2,N=t(L,C,F,a).minus(j).abs().comparedTo(t(A,v,F,a).minus(j).abs())<1?[L,C]:[A,v],d=S,N},o.toNumber=function(){return+z(this)},o.toPrecision=function(x,w){return x!=null&&zt(x,1,an),D(this,x,w,2)},o.toString=function(x){var w,v=this,C=v.s,m=v.e;return m===null?C?(w="Infinity",C<0&&(w="-"+w)):w="NaN":(x==null?w=m<=u||m>=c?Gl(cr(v.c),m):ro(cr(v.c),m,"0"):x===10&&E?(v=P(new I(v),s+m+1,a),w=ro(cr(v.c),v.e,"0")):(zt(x,2,T.length,"Base"),w=n(ro(cr(v.c),m,"0"),10,x,C,!0)),C<0&&v.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return z(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&I.set(e),I}function pr(e){var t=e|0;return e>0||e===t?t:t-1}function cr(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=Ve-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function ti(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=u==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return u>c^n?1:-1;for(a=(u=o.length)<(c=i.length)?u:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return u==c?0:u>c^n?1:-1}function zt(e,t,n,r){if(e<t||e>n||e!==ur(e))throw Error(On+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Vl(e){var t=e.c.length-1;return pr(e.e/Ve)==t&&e.c[t]%2!=0}function Gl(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ro(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var Sz=wv(),vv=Sz;var wz=24,Ks=32,vz=()=>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,sm=vz(),im=(e=4,t=sm)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function kz(e){let t=new vv(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var Cv=(e="")=>{let t=new TextEncoder;return kz(bv(t.encode(e))).toString(36).slice(1)},kv=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),Cz=e=>kv[Math.floor(e()*kv.length)],Tz=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=sm}={})=>{let n=Object.keys(e).toString(),r=n.length?n+im(Ks,t):im(Ks,t);return Cv(r).substring(0,Ks)},Iz=e=>()=>e++,Fz=476782367,Tv=({random:e=sm,counter:t=Iz(Math.floor(e()*Fz)),length:n=wz,fingerprint:r=Tz({random:e})}={})=>{if(n>Ks)throw new Error(`Length must be between 2 and ${Ks}. Received: ${n}`);return function(){let i=Cz(e),s=Date.now().toString(36),a=t().toString(36),u=im(n,e),c=`${s+u+a+r}`;return`${i+Cv(c).substring(1,n)}`}},Fo=Ez(Tv);function Ez(e){let t;return()=>(t||(t=e()),t())}var Lz=Ua(Ev());Rn();Oe();var ql=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function Mz(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function am(e,t){let n=[],r=e.split(`
|
|
15
|
+
`);for(let s=0;s<r.length;s++){let a=Mz(r[s]),u=ql.exec(a);if(u){let[,c,l,,d]=u,g=Bz(l),p=Dz(r,s+1),f={id:Fo(),reviewId:t,type:c.trim(),severity:g,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};n.push(f)}ql.lastIndex=0}return n.map(s=>{let a=_s(s);return a.dismissed?(y.debug(`[parseIssues] Auto-dismissed: ${s.title} - ${a.dismissReason}`),{...s,dismissed:!0,dismissReason:a.dismissReason,dismissedBy:a.dismissedBy,dismissedAt:new Date}):s})}function Bz(e){let t=e.toLowerCase().trim();return t.includes("critical")||t.includes("high")?"critical":t.includes("major")||t.includes("medium")?"major":"minor"}function Dz(e,t){let n={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},r=[];for(let o=t;o<e.length;o++){let i=e[o].trim();if(!i||ql.test(i)){ql.lastIndex=0;break}if(i.startsWith("Expected:"))n.suggestedValue=i.replace("Expected:","").trim();else if(i.startsWith("Actual:")||i.startsWith("Current:"))n.currentValue=i.replace(/^(Actual|Current):/,"").trim();else if(i.startsWith("File:")){let s=i.replace("File:","").trim(),a=s.match(/^(.+?):(\d+)$/);a?(n.file=a[1],n.lineNumber=parseInt(a[2],10)):n.file=s}else if(i.startsWith("Property:"))n.property=i.replace("Property:","").trim();else if(i.startsWith("FixTarget:")){let s=i.replace("FixTarget:","").trim().toLowerCase();(s==="css"||s==="component")&&(n.fixTarget=s)}else if(i.startsWith("FixRequired:")){let s=i.replace("FixRequired:","").trim().toLowerCase();n.fixRequired=s==="true"}else if(i.startsWith("Fix:"))n.suggestedFix=i.replace("Fix:","").trim();else if(i.startsWith("```")){let s=[];for(o++;o<e.length&&!e[o].trim().startsWith("```");)s.push(e[o]),o++;n.suggestedCode=s.join(`
|
|
16
|
+
`)}else r.push(i)}return n.description=r.join(" ").trim(),n}Oe();var Xs=null,Av=0,Rz=3e4;async function zz(){let e=Date.now();if(Xs&&e-Av<Rz)return Xs;try{let t=await fetch("/index.json");if(!t.ok)throw new Error(`Failed to fetch index.json: ${t.status}`);let n=await t.json();return Xs=n.entries||n.stories||{},Av=e,y.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(Xs).length),Xs}catch(t){throw y.error("[storyFilePaths] Error fetching index.json:",t),t}}async function Qs(e){try{let n=(await zz())[e];if(!n?.importPath)return y.warn("[storyFilePaths] No importPath found for story:",e),null;let r=n.importPath;y.debug("[storyFilePaths] Found importPath:",r);let o=r.replace(/^\.\//,""),i;n.componentPath?(i=n.componentPath.replace(/^\.\//,""),y.debug("[storyFilePaths] Using Storybook componentPath:",i)):(i=`${o.replace(/\.stories\.tsx$/,"").replace(/\.stories\.ts$/,"").replace(/\.stories\.jsx$/,"").replace(/\.stories\.js$/,"")}.tsx`,y.debug("[storyFilePaths] Derived componentFile:",i));let s=i.replace(/\.tsx$/,".css").replace(/\.ts$/,".css").replace(/\.jsx$/,".css").replace(/\.js$/,".css"),a=i.substring(0,i.lastIndexOf("/")),u={storyFile:o,componentFile:i,cssFile:s,baseDir:a};return y.debug("[storyFilePaths] Final paths:",u),u}catch(t){return y.error("[storyFilePaths] Error getting file paths:",t),null}}function lm(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function Nz(e,t){let n=e.toLowerCase().trim();return["color","spacing","typography","dimension","border","shadow","layout","background","font","size","margin","padding"].some(i=>n.includes(i))?t.cssFile:t.componentFile}function cm(e,t){let n=e.property?.toLowerCase()||"",r=e.domElement?.toLowerCase()||"",o=r.startsWith("svg"),i=r.startsWith("img"),s=n==="width"||n==="height",a=/\[(?:width|height)=/.test(r);return(o||i)&&s||a?(y.debug(`[storyFilePaths] \u{1F50D} INLINE ATTRIBUTE: domElement="${e.domElement}", property="${e.property}" \u2192 component file`),t.componentFile):Nz(e.type,t)}Oe();function Oz(e){let t=(e.description||"").toLowerCase(),n=(e.title||"").toLowerCase(),r=`${t} ${n}`;return r.includes("inner icon")||r.includes("inner vector")?"inner-icon":r.includes("second icon")?"icon-2":r.includes("first icon")?"icon-1":r.includes("icon")||r.includes("vector")||r.includes("svg")?"icon":r.includes("button")?"button":r.includes("text")||r.includes("label")?"text":r.includes("container")||r.includes("wrapper")?"container":"other"}function _z(e){let t=(e.property||"").toLowerCase(),n=(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":n.includes("overall")||n.includes("visual fidelity")||n.includes("pixel similarity")||t.includes("overall")?"summary":"other"}function $z(e){let t=(e.property||"").toLowerCase(),n=(e.description||"").toLowerCase();return t.includes("overall")||t.includes("visual fidelity")||n.includes("pixel similarity score")||n.includes("primarily explained by")||n.includes("visual discrepancy")}function Uz(e,t,n){let r={critical:3,major:2,minor:1},i=[...e].sort((c,l)=>(r[l.severity]||0)-(r[c.severity]||0))[0],s=e.length,a,u;if(t.includes("icon")&&n==="dimensions"){let c=e.map(d=>d.currentValue).filter(Boolean),l=e.map(d=>d.suggestedValue).filter(Boolean);a=`Icon sizing is incorrect (${s} related issues)`,u=`Icons are rendered at wrong dimensions. Current: ${c[0]||"10px"}, Expected: ${l[0]||"20px"}. This single CSS fix will resolve all ${s} icon dimension issues.`}else a=`${t} ${n} issues (${s} related)`,u=`${s} related ${n} issues for ${t}. ${i.description}`;return{...i,id:`merged-${t}-${n}-${i.id}`,title:a,description:u,currentValue:i.currentValue,suggestedValue:i.suggestedValue,mergedCount:s,mergedIssueIds:e.map(c=>c.id)}}function um(e){if(!e||e.length===0)return[];let t=e.filter(i=>!$z(i)),n=[],r=[];for(let i of t){let s=Oz(i),a=_z(i);s.includes("icon")&&a==="dimensions"?n.push(i):r.push(i)}let o=[];return n.length>0&&(n.length===1?o.push(n[0]):o.push(Uz(n,"icon","dimensions"))),o.push(...r),y.debug("[deduplicateIssues] Input:",e.length,"issues, Output:",o.length,"issues"),y.debug("[deduplicateIssues] Removed",e.length-t.length,"summary issues"),y.debug("[deduplicateIssues] Merged",n.length,"icon issues into",n.length>0?1:0),o}Oe();Rn();var jz=[/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],Hz=[/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 Pv(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"Review failed";return Hz.some(n=>n.test(t))?t:jz.some(n=>n.test(t))?`Can't reach ${Ft.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)?`${Ft.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}. Try again, or send feedback if this keeps happening.`}je();import{addons as Oi}from"storybook/manager-api";var pm="uireview/badge",zi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error"};function Wz(e){return e.criticalCount>0||e.score<70?"status-value:error":e.majorCount>0||e.score<90?"status-value:warning":"status-value:success"}function Vz(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 Gz(e){return e.score>=90?`\u2713 Score ${e.score}`:e.score>=70?`\u26A0 Score ${e.score}`:`\u2717 Score ${e.score}`}function Ni(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function Bv(e){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_START,{storyId:e})}catch{}}function Eo(e,t){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function Dv(e){if(Ni())try{Oi.getChannel().emit(zi.REVIEW_ERROR,{storyId:e})}catch{}}function Lv(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}}var Mv=null;function Rv(e){if(Mv!==null)return;let t=Oi.getChannel(),n=o=>i=>{Ni()&&o(i)};t.on(zi.REVIEW_START,n(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:pm,storyId:o,title:"Reviewing...",description:"AI review in progress"}])})),t.on(zi.REVIEW_COMPLETE,n(({storyId:o,summary:i})=>{e.set([{value:Wz(i),typeId:pm,storyId:o,title:Gz(i),description:Vz(i)}])})),t.on(zi.REVIEW_ERROR,n(({storyId:o})=>{e.set([{value:"status-value:error",typeId:pm,storyId:o,title:"Review Failed",description:"An error occurred during review"}])}));let r=Ni();r||Lv(e),Mv=setInterval(()=>{let o=Ni();o!==r&&(r=o,o||Lv(e))},1500)}var qz="uireview/mapped",zv="uireview/mappings-updated";function Nv(e){try{Oi.getChannel().emit(zv,{storyIds:e})}catch{}}function Ov(e){Oi.getChannel().on(zv,({storyIds:n})=>{n.length&&e.set(n.map(r=>({value:"status-value:success",typeId:qz,storyId:r,title:"\u2713 Linked to Figma",description:"Story has a Figma mapping"})))})}var dm=V(),gm=180;function Ao(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 n=[t.top,t.right,t.bottom,t.left].filter(Boolean);if(n.length>0)return n.join(" ")}return JSON.stringify(e)}return String(e)}var fm=()=>{let{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,selectedModels:l,setIsReviewing:d,setReviewError:g,setReviewResults:p,setShowReviewMenu:f,setSeverityFilter:k,setShowStreamingPanel:T,setStreamingPanelCollapsed:E,addStreamingMessage:I,updateStreamingMessage:D,clearStreamingMessages:R,setStreamingProgress:$,setStreamingStatus:P,setFullPrompt:z,setFullResponse:x,setFigmaImageUrl:w,storybookImageUrl:v,setStorybookImageUrl:C,setFigmaDimensions:m,setMultiModelResults:F,updateMultiModelStreamingMessages:S,setModelCompleted:b,setActiveModelId:A,resetReview:L,addReview:B,setReviewDetailTab:N,includeTextComparison:h,usePromptCache:j,setApplyFixesResult:W,featureFlags:M}=ce(),{sessionToken:K,usageData:ee,setUsageData:ge}=we(),{selectedProjectId:xe}=Je(),{currentStoryId:ae,currentStoryName:Ke}=nt(),be=Yl(ee);be.current=ee;let Te=Yl(null),te=Yl(null),Me=Yl({}),Ae=Js((fe,tt)=>{I({role:fe,content:tt})},[I]),pe=Js((fe,tt)=>{$(fe),P(tt)},[$,P]),Pt=Js(async fe=>{let{isIteration:tt=!1,parentReviewId:he=null}=fe||{};if(!K)throw new Error("Not authenticated");if(!xe)throw new Error("No project selected");if(!ae||!Ke)throw new Error("No story is currently selected in Storybook");if(e){y.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let oe=Date.now();try{d(!0),g(null),p(null),N("issues"),W(null),ae&&M.enableReviewBadges&&Bv(ae),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{y.debug(`[useAIReview] Auto-stopping review after ${gm}s timeout`),Te.current&&Te.current.abort(),I({role:"system",content:`Review auto-stopped after ${gm} seconds timeout.`})},gm*1e3),z(""),x(""),T(!0),E(!1),R(),pe(0,"Starting review..."),pe(5,"Refreshing component preview..."),y.debug("[Review] Forcing iframe reload for fresh styles..."),await jl(),y.debug("[Review] Iframe reloaded, styles should be fresh"),pe(20,"Capturing screenshot & extracting styles..."),y.debug("[Review] Starting parallel data collection...");let[Y,me,ie]=await Promise.all([$l({sessionToken:K||void 0}),Promise.resolve(qs()),Promise.resolve(Kf())]);if(Y&&Y!==v&&(C(Y),y.debug("[Review] Storybook screenshot captured and set")),!me)throw new Error("Failed to extract styles from component");let{computed:O,declared:U,markup:H,textElementStyles:Be,nestedElementStyles:_e}=me;ie?y.debug("[Review] DOM tree extracted:",{selector:ie.selector,childrenCount:ie.children.length}):(y.error("[Review] DOM tree extraction FAILED - domTree is null"),y.error("[Review] This will cause AI to use comparison table instead of tree comparison")),pe(50,"Preparing metadata..."),y.debug("[Review] Current story:",{id:ae,name:Ke});let bt=gt.getState().currentMapping?.figmaNodeId??null,Gn=gt.getState().figmaImageUrl;if(bt&&(y.debug("[Review] Using Figma node ID from store:",bt),Gn&&(pe(65,"Using existing Figma design..."),y.debug("[Review] Reusing already-loaded Figma image"))),!bt)try{let Qe=await fetch(`${dm}/api/mappings?projectId=${xe}&storyId=${ae}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let Rt=await Qe.json();Rt.mapping?.figmaNodeId?(bt=Rt.mapping.figmaNodeId,y.debug("[Review] Found Figma node ID from API:",bt)):y.debug("[Review] No mapping found for story:",ae)}else y.debug("[Review] Failed to fetch mapping:",Qe.status)}catch(Qe){y.error("[Review] Error fetching mapping:",Qe)}if(bt&&!Gn){pe(65,"Fetching Figma design...");try{let Qe=await fetch(`${dm}/api/figma/frames?projectId=${xe}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Qe.ok){let $t=(await Qe.json()).thumbnails?.[bt];$t?(w($t),y.debug("[Review] Figma thumbnail fetched and displayed:",$t)):y.warn("[Review] No thumbnail found for node:",bt)}else y.warn("[Review] Failed to fetch Figma frames:",Qe.status)}catch(Qe){y.error("[Review] Error fetching Figma frames:",Qe)}}if(!bt)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');pe(80,"AI is analyzing your component..."),y.debug("[Review] Sending to streaming API...");let nr={projectId:xe,storyId:ae,storyName:Ke,storybookScreenshot:Y,computedStyles:O,declaredStyles:U,textElementStyles:Be,nestedElementStyles:_e,componentMarkup:H,domTree:ie,figmaNodeId:bt,figmaImageUrl:Gn||void 0,aiModels:l,includeTextComparison:h,usePromptCache:j,parentReviewId:tt?he:void 0,isIteration:tt};y.debug("[Review] Request payload:",{...nr,storybookScreenshot:Y?`${Y.substring(0,50)}...`:null,domTree:ie?{selector:ie.selector,childrenCount:ie.children.length}:null}),Te.current=new AbortController;let En=await fetch(`${dm}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:JSON.stringify(nr),signal:Te.current.signal});if(y.debug("[Review] Response status:",En.status,En.statusText),!En.ok){let Qe=await En.json();if(y.error("[Review] API error response:",Qe),En.status===429){let Rt=Qe.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${Rt} seconds before trying again.`)}if(En.status===402){if(Qe.code==="INSUFFICIENT_CREDITS"){let Rt=Qe.details?.required??1,$t=Qe.details?.balance??0;throw new Error(`Not enough credits. This review requires ${Rt} credit(s) but you have ${$t}. Visit Settings to add more.`)}throw Qe.code==="SUBSCRIPTION_LIMIT_EXCEEDED"?new Error(Qe.message||"Monthly review limit reached. Upgrade your plan to continue."):new Error(Qe.message||"Payment required")}throw En.status===401&&Qe.code==="FIGMA_AUTH_EXPIRED"?new Error("Figma connection expired. Open Settings \u2192 Disconnect \u2192 Reconnect Figma to continue."):new Error(Qe.error||Qe.message||"Review request failed")}let mo=En.body?.getReader(),wn=new TextDecoder,Br="",rn="",$e=null,uu=null,ry=l.length>1,Vo={},cs={},wV={};if(!mo)throw new Error("Response body is not readable");let oy=gt.getState().streamingMessages.length;for(Ae("assistant","");;){let{done:Qe,value:Rt}=await mo.read();if(Qe)break;Br+=wn.decode(Rt,{stream:!0});let $t=Br.split(`
|
|
17
|
+
`);Br=$t.pop()||"";for(let qn of $t)if(qn.startsWith("data: ")){let pn=qn.slice(6);if(pn==="[DONE]")continue;try{let re=JSON.parse(pn);if(re.type!=="text"&&re.type!=="content"&&y.debug("[Review] SSE Event received:",re.type),re.type==="prompt")re.prompt&&(z(re.prompt),y.debug("[Review] Prompt received early"));else if(re.type==="model_started")y.debug("[Review] Model started:",re.modelId),Vo[re.modelId]||(Vo[re.modelId]="",cs[re.modelId]=[{role:"assistant",content:""}]);else if(re.type==="text"||re.type==="content")if(ry&&re.modelId){Vo[re.modelId]||(Vo[re.modelId]="",cs[re.modelId]=[{role:"assistant",content:""}]),Vo[re.modelId]+=re.content,cs[re.modelId][0].content=Vo[re.modelId],S(re.modelId,cs[re.modelId]);let qt=Object.entries(Vo).map(([dn,at])=>`[${dn}]
|
|
18
18
|
${at}`).join(`
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
`);D(
|
|
22
|
+
`);D(oy,qt)}else rn+=re.content,D(oy,rn);else if(re.type==="model_completed")y.debug("[Review] Model completed:",re.modelId,re.complianceScore),b(re.modelId);else if(re.type==="figma_image")re.url&&(w(re.url),y.debug("[Review] Figma image URL received:",re.url));else if(re.type==="figma_dimensions")re.width&&re.height&&(m({width:re.width,height:re.height}),y.debug("[Review] Figma dimensions received:",re.width,"x",re.height));else if(re.type==="complete"||re.type==="result")$e=re,y.debug("[Review] Final result received! Type:",re.type),y.debug("[Review] Final result issues count:",re.issues?.length||0),y.debug("[Review] Final result score:",re.validation?.complianceScore),re.remainingCredits!=null&&be.current&&ge({...be.current,creditBalance:re.remainingCredits,reviewCredits:Math.floor(re.remainingCredits)});else if(re.type==="all_complete")$e=re,y.debug("[Review] Multi-model results received:",Object.keys(re.byModel)),re.remainingCredits!=null&&be.current&&ge({...be.current,creditBalance:re.remainingCredits,reviewCredits:Math.floor(re.remainingCredits)});else if(re.type==="error"||re.type==="model_error"){let qt=new Error(re.message||re.error||"Streaming error");throw qt.isServerError=!0,qt}}catch(re){if(re.isServerError)throw re;let qt=re instanceof Error?{message:re.message,name:re.name,stack:re.stack}:String(re);y.error("[Review] Error parsing SSE data:",qt),y.error("[Review] Failed to parse data:",pn.substring(0,200)+(pn.length>200?"...":"")),uu=re instanceof Error?re:new Error(String(re))}}}if(pe(100,"Review complete!"),!$e&&uu&&(y.error("[Review] No final result received. Last parse error:",uu),y.error("[Review] Streaming text available:",rn.length,"chars")),ry&&$e?.type==="all_complete"){let Qe=Object.keys($e.byModel).reduce(($t,qn)=>{let pn=$e.byModel[qn];return $t[qn]={...pn,fullResponse:pn.response||pn.fullResponse||"",fullPrompt:pn.prompt||pn.fullPrompt||"",streamingMessages:cs[qn]||[]},$t},{}),Rt=Object.keys($e.byModel)[0];F({byModel:Qe,activeModelId:Rt}),Qe[Rt]?.fullPrompt&&z(Qe[Rt].fullPrompt),y.debug("[Review] Multi-model results stored:",Object.keys($e.byModel));try{let $t=Fo(),qn=$e.byModel?.[Rt]?.issues,pn=qn&&qn.length>0,re=pn?qn.map(de=>({id:Fo(),reviewId:$t,dbId:de.dbId,type:de.type,severity:de.severity,title:de.description,description:de.description,property:de.property,expected:Ao(de.expected),actual:Ao(de.actual),currentValue:Ao(de.actual),suggestedValue:Ao(de.expected),source:de.source||"computed-styles",suggestedFix:de.suggestedFix,file:de.file,domElement:de.domElement,figmaElement:de.figmaElement,fixTarget:de.fixTarget,fixRequired:de.fixRequired,detectedBy:de.detectedBy,dismissed:de.dismissed??!1,dismissReason:de.dismissReason,dismissedAt:de.dismissed?new Date:void 0,_unreliable:de._unreliable,_validationError:de._validationError,figmaContext:de.figmaContext,relatedTo:Array.isArray(de.relatedTo)?de.relatedTo:void 0,status:"pending",selectedForFix:!1,createdAt:new Date})):am(Qe[Rt]?.fullResponse||"",$t);y.debug("[Review] Multi-model issues source:",pn?"API (server-side dismissal)":"client-side parsing"),y.debug("[Review] Multi-model issues count:",re.length,"issues");let qt=re.filter(de=>de.dismissed).length;qt>0&&(y.debug("[Review] Multi-model auto-dismissed:",qt,"false positive issues"),Ae("system",`
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
\u2705 ${qt} issue${qt>1?"s were":" was"} auto-dismissed as false positive${qt>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let dn=Me.current[ae];dn||(dn=await
|
|
26
|
+
\u2705 ${qt} issue${qt>1?"s were":" was"} auto-dismissed as false positive${qt>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let dn=Me.current[ae];dn||(dn=await Qs(ae)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},dn.storyFile&&(Me.current[ae]=dn)),y.debug("[Review] Story file paths:",dn);let at=re.map(de=>({...de,file:de.file||lm(de.fixTarget,dn)||cm(de,dn)}));if(at=um(at),y.debug("[Review] After de-duplication:",at.length,"issues"),!h){let de=at.length;at=at.filter(vn=>vn.property?.toLowerCase()!=="textcontent"&&!vn.description?.toLowerCase().includes("text content")),de!==at.length&&y.debug("[Review] Filtered out",de-at.length,"textContent issues (toggle OFF)")}let Dr=$e.validation?.complianceScore??Qe[Rt]?.complianceScore;if(y.debug("[Review] Multi-model score sources:",{firstModelId:Rt,validationScore:$e.validation?.complianceScore,modelScore:Qe[Rt]?.complianceScore,multiModelScore:Dr}),Dr==null){let vn=(Qe[Rt]?.fullResponse||"").match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);Dr=vn?parseInt(vn[1],10):void 0,y.debug("[Review] Parsed multi-model score from response:",Dr)}let An;tt&&he&&(An=(gt.getState().reviewHistory.find(vn=>vn.id===he)?.iterationNumber||0)+1);let us={id:$t,componentId:ae,storyId:ae,modelId:Rt,parentReviewId:tt&&he||void 0,iterationNumber:An,figmaFileKey:void 0,figmaNodeId:bt||void 0,figmaFileUrl:Gn||void 0,complianceScore:Dr,visualSimilarity:$e.visualSimilarity,issuesCount:at.filter(de=>!de.dismissed).length,issues:at,createdAt:new Date,reviewDurationMs:Date.now()-oe,costUsd:$e.costUsd,inputTokens:$e.inputTokens,outputTokens:$e.outputTokens,cacheCreationTokens:$e.cacheCreationTokens,cacheReadTokens:$e.cacheReadTokens};if(y.debug("[Review] Multi-model token data:",{costUsd:$e.costUsd,inputTokens:$e.inputTokens,outputTokens:$e.outputTokens,cacheCreationTokens:$e.cacheCreationTokens,cacheReadTokens:$e.cacheReadTokens,reviewTokens:us.inputTokens}),B(us),ae&&M.enableReviewBadges){let de=at.filter(vn=>!vn.dismissed);Eo(ae,{score:Dr??100,issueCount:de.length,criticalCount:de.filter(vn=>vn.severity==="critical").length,majorCount:de.filter(vn=>vn.severity==="major").length,minorCount:de.filter(vn=>vn.severity==="minor").length})}N("issues");let _a=at.filter(de=>!de.dismissed).length;y.debug("[Review] Created multi-model review with",_a,"active issues,",at.length-_a,"dismissed");let Ie=bt||gt.getState().currentMapping?.figmaNodeId;y.debug("[Review] Issue validation handled server-side. Active:",at.filter(de=>!de.dismissed).length,"Dismissed:",at.filter(de=>de.dismissed).length)}catch($t){y.error("[Review] Failed to parse issues from multi-model response:",$t)}}else if($e){$e.prompt&&z($e.prompt),($e.response||rn)&&x($e.response||rn),$e.figmaImageUrl&&w($e.figmaImageUrl),y.debug("[Review] State updated with prompt, response, and screenshots");try{let Qe=Fo(),Rt=$e.response||rn,$t=$e.issues,qn=$t&&$t.length>0,pn=qn?$t.map(Ie=>({id:Fo(),reviewId:Qe,dbId:Ie.dbId,type:Ie.type,severity:Ie.severity,title:Ie.description,description:Ie.description,property:Ie.property,expected:Ao(Ie.expected),actual:Ao(Ie.actual),currentValue:Ao(Ie.actual),suggestedValue:Ao(Ie.expected),source:Ie.source||"computed-styles",suggestedFix:Ie.suggestedFix,file:Ie.file,domElement:Ie.domElement,figmaElement:Ie.figmaElement,fixTarget:Ie.fixTarget,fixRequired:Ie.fixRequired,detectedBy:Ie.detectedBy,dismissed:Ie.dismissed??!1,dismissReason:Ie.dismissReason,dismissedAt:Ie.dismissed?new Date:void 0,_unreliable:Ie._unreliable,_validationError:Ie._validationError,figmaContext:Ie.figmaContext,relatedTo:Array.isArray(Ie.relatedTo)?Ie.relatedTo:void 0,status:"pending",selectedForFix:!1,createdAt:new Date})):am(Rt,Qe);y.debug("[Review] Issues source:",qn?"API (server-side dismissal)":"client-side parsing"),y.debug("[Review] Issues count:",pn.length,"issues");let re=pn.filter(Ie=>Ie.dismissed).length;re>0&&(y.debug("[Review] Auto-dismissed:",re,"false positive issues"),Ae("system",`
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
\u2705 ${re} issue${re>1?"s were":" was"} auto-dismissed as false positive${re>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let qt=$e.complianceScore??$e.validation?.complianceScore;if(y.debug("[Review] Score sources:",{directScore:$e.complianceScore,validationScore:$e.validation?.complianceScore,parsedScore:qt}),qt==null){let Ie=Rt.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);qt=Ie?parseInt(Ie[1],10):void 0,y.debug("[Review] Parsed score from response:",qt)}let dn=Me.current[ae];dn||(dn=await Xs(ae)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},dn.storyFile&&(Me.current[ae]=dn)),y.debug("[Review] Story file paths:",dn);let at=pn.map(Ie=>({...Ie,file:Ie.file||lm(Ie.fixTarget,dn)||cm(Ie,dn)}));if(at=um(at),y.debug("[Review] After de-duplication:",at.length,"issues"),!h){let Ie=at.length;at=at.filter(de=>de.property?.toLowerCase()!=="textcontent"&&!de.description?.toLowerCase().includes("text content")),Ie!==at.length&&y.debug("[Review] Filtered out",Ie-at.length,"textContent issues (toggle OFF)")}let Dr;tt&&he&&(Dr=(ft.getState().reviewHistory.find(de=>de.id===he)?.iterationNumber||0)+1);let An={id:Qe,componentId:ae,storyId:ae,modelId:l[0],parentReviewId:tt&&he||void 0,iterationNumber:Dr,figmaFileKey:void 0,figmaNodeId:bt||void 0,figmaFileUrl:Gn||void 0,complianceScore:qt,visualSimilarity:$e.visualSimilarity,issuesCount:at.filter(Ie=>!Ie.dismissed).length,issues:at,createdAt:new Date,reviewDurationMs:Date.now()-oe,costUsd:$e.costUsd,inputTokens:$e.inputTokens,outputTokens:$e.outputTokens,cacheCreationTokens:$e.cacheCreationTokens,cacheReadTokens:$e.cacheReadTokens,variantMismatch:$e.variantMismatch,storybookVariant:$e.storybookVariant,figmaVariant:$e.figmaVariant};if(y.debug("[useAIReview] About to call addReview with review:",{id:An.id,storyId:An.storyId,issueCount:An.issues?.length,complianceScore:An.complianceScore,createdAt:An.createdAt?.toISOString(),inputTokens:An.inputTokens,outputTokens:An.outputTokens,costUsd:An.costUsd,cacheCreationTokens:An.cacheCreationTokens,cacheReadTokens:An.cacheReadTokens}),B(An),y.debug("[useAIReview] addReview called successfully"),ae&&M.enableReviewBadges){let Ie=at.filter(de=>!de.dismissed);Eo(ae,{score:qt??100,issueCount:Ie.length,criticalCount:Ie.filter(de=>de.severity==="critical").length,majorCount:Ie.filter(de=>de.severity==="major").length,minorCount:Ie.filter(de=>de.severity==="minor").length})}N("issues");let cs=at.filter(Ie=>!Ie.dismissed).length;y.debug("[Review] Created review with",cs,"active issues,",at.length-cs,"dismissed");let Oa=bt||ft.getState().currentMapping?.figmaNodeId;y.debug("[Review] Validation check:",{figmaNodeId:bt,effectiveFigmaNodeIdSingle:Oa,hasSessionToken:!!K,selectedProjectId:xe,issueCount:at.length}),y.debug("[Review] Issue validation handled server-side. Active:",at.filter(Ie=>!Ie.dismissed).length,"Dismissed:",at.filter(Ie=>Ie.dismissed).length)}catch(Qe){y.error("[Review] Failed to parse issues:",Qe)}}else throw rn?(y.error("[Review] ERROR: No structured result received from backend!"),y.error("[Review] Streaming text length:",rn.length),y.error("[Review] This indicates a bug in SSE parsing or backend not sending complete event"),new Error("Review completed but failed to receive structured result. Check console for details.")):new Error("No results received from API")}catch(Y){if(Y instanceof Error&&Y.name==="AbortError"){y.debug("[useAIReview] Review cancelled by user"),pe(0,"Review cancelled");return}y.error("[useAIReview] Review error:",Y);let me=Av(Y);throw f(me),ae&&M.enableReviewBadges&&Bv(ae),pe(0,`Error: ${me}`),Y}finally{d(!1),Te.current=null,te.current&&(clearTimeout(te.current),te.current=null),fe(null)}},[e,K,xe,ae,Ke,l,d,f,p,F,S,b,A,T,E,R,Ae,pe,D,C,w,z,x,fe]),nn=Qs(()=>n?.issues?o==="all"?n.issues:n.issues.filter(ge=>ge.severity===o):[],[n,o]),Mr=Qs(()=>{Te.current&&(y.debug("[useAIReview] Cancelling review..."),Te.current.abort())},[]);return{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,startReview:Pt,cancelReview:Mr,setShowReviewMenu:g,setSeverityFilter:k,setShowStreamingPanel:T,setStreamingPanelCollapsed:E,addStreamingMessage:I,updateStreamingMessage:D,clearStreamingMessages:R,setStreamingProgress:$,setStreamingStatus:P,resetReview:L,getFilteredIssues:nn}};Ce();Oe();je();import{useCallback as RQ}from"react";var _Q=V();Ce();Oe();import{useEffect as Rv,useRef as zv}from"react";import{useStorybookApi as Wz,useStorybookState as Vz,addons as Gz}from"storybook/manager-api";var Nv="storyArgsUpdated",mm=()=>{let e=Wz(),t=Vz(),{currentStoryId:n,currentStoryName:r,setCurrentStoryId:o,setCurrentStoryName:i}=nt(),{clearStaleReviewsForStory:s,resetReview:a,isReviewing:u,isValidating:c}=ce(),l=zv(null),d=zv(0);return Rv(()=>{let f=t.storyId;if(f){l.current!==f&&(y.debug("[useCurrentStory] Story changed from",l.current,"to",f),s(f),l.current=f,d.current=Date.now()),o(f);let p=e.getData(f),g=p?.name&&p.name!=="default"?`${p.title} / ${p.name}`:p?.title||f;i(g),y.debug("[useCurrentStory] Current story:",{storyId:f,fullName:g})}else o(null),i(""),l.current=null},[t.storyId,e,o,i,s]),Rv(()=>{let f=Gz.getChannel(),p=null,g=k=>{if(k.storyId===n){if(u||c){y.debug("[useCurrentStory] Story args changed but review in progress, skipping reset");return}p&&clearTimeout(p),p=setTimeout(()=>{let{isReviewing:T,isValidating:E}=ft.getState();if(T||E){y.debug("[useCurrentStory] Story args changed but review started, skipping reset");return}if(Date.now()-d.current<2e3){y.debug("[useCurrentStory] Story args changed but story just navigated, skipping reset");return}y.debug("[useCurrentStory] Story args changed, clearing stale review"),a()},500)}};return f.on(Nv,g),()=>{f.off(Nv,g),p&&clearTimeout(p)}},[n,a,u,c]),{currentStoryId:n,currentStoryName:r}};Ce();je();ct();import{useCallback as Ov}from"react";import{addons as _v}from"storybook/manager-api";var $v=V(),ni=()=>{let{currentMapping:e,loadingMapping:t,setCurrentMapping:n,refreshMappings:r}=nt(),{sessionToken:o}=we(),{selectedProjectId:i}=Je(),s=Ov(async c=>{if(!o)throw new Error("Not authenticated");if(!i)throw new Error("No project selected");let l=await ne(`${$v}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({projectId:i,...c})});if(!l.ok)throw new Error("Failed to create mapping");let d=await l.json();r();try{_v.getChannel().emit("uireview/mappings-changed")}catch{}return d.mapping},[o,i,r]),a=Ov(async c=>{if(!o)throw new Error("Not authenticated");if(!(await ne(`${$v}/api/mappings?id=${encodeURIComponent(c)}`,{method:"DELETE",headers:{Authorization:`Bearer ${o}`}})).ok)throw new Error("Failed to delete mapping");r();try{_v.getChannel().emit("uireview/mappings-changed")}catch{}},[o,r]);return{currentMapping:e,loadingMapping:t,hasMapping:!!e,setCurrentMapping:n,createMapping:s,deleteMapping:a,refreshMappings:r}};Di();Ce();import{useCallback as hm,useEffect as Uv,useRef as qz}from"react";import{useChannel as Yz,addons as jv}from"storybook/manager-api";Oe();var Kz=3e4,Xz="forceRemount";function Qz(e,t){let n=parseFloat(e.replace(/[^0-9.-]/g,"")),r=parseFloat(t.replace(/[^0-9.-]/g,""));if(isNaN(n)||isNaN(r))return!1;let o=Math.abs(n-r);return e.includes("px")||t.includes("px")?o<.5:e.includes("%")||t.includes("%")?o<1:o<.5}function Jz(e){let t=["design system","design token","css variable","var(--","hard-coded"],n=`${e.description} ${e.suggestedFix||""} ${e.suggestedValue||""}`.toLowerCase();return t.some(r=>n.includes(r))}var Zz="UICOPILOT/APPLY_FIXES",eN="UICOPILOT/FIX_STARTED",tN="UICOPILOT/FIX_COMPLETED",nN="UICOPILOT/FIX_FAILED",rN="UICOPILOT/ALL_FIXES_APPLIED",xm=(e={})=>{let{onComplete:t,storybookRoot:n}=e,{isApplying:r,setIsApplying:o,setApplyFixesResult:i,updateIssueStatus:s,updateIssueGeneratedFix:a,setReviewDetailTab:u}=ce(),c=qz(null),l=hm(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);Uv(()=>()=>l(),[l]),Uv(()=>{let g=jv.getChannel(),k=()=>{ft.getState().isApplying&&(y.error("[useApplyFixes] WebSocket disconnected while applying fixes"),l(),o(!1),i({succeeded:0,failed:0,total:0,error:"Connection lost. Please restart Storybook and try again."}))};return g.on("channelWSDisconnect",k),()=>g.off("channelWSDisconnect",k)},[l,o,i]);let d=Yz({[eN]:({issueId:g})=>{y.debug(`[useApplyFixes] Fix started for issue: ${g}`),a(g,{status:"applying"})},[tN]:({issueId:g,result:k})=>{y.debug(`[useApplyFixes] Fix completed for issue: ${g}`,k),s(g,"applied"),a(g,{status:"applied"})},[nN]:({issueId:g,error:k})=>{y.error(`[useApplyFixes] Fix failed for issue: ${g}`,k),s(g,"failed",k),a(g,{status:"failed",error:k})},[rN]:async({summary:g})=>{if(y.debug("[useApplyFixes] All fixes applied:",g),l(),o(!1),i({succeeded:g.succeeded,failed:g.failed,total:g.total}),g.failed>0?y.warn(`Applied ${g.succeeded}/${g.total} fixes. ${g.failed} failed.`):y.debug(`Successfully applied all ${g.total} fixes!`),g.succeeded>0){y.debug("[useApplyFixes] Emitting FORCE_REMOUNT to refresh story...");try{jv.getChannel().emit(Xz,{storyId:ft.getState().currentStoryId}),y.debug("[useApplyFixes] FORCE_REMOUNT emitted")}catch(k){y.warn("[useApplyFixes] Failed to emit FORCE_REMOUNT:",k)}y.debug("[useApplyFixes] Reloading Storybook preview to load fresh CSS..."),await Ul(),y.debug("[useApplyFixes] Storybook preview reloaded")}t&&(y.debug("[useApplyFixes] Triggering screenshot refresh after fixes"),t()),y.debug("[useApplyFixes] Switching to Issues tab to show results"),u("issues")}}),f=hm(g=>{let k=[],T=[],E=[];for(let I of g){let D=I.currentValue||I.actual||"",R=I.suggestedValue||I.expected||"";if(D&&R&&Qz(D,R)){k.push(I);continue}if(Jz(I)){T.push(I);continue}let $=I.generatedFix?.filePath||I.file||"";if(!$){y.warn(`[useApplyFixes] Skipping issue ${I.id} - no target file path`);continue}let P=$.toLowerCase().split(".").pop()||"",z=["tsx","jsx","ts","js"].includes(P)?"component":"css";E.push({...I,targetFilePath:$,targetFileType:z})}return{actionable:E,negligible:k,designTokens:T}},[]);return{applyFixes:hm(g=>{if(r){y.warn("[useApplyFixes] Already applying fixes");return}if(g.length===0){y.warn("[useApplyFixes] No issues to fix");return}let k=f(g);if(k.negligible.length>0&&y.debug(`[useApplyFixes] Filtered ${k.negligible.length} negligible issue(s)`),k.designTokens.length>0&&y.debug(`[useApplyFixes] Skipped ${k.designTokens.length} design token suggestion(s)`),k.actionable.length===0){y.warn("[useApplyFixes] No actionable issues to fix after filtering");return}let T=k.actionable.filter(D=>D.targetFileType==="css"),E=k.actionable.filter(D=>D.targetFileType==="component");if(y.debug("[useApplyFixes] Applying fixes:"),T.length>0){let D=[...new Set(T.map(R=>R.targetFilePath))];y.debug(` - ${T.length} CSS issue(s) in: ${D.join(", ")}`)}if(E.length>0){let D=[...new Set(E.map(R=>R.targetFilePath))];y.debug(` - ${E.length} component issue(s) in: ${D.join(", ")}`),y.warn(" \u26A0\uFE0F Component files will be modified - review changes carefully!")}if(!document.querySelector("#storybook-preview-iframe")?.contentWindow){y.error("[useApplyFixes] Storybook preview iframe not found \u2014 connection lost"),i({succeeded:0,failed:0,total:k.actionable.length,error:"Connection lost. Please reload the page and try again."});return}o(!0),l(),c.current=setTimeout(()=>{ft.getState().isApplying&&(y.error("[useApplyFixes] Apply timed out \u2014 no response from server"),o(!1),i({succeeded:0,failed:0,total:k.actionable.length,error:"Apply timed out. The Storybook server may have disconnected. Please reload the page and try again."}))},Kz),d(Zz,{issues:k.actionable,storybookRoot:n||void 0})},[d,r,o,i,f,n,l]),isApplying:r}};Ce();je();import{useState as sJ}from"react";var cJ=V();Ce();import{useState as ri}from"react";je();Oe();ct();var oN=V();async function Kl(e,t,n,r,o){if(!e)return y.warn("[DismissalSync] No database ID provided, skipping server sync"),{success:!1,error:"No database ID"};try{let i=await ne(`${oN}/api/issues/dismiss`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},credentials:"include",body:JSON.stringify({issueId:e,dismissed:t,dismissReason:n,dismissedBy:r})});if(!i.ok){let a=await i.text();return y.error("[DismissalSync] API error:",i.status,a),{success:!1,error:`API error: ${i.status}`}}let s=await i.json();return y.debug(`[DismissalSync] Synced issue ${e}, new score: ${s.newScore}`),{success:!0,newScore:s.newScore,activeIssuesCount:s.activeIssuesCount}}catch(i){return y.error("[DismissalSync] Failed to sync:",i),{success:!1,error:i.message}}}async function Hv(e,t){let n=e.filter(i=>i.dbId);if(n.length===0)return y.warn("[DismissalSync] No valid dismissals to sync (missing dbIds)"),{success:!1,error:"No valid dismissals"};let o=(await Promise.all(n.map(i=>Kl(i.dbId,i.dismissed,i.dismissReason,i.dismissedBy,t)))).filter(i=>i.success);if(o.length>0){let i=o[o.length-1];return y.debug(`[DismissalSync] Batch synced ${o.length}/${n.length} dismissals`),i}return{success:!1,error:"All dismissals failed"}}Rn();Xg();Di();Oe();je();var iN=["no-fix-needed","no-fix-required","no-change-needed","no-changes-needed","no-change-required","no-changes-required","no-action-needed","no-action-required","no_fix_needed","no_change_needed","no_changes_needed","already-correct","values-match","values-already-match","already-matches","css-matches","matches-figma","correctly-implemented","implementation-correct","none-needed","none-required","skipped","skip"],sN=["no changes required","no changes needed","no fix required","no fix needed","values already match","already matches","matches expected","correctly implemented","implementation is correct"],aN=V();function ym(){let[e,t]=ri(!1),[n,r]=ri(null),[o,i]=ri(null),[s,a]=ri(null),[u,c]=ri(null),[l,d]=ri(null),[f,p]=ri(null),{sessionToken:g}=we(),{selectedProjectId:k}=Je(),{currentStoryId:T,currentStoryName:E}=nt(),{workspacePath:I,updateIssueGeneratedFix:D,batchUpdateIssueGeneratedFixes:R,includeComponentIssues:$,dismissIssue:P,recalculateScore:z,addStreamingMessage:x}=ce();return{generateBatchFixes:async v=>{if(!g){r("Not authenticated");return}if(!k){r("No project selected");return}if(!T){r("No story selected");return}if(v.length===0){r("No issues provided");return}t(!0),r(null),i(null),c(null),d(null),a({total:v.length,completed:0});let C=v.map(m=>({issueId:m.id,generatedFix:{code:"",diffPreview:"",filePath:m.file||"",confidence:0,strategy:"",status:"generating"}}));R(C);try{y.debug("[useBatchGenerateFixes] Generating fixes for",v.length,"issues");let m=null;try{let h=Gs();h?.computed&&(m=h.computed,y.debug("[useBatchGenerateFixes] Extracted computed styles for fix context"))}catch(h){y.warn("[useBatchGenerateFixes] Could not extract computed styles:",h)}let F=null;try{F=await Xs(T),F&&y.debug("[useBatchGenerateFixes] Resolved file paths from index.json:",F)}catch(h){y.warn("[useBatchGenerateFixes] Could not resolve story file paths:",h)}let S=await fetch(`${aN}/api/fixes/generate-batch`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({projectId:k,storyId:T,workspacePath:I,includeComponentIssues:$,computedStyles:m,storyFilePaths:F,reviewContext:{storyName:E||void 0,variantArgs:Bi()||void 0},issues:v.map(h=>({id:h.id,dbId:h.dbId,title:h.title,description:h.description,property:h.property,currentValue:h.currentValue,suggestedValue:h.suggestedValue,file:h.file,lineNumber:h.lineNumber,severity:h.severity,type:h.type,fixTarget:h.fixTarget,domElement:h.domElement,figmaContext:h.figmaContext,suggestedFix:h.suggestedFix}))})});if(!S.ok){let h=await S.json().catch(()=>({}));throw new Error(h.error||"Batch fix generation failed")}let b=await S.json();if(!b.success)throw new Error(b.error||"Batch fix generation failed");if(y.debug("[useBatchGenerateFixes] Generated",b.result.fixes.length,"fixes"),b.result.storybookRoot&&(p(b.result.storybookRoot),y.debug("[useBatchGenerateFixes] Stored storybookRoot:",b.result.storybookRoot)),b.result.selfReview&&(d(b.result.selfReview),y.debug("[useBatchGenerateFixes] Self-review:",b.result.selfReview)),b.result.partialFailure){let{failedBatches:h,errors:j}=b.result.partialFailure;y.warn(`[useBatchGenerateFixes] Partial failure: ${h.join(", ")} batch(es) failed`),y.warn("[useBatchGenerateFixes] Errors:",j),r(`Some fixes couldn't be generated (${h.join(", ")}): ${j[0]||"Unknown error"}`)}a({total:v.length,completed:b.result.fixes.length});let A=new Set(b.result.fixes.map(h=>h.issueId)),L=v.filter(h=>!A.has(h.id));L.length>0&&(y.warn(`[useBatchGenerateFixes] ${L.length} issues not returned by API, marking as failed`),L.forEach(h=>{D(h.id,{code:"",diffPreview:"",filePath:h.file||"",confidence:0,strategy:"skipped",status:"failed",error:"Fix generation skipped by server"})})),b.timing&&(i({durationSec:b.timing.durationSec,issueCount:b.timing.issueCount,avgPerIssueSec:b.timing.avgPerIssueSec}),y.debug(`[useBatchGenerateFixes] Generation took ${b.timing.durationSec}s for ${b.timing.issueCount} issues`)),b.result?.usage&&(c({inputTokens:b.result.usage.inputTokens||0,outputTokens:b.result.usage.outputTokens||0,costUsd:b.result.usage.costUsd||0,modelId:b.result.usage.modelId||"unknown",provider:b.result.usage.provider||"unknown"}),y.debug(`[useBatchGenerateFixes] Token usage: ${b.result.usage.inputTokens} in, ${b.result.usage.outputTokens} out, $${b.result.usage.costUsd?.toFixed(4)}`));let B=[],N=[];if(b.result.fixes.forEach(h=>{let j=h.noChangesNeeded===!0;if(!j){let K=(h.fixStrategy||"").toLowerCase(),ee=(h.generatedCode||"").toLowerCase(),fe=(h.diffPreview||"").toLowerCase(),xe=iN.some(Ke=>K.includes(Ke.toLowerCase())||K.replace(/[-_]/g,"").includes(Ke.replace(/[-_]/g,""))),ae=sN.some(Ke=>ee.includes(Ke)||fe.includes(Ke));j=xe||ae}let W=v.find(K=>K.id===h.issueId);if(j&&W){let K=W.suggestedValue,ee=W.currentValue;K&&ee&&!Jo(K,ee)&&(y.debug(`[useBatchGenerateFixes] SAFETY CHECK: values differ (expected="${K}", actual="${ee}"), NOT auto-dismissing issue ${h.issueId}`),j=!1)}let M=W?.programmaticallyVerified===!0;if(y.debug(`[useBatchGenerateFixes] Processing fix for issue ${h.issueId}:`,{isFalsePositive:j,isProgrammaticIssue:M,detectedBy:W?.detectedBy,noChangesNeeded:h.noChangesNeeded,fixStrategy:h.fixStrategy,title:W?.title?.substring(0,50)}),M&&j&&(y.debug(`[useBatchGenerateFixes] SKIPPING auto-dismiss for programmatic issue ${h.issueId} (detectedBy: ${W?.detectedBy})`),j=!1),j){let K=`Auto-dismissed: ${h.fixStrategy} - values already match`;y.debug(`[useBatchGenerateFixes] Auto-dismissing issue ${h.issueId} - noChangesNeeded: ${h.noChangesNeeded}, strategy: "${h.fixStrategy}"`),P(h.issueId,K),B.push({localId:h.issueId,dbId:W?.dbId,dismissReason:K}),N.push({issueId:h.issueId,generatedFix:{code:h.generatedCode||"",diffPreview:h.diffPreview||"",filePath:h.filePath,confidence:h.confidence,strategy:h.fixStrategy,status:"ready",error:void 0,noChangesExplanation:h.noChangesExplanation}})}else{let K=h.error||h.fixStrategy==="skipped"?"failed":"ready";N.push({issueId:h.issueId,generatedFix:{code:h.generatedCode,diffPreview:h.diffPreview,filePath:h.filePath,confidence:h.confidence,strategy:h.fixStrategy,status:K,error:h.error,noChangesExplanation:h.noChangesExplanation}})}}),N.length>0&&(y.debug(`[useBatchGenerateFixes] Applying ${N.length} fix updates in batch`),R(N)),B.length>0){if(y.debug(`[useBatchGenerateFixes] Auto-dismissed ${B.length} false positive(s), recalculating score`),z(),g){let j=B.filter(W=>W.dbId).map(W=>({dbId:W.dbId,dismissed:!0,dismissReason:W.dismissReason,dismissedBy:"system"}));j.length>0&&(y.debug(`[useBatchGenerateFixes] Syncing ${j.length} dismissals to server`),Hv(j,g).then(W=>{W.success?y.debug(`[useBatchGenerateFixes] Server score updated to: ${W.newScore}`):y.warn("[useBatchGenerateFixes] Failed to sync dismissals:",W.error)}).catch(W=>{y.error("[useBatchGenerateFixes] Error syncing dismissals:",W)}))}let h=B.length===1?"1 issue was auto-dismissed as a false positive (values already match the design). The compliance score has been recalculated.":`${B.length} issues were auto-dismissed as false positives (values already match the design). The compliance score has been recalculated.`;x({role:"system",content:h})}y.debug("[useBatchGenerateFixes] Updated",b.result.fixes.length,"issues with fixes")}catch(m){y.error("[useBatchGenerateFixes] Failed to generate batch fixes:",m),r(m?.message||"Failed to generate batch fixes");let F=v.map(S=>({issueId:S.id,generatedFix:{code:"",diffPreview:"",filePath:S.file||"",confidence:0,strategy:"",status:"failed",error:m?.message||"Failed to generate fix"}}));R(F)}finally{t(!1),setTimeout(()=>a(null),1500)}},isGenerating:e,error:n,timing:o,progress:s,usage:u,selfReview:l,lastStorybookRoot:f}}Ce();Oe();je();ct();import{useState as bm,useCallback as Sm}from"react";var lN=V();function wm(){let[e,t]=bm([]),[n,r]=bm(!1),[o,i]=bm(null),{sessionToken:s}=we(),{selectedProjectId:a}=Je(),{currentStoryId:u}=nt(),{setReviewResults:c}=ce(),l=Sm(async()=>{if(!(!s||!a)){r(!0),i(null);try{let p=new URLSearchParams({projectId:a,limit:"10"});u&&p.append("storyId",u);let g=await ne(`${lN}/api/reviews/list?${p.toString()}`,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${s}`}});if(!g.ok){let T=await g.json().catch(()=>({}));throw new Error(T.error||"Failed to fetch reviews")}let k=await g.json();if(!k.success)throw new Error("Failed to fetch reviews");y.debug("[useReviewHistory] Fetched",k.reviews.length,"reviews for:",u),t(k.reviews)}catch(p){y.error("[useReviewHistory] Failed to fetch reviews:",p),i(p instanceof Error?p.message:"Failed to fetch reviews")}finally{r(!1)}}},[s,a,u]),d=Sm(p=>{y.debug("[useReviewHistory] Applying review:",p.id,"with",p.issues.length,"issues");let g=[];if(typeof p.models=="string")try{g=JSON.parse(p.models)}catch(I){y.error("[useReviewHistory] Failed to parse models:",I),g=["claude-sonnet-4-20250514"]}else g=p.models;let k=p.issues.map(I=>({id:I.id,reviewId:p.id,type:I.type,severity:I.severity,title:I.description,description:I.description,file:void 0,lineNumber:void 0,property:I.property,currentValue:I.actual,suggestedValue:I.expected,suggestedCode:I.suggestedFix||void 0,status:I.status,dismissed:I.dismissed||!1,dismissReason:I.dismissReason,dismissedBy:I.dismissedBy,selectedForFix:!1,error:void 0,createdAt:new Date(I.createdAt)})),T=p.completedAt&&p.createdAt?new Date(p.completedAt).getTime()-new Date(p.createdAt).getTime():void 0,E=p.storyId||"";if(c({id:p.id,componentId:"",storyId:E,modelId:g[0]||"claude-sonnet-4-6",complianceScore:p.complianceScore,issuesCount:p.issuesCount,issues:k,createdAt:new Date(p.createdAt),timestamp:new Date(p.createdAt).toISOString(),costUsd:p.costUsd,inputTokens:p.inputTokens,outputTokens:p.outputTokens,reviewDurationMs:T}),E){let I=p.issues.filter(P=>!P.dismissed),D=I.filter(P=>P.severity==="critical").length,R=I.filter(P=>P.severity==="major").length,$=I.filter(P=>P.severity==="minor").length;Eo(E,{score:p.complianceScore,issueCount:I.length,criticalCount:D,majorCount:R,minorCount:$})}},[c]),f=Sm(p=>{let g=e.find(k=>k.id===p);if(!g){y.error("[useReviewHistory] Review not found:",p);return}d(g)},[e,d]);return{reviews:e,isLoading:n,error:o,fetchReviews:l,loadReview:f}}Ce();Oe();import{useEffect as cN,useState as uN,useRef as Xl}from"react";import{useChannel as pN}from"storybook/manager-api";var dN="UICOPILOT/WORKSPACE_PATH",Wv="UICOPILOT/REQUEST_WORKSPACE_PATH",fN=3e3,gN=500,mN=5,vm=()=>{let[e,t]=uN({isSupported:!1,isDetecting:!0,workspacePath:null}),{setWorkspacePath:n}=ce(),r=Xl(!1),o=Xl(null),i=Xl(0),s=Xl(null),a=pN({[dN]:({path:u})=>{r.current||(r.current=!0,o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current),y.debug("[useAutoApplySupport] Server responded - auto-apply supported"),y.debug("[useAutoApplySupport] Workspace path:",u),t({isSupported:!0,isDetecting:!1,workspacePath:u}),n(u))}});return cN(()=>(y.debug("[useAutoApplySupport] Requesting workspace path from server (retry 0)..."),a(Wv,{}),s.current=setInterval(()=>{!r.current&&i.current<mN&&(i.current++,y.debug(`[useAutoApplySupport] Requesting workspace path from server (retry ${i.current})...`),a(Wv,{}))},gN),o.current=setTimeout(async()=>{if(s.current&&clearInterval(s.current),!r.current){y.debug("[useAutoApplySupport] Channel detection timed out, trying HTTP fallback...");try{let u=await fetch("/__uicopilot/health");if(u.ok){let c=await u.json();if(c.ok&&c.workspacePath&&!r.current){r.current=!0,y.debug("[useAutoApplySupport] HTTP fallback succeeded - auto-apply supported"),y.debug("[useAutoApplySupport] Workspace path:",c.workspacePath),t({isSupported:!0,isDetecting:!1,workspacePath:c.workspacePath}),n(c.workspacePath);return}}}catch{}r.current||(r.current=!0,y.debug("[useAutoApplySupport] Both channel and HTTP detection failed - auto-apply NOT supported"),t({isSupported:!1,isDetecting:!1,workspacePath:null}))}},fN),()=>{o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current)}),[a]),e},km=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return y.error("[copyToClipboard] Failed to copy:",t),!1}};Ce();je();import{useEffect as hN,useRef as xN}from"react";var $J=V(),yN=new Set;function Cm(){let{sessionToken:e}=we(),{selectedProjectId:t}=Je(),n=xN(!1);hN(()=>{t&&yN.add(t)},[e,t])}Ce();Rn();import{useCallback as HJ,useState as WJ}from"react";import{useState as oi,useMemo as tk,useCallback as _i}from"react";je();Oe();ct();Rn();import{useState as oo,useEffect as Ql,useRef as Oi,useCallback as Tm}from"react";var bN=300;function Vv({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o=20,enabled:i=!0}){let[s,a]=oo([]),[u,c]=oo({}),[l,d]=oo(0),[f,p]=oo([]),[g,k]=oo(new Set),[T,E]=oo(!1),[I,D]=oo(!1),[R,$]=oo(null),P=Oi(1),z=Oi(null),x=Oi(null),[w,v]=oo(0),C=Oi(!1),m=Oi({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o});m.current={projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o};let F=Tm(async(B,N,h=!1)=>{let{projectId:j,typeFilter:W,search:M,figmaPage:K,limit:ee}=m.current;if(!j||!W)return;z.current&&z.current.abort();let fe=new AbortController;z.current=fe,N?D(!0):E(!0),$(null);try{let xe=V(),ae=localStorage.getItem("uicopilot_session_token");if(!ae)throw new Error(`Not authenticated. Please connect to ${Ft.NAME} first.`);let Ke=new URLSearchParams({projectId:j,page:String(B),limit:String(ee)});W&&Ke.append("type",W),K&&Ke.append("figmaPage",K),M.trim()&&Ke.append("search",M.trim()),h&&Ke.append("refresh","true");let be=await fetch(`${xe}/api/figma/frames?${Ke.toString()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${ae}`},signal:fe.signal});if(!be.ok){let pe=await be.json();throw new Error(pe.error||"Failed to fetch frames")}let Te=await be.json(),te=Te.frames||[],Me=Te.thumbnails||{},Ae=be.headers.get("X-Cache-Status");if(te.length===0&&B===1&&!N&&!h&&!C.current&&Ae!=="HIT"){y.debug("[useFigmaFrameFetch] Empty result (cache miss), retrying with refresh=true"),C.current=!0,await F(1,!1,!0);return}N?(a(pe=>[...pe,...te]),c(pe=>({...pe,...Me}))):(a(te),c(Me)),d(Te.total||te.length),Te.pages&&p(Te.pages),Te.cacheDiff?.added&&k(new Set(Te.cacheDiff.added)),P.current=B}catch(xe){if(xe instanceof DOMException&&xe.name==="AbortError")return;let ae=xe instanceof Error?xe.message:"Failed to fetch Figma frames.";$(ae),y.error("Error fetching frames:",xe)}finally{fe.signal.aborted||(E(!1),D(!1))}},[]);Ql(()=>{if(!i||!e||!t)return;C.current=!1,x.current&&clearTimeout(x.current);let B=n.trim()?bN:0;return x.current=setTimeout(()=>{P.current=1,F(1,!1)},B),()=>{x.current&&clearTimeout(x.current)}},[e,t,n,r,i,w,F]);let S=Oi(new Set);Ql(()=>{if(s.length===0)return;let B={};for(let N of s)N.thumbnailCdnUrl&&!u[N.id]&&(B[N.id]=N.thumbnailCdnUrl);Object.keys(B).length>0&&c(N=>({...N,...B}))},[s]),Ql(()=>{if(s.length===0)return;let B=s.filter(h=>!h.thumbnailCdnUrl&&!u[h.id]&&!S.current.has(h.id)).map(h=>h.id);if(B.length===0)return;B.forEach(h=>S.current.add(h)),(async()=>{try{let{projectId:h}=m.current,j=V(),W=localStorage.getItem("uicopilot_session_token");if(!W||!h)return;let M=await ne(`${j}/api/figma/frames?projectId=${h}&thumbnailIds=${B.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}});if(M.ok){let K=await M.json();K.thumbnails&&Object.keys(K.thumbnails).length>0&&c(ee=>({...ee,...K.thumbnails}))}}catch(h){B.forEach(j=>S.current.delete(j)),y.error("Failed to fetch frame thumbnails:",h)}})()},[s,u]),Ql(()=>()=>{z.current&&z.current.abort(),x.current&&clearTimeout(x.current)},[]);let b=Tm(async()=>{let B=P.current+1;await F(B,!0)},[F]),A=Tm(()=>{C.current=!1,P.current=1,a([]),c({}),v(B=>B+1)},[]),L=s.length<l;return{frames:s,thumbnails:u,totalFrames:l,availablePages:f,recentlyAdded:g,isLoading:T,loadingMore:I,hasMore:L,loadMore:b,refresh:A,error:R}}je();Oe();ct();import{useState as Js,useCallback as Jl,useRef as SN}from"react";function Gv({projectId:e}){let[t,n]=Js({}),[r,o]=Js({}),[i,s]=Js(new Set),[a,u]=Js(new Set),[c,l]=Js({}),d=SN({}),f=Jl(async T=>{if(!(!e||i.has(T))){s(E=>new Set(E).add(T));try{let E=V(),I=localStorage.getItem("uicopilot_session_token"),D=await ne(`${E}/api/figma/variants?projectId=${e}&componentSetId=${T}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`}});if(D.ok){let R=await D.json();if(R.variants){n(P=>({...P,[T]:R.variants}));let $={};for(let P of R.variants)P.thumbnailCdnUrl&&($[P.id]=P.thumbnailCdnUrl);o(P=>({...P,[T]:{...P[T]||{},...$}})),d.current[T]||(d.current[T]=new Set),Object.keys($).forEach(P=>d.current[T].add(P))}else o($=>({...$,[T]:$[T]||{}}))}else o(R=>({...R,[T]:{}}))}catch(E){y.error("Failed to fetch variant metadata:",E),o(I=>({...I,[T]:{}}))}finally{s(E=>{let I=new Set(E);return I.delete(T),I})}}},[e,i]),p=Jl(async(T,E)=>{if(!e||E.length===0)return;d.current[T]||(d.current[T]=new Set);let I=r[T]||{},D=E.filter(R=>!d.current[T].has(R)&&!I[R]);if(D.length!==0){D.forEach(R=>d.current[T].add(R)),u(R=>new Set(R).add(T));try{let R=V(),$=localStorage.getItem("uicopilot_session_token"),P=await ne(`${R}/api/figma/variants?projectId=${e}&componentSetId=${T}&thumbnailIds=${D.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${$}`}});if(P.ok){let z=await P.json();z.thumbnails&&Object.keys(z.thumbnails).length>0&&o(x=>({...x,[T]:{...x[T]||{},...z.thumbnails}})),Array.isArray(z.failed)&&z.failed.length>0&&l(x=>{let w=new Set(x[T]||[]);for(let v of z.failed)w.add(v);return{...x,[T]:w}})}}catch(R){y.error("Failed to fetch variant thumbnails:",R),D.forEach($=>d.current[T]?.delete($))}finally{u(R=>{let $=new Set(R);return $.delete(T),$})}}},[e]),g=Jl(T=>{o(E=>{let I={...E};return delete I[T],I}),n(E=>{let I={...E};return delete I[T],I}),l(E=>{let I={...E};return delete I[T],I}),delete d.current[T]},[]),k=Jl(()=>{o({}),n({}),l({}),d.current={}},[]);return{variantChildren:t,variantThumbnails:r,variantFailed:c,loadingVariants:i,loadingThumbnails:a,fetchVariants:f,fetchVariantThumbnails:p,clearVariantsForSet:g,clearAllVariants:k}}je();Di();Ce();Oe();ct();import{useState as qv,useEffect as Yv,useRef as Kv,useCallback as Im}from"react";function Xv({expandedSetId:e,availableFilters:t,filtersReady:n}){let[r,o]=qv(null),[i,s]=qv(!1),a=Kv(null),u=Kv(new Set),c=Im(async()=>{if(!e||!n||t.length===0||a.current===e||u.current.has(e))return;let f=Bi();if(!f||Object.keys(f).length===0)return;let p=ft.getState().currentStoryId||"",g=p.replace(/--/g," / ").replace(/-/g," ").replace(/\b\w/g,k=>k.toUpperCase());a.current=e,s(!0),o(null);try{let k=V(),T=localStorage.getItem("uicopilot_session_token"),E=await ne(`${k}/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(I=>({property:I.property,values:I.values}))})});if(E.ok){let I=await E.json();I.confidence>0&&Object.keys(I.suggestedFilters).length>0&&(y.debug("[useFilterSuggestion] Suggestion:",I),o(I))}}catch(k){y.error("[useFilterSuggestion] Error:",k)}finally{s(!1)}},[e,t,n]);Yv(()=>{c()},[c]),Yv(()=>{e||(o(null),a.current=null)},[e]);let l=Im(()=>{},[]),d=Im(()=>{e&&u.current.add(e),o(null)},[e]);return{suggestion:r,isLoading:i,applySuggestion:l,dismissSuggestion:d}}function Qv(e,t,n){let r=[];return e&&r.push("COMPONENT_SET"),t&&r.push("FRAME"),n&&r.push("COMPONENT"),r.join(",")}function Jv(e){let t={};for(let n of Object.values(e))for(let r of n)if(r.variantProperties)for(let[o,i]of Object.entries(r.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);return Object.entries(t).map(([n,r])=>({property:n,values:Array.from(r).sort()}))}function Zv(e){let t={},n=r=>{if(r.variantProperties)for(let[o,i]of Object.entries(r.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);r.children?.forEach(n)};return e.forEach(n),Object.entries(t).map(([r,o])=>({property:r,values:Array.from(o).sort()}))}function ek(e,t,n){if(t.length===0||!t.some(o=>o.value))return!0;let r=o=>o.variantProperties?t.every(i=>i.value?o.variantProperties?.[i.property]===i.value:!0):!1;return!!(r(e)||e.children?.some(r)||n?.some(r))}function Zs({projectId:e,limit:t=20,enabled:n=!0}){let[r,o]=oi(!0),[i,s]=oi(!1),[a,u]=oi(!1),[c,l]=oi(""),[d,f]=oi(""),[p,g]=oi([]),[k,T]=oi(new Set),E=_i(te=>{l(te),p.length>0&&g([]),k.size>0&&T(new Set)},[p.length,k.size]),I=Qv(r,i,a),{frames:D,thumbnails:R,totalFrames:$,availablePages:P,recentlyAdded:z,isLoading:x,loadingMore:w,hasMore:v,loadMore:C,refresh:m,error:F}=Vv({projectId:e,typeFilter:I,search:c,figmaPage:d||void 0,limit:t,enabled:n&&!!I}),{variantChildren:S,variantThumbnails:b,variantFailed:A,loadingVariants:L,loadingThumbnails:B,fetchVariants:N,fetchVariantThumbnails:h,clearVariantsForSet:j,clearAllVariants:W}=Gv({projectId:e}),M=tk(()=>{let te=Jv(S),Me=Zv(D),Ae={};for(let pe of[...te,...Me])Ae[pe.property]||(Ae[pe.property]=new Set),pe.values.forEach(Pt=>Ae[pe.property].add(Pt));return Object.entries(Ae).map(([pe,Pt])=>({property:pe,values:Array.from(Pt).sort()}))},[S,D]),K=k.size===1?Array.from(k)[0]:null,ee=Xv({expandedSetId:K,availableFilters:M,filtersReady:M.length>0}),fe=_i(()=>{if(!ee.suggestion)return;let{suggestedFilters:te}=ee.suggestion,Me=Object.entries(te).map(([Ae,pe])=>({property:Ae,value:pe}));g(Me),ee.dismissSuggestion()},[ee.suggestion]),xe=tk(()=>p.some(te=>te.value)?D.filter(te=>ek(te,p,S[te.id])):D,[D,p,S]),ae=_i((te,Me)=>{Me.stopPropagation();let Ae=!k.has(te);T(pe=>{let Pt=new Set(pe);return Pt.has(te)?Pt.delete(te):Pt.add(te),Pt}),Ae&&!S[te]&&!L.has(te)?N(te):Ae||j(te)},[k,S,L,N,j]),Ke=_i((te,Me)=>{let Ae=Me===""?null:Me;g(pe=>pe.find(nn=>nn.property===te)?pe.map(nn=>nn.property===te?{...nn,value:Ae}:nn):[...pe,{property:te,value:Ae}])},[]),be=_i(()=>{g([])},[]),Te=_i(te=>{let Me=D.find(Ae=>Ae.id===te);if(Me?.thumbnailCdnUrl)return Me.thumbnailCdnUrl;if(R[te])return R[te];for(let Ae of Object.values(b))if(Ae[te])return Ae[te]},[R,b]);return{frames:D,filteredFrames:xe,thumbnails:R,totalFrames:$,isLoading:x,loadingMore:w,hasMore:v,error:F,loadMore:C,refresh:m,search:c,setSearch:E,figmaPage:d,setFigmaPage:f,availablePages:P,recentlyAdded:z,showComponentSets:r,showFrames:i,showComponents:a,setShowComponentSets:o,setShowFrames:s,setShowComponents:u,variantFilters:p,availableFilters:M,handleFilterChange:Ke,clearFilters:be,expandedSets:k,toggleExpanded:ae,variantChildren:S,variantThumbnails:b,variantFailed:A,loadingVariants:L,loadingThumbnails:B,fetchVariantThumbnails:h,resolveThumbnail:Te,filterSuggestion:ee.suggestion,filterSuggestionLoading:ee.isLoading,applySuggestedFilters:fe,dismissFilterSuggestion:ee.dismissSuggestion}}Ce();import{useEffect as Ir,useCallback as TN,useState as IN,useRef as FN}from"react";import{useChannel as EN}from"storybook/manager-api";function Po(e){return e.status===401||e.status===403}var In=class extends Error{constructor(t){super(`Authentication failed (${t}). Please reconnect.`),this.name="AuthError",this.status=t}};Rn();function nk(e){try{let t=new URL(e),n=t.pathname.match(/\/(file|design)\/([a-zA-Z0-9]+)/),r=n?n[2]:null,o=t.searchParams.get("node-id"),i=t.hash.match(/node-id=([0-9-:]+)/),s=o||(i?i[1]:null);if(!r||!s)return null;let a=s.replace(/-/g,":");return{fileKey:r,nodeId:a}}catch(t){return vu.error("Error parsing Figma URL:",t),null}}Oe();je();je();ct();var wN=V();async function Fm(e){let t=await ne(`${wN}/api/projects`,{headers:{Authorization:`Bearer ${e}`}});if(Po(t))throw new In(t.status);return t.ok?(await t.json()).projects||[]:[]}je();ct();var vN=V();async function Em(e,t){let n=await ne(`${vN}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(n))throw new In(n.status);if(!n.ok)return[];let r=await n.json();return Array.isArray(r.mappings)?r.mappings:[]}je();ct();var kN=V();async function Am(e,t,n,r=10,o=!1){let i=new URLSearchParams({projectId:t,limit:String(r),storyId:n});o&&i.set("includeAI","true");let s=await ne(`${kN}/api/reviews/list?${i}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(s))throw new In(s.status);if(!s.ok)return[];let a=await s.json();return a.success?a.reviews||[]:[]}je();ct();var CN=V();async function Pm(e,t){let n=await ne(`${CN}/api/reviews/status?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(n))throw new In(n.status);if(!n.ok)return{};let r=await n.json();return r.success?r.statuses||{}:{}}Di();function AN(e){return e.storyId?{id:e.id,componentId:"",storyId:e.storyId,modelId:e.models?.[0]||"unknown",complianceScore:e.complianceScore,issuesCount:e.issuesCount,costUsd:e.costUsd,inputTokens:e.inputTokens,outputTokens:e.outputTokens,parentReviewId:e.parentReviewId||void 0,iterationNumber:e.iterationNumber,storybookImageData:e.storybookScreenshot||void 0,figmaImageData:e.figmaScreenshot||void 0,aiPrompt:e.aiPrompt||void 0,aiResponse:e.aiResponse||void 0,issues:e.issues.map(t=>({id:t.id,reviewId:e.id,type:t.type,severity:t.severity,title:t.description,description:t.description,property:t.property,currentValue:t.actual,suggestedValue:t.expected,suggestedCode:t.suggestedFix||void 0,status:t.status||"pending",dismissed:t.dismissed||!1,dismissReason:t.dismissReason,dismissedBy:t.dismissedBy,figmaContext:t.figmaContext,selectedForFix:!1,createdAt:new Date(t.createdAt)})),createdAt:new Date(e.createdAt)}:null}var PN=V(),LN="UICOPILOT/WORKSPACE_PATH",MN="UICOPILOT/REQUEST_WORKSPACE_PATH",Lm=!1;function Mm(){let{sessionToken:e,setSessionToken:t,setAuthError:n}=we(),{projects:r,selectedProjectId:o,currentStorybookPath:i,setProjects:s,setSelectedProjectId:a,setLoadingProjects:u,setCurrentStorybookPath:c}=Je(),{currentStoryId:l,mappingsRefreshKey:d,mappingsByStoryId:f,setFigmaFileUrl:p,setCurrentMapping:g,setMappingsByStoryId:k,setMappingSource:T,setLoadingMapping:E}=nt(),{setReviewResults:I,setReviewDetailTab:D,setStorybookImageUrl:R,setFigmaImageUrl:$,setFullPrompt:P,setFullResponse:z,bulkAddReviews:x}=ce(),[w,v]=IN([]),C=FN(null);Ir(()=>{let S=b=>{b.origin.startsWith(PN)&&b.data?.type==="UICOPILOT_AUTH_SUCCESS"&&b.data.token&&(y.debug("[useDataInit] OAuth success, setting token"),t(b.data.token))};return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[t]);let m=EN({[LN]:S=>{y.debug("[useDataInit] Received workspace path:",S.path),c(S.path)}});Ir(()=>{m(MN)},[m]),Ir(()=>{if(!e)return;let S=!1;return(async()=>{try{u(!0);let A=await Fm(e);S||(s(A),n(null))}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch projects:",A)}finally{S||u(!1)}})(),()=>{S=!0}},[e,s,u]),Ir(()=>{if(!i||r.length===0)return;let S=r.find(b=>b.storybookRoot===i);S&&o!==S.id&&(y.debug("[useDataInit] Auto-selecting project:",S.name),a(S.id))},[i,r,o,a]),Ir(()=>{if(!o||r.length===0)return;let S=r.find(A=>A.id===o),b=S?.figmaFileId;if(S&&typeof b=="string"&&b){let A=b,L=A.includes("figma.com")&&nk(A)?.fileKey||A;p(`https://www.figma.com/file/${L}`)}},[o,r,p]),Ir(()=>!e||!o||Lm?void 0:(Lm=!0,(async()=>{try{let b=await Pm(e,o);for(let[A,L]of Object.entries(b))Eo(A,{score:L.score,issueCount:L.issueCount,criticalCount:L.criticalCount,majorCount:L.majorCount,minorCount:L.minorCount});y.debug("[useDataInit] Populated sidebar badges for",Object.keys(b).length,"stories")}catch(b){b instanceof In&&n(b.message),y.error("[useDataInit] Failed to fetch review statuses:",b)}})(),()=>{Lm=!1}),[e,o]),Ir(()=>{if(!e||!o)return;let S=!1;return(async()=>{try{let A=await Em(e,o);if(S)return;let L={};for(let B of A)B.storyId&&(L[B.storyId]=B);k(L)}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch all mappings:",A)}})(),()=>{S=!0}},[e,o,d,k]),Ir(()=>{if(!l){g(null),T(null);return}let S=f[l]||null;S?(g(S),T("database")):(g(null),T(null)),E(!1)},[l,f,g,T,E]),Ir(()=>{v([]),C.current=null},[l]),Ir(()=>{if(!e||!o||!l)return;let S=!1;return(async()=>{try{let A=await Am(e,o,l,10,!0);if(!S){v(A);let L=A.map(B=>AN(B)).filter(Boolean);L.length>0&&x(L)}}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch reviews:",A)}})(),()=>{S=!0}},[e,o,l]);let F=TN(S=>{y.debug("[useDataInit] Applying review:",S.id,"with",S.issues.length,"issues");let b=[];if(typeof S.models=="string")try{b=JSON.parse(S.models)}catch{b=["claude-sonnet-4-20250514"]}else b=S.models;let A=S.issues.map(h=>({id:h.id,reviewId:S.id,type:h.type,severity:h.severity,title:h.description,description:h.description,file:void 0,lineNumber:void 0,property:h.property,currentValue:h.actual,suggestedValue:h.expected,suggestedCode:h.suggestedFix||void 0,status:h.status,dismissed:h.dismissed||!1,dismissReason:h.dismissReason,dismissedBy:h.dismissedBy,figmaContext:h.figmaContext,selectedForFix:!1,error:void 0,createdAt:new Date(h.createdAt)})),L=S.completedAt&&S.createdAt?new Date(S.completedAt).getTime()-new Date(S.createdAt).getTime():void 0,B=S.storyId||"";I({id:S.id,componentId:"",storyId:B,modelId:b[0]||"claude-sonnet-4-6",complianceScore:S.complianceScore,issuesCount:S.issuesCount,issues:A,createdAt:new Date(S.createdAt),timestamp:new Date(S.createdAt).toISOString(),costUsd:S.costUsd,inputTokens:S.inputTokens,outputTokens:S.outputTokens,reviewDurationMs:L});let N=ft.getState().currentStoryId;if(B&&B===N&&(S.storybookScreenshot&&(R(S.storybookScreenshot),Gw(B,S.storybookScreenshot,S.figmaScreenshot??void 0),y.debug("[useDataInit] Loaded persisted Storybook screenshot")),S.figmaScreenshot&&($(S.figmaScreenshot),y.debug("[useDataInit] Loaded persisted Figma screenshot"))),S.aiPrompt&&(P(S.aiPrompt),y.debug("[useDataInit] Loaded persisted AI prompt")),S.aiResponse&&(z(S.aiResponse),y.debug("[useDataInit] Loaded persisted AI response")),B){let h=S.issues.filter(K=>!K.dismissed),j=h.filter(K=>K.severity==="critical").length,W=h.filter(K=>K.severity==="major").length,M=h.filter(K=>K.severity==="minor").length;Eo(B,{score:S.complianceScore,issueCount:h.length,criticalCount:j,majorCount:W,minorCount:M})}},[I,R,$,P,z]);Ir(()=>{if(w.length>0&&l&&C.current!==l){let S=w[0];S&&S.storyId===l&&(y.debug("[useDataInit] Auto-loading review:",S.id,"for:",l),C.current=l,F(S),D("issues"))}},[w,l,F,D])}Rn();import{styled as ea}from"storybook/theming";var BN=ea.div({display:"flex",gap:"10px",marginTop:"8px"}),rk=ea.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer"})),ok=ea.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.base==="dark"?"rgba(0, 204, 102, 0.2)":"rgba(0, 204, 102, 0.1)",border:`1px solid ${e.color.positive}`,borderRadius:"8px",marginBottom:"12px",display:"flex",alignItems:"center",justifyContent:"space-between"})),ik=ea.div({display:"flex",alignItems:"center",gap:"8px"}),sk=ea(kn)(({theme:e})=>({backgroundColor:`${e.base==="dark"?"rgba(197, 48, 48, 0.15)":"rgba(254, 178, 178, 0.3)"} !important`,color:`${e.color.negative} !important`,border:`1px solid ${e.color.negative} !important`,padding:"6px 12px !important",fontSize:"12px !important"})),ak=({onConnect:e})=>{let{sessionToken:t,authMethod:n,setAuthMethod:r,startOAuth:o,logout:i,oauthPending:s,authError:a,saveApiKey:u}=Us(),[c,l]=rt.useState(""),d=()=>{let f=c.trim();f&&(u(f),e?.())};return rt.createElement(rt.Fragment,null,rt.createElement(ho,null,rt.createElement(xo,null,"Authentication Method"),rt.createElement(BN,null,rt.createElement(rk,null,rt.createElement("input",{type:"radio",name:"authMethod",checked:n==="oauth",onChange:()=>r("oauth")}),"OAuth (Recommended)"),rt.createElement(rk,null,rt.createElement("input",{type:"radio",name:"authMethod",checked:n==="apikey",onChange:()=>r("apikey")}),"API Key"))),n==="oauth"&&rt.createElement(ho,null,rt.createElement(xo,null,"Connect to ",Ft.NAME),t?rt.createElement(ok,null,rt.createElement(ik,null,rt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),rt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to ",Ft.NAME)),rt.createElement(sk,{onClick:i},"Disconnect")):s?rt.createElement("div",{style:{padding:"20px 0",textAlign:"center",fontSize:"13px"}},rt.createElement("div",{style:{fontSize:"24px",marginBottom:"8px"}},"\u{1F510}"),rt.createElement(ps,{style:{marginBottom:"8px",fontWeight:600}},"Sign-in window opened"),rt.createElement(ps,{style:{color:"inherit",opacity:.7}},"Complete sign-in in the popup, then return here.")):rt.createElement("div",null,a&&rt.createElement("div",{style:{marginBottom:"12px",padding:"10px 12px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.4)",borderRadius:"6px",fontSize:"12px",color:"#b91c1c"}},"\u26A0\uFE0F ",a),rt.createElement(ps,{style:{marginBottom:"12px"}},"Connect to ",Ft.NAME," to manage projects and integrations."),rt.createElement(kn,{onClick:()=>{o(),e?.()}},"\u{1F517} Connect to ",Ft.NAME))),n==="apikey"&&rt.createElement(ho,null,rt.createElement(xo,null,"Session Token"),t?rt.createElement(ok,null,rt.createElement(ik,null,rt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),rt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to ",Ft.NAME)),rt.createElement(sk,{onClick:i},"Disconnect")):rt.createElement(rt.Fragment,null,rt.createElement(ps,{style:{marginBottom:"12px"}},"Paste the session token from your ",Ft.NAME," setup page."),rt.createElement(us,{type:"password",placeholder:"Paste session token",value:c,onChange:f=>l(f.target.value)}),rt.createElement(kn,{disabled:!c.trim(),style:{marginTop:"12px"},onClick:d},"Save Token"))))};import Ot,{useState as ta}from"react";Ce();import _n,{useState as DN,useEffect as RN,useCallback as zN}from"react";import{styled as io,keyframes as lk}from"storybook/theming";var NN=lk({from:{opacity:0},to:{opacity:1}}),ON=lk({from:{opacity:0,transform:"translate(-50%, -50%) scale(0.95)"},to:{opacity:1,transform:"translate(-50%, -50%) scale(1)"}}),_N=io.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,animation:`${NN} 150ms ease-out`}),$N=io.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:`${ON} 150ms ease-out`})),UN=io.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),jN=io.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})),HN=io.div(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:`${e.layoutMargin*.8}px`})),WN=io.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}})),VN=io.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.6}px`,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.mediumdark})),GN=io.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}})),qN=io.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"}})),_r=({isOpen:e,title:t,message:n,confirmLabel:r="OK",cancelLabel:o="Cancel",variant:i="default",confirmText:s,onConfirm:a,onCancel:u})=>{let[c,l]=DN(""),d=!!s&&c!==s,f=zN(p=>{p.key==="Escape"&&u()},[u]);return RN(()=>{if(e)return l(""),document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,f]),e?_n.createElement(_n.Fragment,null,_n.createElement(_N,{onClick:u}),_n.createElement($N,{role:"dialog","aria-modal":"true","aria-label":t},_n.createElement(UN,null,t),_n.createElement(jN,null,n),s&&_n.createElement(_n.Fragment,null,_n.createElement(VN,null,"Type ",_n.createElement("strong",null,s)," to confirm:"),_n.createElement(WN,{type:"text",value:c,onChange:p=>l(p.target.value),placeholder:s,autoFocus:!0})),_n.createElement(HN,null,_n.createElement(GN,{onClick:u},o),_n.createElement(qN,{variant:i,onClick:a,disabled:d},r)))):null};import{styled as dr}from"storybook/theming";var YN=dr.div({marginBottom:"30px"}),KN=dr.div({display:"flex",gap:"8px",alignItems:"center"}),XN=dr(hn)({flex:1}),QN=dr(Yt)({padding:"8px 12px",whiteSpace:"nowrap"}),JN=dr.div(({theme:e})=>({marginTop:"12px",padding:"12px",backgroundColor:e.background.hoverable,borderRadius:"6px"})),Bm=dr.div({marginBottom:"10px","&:last-child":{marginBottom:0}}),Dm=dr.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:500,marginBottom:"4px",color:e.color.mediumdark})),Rm=dr(us)({fontSize:"13px",padding:"6px 8px"}),ZN=dr.div({display:"flex",gap:"8px",marginTop:"12px"}),ck=dr(Yt)({fontSize:"12px",padding:"6px 12px"}),eO=dr(ck)(({theme:e})=>({backgroundColor:"transparent",color:e.color.mediumdark,border:`1px solid ${e.appBorderColor}`,"&:hover":{backgroundColor:e.background.hoverable}})),tO=dr.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:e.typography.size.s1,transition:"all 0.15s","&:hover:not(:disabled)":{borderColor:e.color.negative,color:e.color.negative},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),uk=()=>{let{projects:e,selectedProjectId:t,setSelectedProjectId:n,loadingProjects:r,createProject:o,deleteProject:i}=no(),{currentStorybookPath:s}=Je(),[a,u]=ta(!1),[c,l]=ta(!1),[d,f]=ta(!1),[p,g]=ta(!1),[k,T]=ta({name:"",storybookRoot:"",figmaFileUrl:""}),E=e.find(z=>z.id===t),I=z=>{n(z||null),u(!1)},D=async()=>{if(t)try{g(!0),await i(t),f(!1)}catch(z){console.error("Failed to delete project:",z)}finally{g(!1)}},R=()=>{if(u(!0),s){let z=s.replace(/\/+$/,"").split("/").pop()||"";T({storybookRoot:s,name:z,figmaFileUrl:""})}},$=async()=>{if(k.name.trim())try{l(!0);let z;if(k.figmaFileUrl.trim()){let w=k.figmaFileUrl.trim(),v=w.match(/figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)/);z=v?v[1]:w}let x=await o({name:k.name.trim(),storybookRoot:k.storybookRoot.trim()||void 0,figmaFileId:z});n(x.id),u(!1),T({name:"",storybookRoot:"",figmaFileUrl:""})}catch(z){console.error("Failed to create project:",z)}finally{l(!1)}},P=z=>{T(x=>{let w={...x,storybookRoot:z};if(!x.name&&z){let v=z.replace(/\/+$/,"").split("/").pop()||"";w.name=v}return w})};return Ot.createElement(YN,null,Ot.createElement(ly,null,"Project"),Ot.createElement(KN,null,Ot.createElement(XN,{value:t||"",onChange:z=>I(z.target.value),disabled:r||a},Ot.createElement("option",{value:""},"-- Select a project --"),e.map(z=>Ot.createElement("option",{key:z.id,value:z.id},z.name))),Ot.createElement(QN,{onClick:R,disabled:r,type:"button"},"+ New"),Ot.createElement(tO,{onClick:()=>f(!0),disabled:!t||r,title:"Delete project",type:"button"},"\u{1F5D1}")),Ot.createElement(_r,{isOpen:d,title:"Delete Project",message:`This will permanently remove all reviews, mappings, and history for "${E?.name||"this project"}". This cannot be undone.`,confirmLabel:p?"Deleting...":"Delete",confirmText:E?.name,variant:"danger",onConfirm:D,onCancel:()=>f(!1)}),a&&Ot.createElement(JN,null,Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Storybook Path (for fix generation)"),Ot.createElement(Rm,{type:"text",placeholder:"/path/to/your/storybook",value:k.storybookRoot,onChange:z=>P(z.target.value)})),Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Project Name *"),Ot.createElement(Rm,{type:"text",placeholder:"my-storybook",value:k.name,onChange:z=>{let x=z.target.value;T(w=>({...w,name:x}))}})),Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Figma File URL (for design comparison)"),Ot.createElement(Rm,{type:"text",placeholder:"https://www.figma.com/file/...",value:k.figmaFileUrl,onChange:z=>{let x=z.target.value;T(w=>({...w,figmaFileUrl:x}))}})),Ot.createElement(ZN,null,Ot.createElement(ck,{onClick:$,disabled:c||!k.name.trim()},c?"Creating...":"Create"),Ot.createElement(eO,{onClick:()=>{u(!1),T({name:"",storybookRoot:"",figmaFileUrl:""})}},"Cancel"))))};import yt,{useState as xc,useCallback as jC,useEffect as a4}from"react";import{styled as Er}from"storybook/theming";import $r,{useState as na,useEffect as SO,useCallback as Nm}from"react";import{styled as Lo}from"storybook/theming";Ce();je();ct();Ce();je();ct();import Ht,{useState as zm}from"react";import{styled as $n,keyframes as nO}from"storybook/theming";var rO={autoLayout:"Auto Layout",componentStructure:"Structure",naming:"Naming",constraints:"Constraints",spacing:"Spacing",styles:"Styles",variants:"Variants"},oO=e=>e==="pass"?"\u2713":e==="warn"?"\u26A0":"\u2717",iO=$n.div({position:"relative",display:"inline-flex"}),sO=nO`
|
|
30
|
+
\u2705 ${re} issue${re>1?"s were":" was"} auto-dismissed as false positive${re>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let qt=$e.complianceScore??$e.validation?.complianceScore;if(y.debug("[Review] Score sources:",{directScore:$e.complianceScore,validationScore:$e.validation?.complianceScore,parsedScore:qt}),qt==null){let Ie=Rt.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);qt=Ie?parseInt(Ie[1],10):void 0,y.debug("[Review] Parsed score from response:",qt)}let dn=Me.current[ae];dn||(dn=await Qs(ae)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},dn.storyFile&&(Me.current[ae]=dn)),y.debug("[Review] Story file paths:",dn);let at=pn.map(Ie=>({...Ie,file:Ie.file||lm(Ie.fixTarget,dn)||cm(Ie,dn)}));if(at=um(at),y.debug("[Review] After de-duplication:",at.length,"issues"),!h){let Ie=at.length;at=at.filter(de=>de.property?.toLowerCase()!=="textcontent"&&!de.description?.toLowerCase().includes("text content")),Ie!==at.length&&y.debug("[Review] Filtered out",Ie-at.length,"textContent issues (toggle OFF)")}let Dr;tt&&he&&(Dr=(gt.getState().reviewHistory.find(de=>de.id===he)?.iterationNumber||0)+1);let An={id:Qe,componentId:ae,storyId:ae,modelId:l[0],parentReviewId:tt&&he||void 0,iterationNumber:Dr,figmaFileKey:void 0,figmaNodeId:bt||void 0,figmaFileUrl:Gn||void 0,complianceScore:qt,visualSimilarity:$e.visualSimilarity,issuesCount:at.filter(Ie=>!Ie.dismissed).length,issues:at,createdAt:new Date,reviewDurationMs:Date.now()-oe,costUsd:$e.costUsd,inputTokens:$e.inputTokens,outputTokens:$e.outputTokens,cacheCreationTokens:$e.cacheCreationTokens,cacheReadTokens:$e.cacheReadTokens,variantMismatch:$e.variantMismatch,storybookVariant:$e.storybookVariant,figmaVariant:$e.figmaVariant};if(y.debug("[useAIReview] About to call addReview with review:",{id:An.id,storyId:An.storyId,issueCount:An.issues?.length,complianceScore:An.complianceScore,createdAt:An.createdAt?.toISOString(),inputTokens:An.inputTokens,outputTokens:An.outputTokens,costUsd:An.costUsd,cacheCreationTokens:An.cacheCreationTokens,cacheReadTokens:An.cacheReadTokens}),B(An),y.debug("[useAIReview] addReview called successfully"),ae&&M.enableReviewBadges){let Ie=at.filter(de=>!de.dismissed);Eo(ae,{score:qt??100,issueCount:Ie.length,criticalCount:Ie.filter(de=>de.severity==="critical").length,majorCount:Ie.filter(de=>de.severity==="major").length,minorCount:Ie.filter(de=>de.severity==="minor").length})}N("issues");let us=at.filter(Ie=>!Ie.dismissed).length;y.debug("[Review] Created review with",us,"active issues,",at.length-us,"dismissed");let _a=bt||gt.getState().currentMapping?.figmaNodeId;y.debug("[Review] Validation check:",{figmaNodeId:bt,effectiveFigmaNodeIdSingle:_a,hasSessionToken:!!K,selectedProjectId:xe,issueCount:at.length}),y.debug("[Review] Issue validation handled server-side. Active:",at.filter(Ie=>!Ie.dismissed).length,"Dismissed:",at.filter(Ie=>Ie.dismissed).length)}catch(Qe){y.error("[Review] Failed to parse issues:",Qe)}}else throw rn?(y.error("[Review] ERROR: No structured result received from backend!"),y.error("[Review] Streaming text length:",rn.length),y.error("[Review] This indicates a bug in SSE parsing or backend not sending complete event"),new Error("Review completed but failed to receive structured result. Check console for details.")):new Error("No results received from API")}catch(Y){if(Y instanceof Error&&Y.name==="AbortError"){y.debug("[useAIReview] Review cancelled by user"),pe(0,"Review cancelled");return}y.error("[useAIReview] Review error:",Y);let me=Pv(Y);throw g(me),ae&&M.enableReviewBadges&&Dv(ae),pe(0,`Error: ${me}`),Y}finally{d(!1),Te.current=null,te.current&&(clearTimeout(te.current),te.current=null),ge(null)}},[e,K,xe,ae,Ke,l,d,g,p,F,S,b,A,T,E,R,Ae,pe,D,C,w,z,x,ge]),nn=Js(()=>n?.issues?o==="all"?n.issues:n.issues.filter(fe=>fe.severity===o):[],[n,o]),Mr=Js(()=>{Te.current&&(y.debug("[useAIReview] Cancelling review..."),Te.current.abort())},[]);return{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,startReview:Pt,cancelReview:Mr,setShowReviewMenu:f,setSeverityFilter:k,setShowStreamingPanel:T,setStreamingPanelCollapsed:E,addStreamingMessage:I,updateStreamingMessage:D,clearStreamingMessages:R,setStreamingProgress:$,setStreamingStatus:P,resetReview:L,getFilteredIssues:nn}};Ce();Oe();je();import{useCallback as _Q}from"react";var HQ=V();Ce();Oe();import{useEffect as _v,useRef as $v}from"react";import{useStorybookApi as Yz,useStorybookState as Kz,addons as Xz}from"storybook/manager-api";var Uv="storyArgsUpdated",mm=()=>{let e=Yz(),t=Kz(),{currentStoryId:n,currentStoryName:r,setCurrentStoryId:o,setCurrentStoryName:i}=nt(),{clearStaleReviewsForStory:s,resetReview:a,isReviewing:u,isValidating:c}=ce(),l=$v(null),d=$v(0);return _v(()=>{let g=t.storyId;if(g){l.current!==g&&(y.debug("[useCurrentStory] Story changed from",l.current,"to",g),s(g),l.current=g,d.current=Date.now()),o(g);let p=e.getData(g),f=p?.name&&p.name!=="default"?`${p.title} / ${p.name}`:p?.title||g;i(f),y.debug("[useCurrentStory] Current story:",{storyId:g,fullName:f})}else o(null),i(""),l.current=null},[t.storyId,e,o,i,s]),_v(()=>{let g=Xz.getChannel(),p=null,f=k=>{if(k.storyId===n){if(u||c){y.debug("[useCurrentStory] Story args changed but review in progress, skipping reset");return}p&&clearTimeout(p),p=setTimeout(()=>{let{isReviewing:T,isValidating:E}=gt.getState();if(T||E){y.debug("[useCurrentStory] Story args changed but review started, skipping reset");return}if(Date.now()-d.current<2e3){y.debug("[useCurrentStory] Story args changed but story just navigated, skipping reset");return}y.debug("[useCurrentStory] Story args changed, clearing stale review"),a()},500)}};return g.on(Uv,f),()=>{g.off(Uv,f),p&&clearTimeout(p)}},[n,a,u,c]),{currentStoryId:n,currentStoryName:r}};Ce();je();ct();import{useCallback as jv}from"react";import{addons as Hv}from"storybook/manager-api";var Wv=V(),ni=()=>{let{currentMapping:e,loadingMapping:t,setCurrentMapping:n,refreshMappings:r}=nt(),{sessionToken:o}=we(),{selectedProjectId:i}=Je(),s=jv(async c=>{if(!o)throw new Error("Not authenticated");if(!i)throw new Error("No project selected");let l=await ne(`${Wv}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({projectId:i,...c})});if(!l.ok)throw new Error("Failed to create mapping");let d=await l.json();r();try{Hv.getChannel().emit("uireview/mappings-changed")}catch{}return d.mapping},[o,i,r]),a=jv(async c=>{if(!o)throw new Error("Not authenticated");if(!(await ne(`${Wv}/api/mappings?id=${encodeURIComponent(c)}`,{method:"DELETE",headers:{Authorization:`Bearer ${o}`}})).ok)throw new Error("Failed to delete mapping");r();try{Hv.getChannel().emit("uireview/mappings-changed")}catch{}},[o,r]);return{currentMapping:e,loadingMapping:t,hasMapping:!!e,setCurrentMapping:n,createMapping:s,deleteMapping:a,refreshMappings:r}};Di();Ce();import{useCallback as hm,useEffect as Vv,useRef as Qz}from"react";import{useChannel as Jz,addons as Gv}from"storybook/manager-api";Oe();var Zz=3e4,eN="forceRemount";function tN(e,t){let n=parseFloat(e.replace(/[^0-9.-]/g,"")),r=parseFloat(t.replace(/[^0-9.-]/g,""));if(isNaN(n)||isNaN(r))return!1;let o=Math.abs(n-r);return e.includes("px")||t.includes("px")?o<.5:e.includes("%")||t.includes("%")?o<1:o<.5}function nN(e){let t=["design system","design token","css variable","var(--","hard-coded"],n=`${e.description} ${e.suggestedFix||""} ${e.suggestedValue||""}`.toLowerCase();return t.some(r=>n.includes(r))}var rN="UICOPILOT/APPLY_FIXES",oN="UICOPILOT/FIX_STARTED",iN="UICOPILOT/FIX_COMPLETED",sN="UICOPILOT/FIX_FAILED",aN="UICOPILOT/ALL_FIXES_APPLIED",xm=(e={})=>{let{onComplete:t,storybookRoot:n}=e,{isApplying:r,setIsApplying:o,setApplyFixesResult:i,updateIssueStatus:s,updateIssueGeneratedFix:a,setReviewDetailTab:u}=ce(),c=Qz(null),l=hm(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);Vv(()=>()=>l(),[l]),Vv(()=>{let f=Gv.getChannel(),k=()=>{gt.getState().isApplying&&(y.error("[useApplyFixes] WebSocket disconnected while applying fixes"),l(),o(!1),i({succeeded:0,failed:0,total:0,error:"Connection lost. Please restart Storybook and try again."}))};return f.on("channelWSDisconnect",k),()=>f.off("channelWSDisconnect",k)},[l,o,i]);let d=Jz({[oN]:({issueId:f})=>{y.debug(`[useApplyFixes] Fix started for issue: ${f}`),a(f,{status:"applying"})},[iN]:({issueId:f,result:k})=>{y.debug(`[useApplyFixes] Fix completed for issue: ${f}`,k),s(f,"applied"),a(f,{status:"applied"})},[sN]:({issueId:f,error:k})=>{y.error(`[useApplyFixes] Fix failed for issue: ${f}`,k),s(f,"failed",k),a(f,{status:"failed",error:k})},[aN]:async({summary:f})=>{if(y.debug("[useApplyFixes] All fixes applied:",f),l(),o(!1),i({succeeded:f.succeeded,failed:f.failed,total:f.total}),f.failed>0?y.warn(`Applied ${f.succeeded}/${f.total} fixes. ${f.failed} failed.`):y.debug(`Successfully applied all ${f.total} fixes!`),f.succeeded>0){y.debug("[useApplyFixes] Emitting FORCE_REMOUNT to refresh story...");try{Gv.getChannel().emit(eN,{storyId:gt.getState().currentStoryId}),y.debug("[useApplyFixes] FORCE_REMOUNT emitted")}catch(k){y.warn("[useApplyFixes] Failed to emit FORCE_REMOUNT:",k)}y.debug("[useApplyFixes] Reloading Storybook preview to load fresh CSS..."),await jl(),y.debug("[useApplyFixes] Storybook preview reloaded")}t&&(y.debug("[useApplyFixes] Triggering screenshot refresh after fixes"),t()),y.debug("[useApplyFixes] Switching to Issues tab to show results"),u("issues")}}),g=hm(f=>{let k=[],T=[],E=[];for(let I of f){let D=I.currentValue||I.actual||"",R=I.suggestedValue||I.expected||"";if(D&&R&&tN(D,R)){k.push(I);continue}if(nN(I)){T.push(I);continue}let $=I.generatedFix?.filePath||I.file||"";if(!$){y.warn(`[useApplyFixes] Skipping issue ${I.id} - no target file path`);continue}let P=$.toLowerCase().split(".").pop()||"",z=["tsx","jsx","ts","js"].includes(P)?"component":"css";E.push({...I,targetFilePath:$,targetFileType:z})}return{actionable:E,negligible:k,designTokens:T}},[]);return{applyFixes:hm(f=>{if(r){y.warn("[useApplyFixes] Already applying fixes");return}if(f.length===0){y.warn("[useApplyFixes] No issues to fix");return}let k=g(f);if(k.negligible.length>0&&y.debug(`[useApplyFixes] Filtered ${k.negligible.length} negligible issue(s)`),k.designTokens.length>0&&y.debug(`[useApplyFixes] Skipped ${k.designTokens.length} design token suggestion(s)`),k.actionable.length===0){y.warn("[useApplyFixes] No actionable issues to fix after filtering");return}let T=k.actionable.filter(D=>D.targetFileType==="css"),E=k.actionable.filter(D=>D.targetFileType==="component");if(y.debug("[useApplyFixes] Applying fixes:"),T.length>0){let D=[...new Set(T.map(R=>R.targetFilePath))];y.debug(` - ${T.length} CSS issue(s) in: ${D.join(", ")}`)}if(E.length>0){let D=[...new Set(E.map(R=>R.targetFilePath))];y.debug(` - ${E.length} component issue(s) in: ${D.join(", ")}`),y.warn(" \u26A0\uFE0F Component files will be modified - review changes carefully!")}if(!document.querySelector("#storybook-preview-iframe")?.contentWindow){y.error("[useApplyFixes] Storybook preview iframe not found \u2014 connection lost"),i({succeeded:0,failed:0,total:k.actionable.length,error:"Connection lost. Please reload the page and try again."});return}o(!0),l(),c.current=setTimeout(()=>{gt.getState().isApplying&&(y.error("[useApplyFixes] Apply timed out \u2014 no response from server"),o(!1),i({succeeded:0,failed:0,total:k.actionable.length,error:"Apply timed out. The Storybook server may have disconnected. Please reload the page and try again."}))},Zz),d(rN,{issues:k.actionable,storybookRoot:n||void 0})},[d,r,o,i,g,n,l]),isApplying:r}};Ce();je();import{useState as uJ}from"react";var gJ=V();Ce();import{useState as ri}from"react";je();Oe();ct();var lN=V();async function Kl(e,t,n,r,o){if(!e)return y.warn("[DismissalSync] No database ID provided, skipping server sync"),{success:!1,error:"No database ID"};try{let i=await ne(`${lN}/api/issues/dismiss`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},credentials:"include",body:JSON.stringify({issueId:e,dismissed:t,dismissReason:n,dismissedBy:r})});if(!i.ok){let a=await i.text();return y.error("[DismissalSync] API error:",i.status,a),{success:!1,error:`API error: ${i.status}`}}let s=await i.json();return y.debug(`[DismissalSync] Synced issue ${e}, new score: ${s.newScore}`),{success:!0,newScore:s.newScore,activeIssuesCount:s.activeIssuesCount}}catch(i){return y.error("[DismissalSync] Failed to sync:",i),{success:!1,error:i.message}}}async function qv(e,t){let n=e.filter(i=>i.dbId);if(n.length===0)return y.warn("[DismissalSync] No valid dismissals to sync (missing dbIds)"),{success:!1,error:"No valid dismissals"};let o=(await Promise.all(n.map(i=>Kl(i.dbId,i.dismissed,i.dismissReason,i.dismissedBy,t)))).filter(i=>i.success);if(o.length>0){let i=o[o.length-1];return y.debug(`[DismissalSync] Batch synced ${o.length}/${n.length} dismissals`),i}return{success:!1,error:"All dismissals failed"}}Rn();Xf();Di();Oe();je();var cN=["no-fix-needed","no-fix-required","no-change-needed","no-changes-needed","no-change-required","no-changes-required","no-action-needed","no-action-required","no_fix_needed","no_change_needed","no_changes_needed","already-correct","values-match","values-already-match","already-matches","css-matches","matches-figma","correctly-implemented","implementation-correct","none-needed","none-required","skipped","skip"],uN=["no changes required","no changes needed","no fix required","no fix needed","values already match","already matches","matches expected","correctly implemented","implementation is correct"],pN=V();function ym(){let[e,t]=ri(!1),[n,r]=ri(null),[o,i]=ri(null),[s,a]=ri(null),[u,c]=ri(null),[l,d]=ri(null),[g,p]=ri(null),{sessionToken:f}=we(),{selectedProjectId:k}=Je(),{currentStoryId:T,currentStoryName:E}=nt(),{workspacePath:I,updateIssueGeneratedFix:D,batchUpdateIssueGeneratedFixes:R,includeComponentIssues:$,dismissIssue:P,recalculateScore:z,addStreamingMessage:x}=ce();return{generateBatchFixes:async v=>{if(!f){r("Not authenticated");return}if(!k){r("No project selected");return}if(!T){r("No story selected");return}if(v.length===0){r("No issues provided");return}t(!0),r(null),i(null),c(null),d(null),a({total:v.length,completed:0});let C=v.map(m=>({issueId:m.id,generatedFix:{code:"",diffPreview:"",filePath:m.file||"",confidence:0,strategy:"",status:"generating"}}));R(C);try{y.debug("[useBatchGenerateFixes] Generating fixes for",v.length,"issues");let m=null;try{let h=qs();h?.computed&&(m=h.computed,y.debug("[useBatchGenerateFixes] Extracted computed styles for fix context"))}catch(h){y.warn("[useBatchGenerateFixes] Could not extract computed styles:",h)}let F=null;try{F=await Qs(T),F&&y.debug("[useBatchGenerateFixes] Resolved file paths from index.json:",F)}catch(h){y.warn("[useBatchGenerateFixes] Could not resolve story file paths:",h)}let S=await fetch(`${pN}/api/fixes/generate-batch`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({projectId:k,storyId:T,workspacePath:I,includeComponentIssues:$,computedStyles:m,storyFilePaths:F,reviewContext:{storyName:E||void 0,variantArgs:Bi()||void 0},issues:v.map(h=>({id:h.id,dbId:h.dbId,title:h.title,description:h.description,property:h.property,currentValue:h.currentValue,suggestedValue:h.suggestedValue,file:h.file,lineNumber:h.lineNumber,severity:h.severity,type:h.type,fixTarget:h.fixTarget,domElement:h.domElement,figmaContext:h.figmaContext,suggestedFix:h.suggestedFix}))})});if(!S.ok){let h=await S.json().catch(()=>({}));throw new Error(h.error||"Batch fix generation failed")}let b=await S.json();if(!b.success)throw new Error(b.error||"Batch fix generation failed");if(y.debug("[useBatchGenerateFixes] Generated",b.result.fixes.length,"fixes"),b.result.storybookRoot&&(p(b.result.storybookRoot),y.debug("[useBatchGenerateFixes] Stored storybookRoot:",b.result.storybookRoot)),b.result.selfReview&&(d(b.result.selfReview),y.debug("[useBatchGenerateFixes] Self-review:",b.result.selfReview)),b.result.partialFailure){let{failedBatches:h,errors:j}=b.result.partialFailure;y.warn(`[useBatchGenerateFixes] Partial failure: ${h.join(", ")} batch(es) failed`),y.warn("[useBatchGenerateFixes] Errors:",j),r(`Some fixes couldn't be generated (${h.join(", ")}): ${j[0]||"Unknown error"}`)}a({total:v.length,completed:b.result.fixes.length});let A=new Set(b.result.fixes.map(h=>h.issueId)),L=v.filter(h=>!A.has(h.id));L.length>0&&(y.warn(`[useBatchGenerateFixes] ${L.length} issues not returned by API, marking as failed`),L.forEach(h=>{D(h.id,{code:"",diffPreview:"",filePath:h.file||"",confidence:0,strategy:"skipped",status:"failed",error:"Fix generation skipped by server"})})),b.timing&&(i({durationSec:b.timing.durationSec,issueCount:b.timing.issueCount,avgPerIssueSec:b.timing.avgPerIssueSec}),y.debug(`[useBatchGenerateFixes] Generation took ${b.timing.durationSec}s for ${b.timing.issueCount} issues`)),b.result?.usage&&(c({inputTokens:b.result.usage.inputTokens||0,outputTokens:b.result.usage.outputTokens||0,costUsd:b.result.usage.costUsd||0,modelId:b.result.usage.modelId||"unknown",provider:b.result.usage.provider||"unknown"}),y.debug(`[useBatchGenerateFixes] Token usage: ${b.result.usage.inputTokens} in, ${b.result.usage.outputTokens} out, $${b.result.usage.costUsd?.toFixed(4)}`));let B=[],N=[];if(b.result.fixes.forEach(h=>{let j=h.noChangesNeeded===!0;if(!j){let K=(h.fixStrategy||"").toLowerCase(),ee=(h.generatedCode||"").toLowerCase(),ge=(h.diffPreview||"").toLowerCase(),xe=cN.some(Ke=>K.includes(Ke.toLowerCase())||K.replace(/[-_]/g,"").includes(Ke.replace(/[-_]/g,""))),ae=uN.some(Ke=>ee.includes(Ke)||ge.includes(Ke));j=xe||ae}let W=v.find(K=>K.id===h.issueId);if(j&&W){let K=W.suggestedValue,ee=W.currentValue;K&&ee&&!Jo(K,ee)&&(y.debug(`[useBatchGenerateFixes] SAFETY CHECK: values differ (expected="${K}", actual="${ee}"), NOT auto-dismissing issue ${h.issueId}`),j=!1)}let M=W?.programmaticallyVerified===!0;if(y.debug(`[useBatchGenerateFixes] Processing fix for issue ${h.issueId}:`,{isFalsePositive:j,isProgrammaticIssue:M,detectedBy:W?.detectedBy,noChangesNeeded:h.noChangesNeeded,fixStrategy:h.fixStrategy,title:W?.title?.substring(0,50)}),M&&j&&(y.debug(`[useBatchGenerateFixes] SKIPPING auto-dismiss for programmatic issue ${h.issueId} (detectedBy: ${W?.detectedBy})`),j=!1),j){let K=`Auto-dismissed: ${h.fixStrategy} - values already match`;y.debug(`[useBatchGenerateFixes] Auto-dismissing issue ${h.issueId} - noChangesNeeded: ${h.noChangesNeeded}, strategy: "${h.fixStrategy}"`),P(h.issueId,K),B.push({localId:h.issueId,dbId:W?.dbId,dismissReason:K}),N.push({issueId:h.issueId,generatedFix:{code:h.generatedCode||"",diffPreview:h.diffPreview||"",filePath:h.filePath,confidence:h.confidence,strategy:h.fixStrategy,status:"ready",error:void 0,noChangesExplanation:h.noChangesExplanation}})}else{let K=h.error||h.fixStrategy==="skipped"?"failed":"ready";N.push({issueId:h.issueId,generatedFix:{code:h.generatedCode,diffPreview:h.diffPreview,filePath:h.filePath,confidence:h.confidence,strategy:h.fixStrategy,status:K,error:h.error,noChangesExplanation:h.noChangesExplanation}})}}),N.length>0&&(y.debug(`[useBatchGenerateFixes] Applying ${N.length} fix updates in batch`),R(N)),B.length>0){if(y.debug(`[useBatchGenerateFixes] Auto-dismissed ${B.length} false positive(s), recalculating score`),z(),f){let j=B.filter(W=>W.dbId).map(W=>({dbId:W.dbId,dismissed:!0,dismissReason:W.dismissReason,dismissedBy:"system"}));j.length>0&&(y.debug(`[useBatchGenerateFixes] Syncing ${j.length} dismissals to server`),qv(j,f).then(W=>{W.success?y.debug(`[useBatchGenerateFixes] Server score updated to: ${W.newScore}`):y.warn("[useBatchGenerateFixes] Failed to sync dismissals:",W.error)}).catch(W=>{y.error("[useBatchGenerateFixes] Error syncing dismissals:",W)}))}let h=B.length===1?"1 issue was auto-dismissed as a false positive (values already match the design). The compliance score has been recalculated.":`${B.length} issues were auto-dismissed as false positives (values already match the design). The compliance score has been recalculated.`;x({role:"system",content:h})}y.debug("[useBatchGenerateFixes] Updated",b.result.fixes.length,"issues with fixes")}catch(m){y.error("[useBatchGenerateFixes] Failed to generate batch fixes:",m),r(m?.message||"Failed to generate batch fixes");let F=v.map(S=>({issueId:S.id,generatedFix:{code:"",diffPreview:"",filePath:S.file||"",confidence:0,strategy:"",status:"failed",error:m?.message||"Failed to generate fix"}}));R(F)}finally{t(!1),setTimeout(()=>a(null),1500)}},isGenerating:e,error:n,timing:o,progress:s,usage:u,selfReview:l,lastStorybookRoot:g}}Ce();Oe();je();ct();import{useState as bm,useCallback as Sm}from"react";var dN=V();function wm(){let[e,t]=bm([]),[n,r]=bm(!1),[o,i]=bm(null),{sessionToken:s}=we(),{selectedProjectId:a}=Je(),{currentStoryId:u}=nt(),{setReviewResults:c}=ce(),l=Sm(async()=>{if(!(!s||!a)){r(!0),i(null);try{let p=new URLSearchParams({projectId:a,limit:"10"});u&&p.append("storyId",u);let f=await ne(`${dN}/api/reviews/list?${p.toString()}`,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${s}`}});if(!f.ok){let T=await f.json().catch(()=>({}));throw new Error(T.error||"Failed to fetch reviews")}let k=await f.json();if(!k.success)throw new Error("Failed to fetch reviews");y.debug("[useReviewHistory] Fetched",k.reviews.length,"reviews for:",u),t(k.reviews)}catch(p){y.error("[useReviewHistory] Failed to fetch reviews:",p),i(p instanceof Error?p.message:"Failed to fetch reviews")}finally{r(!1)}}},[s,a,u]),d=Sm(p=>{y.debug("[useReviewHistory] Applying review:",p.id,"with",p.issues.length,"issues");let f=[];if(typeof p.models=="string")try{f=JSON.parse(p.models)}catch(I){y.error("[useReviewHistory] Failed to parse models:",I),f=["claude-sonnet-4-20250514"]}else f=p.models;let k=p.issues.map(I=>({id:I.id,reviewId:p.id,type:I.type,severity:I.severity,title:I.description,description:I.description,file:void 0,lineNumber:void 0,property:I.property,currentValue:I.actual,suggestedValue:I.expected,suggestedCode:I.suggestedFix||void 0,status:I.status,dismissed:I.dismissed||!1,dismissReason:I.dismissReason,dismissedBy:I.dismissedBy,selectedForFix:!1,error:void 0,createdAt:new Date(I.createdAt)})),T=p.completedAt&&p.createdAt?new Date(p.completedAt).getTime()-new Date(p.createdAt).getTime():void 0,E=p.storyId||"";if(c({id:p.id,componentId:"",storyId:E,modelId:f[0]||"claude-sonnet-4-6",complianceScore:p.complianceScore,issuesCount:p.issuesCount,issues:k,createdAt:new Date(p.createdAt),timestamp:new Date(p.createdAt).toISOString(),costUsd:p.costUsd,inputTokens:p.inputTokens,outputTokens:p.outputTokens,reviewDurationMs:T}),E){let I=p.issues.filter(P=>!P.dismissed),D=I.filter(P=>P.severity==="critical").length,R=I.filter(P=>P.severity==="major").length,$=I.filter(P=>P.severity==="minor").length;Eo(E,{score:p.complianceScore,issueCount:I.length,criticalCount:D,majorCount:R,minorCount:$})}},[c]),g=Sm(p=>{let f=e.find(k=>k.id===p);if(!f){y.error("[useReviewHistory] Review not found:",p);return}d(f)},[e,d]);return{reviews:e,isLoading:n,error:o,fetchReviews:l,loadReview:g}}Ce();Oe();import{useEffect as gN,useState as fN,useRef as Xl}from"react";import{useChannel as mN}from"storybook/manager-api";var hN="UICOPILOT/WORKSPACE_PATH",Yv="UICOPILOT/REQUEST_WORKSPACE_PATH",xN=3e3,yN=500,bN=5,vm=()=>{let[e,t]=fN({isSupported:!1,isDetecting:!0,workspacePath:null}),{setWorkspacePath:n}=ce(),r=Xl(!1),o=Xl(null),i=Xl(0),s=Xl(null),a=mN({[hN]:({path:u})=>{r.current||(r.current=!0,o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current),y.debug("[useAutoApplySupport] Server responded - auto-apply supported"),y.debug("[useAutoApplySupport] Workspace path:",u),t({isSupported:!0,isDetecting:!1,workspacePath:u}),n(u))}});return gN(()=>(y.debug("[useAutoApplySupport] Requesting workspace path from server (retry 0)..."),a(Yv,{}),s.current=setInterval(()=>{!r.current&&i.current<bN&&(i.current++,y.debug(`[useAutoApplySupport] Requesting workspace path from server (retry ${i.current})...`),a(Yv,{}))},yN),o.current=setTimeout(async()=>{if(s.current&&clearInterval(s.current),!r.current){y.debug("[useAutoApplySupport] Channel detection timed out, trying HTTP fallback...");try{let u=await fetch("/__uicopilot/health");if(u.ok){let c=await u.json();if(c.ok&&c.workspacePath&&!r.current){r.current=!0,y.debug("[useAutoApplySupport] HTTP fallback succeeded - auto-apply supported"),y.debug("[useAutoApplySupport] Workspace path:",c.workspacePath),t({isSupported:!0,isDetecting:!1,workspacePath:c.workspacePath}),n(c.workspacePath);return}}}catch{}r.current||(r.current=!0,y.debug("[useAutoApplySupport] Both channel and HTTP detection failed - auto-apply NOT supported"),t({isSupported:!1,isDetecting:!1,workspacePath:null}))}},xN),()=>{o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current)}),[a]),e},km=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand("copy");return document.body.removeChild(t),n}}catch(t){return y.error("[copyToClipboard] Failed to copy:",t),!1}};Ce();je();import{useEffect as SN,useRef as wN}from"react";var WJ=V(),vN=new Set;function Cm(){let{sessionToken:e}=we(),{selectedProjectId:t}=Je(),n=wN(!1);SN(()=>{t&&vN.add(t)},[e,t])}Ce();Rn();import{useCallback as qJ,useState as YJ}from"react";import{useState as oi,useMemo as ik,useCallback as $i}from"react";je();Oe();ct();Rn();import{useState as oo,useEffect as Ql,useRef as _i,useCallback as Tm}from"react";var kN=300;function Kv({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o=20,enabled:i=!0}){let[s,a]=oo([]),[u,c]=oo({}),[l,d]=oo(0),[g,p]=oo([]),[f,k]=oo(new Set),[T,E]=oo(!1),[I,D]=oo(!1),[R,$]=oo(null),P=_i(1),z=_i(null),x=_i(null),[w,v]=oo(0),C=_i(!1),m=_i({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o});m.current={projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o};let F=Tm(async(B,N,h=!1)=>{let{projectId:j,typeFilter:W,search:M,figmaPage:K,limit:ee}=m.current;if(!j||!W)return;z.current&&z.current.abort();let ge=new AbortController;z.current=ge,N?D(!0):E(!0),$(null);try{let xe=V(),ae=localStorage.getItem("uicopilot_session_token");if(!ae)throw new Error(`Not authenticated. Please connect to ${Ft.NAME} first.`);let Ke=new URLSearchParams({projectId:j,page:String(B),limit:String(ee)});W&&Ke.append("type",W),K&&Ke.append("figmaPage",K),M.trim()&&Ke.append("search",M.trim()),h&&Ke.append("refresh","true");let be=await fetch(`${xe}/api/figma/frames?${Ke.toString()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${ae}`},signal:ge.signal});if(!be.ok){let pe=await be.json();throw new Error(pe.error||"Failed to fetch frames")}let Te=await be.json(),te=Te.frames||[],Me=Te.thumbnails||{},Ae=be.headers.get("X-Cache-Status");if(te.length===0&&B===1&&!N&&!h&&!C.current&&Ae!=="HIT"){y.debug("[useFigmaFrameFetch] Empty result (cache miss), retrying with refresh=true"),C.current=!0,await F(1,!1,!0);return}N?(a(pe=>[...pe,...te]),c(pe=>({...pe,...Me}))):(a(te),c(Me)),d(Te.total||te.length),Te.pages&&p(Te.pages),Te.cacheDiff?.added&&k(new Set(Te.cacheDiff.added)),P.current=B}catch(xe){if(xe instanceof DOMException&&xe.name==="AbortError")return;let ae=xe instanceof Error?xe.message:"Failed to fetch Figma frames.";$(ae),y.error("Error fetching frames:",xe)}finally{ge.signal.aborted||(E(!1),D(!1))}},[]);Ql(()=>{if(!i||!e||!t)return;C.current=!1,x.current&&clearTimeout(x.current);let B=n.trim()?kN:0;return x.current=setTimeout(()=>{P.current=1,F(1,!1)},B),()=>{x.current&&clearTimeout(x.current)}},[e,t,n,r,i,w,F]);let S=_i(new Set);Ql(()=>{if(s.length===0)return;let B={};for(let N of s)N.thumbnailCdnUrl&&!u[N.id]&&(B[N.id]=N.thumbnailCdnUrl);Object.keys(B).length>0&&c(N=>({...N,...B}))},[s]),Ql(()=>{if(s.length===0)return;let B=s.filter(h=>!h.thumbnailCdnUrl&&!u[h.id]&&!S.current.has(h.id)).map(h=>h.id);if(B.length===0)return;B.forEach(h=>S.current.add(h)),(async()=>{try{let{projectId:h}=m.current,j=V(),W=localStorage.getItem("uicopilot_session_token");if(!W||!h)return;let M=await ne(`${j}/api/figma/frames?projectId=${h}&thumbnailIds=${B.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${W}`}});if(M.ok){let K=await M.json();K.thumbnails&&Object.keys(K.thumbnails).length>0&&c(ee=>({...ee,...K.thumbnails}))}}catch(h){B.forEach(j=>S.current.delete(j)),y.error("Failed to fetch frame thumbnails:",h)}})()},[s,u]),Ql(()=>()=>{z.current&&z.current.abort(),x.current&&clearTimeout(x.current)},[]);let b=Tm(async()=>{let B=P.current+1;await F(B,!0)},[F]),A=Tm(()=>{C.current=!1,P.current=1,a([]),c({}),v(B=>B+1)},[]),L=s.length<l;return{frames:s,thumbnails:u,totalFrames:l,availablePages:g,recentlyAdded:f,isLoading:T,loadingMore:I,hasMore:L,loadMore:b,refresh:A,error:R}}je();Oe();ct();import{useState as Zs,useCallback as Jl,useRef as CN}from"react";function Xv({projectId:e}){let[t,n]=Zs({}),[r,o]=Zs({}),[i,s]=Zs(new Set),[a,u]=Zs(new Set),[c,l]=Zs({}),d=CN({}),g=Jl(async T=>{if(!(!e||i.has(T))){s(E=>new Set(E).add(T));try{let E=V(),I=localStorage.getItem("uicopilot_session_token"),D=await ne(`${E}/api/figma/variants?projectId=${e}&componentSetId=${T}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`}});if(D.ok){let R=await D.json();if(R.variants){n(P=>({...P,[T]:R.variants}));let $={};for(let P of R.variants)P.thumbnailCdnUrl&&($[P.id]=P.thumbnailCdnUrl);o(P=>({...P,[T]:{...P[T]||{},...$}})),d.current[T]||(d.current[T]=new Set),Object.keys($).forEach(P=>d.current[T].add(P))}else o($=>({...$,[T]:$[T]||{}}))}else o(R=>({...R,[T]:{}}))}catch(E){y.error("Failed to fetch variant metadata:",E),o(I=>({...I,[T]:{}}))}finally{s(E=>{let I=new Set(E);return I.delete(T),I})}}},[e,i]),p=Jl(async(T,E)=>{if(!e||E.length===0)return;d.current[T]||(d.current[T]=new Set);let I=r[T]||{},D=E.filter(R=>!d.current[T].has(R)&&!I[R]);if(D.length!==0){D.forEach(R=>d.current[T].add(R)),u(R=>new Set(R).add(T));try{let R=V(),$=localStorage.getItem("uicopilot_session_token"),P=await ne(`${R}/api/figma/variants?projectId=${e}&componentSetId=${T}&thumbnailIds=${D.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${$}`}});if(P.ok){let z=await P.json();z.thumbnails&&Object.keys(z.thumbnails).length>0&&o(x=>({...x,[T]:{...x[T]||{},...z.thumbnails}})),Array.isArray(z.failed)&&z.failed.length>0&&l(x=>{let w=new Set(x[T]||[]);for(let v of z.failed)w.add(v);return{...x,[T]:w}})}}catch(R){y.error("Failed to fetch variant thumbnails:",R),D.forEach($=>d.current[T]?.delete($))}finally{u(R=>{let $=new Set(R);return $.delete(T),$})}}},[e]),f=Jl(T=>{o(E=>{let I={...E};return delete I[T],I}),n(E=>{let I={...E};return delete I[T],I}),l(E=>{let I={...E};return delete I[T],I}),delete d.current[T]},[]),k=Jl(()=>{o({}),n({}),l({}),d.current={}},[]);return{variantChildren:t,variantThumbnails:r,variantFailed:c,loadingVariants:i,loadingThumbnails:a,fetchVariants:g,fetchVariantThumbnails:p,clearVariantsForSet:f,clearAllVariants:k}}je();Di();Ce();Oe();ct();import{useState as Qv,useEffect as Jv,useRef as Zv,useCallback as Im}from"react";function ek({expandedSetId:e,availableFilters:t,filtersReady:n}){let[r,o]=Qv(null),[i,s]=Qv(!1),a=Zv(null),u=Zv(new Set),c=Im(async()=>{if(!e||!n||t.length===0||a.current===e||u.current.has(e))return;let g=Bi();if(!g||Object.keys(g).length===0)return;let p=gt.getState().currentStoryId||"",f=p.replace(/--/g," / ").replace(/-/g," ").replace(/\b\w/g,k=>k.toUpperCase());a.current=e,s(!0),o(null);try{let k=V(),T=localStorage.getItem("uicopilot_session_token"),E=await ne(`${k}/api/figma/match-filters`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({storyName:f,storyId:p,storyArgs:g,availableFilters:t.map(I=>({property:I.property,values:I.values}))})});if(E.ok){let I=await E.json();I.confidence>0&&Object.keys(I.suggestedFilters).length>0&&(y.debug("[useFilterSuggestion] Suggestion:",I),o(I))}}catch(k){y.error("[useFilterSuggestion] Error:",k)}finally{s(!1)}},[e,t,n]);Jv(()=>{c()},[c]),Jv(()=>{e||(o(null),a.current=null)},[e]);let l=Im(()=>{},[]),d=Im(()=>{e&&u.current.add(e),o(null)},[e]);return{suggestion:r,isLoading:i,applySuggestion:l,dismissSuggestion:d}}function tk(e,t,n){let r=[];return e&&r.push("COMPONENT_SET"),t&&r.push("FRAME"),n&&r.push("COMPONENT"),r.join(",")}function nk(e){let t={};for(let n of Object.values(e))for(let r of n)if(r.variantProperties)for(let[o,i]of Object.entries(r.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);return Object.entries(t).map(([n,r])=>({property:n,values:Array.from(r).sort()}))}function rk(e){let t={},n=r=>{if(r.variantProperties)for(let[o,i]of Object.entries(r.variantProperties))t[o]||(t[o]=new Set),t[o].add(i);r.children?.forEach(n)};return e.forEach(n),Object.entries(t).map(([r,o])=>({property:r,values:Array.from(o).sort()}))}function ok(e,t,n){if(t.length===0||!t.some(o=>o.value))return!0;let r=o=>o.variantProperties?t.every(i=>i.value?o.variantProperties?.[i.property]===i.value:!0):!1;return!!(r(e)||e.children?.some(r)||n?.some(r))}function ea({projectId:e,limit:t=20,enabled:n=!0}){let[r,o]=oi(!0),[i,s]=oi(!1),[a,u]=oi(!1),[c,l]=oi(""),[d,g]=oi(""),[p,f]=oi([]),[k,T]=oi(new Set),E=$i(te=>{l(te),p.length>0&&f([]),k.size>0&&T(new Set)},[p.length,k.size]),I=tk(r,i,a),{frames:D,thumbnails:R,totalFrames:$,availablePages:P,recentlyAdded:z,isLoading:x,loadingMore:w,hasMore:v,loadMore:C,refresh:m,error:F}=Kv({projectId:e,typeFilter:I,search:c,figmaPage:d||void 0,limit:t,enabled:n&&!!I}),{variantChildren:S,variantThumbnails:b,variantFailed:A,loadingVariants:L,loadingThumbnails:B,fetchVariants:N,fetchVariantThumbnails:h,clearVariantsForSet:j,clearAllVariants:W}=Xv({projectId:e}),M=ik(()=>{let te=nk(S),Me=rk(D),Ae={};for(let pe of[...te,...Me])Ae[pe.property]||(Ae[pe.property]=new Set),pe.values.forEach(Pt=>Ae[pe.property].add(Pt));return Object.entries(Ae).map(([pe,Pt])=>({property:pe,values:Array.from(Pt).sort()}))},[S,D]),K=k.size===1?Array.from(k)[0]:null,ee=ek({expandedSetId:K,availableFilters:M,filtersReady:M.length>0}),ge=$i(()=>{if(!ee.suggestion)return;let{suggestedFilters:te}=ee.suggestion,Me=Object.entries(te).map(([Ae,pe])=>({property:Ae,value:pe}));f(Me),ee.dismissSuggestion()},[ee.suggestion]),xe=ik(()=>p.some(te=>te.value)?D.filter(te=>ok(te,p,S[te.id])):D,[D,p,S]),ae=$i((te,Me)=>{Me.stopPropagation();let Ae=!k.has(te);T(pe=>{let Pt=new Set(pe);return Pt.has(te)?Pt.delete(te):Pt.add(te),Pt}),Ae&&!S[te]&&!L.has(te)?N(te):Ae||j(te)},[k,S,L,N,j]),Ke=$i((te,Me)=>{let Ae=Me===""?null:Me;f(pe=>pe.find(nn=>nn.property===te)?pe.map(nn=>nn.property===te?{...nn,value:Ae}:nn):[...pe,{property:te,value:Ae}])},[]),be=$i(()=>{f([])},[]),Te=$i(te=>{let Me=D.find(Ae=>Ae.id===te);if(Me?.thumbnailCdnUrl)return Me.thumbnailCdnUrl;if(R[te])return R[te];for(let Ae of Object.values(b))if(Ae[te])return Ae[te]},[R,b]);return{frames:D,filteredFrames:xe,thumbnails:R,totalFrames:$,isLoading:x,loadingMore:w,hasMore:v,error:F,loadMore:C,refresh:m,search:c,setSearch:E,figmaPage:d,setFigmaPage:g,availablePages:P,recentlyAdded:z,showComponentSets:r,showFrames:i,showComponents:a,setShowComponentSets:o,setShowFrames:s,setShowComponents:u,variantFilters:p,availableFilters:M,handleFilterChange:Ke,clearFilters:be,expandedSets:k,toggleExpanded:ae,variantChildren:S,variantThumbnails:b,variantFailed:A,loadingVariants:L,loadingThumbnails:B,fetchVariantThumbnails:h,resolveThumbnail:Te,filterSuggestion:ee.suggestion,filterSuggestionLoading:ee.isLoading,applySuggestedFilters:ge,dismissFilterSuggestion:ee.dismissSuggestion}}Ce();import{useEffect as Ir,useCallback as AN,useState as PN,useRef as LN}from"react";import{useChannel as MN}from"storybook/manager-api";function Po(e){return e.status===401||e.status===403}var In=class extends Error{constructor(t){super(`Authentication failed (${t}). Please reconnect.`),this.name="AuthError",this.status=t}};Rn();function sk(e){try{let t=new URL(e),n=t.pathname.match(/\/(file|design)\/([a-zA-Z0-9]+)/),r=n?n[2]:null,o=t.searchParams.get("node-id"),i=t.hash.match(/node-id=([0-9-:]+)/),s=o||(i?i[1]:null);if(!r||!s)return null;let a=s.replace(/-/g,":");return{fileKey:r,nodeId:a}}catch(t){return vu.error("Error parsing Figma URL:",t),null}}Oe();je();je();ct();var TN=V();async function Fm(e){let t=await ne(`${TN}/api/projects`,{headers:{Authorization:`Bearer ${e}`}});if(Po(t))throw new In(t.status);return t.ok?(await t.json()).projects||[]:[]}je();ct();var IN=V();async function Em(e,t){let n=await ne(`${IN}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(n))throw new In(n.status);if(!n.ok)return[];let r=await n.json();return Array.isArray(r.mappings)?r.mappings:[]}je();ct();var FN=V();async function Am(e,t,n,r=10,o=!1){let i=new URLSearchParams({projectId:t,limit:String(r),storyId:n});o&&i.set("includeAI","true");let s=await ne(`${FN}/api/reviews/list?${i}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(s))throw new In(s.status);if(!s.ok)return[];let a=await s.json();return a.success?a.reviews||[]:[]}je();ct();var EN=V();async function Pm(e,t){let n=await ne(`${EN}/api/reviews/status?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(Po(n))throw new In(n.status);if(!n.ok)return{};let r=await n.json();return r.success?r.statuses||{}:{}}Di();function BN(e){return e.storyId?{id:e.id,componentId:"",storyId:e.storyId,modelId:e.models?.[0]||"unknown",complianceScore:e.complianceScore,issuesCount:e.issuesCount,costUsd:e.costUsd,inputTokens:e.inputTokens,outputTokens:e.outputTokens,parentReviewId:e.parentReviewId||void 0,iterationNumber:e.iterationNumber,storybookImageData:e.storybookScreenshot||void 0,figmaImageData:e.figmaScreenshot||void 0,aiPrompt:e.aiPrompt||void 0,aiResponse:e.aiResponse||void 0,issues:e.issues.map(t=>({id:t.id,reviewId:e.id,type:t.type,severity:t.severity,title:t.description,description:t.description,property:t.property,currentValue:t.actual,suggestedValue:t.expected,suggestedCode:t.suggestedFix||void 0,status:t.status||"pending",dismissed:t.dismissed||!1,dismissReason:t.dismissReason,dismissedBy:t.dismissedBy,figmaContext:t.figmaContext,selectedForFix:!1,createdAt:new Date(t.createdAt)})),createdAt:new Date(e.createdAt)}:null}var DN=V(),RN="UICOPILOT/WORKSPACE_PATH",zN="UICOPILOT/REQUEST_WORKSPACE_PATH",Lm=!1;function Mm(){let{sessionToken:e,setSessionToken:t,setAuthError:n}=we(),{projects:r,selectedProjectId:o,currentStorybookPath:i,setProjects:s,setSelectedProjectId:a,setLoadingProjects:u,setCurrentStorybookPath:c}=Je(),{currentStoryId:l,mappingsRefreshKey:d,mappingsByStoryId:g,setFigmaFileUrl:p,setCurrentMapping:f,setMappingsByStoryId:k,setMappingSource:T,setLoadingMapping:E}=nt(),{setReviewResults:I,setReviewDetailTab:D,setStorybookImageUrl:R,setFigmaImageUrl:$,setFullPrompt:P,setFullResponse:z,bulkAddReviews:x}=ce(),[w,v]=PN([]),C=LN(null);Ir(()=>{let S=b=>{b.origin.startsWith(DN)&&b.data?.type==="UICOPILOT_AUTH_SUCCESS"&&b.data.token&&(y.debug("[useDataInit] OAuth success, setting token"),t(b.data.token))};return window.addEventListener("message",S),()=>window.removeEventListener("message",S)},[t]);let m=MN({[RN]:S=>{y.debug("[useDataInit] Received workspace path:",S.path),c(S.path)}});Ir(()=>{m(zN)},[m]),Ir(()=>{if(!e)return;let S=!1;return(async()=>{try{u(!0);let A=await Fm(e);S||(s(A),n(null))}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch projects:",A)}finally{S||u(!1)}})(),()=>{S=!0}},[e,s,u]),Ir(()=>{if(!i||r.length===0)return;let S=r.find(b=>b.storybookRoot===i);S&&o!==S.id&&(y.debug("[useDataInit] Auto-selecting project:",S.name),a(S.id))},[i,r,o,a]),Ir(()=>{if(!o||r.length===0)return;let S=r.find(A=>A.id===o),b=S?.figmaFileId;if(S&&typeof b=="string"&&b){let A=b,L=A.includes("figma.com")&&sk(A)?.fileKey||A;p(`https://www.figma.com/file/${L}`)}},[o,r,p]),Ir(()=>!e||!o||Lm?void 0:(Lm=!0,(async()=>{try{let b=await Pm(e,o);for(let[A,L]of Object.entries(b))Eo(A,{score:L.score,issueCount:L.issueCount,criticalCount:L.criticalCount,majorCount:L.majorCount,minorCount:L.minorCount});y.debug("[useDataInit] Populated sidebar badges for",Object.keys(b).length,"stories")}catch(b){b instanceof In&&n(b.message),y.error("[useDataInit] Failed to fetch review statuses:",b)}})(),()=>{Lm=!1}),[e,o]),Ir(()=>{if(!e||!o)return;let S=!1;return(async()=>{try{let A=await Em(e,o);if(S)return;let L={};for(let B of A)B.storyId&&(L[B.storyId]=B);k(L),Nv(Object.keys(L))}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch all mappings:",A)}})(),()=>{S=!0}},[e,o,d,k]),Ir(()=>{if(!l){f(null),T(null);return}let S=g[l]||null;S?(f(S),T("database")):(f(null),T(null)),E(!1)},[l,g,f,T,E]),Ir(()=>{v([]),C.current=null},[l]),Ir(()=>{if(!e||!o||!l)return;let S=!1;return(async()=>{try{let A=await Am(e,o,l,10,!0);if(!S){v(A);let L=A.map(B=>BN(B)).filter(Boolean);L.length>0&&x(L)}}catch(A){A instanceof In&&n(A.message),y.error("[useDataInit] Failed to fetch reviews:",A)}})(),()=>{S=!0}},[e,o,l]);let F=AN(S=>{y.debug("[useDataInit] Applying review:",S.id,"with",S.issues.length,"issues");let b=[];if(typeof S.models=="string")try{b=JSON.parse(S.models)}catch{b=["claude-sonnet-4-20250514"]}else b=S.models;let A=S.issues.map(h=>({id:h.id,reviewId:S.id,type:h.type,severity:h.severity,title:h.description,description:h.description,file:void 0,lineNumber:void 0,property:h.property,currentValue:h.actual,suggestedValue:h.expected,suggestedCode:h.suggestedFix||void 0,status:h.status,dismissed:h.dismissed||!1,dismissReason:h.dismissReason,dismissedBy:h.dismissedBy,figmaContext:h.figmaContext,selectedForFix:!1,error:void 0,createdAt:new Date(h.createdAt)})),L=S.completedAt&&S.createdAt?new Date(S.completedAt).getTime()-new Date(S.createdAt).getTime():void 0,B=S.storyId||"";I({id:S.id,componentId:"",storyId:B,modelId:b[0]||"claude-sonnet-4-5-20250929",complianceScore:S.complianceScore,issuesCount:S.issuesCount,issues:A,createdAt:new Date(S.createdAt),timestamp:new Date(S.createdAt).toISOString(),costUsd:S.costUsd,inputTokens:S.inputTokens,outputTokens:S.outputTokens,reviewDurationMs:L});let N=gt.getState().currentStoryId;if(B&&B===N&&(S.storybookScreenshot&&(R(S.storybookScreenshot),qw(B,S.storybookScreenshot,S.figmaScreenshot??void 0),y.debug("[useDataInit] Loaded persisted Storybook screenshot")),S.figmaScreenshot&&($(S.figmaScreenshot),y.debug("[useDataInit] Loaded persisted Figma screenshot"))),S.aiPrompt&&(P(S.aiPrompt),y.debug("[useDataInit] Loaded persisted AI prompt")),S.aiResponse&&(z(S.aiResponse),y.debug("[useDataInit] Loaded persisted AI response")),B){let h=S.issues.filter(K=>!K.dismissed),j=h.filter(K=>K.severity==="critical").length,W=h.filter(K=>K.severity==="major").length,M=h.filter(K=>K.severity==="minor").length;Eo(B,{score:S.complianceScore,issueCount:h.length,criticalCount:j,majorCount:W,minorCount:M})}},[I,R,$,P,z]);Ir(()=>{if(w.length>0&&l&&C.current!==l){let S=w[0];S&&S.storyId===l&&(y.debug("[useDataInit] Auto-loading review:",S.id,"for:",l),C.current=l,F(S),D("issues"))}},[w,l,F,D])}Rn();import{styled as ta}from"storybook/theming";var NN=ta.div({display:"flex",gap:"10px",marginTop:"8px"}),ak=ta.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer"})),lk=ta.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.base==="dark"?"rgba(0, 204, 102, 0.2)":"rgba(0, 204, 102, 0.1)",border:`1px solid ${e.color.positive}`,borderRadius:"8px",marginBottom:"12px",display:"flex",alignItems:"center",justifyContent:"space-between"})),ck=ta.div({display:"flex",alignItems:"center",gap:"8px"}),uk=ta(kn)(({theme:e})=>({backgroundColor:`${e.base==="dark"?"rgba(197, 48, 48, 0.15)":"rgba(254, 178, 178, 0.3)"} !important`,color:`${e.color.negative} !important`,border:`1px solid ${e.color.negative} !important`,padding:"6px 12px !important",fontSize:"12px !important"})),pk=({onConnect:e})=>{let{sessionToken:t,authMethod:n,setAuthMethod:r,startOAuth:o,logout:i,oauthPending:s,authError:a,saveApiKey:u}=js(),[c,l]=rt.useState(""),d=()=>{let g=c.trim();g&&(u(g),e?.())};return rt.createElement(rt.Fragment,null,rt.createElement(ho,null,rt.createElement(xo,null,"Authentication Method"),rt.createElement(NN,null,rt.createElement(ak,null,rt.createElement("input",{type:"radio",name:"authMethod",checked:n==="oauth",onChange:()=>r("oauth")}),"OAuth (Recommended)"),rt.createElement(ak,null,rt.createElement("input",{type:"radio",name:"authMethod",checked:n==="apikey",onChange:()=>r("apikey")}),"API Key"))),n==="oauth"&&rt.createElement(ho,null,rt.createElement(xo,null,"Connect to ",Ft.NAME),t?rt.createElement(lk,null,rt.createElement(ck,null,rt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),rt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to ",Ft.NAME)),rt.createElement(uk,{onClick:i},"Disconnect")):s?rt.createElement("div",{style:{padding:"20px 0",textAlign:"center",fontSize:"13px"}},rt.createElement("div",{style:{fontSize:"24px",marginBottom:"8px"}},"\u{1F510}"),rt.createElement(ds,{style:{marginBottom:"8px",fontWeight:600}},"Sign-in window opened"),rt.createElement(ds,{style:{color:"inherit",opacity:.7}},"Complete sign-in in the popup, then return here.")):rt.createElement("div",null,a&&rt.createElement("div",{style:{marginBottom:"12px",padding:"10px 12px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.4)",borderRadius:"6px",fontSize:"12px",color:"#b91c1c"}},"\u26A0\uFE0F ",a),rt.createElement(ds,{style:{marginBottom:"12px"}},"Connect to ",Ft.NAME," to manage projects and integrations."),rt.createElement(kn,{onClick:()=>{o(),e?.()}},"\u{1F517} Connect to ",Ft.NAME))),n==="apikey"&&rt.createElement(ho,null,rt.createElement(xo,null,"Session Token"),t?rt.createElement(lk,null,rt.createElement(ck,null,rt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),rt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to ",Ft.NAME)),rt.createElement(uk,{onClick:i},"Disconnect")):rt.createElement(rt.Fragment,null,rt.createElement(ds,{style:{marginBottom:"12px"}},"Paste the session token from your ",Ft.NAME," setup page."),rt.createElement(ps,{type:"password",placeholder:"Paste session token",value:c,onChange:g=>l(g.target.value)}),rt.createElement(kn,{disabled:!c.trim(),style:{marginTop:"12px"},onClick:d},"Save Token"))))};import Ot,{useState as na}from"react";Ce();import _n,{useState as ON,useEffect as _N,useCallback as $N}from"react";import{styled as io,keyframes as dk}from"storybook/theming";var UN=dk({from:{opacity:0},to:{opacity:1}}),jN=dk({from:{opacity:0,transform:"translate(-50%, -50%) scale(0.95)"},to:{opacity:1,transform:"translate(-50%, -50%) scale(1)"}}),HN=io.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,animation:`${UN} 150ms ease-out`}),WN=io.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:`${jN} 150ms ease-out`})),VN=io.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),GN=io.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})),qN=io.div(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:`${e.layoutMargin*.8}px`})),YN=io.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}})),KN=io.p(({theme:e})=>({margin:`0 0 ${e.layoutMargin*.6}px`,fontSize:e.typography.size.s1,fontFamily:e.typography.fonts.base,color:e.color.mediumdark})),XN=io.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}})),QN=io.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"}})),_r=({isOpen:e,title:t,message:n,confirmLabel:r="OK",cancelLabel:o="Cancel",variant:i="default",confirmText:s,onConfirm:a,onCancel:u})=>{let[c,l]=ON(""),d=!!s&&c!==s,g=$N(p=>{p.key==="Escape"&&u()},[u]);return _N(()=>{if(e)return l(""),document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,g]),e?_n.createElement(_n.Fragment,null,_n.createElement(HN,{onClick:u}),_n.createElement(WN,{role:"dialog","aria-modal":"true","aria-label":t},_n.createElement(VN,null,t),_n.createElement(GN,null,n),s&&_n.createElement(_n.Fragment,null,_n.createElement(KN,null,"Type ",_n.createElement("strong",null,s)," to confirm:"),_n.createElement(YN,{type:"text",value:c,onChange:p=>l(p.target.value),placeholder:s,autoFocus:!0})),_n.createElement(qN,null,_n.createElement(XN,{onClick:u},o),_n.createElement(QN,{variant:i,onClick:a,disabled:d},r)))):null};import{styled as dr}from"storybook/theming";var JN=dr.div({marginBottom:"30px"}),ZN=dr.div({display:"flex",gap:"8px",alignItems:"center"}),eO=dr(hn)({flex:1}),tO=dr(Yt)({padding:"8px 12px",whiteSpace:"nowrap"}),nO=dr.div(({theme:e})=>({marginTop:"12px",padding:"12px",backgroundColor:e.background.hoverable,borderRadius:"6px"})),Bm=dr.div({marginBottom:"10px","&:last-child":{marginBottom:0}}),Dm=dr.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:500,marginBottom:"4px",color:e.color.mediumdark})),Rm=dr(ps)({fontSize:"13px",padding:"6px 8px"}),rO=dr.div({display:"flex",gap:"8px",marginTop:"12px"}),gk=dr(Yt)({fontSize:"12px",padding:"6px 12px"}),oO=dr(gk)(({theme:e})=>({backgroundColor:"transparent",color:e.color.mediumdark,border:`1px solid ${e.appBorderColor}`,"&:hover":{backgroundColor:e.background.hoverable}})),iO=dr.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:e.typography.size.s1,transition:"all 0.15s","&:hover:not(:disabled)":{borderColor:e.color.negative,color:e.color.negative},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),fk=()=>{let{projects:e,selectedProjectId:t,setSelectedProjectId:n,loadingProjects:r,createProject:o,deleteProject:i}=no(),{currentStorybookPath:s}=Je(),[a,u]=na(!1),[c,l]=na(!1),[d,g]=na(!1),[p,f]=na(!1),[k,T]=na({name:"",storybookRoot:"",figmaFileUrl:""}),E=e.find(z=>z.id===t),I=z=>{n(z||null),u(!1)},D=async()=>{if(t)try{f(!0),await i(t),g(!1)}catch(z){console.error("Failed to delete project:",z)}finally{f(!1)}},R=()=>{if(u(!0),s){let z=s.replace(/\/+$/,"").split("/").pop()||"";T({storybookRoot:s,name:z,figmaFileUrl:""})}},$=async()=>{if(k.name.trim())try{l(!0);let z;if(k.figmaFileUrl.trim()){let w=k.figmaFileUrl.trim(),v=w.match(/figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)/);z=v?v[1]:w}let x=await o({name:k.name.trim(),storybookRoot:k.storybookRoot.trim()||void 0,figmaFileId:z});n(x.id),u(!1),T({name:"",storybookRoot:"",figmaFileUrl:""})}catch(z){console.error("Failed to create project:",z)}finally{l(!1)}},P=z=>{T(x=>{let w={...x,storybookRoot:z};if(!x.name&&z){let v=z.replace(/\/+$/,"").split("/").pop()||"";w.name=v}return w})};return Ot.createElement(JN,null,Ot.createElement(cy,null,"Project"),Ot.createElement(ZN,null,Ot.createElement(eO,{value:t||"",onChange:z=>I(z.target.value),disabled:r||a},Ot.createElement("option",{value:""},"-- Select a project --"),e.map(z=>Ot.createElement("option",{key:z.id,value:z.id},z.name))),Ot.createElement(tO,{onClick:R,disabled:r,type:"button"},"+ New"),Ot.createElement(iO,{onClick:()=>g(!0),disabled:!t||r,title:"Delete project",type:"button"},"\u{1F5D1}")),Ot.createElement(_r,{isOpen:d,title:"Delete Project",message:`This will permanently remove all reviews, mappings, and history for "${E?.name||"this project"}". This cannot be undone.`,confirmLabel:p?"Deleting...":"Delete",confirmText:E?.name,variant:"danger",onConfirm:D,onCancel:()=>g(!1)}),a&&Ot.createElement(nO,null,Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Storybook Path (for fix generation)"),Ot.createElement(Rm,{type:"text",placeholder:"/path/to/your/storybook",value:k.storybookRoot,onChange:z=>P(z.target.value)})),Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Project Name *"),Ot.createElement(Rm,{type:"text",placeholder:"my-storybook",value:k.name,onChange:z=>{let x=z.target.value;T(w=>({...w,name:x}))}})),Ot.createElement(Bm,null,Ot.createElement(Dm,null,"Figma File URL (for design comparison)"),Ot.createElement(Rm,{type:"text",placeholder:"https://www.figma.com/file/...",value:k.figmaFileUrl,onChange:z=>{let x=z.target.value;T(w=>({...w,figmaFileUrl:x}))}})),Ot.createElement(rO,null,Ot.createElement(gk,{onClick:$,disabled:c||!k.name.trim()},c?"Creating...":"Create"),Ot.createElement(oO,{onClick:()=>{u(!1),T({name:"",storybookRoot:"",figmaFileUrl:""})}},"Cancel"))))};import yt,{useState as xc,useCallback as GC,useEffect as p4}from"react";import{styled as Er}from"storybook/theming";import $r,{useState as ra,useEffect as CO,useCallback as Nm}from"react";import{styled as Lo}from"storybook/theming";Ce();je();ct();Ce();je();ct();import Ht,{useState as zm}from"react";import{styled as $n,keyframes as sO}from"storybook/theming";var aO={autoLayout:"Auto Layout",componentStructure:"Structure",naming:"Naming",constraints:"Constraints",spacing:"Spacing",styles:"Styles",variants:"Variants"},lO=e=>e==="pass"?"\u2713":e==="warn"?"\u26A0":"\u2717",cO=$n.div({position:"relative",display:"inline-flex"}),uO=sO`
|
|
31
31
|
0% { transform: rotate(0deg); }
|
|
32
32
|
100% { transform: rotate(360deg); }
|
|
33
|
-
`,
|
|
33
|
+
`,pO=$n.button(({score:e,isLoading:t,theme:n})=>{let r=()=>t?n.color.secondary:e?e>=80?n.color.positive:e>=50?n.color.warning:n.color.negative:n.color.mediumdark;return{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"10px",fontSize:n.typography.size.s1,fontWeight:n.typography.weight.bold,fontFamily:n.typography.fonts.base,backgroundColor:r(),color:n.color.inverseText,cursor:t?"wait":"pointer",transition:"all 0.15s",border:"none",outline:"none","&:hover:not(:disabled)":{transform:"scale(1.05)",opacity:.9},"&:disabled":{cursor:"not-allowed",opacity:.7}}}),dO=$n.span`
|
|
34
34
|
display: inline-block;
|
|
35
35
|
width: 10px;
|
|
36
36
|
height: 10px;
|
|
37
37
|
border: 2px solid rgba(255,255,255,0.3);
|
|
38
38
|
border-top-color: #fff;
|
|
39
39
|
border-radius: 50%;
|
|
40
|
-
animation: ${
|
|
41
|
-
`,cO=$n.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})),uO=$n.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px",paddingBottom:"8px",borderBottom:`1px solid ${e.appBorderColor}`})),pO=$n.div(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText,fontSize:e.typography.size.s2})),dO=$n.span(({score:e,theme:t})=>{let n=()=>e>=80?t.color.positive:e>=50?t.color.warning:t.color.negative;return{fontWeight:700,fontSize:t.typography.size.s3,color:n()}}),fO=$n.div({display:"flex",flexDirection:"column",gap:"6px",marginBottom:"10px"}),gO=$n.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:e.typography.size.s1,color:e.color.defaultText})),mO=$n.span({display:"flex",alignItems:"center",gap:"4px"}),hO=$n.span(({status:e,theme:t})=>({color:e==="pass"?t.color.positive:e==="warn"?t.color.warning:t.color.negative,fontSize:t.typography.size.s1})),xO=$n.span(({theme:e})=>({fontWeight:500,color:e.color.mediumdark})),yO=$n.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4,fontStyle:"italic"})),bO=$n.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"}})),pk=({figmaFileUrl:e})=>{let{selectedProjectId:t}=Je(),[n,r]=zm(!1),[o,i]=zm(!1),[s,a]=zm(null),u=async()=>{if(!(!e||!t||o)){i(!0);try{let c=V(),l=localStorage.getItem("uicopilot_session_token"),d=await ne(`${c}/api/figma/quality-check`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`},body:JSON.stringify({projectId:t,figmaFileUrl:e,figmaMetadata:{}})});if(!d.ok)throw new Error("Failed to check quality");let f=await d.json();a(f),r(!0)}catch(c){console.error("[FigmaQualityBadge] Quality check error:",c)}finally{i(!1)}}};return e?Ht.createElement(iO,{onMouseEnter:()=>s&&r(!0),onMouseLeave:()=>r(!1)},Ht.createElement(aO,{score:s?.score,isLoading:o,onClick:u,disabled:o||!t,title:s?"Click to refresh quality check":"Click to check Figma design quality"},o?Ht.createElement(Ht.Fragment,null,Ht.createElement(lO,null)," Checking..."):s?Ht.createElement(Ht.Fragment,null,"\u{1F3A8} ",Math.round(s.score),"%"):Ht.createElement(Ht.Fragment,null,"\u{1F3A8} Check Quality")),n&&s&&Ht.createElement(cO,null,Ht.createElement(uO,null,Ht.createElement(pO,null,"Figma Design Quality"),Ht.createElement(dO,{score:s.score},Math.round(s.score),"%")),Ht.createElement(fO,null,Object.entries(s.categories).map(([c,l])=>Ht.createElement(gO,{key:c},Ht.createElement(mO,null,Ht.createElement(hO,{status:l.status},oO(l.status)),rO[c]||c),Ht.createElement(xO,null,l.score)))),s.summary&&Ht.createElement(yO,null,s.summary),s.recommendations?.length>0&&Ht.createElement(bO,null,s.recommendations.slice(0,2).map((c,l)=>Ht.createElement("li",{key:l},c))))):null};var wO=Lo.div(({theme:e})=>({padding:"12px 16px",marginBottom:"16px"})),vO=Lo.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"}),kO=Lo.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),CO=Lo.div({display:"flex",gap:"8px",alignItems:"center"}),TO=Lo.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","&:focus":{borderColor:se,boxShadow:`0 0 0 1px ${se}`},"&::placeholder":{color:e.color.mediumlight}})),IO=Lo(Yt)({whiteSpace:"nowrap"}),FO=Lo.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"}})),EO=Lo.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":"#dc2626",marginTop:"4px",display:"block"})),dk=()=>{let{selectedProjectId:e,projects:t}=Je(),{sessionToken:n}=we(),{updateProject:r}=no(),o=t.find(R=>R.id===e),[i,s]=na(""),[a,u]=na(!1),[c,l]=na(null),d=o?.figmaFileUrl||o?.figmaFileId||"";SO(()=>{s(d),l(null)},[o?.id,d]);let f=i!==d,p=Nm(async()=>{if(!(!e||!f))try{u(!0),l(null),await r(e,{figmaFileUrl:i.trim()||void 0});let R=V();try{await ne(`${R}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})})}catch{}ne(`${R}/api/figma/frames?projectId=${e}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${n}`}},6e4).catch(()=>{}),l({type:"success",message:"Saved \u2014 reloading Figma cache\u2026"}),setTimeout(()=>l(null),3e3)}catch(R){l({type:"error",message:R instanceof Error?R.message:"Failed to save"})}finally{u(!1)}},[e,i,f,r]),g=Nm(R=>{R.key==="Enter"&&f&&!a&&p()},[f,a,p]),[k,T]=na(!1),[E,I]=na(!1),D=Nm(async()=>{if(!(!e||!n))try{I(!0),await r(e,{figmaFileUrl:""});let R=V();await ne(`${R}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})}).catch(()=>{}),await ne(`${R}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})}).catch(()=>{}),s(""),T(!1),l({type:"success",message:"Figma file removed and cache cleared"}),setTimeout(()=>l(null),3e3)}catch{l({type:"error",message:"Failed to remove Figma file"})}finally{I(!1)}},[e,n,r]);return e?$r.createElement(wO,null,$r.createElement(vO,null,$r.createElement(kO,null,"Figma File URL"),$r.createElement(pk,{figmaFileUrl:d})),$r.createElement(CO,null,$r.createElement(TO,{type:"text",value:i,onChange:R=>s(R.target.value),onKeyDown:g,placeholder:"https://www.figma.com/file/..."}),$r.createElement(IO,{onClick:p,disabled:!f||a},a?"Saving...":"Save"),d&&$r.createElement(FO,{onClick:()=>T(!0),title:"Remove Figma file and clear cache"},"\u{1F5D1}")),$r.createElement(_r,{isOpen:k,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:E?"Removing...":"Remove",variant:"danger",onConfirm:D,onCancel:()=>T(!1)}),c&&$r.createElement(EO,{variant:c.type},c.message)):null};import kt,{useState as dc,useEffect as _$}from"react";import{styled as Zn}from"storybook/theming";Ce();je();import et,{useState as Hi,useEffect as w$,useCallback as Ro}from"react";import{styled as en}from"storybook/theming";je();je();Oe();import Q,{useState as Ui,useEffect as Zk,useMemo as Xm,useCallback as eC}from"react";import{styled as Ye}from"storybook/theming";ct();import Re,{useState as Jk,useEffect as AO,memo as PO}from"react";import{styled as ye}from"storybook/theming";var fk=ye.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}),gk=ye.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}`})),mk=ye.div(({theme:e})=>({padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"space-between",alignItems:"center"})),hk=ye.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),xk=ye(Cn)({fontSize:"20px",padding:"4px 8px"}),yk=ye.div({flex:1,overflow:"auto",padding:"20px"}),bk=ye(bo)({fontSize:"14px",marginBottom:"16px"}),Om=ye.div({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"}),Sk=ye.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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),_m=ye.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"})),wk=ye.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"})),vk=ye.img(({theme:e})=>({maxWidth:"100%",maxHeight:"100%",objectFit:"cover",display:"block",backgroundColor:e.background.content,borderRadius:"4px"})),ra=ye.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})),$m=ye.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"thumbnail-spin 0.8s linear infinite","@keyframes thumbnail-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),oa=ye.div(({theme:e})=>({fontSize:"11px",fontWeight:500,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),Um=ye.div(({theme:e})=>({fontSize:"32px",opacity:.5,color:e.color.mediumdark})),jm=ye.div(({theme:e})=>({padding:"12px",textAlign:"left",backgroundColor:e.background.content,borderTop:`1px solid ${e.appBorderColor}`})),Hm=ye.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3})),Wm=ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),kk=ye.div(({theme:e})=>({display:"flex",gap:"16px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Zl=ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer",userSelect:"none","& input":{cursor:"pointer"}})),Ck=ye.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"14px"})),Tk=ye.div(({theme:e})=>({padding:"20px",backgroundColor:e.background.critical,color:e.color.inverseText,borderRadius:"4px",fontSize:"14px"})),Ik=ye.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:se}})),Fk=ye.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${se}`,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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),Ek=ye.div(({theme:e})=>({position:"absolute",top:"8px",right:"8px",padding:"2px 8px",background:se,color:e.color.lightest,borderRadius:"4px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",zIndex:10})),Ak=ye.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px",marginBottom:"4px"}),ste=ye.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"})),Pk=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${se}`,borderRadius:"6px",backgroundColor:e.background.content,overflow:"hidden",minHeight:"200px"})),Lk=ye.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%"}}})),Vm=ye.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"}})),Mk=ye.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})),Bk=ye.span(({theme:e})=>({fontWeight:600,color:e.color.mediumdark})),Dk=ye.span(({theme:e})=>({color:e.color.defaultText})),ec=ye.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,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%"}}})),Rk=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,overflow:"hidden"})),zk=ye.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Nk=ye.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),Ok=ye(hn)({flex:1,width:"auto"}),_k=ye.span(({theme:e,hasMapping:t})=>({fontSize:"12px",color:t?e.color.positive:e.color.mediumdark,fontWeight:t?500:400})),$k=ye.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"})),Uk=ye.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),jk=ye.span(({theme:e})=>({color:e.color.defaultText})),Hk=ye.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}})),Wk=ye.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}})),Vk=ye.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:"8px",fontStyle:"italic"})),tc=ye.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px",flexWrap:"wrap"})),ia=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),$i=ye(hn)(({theme:e,isActive:t})=>({width:"auto",padding:"6px 28px 6px 10px",fontSize:"12px",...t&&{borderColor:e.color.secondary,backgroundColor:`${e.color.secondary}14`}})),nc=ye.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`}})),Gk=ye.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",padding:"8px 0",borderBottom:`1px solid ${e.appBorderColor}`})),qk=ye.button(({theme:e})=>({padding:"6px 12px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:se,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:"rgba(234, 88, 12, 0.08)"}})),Yk=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Gm=ye.button(({theme:e,isSelected:t})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${t?se: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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),qm=ye.div(({theme:e,isSelected:t})=>({position:"absolute",top:"8px",left:"8px",width:"20px",height:"20px",borderRadius:"4px",border:`2px solid ${t?se:e.appBorderColor}`,backgroundColor:t?se:e.background.content,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,fontSize:"12px",color:t?e.color.lightest:"transparent"})),Kk=ye.div(({theme:e})=>({padding:"16px 20px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"flex-end",gap:"12px"})),Xk=ye.button(({theme:e,disabled:t})=>({padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:t?e.color.mediumdark:se,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:se,opacity:t?.6:.9}})),Qk=ye.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"}));Oe();import{styled as LO}from"storybook/theming";var MO=LO.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}})),Ym=PO(({src:e,alt:t,isComponentSet:n,loadingDone:r,failed:o})=>{let[i,s]=Jk(!1),[a,u]=Jk(!1);return AO(()=>{s(!1),u(!1)},[e]),i?Re.createElement(ra,null,Re.createElement(Um,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Re.createElement(oa,null,"Failed to load")):e?Re.createElement(Re.Fragment,null,!a&&Re.createElement(ra,{style:{position:"absolute",inset:0}},Re.createElement($m,null),Re.createElement(oa,null,"Loading...")),Re.createElement(vk,{src:e,alt:t,onLoad:()=>u(!0),onError:()=>s(!0),style:{opacity:a?1:0}})):r?Re.createElement(ra,null,Re.createElement(Um,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Re.createElement(oa,null,o?"Render failed":"No preview")):Re.createElement(ra,null,Re.createElement($m,null),Re.createElement(oa,null,"Loading..."))}),sa=({frame:e,thumbnail:t,thumbnails:n,variantThumbnails:r,variantChildren:o,variantFailed:i,isLoadingVariants:s=!1,isExpanded:a,isNew:u=!1,onToggleExpand:c,onSelect:l,multiSelect:d=!1,selectedFrames:f=new Set,variantFilters:p=[],variantPage:g=1,onShowMore:k})=>{let E=e.type==="COMPONENT_SET",I=E&&(e.children&&e.children.length>0||(e.childCount??0)>0),D=e.children||o||[],R=Re.useMemo(()=>D.length===0?[]:p.some(z=>z.value)?D.filter(z=>z.variantProperties?p.every(x=>x.value?z.variantProperties?.[x.property]===x.value:!0):!1):D,[D,p]),$=z=>{if(E){c(e.id,z);return}l(e)},P=d?Gm:Sk;return Re.createElement(Re.Fragment,null,Re.createElement(P,{onClick:$,title:e.name,isSelected:d?f.has(e.id):void 0,style:{cursor:"pointer"}},d&&!I&&Re.createElement(qm,{isSelected:f.has(e.id)},f.has(e.id)?"\u2713":""),E?Re.createElement(wk,null,I&&Re.createElement(Ik,{onClick:z=>c(e.id,z),title:a?"Collapse variants":"Expand variants"},a?"\u25BC":"\u25B6"),I&&Re.createElement(Ek,null,R.length>0&&R.length!==D.length?`${R.length} / ${D.length}`:e.childCount??D.length," ","variants"),Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!0})):Re.createElement(_m,null,Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!1})),Re.createElement(jm,null,Re.createElement(Hm,null,e.name,u&&Re.createElement(Qk,null,"New")),Re.createElement(Wm,null,e.type))),I&&a&&s&&Re.createElement(Re.Fragment,null,Array.from({length:Math.min(6,e.childCount??e.children?.length??6)}).map((z,x)=>Re.createElement(Pk,{key:`skeleton-${x}`},Re.createElement(Lk,null),Re.createElement(Vm,{width:"80%"}),Re.createElement(Vm,{width:"50%"})))),I&&a&&!s&&R.slice(0,g*50).map(z=>Re.createElement(Km,{key:z.id,variant:z,thumbnail:r?.[z.id]||n[z.id],onSelect:l,multiSelect:d,isSelected:f.has(z.id),loadingDone:!!t||r!==void 0&&z.id in(r||{}),failed:i?.has(z.id)})),I&&a&&!s&&R.length>g*50&&Re.createElement(MO,{onClick:()=>k?.(e.id)},"Show more (",R.length-g*50," ","remaining)"))},Km=({variant:e,thumbnail:t,onSelect:n,multiSelect:r=!1,isSelected:o=!1,loadingDone:i=!1,failed:s=!1})=>Re.createElement(r?Gm:Fk,{onClick:()=>{y.debug("[VariantCard] Clicked:",e.id,e.name),n(e)},title:e.name,isSelected:r?o:void 0},r&&Re.createElement(qm,{isSelected:o},o?"\u2713":""),Re.createElement(_m,null,Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!1,loadingDone:i,failed:s})),Re.createElement(jm,null,Re.createElement(Hm,null,e.name),e.variantProperties&&Object.keys(e.variantProperties).length>0&&Re.createElement(Ak,null,Object.entries(e.variantProperties).map(([c,l])=>Re.createElement(Mk,{key:c},Re.createElement(Bk,null,c,":")," ",Re.createElement(Dk,null,l)))),Re.createElement(Wm,{style:{marginTop:"6px"}},"VARIANT")));var BO=Ye.div({display:"flex",height:"100%",overflow:"hidden"}),DO=Ye.div(({theme:e})=>({width:"380px",minWidth:"300px",borderRight:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",overflow:"hidden"})),RO=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}),tC=Ye.div(({theme:e})=>({padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),nC=Ye.h4(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px",margin:0})),rc=Ye.div({display:"flex",gap:"8px",marginTop:"10px"}),zO=Ye(hn)({flex:1,width:"auto"}),rC=Ye(bo)({flex:1,fontSize:"13px"}),NO=Ye.div({flex:1,overflow:"auto",padding:"8px"}),OO=Ye.div(({theme:e,selected:t,mapped:n})=>({padding:"12px",marginBottom:"8px",borderRadius:"8px",border:`2px solid ${t?e.color.secondary:n?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}})),_O=Ye.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"}),$O=Ye.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),UO=Ye.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})),jO=Ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),HO=Ye.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"})),WO=Ye.img(({theme:e})=>({width:"48px",height:"36px",objectFit:"contain",backgroundColor:e.background.content,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,flexShrink:0})),VO=Ye.div({flex:1,overflow:"hidden"}),GO=Ye.div({fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),qO=Ye.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)"}}})),YO=Ye.img(({theme:e})=>({width:"100%",maxWidth:"260px",maxHeight:"200px",objectFit:"contain",borderRadius:"4px",backgroundColor:e.background.app,display:"block"})),KO=Ye.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",fontWeight:500,color:e.color.defaultText,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),XO=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}),QO=Ye.div({display:"flex",gap:"8px",flexWrap:"wrap"}),Qm=Ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:e.color.mediumdark,cursor:"pointer","& input":{cursor:"pointer"}})),JO=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),Jm=20,ZO=Ye.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"12px 0",borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),e_=Ye.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`}})),t_=Ye.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px",backgroundColor:e.background.app,borderRadius:"6px",marginBottom:"8px"})),n_=Ye.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`}})),r_=Ye.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Zm=Ye.div(({theme:e})=>({gridColumn:"1 / -1",fontSize:"12px",color:e.color.mediumdark,textAlign:"center",padding:"8px 0"})),eh=Ye.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px"})),o_=Ye.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),i_=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),oC=Ye.div(({theme:e})=>({borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,overflow:"hidden",backgroundColor:e.background.content})),iC=Ye.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"}}})),sC=Ye.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"}}})),s_=()=>Q.createElement(i_,null,Array.from({length:8}).map((e,t)=>Q.createElement(oC,{key:t},Q.createElement(iC,null),Q.createElement(sC,{width:`${60+t%3*15}%`})))),a_=Ye.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"})),l_=Ye.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"}),c_=Ye.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)"}}})),u_=Ye.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark})),aC=({stories:e,loading:t,selectedStoryId:n,onSelectStory:r,onStoryMapped:o,projectId:i})=>{let s=Zs({projectId:i,limit:Jm,enabled:!!i}),[a,u]=Ui("all"),[c,l]=Ui(""),[d,f]=Ui(null),[p,g]=Ui(1),[k,T]=Ui(null),[E,I]=Ui(!1),D=Xm(()=>{let m=new Set;return e.forEach(F=>{F.componentTitle&&m.add(F.componentTitle)}),Array.from(m).sort()},[e]),R=Xm(()=>e.filter(m=>{if(a!=="all"&&m.componentTitle!==a)return!1;if(c){let F=c.toLowerCase();return m.name.toLowerCase().includes(F)||m.title.toLowerCase().includes(F)}return!0}),[e,a,c]),$=d?s.frames.find(m=>m.id===d):null,P=Xm(()=>{if(!d)return[];let m=s.variantChildren[d]||[];return m.length===0?[]:s.variantFilters.some(F=>F.value)?m.filter(F=>F.variantProperties?s.variantFilters.every(S=>S.value?F.variantProperties?.[S.property]===S.value:!0):!1):m},[d,s.variantChildren,s.variantFilters]),z=P.slice(0,p*Jm),x=P.length>p*Jm;Zk(()=>{if(!d||z.length===0)return;let m=z.map(F=>F.id);s.fetchVariantThumbnails(d,m)},[d,z.length,p]),Zk(()=>{I(!1)},[]);let w=eC(async m=>{if(n)try{let F=V(),S=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${F}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${S}`},body:JSON.stringify({projectId:i,storyId:n,figmaNodeId:m.id,name:m.name})})).ok)throw new Error("Failed to save mapping");o(n,m.id,m.name)}catch(F){y.error("[MapStoriesTab] Error saving mapping:",F)}},[n,i,o]),v=eC((m,F)=>{if(F.stopPropagation(),d===m){f(null),g(1);return}f(m),g(1),!s.variantThumbnails[m]&&!s.loadingVariants.has(m)&&s.toggleExpanded(m,F)},[d,s]),C=e.find(m=>m.id===n);return t?Q.createElement(o_,null,"Loading stories..."):Q.createElement(BO,null,Q.createElement(DO,null,Q.createElement(tC,null,Q.createElement(nC,null,"Storybook Stories"),Q.createElement(rc,null,Q.createElement(zO,{value:a,onChange:m=>u(m.target.value)},Q.createElement("option",{value:"all"},"All Components"),D.map(m=>Q.createElement("option",{key:m,value:m},m)))),Q.createElement(rc,null,Q.createElement(rC,{type:"text",placeholder:"Search stories...",value:c,onChange:m=>l(m.target.value)}))),Q.createElement(NO,null,R.length===0?Q.createElement(eh,null,"No stories found"):R.map(m=>Q.createElement(OO,{key:m.id,selected:m.id===n,mapped:!!m.figmaMapping,onClick:()=>r(m.id)},Q.createElement(_O,null,Q.createElement($O,null,m.name),Q.createElement(UO,{mapped:!!m.figmaMapping},m.figmaMapping?"Mapped":"Unmapped")),Q.createElement(jO,null,m.title),m.figmaMapping&&Q.createElement(HO,{onMouseEnter:()=>T(m.id),onMouseLeave:()=>T(null)},(()=>{let F=m.figmaMapping?.figmaNodeId,S=F?s.resolveThumbnail(F):void 0;return Q.createElement(Q.Fragment,null,S?Q.createElement(WO,{src:S,alt:m.figmaMapping?.figmaFrameName||""}):Q.createElement("span",null,"\u{1F517}"),k===m.id&&S&&Q.createElement(qO,null,Q.createElement(YO,{src:S,alt:m.figmaMapping?.figmaFrameName||""}),Q.createElement(KO,null,m.figmaMapping?.figmaFrameName)))})(),Q.createElement(VO,null,Q.createElement(GO,null,m.figmaMapping.figmaFrameName))))))),Q.createElement(RO,null,n?Q.createElement(Q.Fragment,null,Q.createElement(a_,null,Q.createElement("span",null,"Click a Figma component below to link it to"," ",Q.createElement("strong",null,C?.name))),Q.createElement(tC,null,Q.createElement(nC,null,"Figma Components"),Q.createElement(rc,null,Q.createElement(QO,null,Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showComponentSets,onChange:m=>s.setShowComponentSets(m.target.checked)}),"Component Sets"),Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showFrames,onChange:m=>s.setShowFrames(m.target.checked)}),"Frames"),Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showComponents,onChange:m=>s.setShowComponents(m.target.checked)}),"Components")),s.availablePages.length>1&&Q.createElement($i,{isActive:!!s.figmaPage,value:s.figmaPage,onChange:m=>s.setFigmaPage(m.target.value)},Q.createElement("option",{value:""},"All pages"),s.availablePages.map(m=>Q.createElement("option",{key:m,value:m},m)))),s.availableFilters.length>0&&Q.createElement(tc,null,Q.createElement(ia,null,"Filters:"),s.availableFilters.slice(0,5).map(({property:m,values:F})=>{let S=s.variantFilters.find(b=>b.property===m);return Q.createElement($i,{key:m,isActive:!!S?.value,value:S?.value||"",onChange:b=>s.handleFilterChange(m,b.target.value)},Q.createElement("option",{value:""},m),F.map(b=>Q.createElement("option",{key:b,value:b},m,"=",b)))}),s.availableFilters.length>5&&Q.createElement(ia,{style:{opacity:.6,fontSize:"11px"}},"+",s.availableFilters.length-5," more"),s.variantFilters.some(m=>m.value)&&Q.createElement(nc,{onClick:s.clearFilters},"Clear All")),Q.createElement(rc,null,Q.createElement(rC,{type:"text",placeholder:"Search Figma components...",value:s.search,onChange:m=>s.setSearch(m.target.value)}))),Q.createElement(XO,null,E&&Q.createElement(l_,null,Q.createElement(c_,null),Q.createElement(u_,null,"Loading thumbnails...")),s.isLoading?Q.createElement(s_,null):s.filteredFrames.length===0?Q.createElement(eh,null,Q.createElement("span",null,"No components match. Try a different search term, or check that your Figma file has component sets defined.")):Q.createElement(JO,null,d&&$?Q.createElement(Q.Fragment,null,Q.createElement(t_,null,Q.createElement(n_,{onClick:()=>{f(null),g(1)}},"Back"),Q.createElement(r_,null,$.name)),s.loadingVariants.has(d)?Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Loading ",$.childCount??"..."," ","variants..."),Array.from({length:Math.min(8,$.childCount??8)}).map((m,F)=>Q.createElement(oC,{key:`variant-skeleton-${F}`},Q.createElement(iC,null),Q.createElement(sC,{width:`${60+F%3*15}%`})))):Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Showing ",z.length," of"," ",P.length," variants"),z.map(m=>Q.createElement(Km,{key:m.id,variant:m,thumbnail:s.variantThumbnails[d]?.[m.id]||s.thumbnails[m.id],onSelect:w,loadingDone:s.variantThumbnails[d]!==void 0&&!s.loadingVariants.has(d),failed:s.variantFailed[d]?.has(m.id)})))):Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Showing ",s.frames.length," of ",s.totalFrames," ","components"),s.filteredFrames.map(m=>Q.createElement(sa,{key:m.id,frame:m,thumbnail:s.thumbnails[m.id],thumbnails:s.thumbnails,variantThumbnails:s.variantThumbnails[m.id],variantChildren:s.variantChildren[m.id],variantFailed:s.variantFailed[m.id],isLoadingVariants:s.loadingVariants.has(m.id),isExpanded:!1,onToggleExpand:v,onSelect:w,variantFilters:s.variantFilters}))),(d?x:s.hasMore)&&Q.createElement(ZO,null,Q.createElement(e_,{disabled:s.loadingMore,onClick:async()=>{d?g(m=>m+1):await s.loadMore()}},s.loadingMore?"Loading...":"Load More"))))):Q.createElement(eh,null,Q.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."))))};je();import ot,{useState as th,useMemo as lC,useCallback as cC}from"react";import{styled as Nt}from"storybook/theming";ct();var p_=Nt.div({display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}),d_=Nt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`,flexWrap:"wrap"})),f_=Nt(hn)({width:"auto",minWidth:"200px"}),g_=Nt(bo)({fontSize:"13px",minWidth:"250px"}),m_=Nt.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}})),h_=Nt.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}})),x_=Nt.div({flex:1,overflow:"auto"}),y_=Nt.table(({theme:e})=>({width:"100%",borderCollapse:"collapse",fontSize:"13px"})),b_=Nt.thead(({theme:e})=>({position:"sticky",top:0,backgroundColor:e.background.app,zIndex:1})),oc=Nt.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}`})),S_=Nt.tbody({}),w_=Nt.tr(({theme:e,mapped:t})=>({backgroundColor:t?"transparent":`${e.color.warning}05`,"&:hover":{backgroundColor:e.background.hoverable}})),ic=Nt.td(({theme:e})=>({padding:"14px 20px",borderBottom:`1px solid ${e.appBorderColor}`,verticalAlign:"middle"})),v_=Nt.div({display:"flex",flexDirection:"column",gap:"2px"}),k_=Nt.div(({theme:e})=>({fontWeight:500,color:e.color.defaultText})),C_=Nt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),T_=Nt.div(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumlight,fontWeight:t?500:400,display:"flex",alignItems:"center",gap:"6px"})),I_=Nt.div({display:"flex",alignItems:"center",gap:"8px"}),F_=Nt.span(({theme:e,mapped:t})=>({width:"10px",height:"10px",borderRadius:"50%",backgroundColor:t?e.color.positive:e.color.mediumlight})),E_=Nt.span(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumdark,fontWeight:500})),uC=Nt.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`}})),A_=Nt.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px",padding:"40px"})),P_=Nt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),pC=({stories:e,loading:t,onLink:n,onUnlink:r,projectId:o})=>{let[i,s]=th("all"),[a,u]=th(""),[c,l]=th(!0),d=lC(()=>{let T=new Set;return e.forEach(E=>{E.componentTitle&&T.add(E.componentTitle)}),Array.from(T).sort()},[e]),f=lC(()=>e.filter(T=>{if(i!=="all"&&T.componentTitle!==i||!c&&!T.figmaMapping)return!1;if(a){let E=a.toLowerCase();return T.name.toLowerCase().includes(E)||T.title.toLowerCase().includes(E)||(T.figmaMapping?.figmaFrameName?.toLowerCase().includes(E)??!1)}return!0}),[e,i,a,c]),p=cC(async T=>{try{let E=V(),I=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${E}/api/mappings?projectId=${o}&storyId=${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${I}`}})).ok)throw new Error("Failed to delete mapping");r(T)}catch(E){console.error("[ViewAllMappingsTab] Error unlinking:",E)}},[o,r]),g=cC(()=>{let T=e.filter(R=>R.figmaMapping).map(R=>({storyId:R.id,storyName:R.name,storyTitle:R.title,figmaNodeId:R.figmaMapping.figmaNodeId,figmaFrameName:R.figmaMapping.figmaFrameName})),E=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),I=URL.createObjectURL(E),D=document.createElement("a");D.href=I,D.download=`figma-mappings-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(I)},[e]);if(t)return ot.createElement(P_,null,"Loading mappings...");let k=e.filter(T=>T.figmaMapping).length;return ot.createElement(p_,null,ot.createElement(d_,null,ot.createElement(f_,{value:i,onChange:T=>s(T.target.value)},ot.createElement("option",{value:"all"},"All Components"),d.map(T=>ot.createElement("option",{key:T,value:T},T))),ot.createElement(g_,{type:"text",placeholder:"\u{1F50D} Search stories or Figma components...",value:a,onChange:T=>u(T.target.value)}),ot.createElement(m_,{active:c,onClick:()=>l(!c)},c?"\u2611":"\u2610"," Show unmapped"),ot.createElement(h_,{onClick:g,disabled:k===0},"\u{1F4E5} Export JSON")),f.length===0?ot.createElement(A_,null,ot.createElement("span",null,"\u{1F4ED}"),a?"No stories match your search":"No stories found"):ot.createElement(x_,null,ot.createElement(y_,null,ot.createElement(b_,null,ot.createElement("tr",null,ot.createElement(oc,{style:{width:"35%"}},"Story"),ot.createElement(oc,{style:{width:"35%"}},"Figma Component"),ot.createElement(oc,{style:{width:"15%"}},"Status"),ot.createElement(oc,{style:{width:"15%"}},"Actions"))),ot.createElement(S_,null,f.map(T=>ot.createElement(w_,{key:T.id,mapped:!!T.figmaMapping},ot.createElement(ic,null,ot.createElement(v_,null,ot.createElement(k_,null,T.name),ot.createElement(C_,null,T.title))),ot.createElement(ic,null,ot.createElement(T_,{mapped:!!T.figmaMapping},T.figmaMapping?ot.createElement(ot.Fragment,null,ot.createElement("span",null,"\u{1F3A8}"),T.figmaMapping.figmaFrameName):"\u2014")),ot.createElement(ic,null,ot.createElement(I_,null,ot.createElement(F_,{mapped:!!T.figmaMapping}),ot.createElement(E_,{mapped:!!T.figmaMapping},T.figmaMapping?"Mapped":"Unmapped"))),ot.createElement(ic,null,T.figmaMapping?ot.createElement(uC,{variant:"unlink",onClick:()=>p(T.id)},"Unlink"):ot.createElement(uC,{variant:"link",onClick:()=>n(T.id)},"Link"))))))))};import Fe,{useState as pc,useMemo as yC}from"react";import{styled as dt}from"storybook/theming";import dC from"react";import{styled as fC,keyframes as L_}from"storybook/theming";var M_=L_`
|
|
40
|
+
animation: ${uO} 0.8s linear infinite;
|
|
41
|
+
`,gO=$n.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})),fO=$n.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px",paddingBottom:"8px",borderBottom:`1px solid ${e.appBorderColor}`})),mO=$n.div(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText,fontSize:e.typography.size.s2})),hO=$n.span(({score:e,theme:t})=>{let n=()=>e>=80?t.color.positive:e>=50?t.color.warning:t.color.negative;return{fontWeight:700,fontSize:t.typography.size.s3,color:n()}}),xO=$n.div({display:"flex",flexDirection:"column",gap:"6px",marginBottom:"10px"}),yO=$n.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:e.typography.size.s1,color:e.color.defaultText})),bO=$n.span({display:"flex",alignItems:"center",gap:"4px"}),SO=$n.span(({status:e,theme:t})=>({color:e==="pass"?t.color.positive:e==="warn"?t.color.warning:t.color.negative,fontSize:t.typography.size.s1})),wO=$n.span(({theme:e})=>({fontWeight:500,color:e.color.mediumdark})),vO=$n.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4,fontStyle:"italic"})),kO=$n.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"}})),mk=({figmaFileUrl:e})=>{let{selectedProjectId:t}=Je(),[n,r]=zm(!1),[o,i]=zm(!1),[s,a]=zm(null),u=async()=>{if(!(!e||!t||o)){i(!0);try{let c=V(),l=localStorage.getItem("uicopilot_session_token"),d=await ne(`${c}/api/figma/quality-check`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`},body:JSON.stringify({projectId:t,figmaFileUrl:e,figmaMetadata:{}})});if(!d.ok)throw new Error("Failed to check quality");let g=await d.json();a(g),r(!0)}catch(c){console.error("[FigmaQualityBadge] Quality check error:",c)}finally{i(!1)}}};return e?Ht.createElement(cO,{onMouseEnter:()=>s&&r(!0),onMouseLeave:()=>r(!1)},Ht.createElement(pO,{score:s?.score,isLoading:o,onClick:u,disabled:o||!t,title:s?"Click to refresh quality check":"Click to check Figma design quality"},o?Ht.createElement(Ht.Fragment,null,Ht.createElement(dO,null)," Checking..."):s?Ht.createElement(Ht.Fragment,null,"\u{1F3A8} ",Math.round(s.score),"%"):Ht.createElement(Ht.Fragment,null,"\u{1F3A8} Check Quality")),n&&s&&Ht.createElement(gO,null,Ht.createElement(fO,null,Ht.createElement(mO,null,"Figma Design Quality"),Ht.createElement(hO,{score:s.score},Math.round(s.score),"%")),Ht.createElement(xO,null,Object.entries(s.categories).map(([c,l])=>Ht.createElement(yO,{key:c},Ht.createElement(bO,null,Ht.createElement(SO,{status:l.status},lO(l.status)),aO[c]||c),Ht.createElement(wO,null,l.score)))),s.summary&&Ht.createElement(vO,null,s.summary),s.recommendations?.length>0&&Ht.createElement(kO,null,s.recommendations.slice(0,2).map((c,l)=>Ht.createElement("li",{key:l},c))))):null};var TO=Lo.div(({theme:e})=>({padding:"12px 16px",marginBottom:"16px"})),IO=Lo.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"}),FO=Lo.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),EO=Lo.div({display:"flex",gap:"8px",alignItems:"center"}),AO=Lo.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","&:focus":{borderColor:se,boxShadow:`0 0 0 1px ${se}`},"&::placeholder":{color:e.color.mediumlight}})),PO=Lo(Yt)({whiteSpace:"nowrap"}),LO=Lo.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"}})),MO=Lo.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":"#dc2626",marginTop:"4px",display:"block"})),hk=()=>{let{selectedProjectId:e,projects:t}=Je(),{sessionToken:n}=we(),{updateProject:r}=no(),o=t.find(R=>R.id===e),[i,s]=ra(""),[a,u]=ra(!1),[c,l]=ra(null),d=o?.figmaFileUrl||o?.figmaFileId||"";CO(()=>{s(d),l(null)},[o?.id,d]);let g=i!==d,p=Nm(async()=>{if(!(!e||!g))try{u(!0),l(null),await r(e,{figmaFileUrl:i.trim()||void 0});let R=V();try{await ne(`${R}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})})}catch{}ne(`${R}/api/figma/frames?projectId=${e}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${n}`}},6e4).catch(()=>{}),l({type:"success",message:"Saved \u2014 reloading Figma cache\u2026"}),setTimeout(()=>l(null),3e3)}catch(R){l({type:"error",message:R instanceof Error?R.message:"Failed to save"})}finally{u(!1)}},[e,i,g,r]),f=Nm(R=>{R.key==="Enter"&&g&&!a&&p()},[g,a,p]),[k,T]=ra(!1),[E,I]=ra(!1),D=Nm(async()=>{if(!(!e||!n))try{I(!0),await r(e,{figmaFileUrl:""});let R=V();await ne(`${R}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})}).catch(()=>{}),await ne(`${R}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})}).catch(()=>{}),s(""),T(!1),l({type:"success",message:"Figma file removed and cache cleared"}),setTimeout(()=>l(null),3e3)}catch{l({type:"error",message:"Failed to remove Figma file"})}finally{I(!1)}},[e,n,r]);return e?$r.createElement(TO,null,$r.createElement(IO,null,$r.createElement(FO,null,"Figma File URL"),$r.createElement(mk,{figmaFileUrl:d})),$r.createElement(EO,null,$r.createElement(AO,{type:"text",value:i,onChange:R=>s(R.target.value),onKeyDown:f,placeholder:"https://www.figma.com/file/..."}),$r.createElement(PO,{onClick:p,disabled:!g||a},a?"Saving...":"Save"),d&&$r.createElement(LO,{onClick:()=>T(!0),title:"Remove Figma file and clear cache"},"\u{1F5D1}")),$r.createElement(_r,{isOpen:k,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:E?"Removing...":"Remove",variant:"danger",onConfirm:D,onCancel:()=>T(!1)}),c&&$r.createElement(MO,{variant:c.type},c.message)):null};import kt,{useState as dc,useEffect as H$}from"react";import{styled as Zn}from"storybook/theming";Ce();je();import et,{useState as Wi,useEffect as T$,useCallback as Ro}from"react";import{styled as en}from"storybook/theming";je();je();Oe();import Q,{useState as ji,useEffect as rC,useMemo as Xm,useCallback as oC}from"react";import{styled as Ye}from"storybook/theming";ct();import Re,{useState as nC,useEffect as BO,memo as DO}from"react";import{styled as ye}from"storybook/theming";var xk=ye.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}),yk=ye.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}`})),bk=ye.div(({theme:e})=>({padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"space-between",alignItems:"center"})),Sk=ye.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),wk=ye(Cn)({fontSize:"20px",padding:"4px 8px"}),vk=ye.div({flex:1,overflow:"auto",padding:"20px"}),kk=ye(bo)({fontSize:"14px",marginBottom:"16px"}),Om=ye.div({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"}),Ck=ye.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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),_m=ye.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"})),Tk=ye.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"})),Ik=ye.img(({theme:e})=>({maxWidth:"100%",maxHeight:"100%",objectFit:"cover",display:"block",backgroundColor:e.background.content,borderRadius:"4px"})),oa=ye.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})),$m=ye.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"thumbnail-spin 0.8s linear infinite","@keyframes thumbnail-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),ia=ye.div(({theme:e})=>({fontSize:"11px",fontWeight:500,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),Um=ye.div(({theme:e})=>({fontSize:"32px",opacity:.5,color:e.color.mediumdark})),jm=ye.div(({theme:e})=>({padding:"12px",textAlign:"left",backgroundColor:e.background.content,borderTop:`1px solid ${e.appBorderColor}`})),Hm=ye.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3})),Wm=ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),Fk=ye.div(({theme:e})=>({display:"flex",gap:"16px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Zl=ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer",userSelect:"none","& input":{cursor:"pointer"}})),Ek=ye.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"14px"})),Ak=ye.div(({theme:e})=>({padding:"20px",backgroundColor:e.background.critical,color:e.color.inverseText,borderRadius:"4px",fontSize:"14px"})),Pk=ye.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:se}})),Lk=ye.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${se}`,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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),Mk=ye.div(({theme:e})=>({position:"absolute",top:"8px",right:"8px",padding:"2px 8px",background:se,color:e.color.lightest,borderRadius:"4px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",zIndex:10})),Bk=ye.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px",marginBottom:"4px"}),ute=ye.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"})),Dk=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${se}`,borderRadius:"6px",backgroundColor:e.background.content,overflow:"hidden",minHeight:"200px"})),Rk=ye.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%"}}})),Vm=ye.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"}})),zk=ye.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})),Nk=ye.span(({theme:e})=>({fontWeight:600,color:e.color.mediumdark})),Ok=ye.span(({theme:e})=>({color:e.color.defaultText})),ec=ye.div(({theme:e,width:t="100%",height:n="40px"})=>({width:t,height:n,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%"}}})),_k=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,overflow:"hidden"})),$k=ye.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Uk=ye.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),jk=ye(hn)({flex:1,width:"auto"}),Hk=ye.span(({theme:e,hasMapping:t})=>({fontSize:"12px",color:t?e.color.positive:e.color.mediumdark,fontWeight:t?500:400})),Wk=ye.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"})),Vk=ye.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),Gk=ye.span(({theme:e})=>({color:e.color.defaultText})),qk=ye.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}})),Yk=ye.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}})),Kk=ye.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:"8px",fontStyle:"italic"})),tc=ye.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px",flexWrap:"wrap"})),sa=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Ui=ye(hn)(({theme:e,isActive:t})=>({width:"auto",padding:"6px 28px 6px 10px",fontSize:"12px",...t&&{borderColor:e.color.secondary,backgroundColor:`${e.color.secondary}14`}})),nc=ye.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`}})),Xk=ye.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",padding:"8px 0",borderBottom:`1px solid ${e.appBorderColor}`})),Qk=ye.button(({theme:e})=>({padding:"6px 12px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:se,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:"rgba(234, 88, 12, 0.08)"}})),Jk=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Gm=ye.button(({theme:e,isSelected:t})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${t?se: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:se,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),qm=ye.div(({theme:e,isSelected:t})=>({position:"absolute",top:"8px",left:"8px",width:"20px",height:"20px",borderRadius:"4px",border:`2px solid ${t?se:e.appBorderColor}`,backgroundColor:t?se:e.background.content,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,fontSize:"12px",color:t?e.color.lightest:"transparent"})),Zk=ye.div(({theme:e})=>({padding:"16px 20px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"flex-end",gap:"12px"})),eC=ye.button(({theme:e,disabled:t})=>({padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:t?e.color.mediumdark:se,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:se,opacity:t?.6:.9}})),tC=ye.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"}));Oe();import{styled as RO}from"storybook/theming";var zO=RO.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}})),Ym=DO(({src:e,alt:t,isComponentSet:n,loadingDone:r,failed:o})=>{let[i,s]=nC(!1),[a,u]=nC(!1);return BO(()=>{s(!1),u(!1)},[e]),i?Re.createElement(oa,null,Re.createElement(Um,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Re.createElement(ia,null,"Failed to load")):e?Re.createElement(Re.Fragment,null,!a&&Re.createElement(oa,{style:{position:"absolute",inset:0}},Re.createElement($m,null),Re.createElement(ia,null,"Loading...")),Re.createElement(Ik,{src:e,alt:t,onLoad:()=>u(!0),onError:()=>s(!0),style:{opacity:a?1:0}})):r?Re.createElement(oa,null,Re.createElement(Um,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Re.createElement(ia,null,o?"Render failed":"No preview")):Re.createElement(oa,null,Re.createElement($m,null),Re.createElement(ia,null,"Loading..."))}),aa=({frame:e,thumbnail:t,thumbnails:n,variantThumbnails:r,variantChildren:o,variantFailed:i,isLoadingVariants:s=!1,isExpanded:a,isNew:u=!1,onToggleExpand:c,onSelect:l,multiSelect:d=!1,selectedFrames:g=new Set,variantFilters:p=[],variantPage:f=1,onShowMore:k})=>{let E=e.type==="COMPONENT_SET",I=E&&(e.children&&e.children.length>0||(e.childCount??0)>0),D=e.children||o||[],R=Re.useMemo(()=>D.length===0?[]:p.some(z=>z.value)?D.filter(z=>z.variantProperties?p.every(x=>x.value?z.variantProperties?.[x.property]===x.value:!0):!1):D,[D,p]),$=z=>{if(E){c(e.id,z);return}l(e)},P=d?Gm:Ck;return Re.createElement(Re.Fragment,null,Re.createElement(P,{onClick:$,title:e.name,isSelected:d?g.has(e.id):void 0,style:{cursor:"pointer"}},d&&!I&&Re.createElement(qm,{isSelected:g.has(e.id)},g.has(e.id)?"\u2713":""),E?Re.createElement(Tk,null,I&&Re.createElement(Pk,{onClick:z=>c(e.id,z),title:a?"Collapse variants":"Expand variants"},a?"\u25BC":"\u25B6"),I&&Re.createElement(Mk,null,R.length>0&&R.length!==D.length?`${R.length} / ${D.length}`:e.childCount??D.length," ","variants"),Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!0})):Re.createElement(_m,null,Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!1})),Re.createElement(jm,null,Re.createElement(Hm,null,e.name,u&&Re.createElement(tC,null,"New")),Re.createElement(Wm,null,e.type))),I&&a&&s&&Re.createElement(Re.Fragment,null,Array.from({length:Math.min(6,e.childCount??e.children?.length??6)}).map((z,x)=>Re.createElement(Dk,{key:`skeleton-${x}`},Re.createElement(Rk,null),Re.createElement(Vm,{width:"80%"}),Re.createElement(Vm,{width:"50%"})))),I&&a&&!s&&R.slice(0,f*50).map(z=>Re.createElement(Km,{key:z.id,variant:z,thumbnail:r?.[z.id]||n[z.id],onSelect:l,multiSelect:d,isSelected:g.has(z.id),loadingDone:!!t||r!==void 0&&z.id in(r||{}),failed:i?.has(z.id)})),I&&a&&!s&&R.length>f*50&&Re.createElement(zO,{onClick:()=>k?.(e.id)},"Show more (",R.length-f*50," ","remaining)"))},Km=({variant:e,thumbnail:t,onSelect:n,multiSelect:r=!1,isSelected:o=!1,loadingDone:i=!1,failed:s=!1})=>Re.createElement(r?Gm:Lk,{onClick:()=>{y.debug("[VariantCard] Clicked:",e.id,e.name),n(e)},title:e.name,isSelected:r?o:void 0},r&&Re.createElement(qm,{isSelected:o},o?"\u2713":""),Re.createElement(_m,null,Re.createElement(Ym,{src:t,alt:e.name,isComponentSet:!1,loadingDone:i,failed:s})),Re.createElement(jm,null,Re.createElement(Hm,null,e.name),e.variantProperties&&Object.keys(e.variantProperties).length>0&&Re.createElement(Bk,null,Object.entries(e.variantProperties).map(([c,l])=>Re.createElement(zk,{key:c},Re.createElement(Nk,null,c,":")," ",Re.createElement(Ok,null,l)))),Re.createElement(Wm,{style:{marginTop:"6px"}},"VARIANT")));var NO=Ye.div({display:"flex",height:"100%",overflow:"hidden"}),OO=Ye.div(({theme:e})=>({width:"380px",minWidth:"300px",borderRight:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",overflow:"hidden"})),_O=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}),iC=Ye.div(({theme:e})=>({padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),sC=Ye.h4(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px",margin:0})),rc=Ye.div({display:"flex",gap:"8px",marginTop:"10px"}),$O=Ye(hn)({flex:1,width:"auto"}),aC=Ye(bo)({flex:1,fontSize:"13px"}),UO=Ye.div({flex:1,overflow:"auto",padding:"8px"}),jO=Ye.div(({theme:e,selected:t,mapped:n})=>({padding:"12px",marginBottom:"8px",borderRadius:"8px",border:`2px solid ${t?e.color.secondary:n?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}})),HO=Ye.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"}),WO=Ye.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),VO=Ye.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})),GO=Ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),qO=Ye.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"})),YO=Ye.img(({theme:e})=>({width:"48px",height:"36px",objectFit:"contain",backgroundColor:e.background.content,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,flexShrink:0})),KO=Ye.div({flex:1,overflow:"hidden"}),XO=Ye.div({fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),QO=Ye.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)"}}})),JO=Ye.img(({theme:e})=>({width:"100%",maxWidth:"260px",maxHeight:"200px",objectFit:"contain",borderRadius:"4px",backgroundColor:e.background.app,display:"block"})),ZO=Ye.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",fontWeight:500,color:e.color.defaultText,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),e_=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}),t_=Ye.div({display:"flex",gap:"8px",flexWrap:"wrap"}),Qm=Ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:e.color.mediumdark,cursor:"pointer","& input":{cursor:"pointer"}})),n_=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),Jm=20,r_=Ye.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"12px 0",borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),o_=Ye.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`}})),i_=Ye.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px",backgroundColor:e.background.app,borderRadius:"6px",marginBottom:"8px"})),s_=Ye.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`}})),a_=Ye.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Zm=Ye.div(({theme:e})=>({gridColumn:"1 / -1",fontSize:"12px",color:e.color.mediumdark,textAlign:"center",padding:"8px 0"})),eh=Ye.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px"})),l_=Ye.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),c_=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),lC=Ye.div(({theme:e})=>({borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,overflow:"hidden",backgroundColor:e.background.content})),cC=Ye.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"}}})),uC=Ye.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"}}})),u_=()=>Q.createElement(c_,null,Array.from({length:8}).map((e,t)=>Q.createElement(lC,{key:t},Q.createElement(cC,null),Q.createElement(uC,{width:`${60+t%3*15}%`})))),p_=Ye.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"})),d_=Ye.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"}),g_=Ye.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)"}}})),f_=Ye.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark})),pC=({stories:e,loading:t,selectedStoryId:n,onSelectStory:r,onStoryMapped:o,projectId:i})=>{let s=ea({projectId:i,limit:Jm,enabled:!!i}),[a,u]=ji("all"),[c,l]=ji(""),[d,g]=ji(null),[p,f]=ji(1),[k,T]=ji(null),[E,I]=ji(!1),D=Xm(()=>{let m=new Set;return e.forEach(F=>{F.componentTitle&&m.add(F.componentTitle)}),Array.from(m).sort()},[e]),R=Xm(()=>e.filter(m=>{if(a!=="all"&&m.componentTitle!==a)return!1;if(c){let F=c.toLowerCase();return m.name.toLowerCase().includes(F)||m.title.toLowerCase().includes(F)}return!0}),[e,a,c]),$=d?s.frames.find(m=>m.id===d):null,P=Xm(()=>{if(!d)return[];let m=s.variantChildren[d]||[];return m.length===0?[]:s.variantFilters.some(F=>F.value)?m.filter(F=>F.variantProperties?s.variantFilters.every(S=>S.value?F.variantProperties?.[S.property]===S.value:!0):!1):m},[d,s.variantChildren,s.variantFilters]),z=P.slice(0,p*Jm),x=P.length>p*Jm;rC(()=>{if(!d||z.length===0)return;let m=z.map(F=>F.id);s.fetchVariantThumbnails(d,m)},[d,z.length,p]),rC(()=>{I(!1)},[]);let w=oC(async m=>{if(n)try{let F=V(),S=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${F}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${S}`},body:JSON.stringify({projectId:i,storyId:n,figmaNodeId:m.id,name:m.name})})).ok)throw new Error("Failed to save mapping");o(n,m.id,m.name)}catch(F){y.error("[MapStoriesTab] Error saving mapping:",F)}},[n,i,o]),v=oC((m,F)=>{if(F.stopPropagation(),d===m){g(null),f(1);return}g(m),f(1),!s.variantThumbnails[m]&&!s.loadingVariants.has(m)&&s.toggleExpanded(m,F)},[d,s]),C=e.find(m=>m.id===n);return t?Q.createElement(l_,null,"Loading stories..."):Q.createElement(NO,null,Q.createElement(OO,null,Q.createElement(iC,null,Q.createElement(sC,null,"Storybook Stories"),Q.createElement(rc,null,Q.createElement($O,{value:a,onChange:m=>u(m.target.value)},Q.createElement("option",{value:"all"},"All Components"),D.map(m=>Q.createElement("option",{key:m,value:m},m)))),Q.createElement(rc,null,Q.createElement(aC,{type:"text",placeholder:"Search stories...",value:c,onChange:m=>l(m.target.value)}))),Q.createElement(UO,null,R.length===0?Q.createElement(eh,null,"No stories found"):R.map(m=>Q.createElement(jO,{key:m.id,selected:m.id===n,mapped:!!m.figmaMapping,onClick:()=>r(m.id)},Q.createElement(HO,null,Q.createElement(WO,null,m.name),Q.createElement(VO,{mapped:!!m.figmaMapping},m.figmaMapping?"Mapped":"Unmapped")),Q.createElement(GO,null,m.title),m.figmaMapping&&Q.createElement(qO,{onMouseEnter:()=>T(m.id),onMouseLeave:()=>T(null)},(()=>{let F=m.figmaMapping?.figmaNodeId,S=F?s.resolveThumbnail(F):void 0;return Q.createElement(Q.Fragment,null,S?Q.createElement(YO,{src:S,alt:m.figmaMapping?.figmaFrameName||""}):Q.createElement("span",null,"\u{1F517}"),k===m.id&&S&&Q.createElement(QO,null,Q.createElement(JO,{src:S,alt:m.figmaMapping?.figmaFrameName||""}),Q.createElement(ZO,null,m.figmaMapping?.figmaFrameName)))})(),Q.createElement(KO,null,Q.createElement(XO,null,m.figmaMapping.figmaFrameName))))))),Q.createElement(_O,null,n?Q.createElement(Q.Fragment,null,Q.createElement(p_,null,Q.createElement("span",null,"Click a Figma component below to link it to"," ",Q.createElement("strong",null,C?.name))),Q.createElement(iC,null,Q.createElement(sC,null,"Figma Components"),Q.createElement(rc,null,Q.createElement(t_,null,Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showComponentSets,onChange:m=>s.setShowComponentSets(m.target.checked)}),"Component Sets"),Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showFrames,onChange:m=>s.setShowFrames(m.target.checked)}),"Frames"),Q.createElement(Qm,null,Q.createElement("input",{type:"checkbox",checked:s.showComponents,onChange:m=>s.setShowComponents(m.target.checked)}),"Components")),s.availablePages.length>1&&Q.createElement(Ui,{isActive:!!s.figmaPage,value:s.figmaPage,onChange:m=>s.setFigmaPage(m.target.value)},Q.createElement("option",{value:""},"All pages"),s.availablePages.map(m=>Q.createElement("option",{key:m,value:m},m)))),s.availableFilters.length>0&&Q.createElement(tc,null,Q.createElement(sa,null,"Filters:"),s.availableFilters.slice(0,5).map(({property:m,values:F})=>{let S=s.variantFilters.find(b=>b.property===m);return Q.createElement(Ui,{key:m,isActive:!!S?.value,value:S?.value||"",onChange:b=>s.handleFilterChange(m,b.target.value)},Q.createElement("option",{value:""},m),F.map(b=>Q.createElement("option",{key:b,value:b},m,"=",b)))}),s.availableFilters.length>5&&Q.createElement(sa,{style:{opacity:.6,fontSize:"11px"}},"+",s.availableFilters.length-5," more"),s.variantFilters.some(m=>m.value)&&Q.createElement(nc,{onClick:s.clearFilters},"Clear All")),Q.createElement(rc,null,Q.createElement(aC,{type:"text",placeholder:"Search Figma components...",value:s.search,onChange:m=>s.setSearch(m.target.value)}))),Q.createElement(e_,null,E&&Q.createElement(d_,null,Q.createElement(g_,null),Q.createElement(f_,null,"Loading thumbnails...")),s.isLoading?Q.createElement(u_,null):s.filteredFrames.length===0?Q.createElement(eh,null,Q.createElement("span",null,"No components match. Try a different search term, or check that your Figma file has component sets defined.")):Q.createElement(n_,null,d&&$?Q.createElement(Q.Fragment,null,Q.createElement(i_,null,Q.createElement(s_,{onClick:()=>{g(null),f(1)}},"Back"),Q.createElement(a_,null,$.name)),s.loadingVariants.has(d)?Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Loading ",$.childCount??"..."," ","variants..."),Array.from({length:Math.min(8,$.childCount??8)}).map((m,F)=>Q.createElement(lC,{key:`variant-skeleton-${F}`},Q.createElement(cC,null),Q.createElement(uC,{width:`${60+F%3*15}%`})))):Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Showing ",z.length," of"," ",P.length," variants"),z.map(m=>Q.createElement(Km,{key:m.id,variant:m,thumbnail:s.variantThumbnails[d]?.[m.id]||s.thumbnails[m.id],onSelect:w,loadingDone:s.variantThumbnails[d]!==void 0&&!s.loadingVariants.has(d),failed:s.variantFailed[d]?.has(m.id)})))):Q.createElement(Q.Fragment,null,Q.createElement(Zm,null,"Showing ",s.frames.length," of ",s.totalFrames," ","components"),s.filteredFrames.map(m=>Q.createElement(aa,{key:m.id,frame:m,thumbnail:s.thumbnails[m.id],thumbnails:s.thumbnails,variantThumbnails:s.variantThumbnails[m.id],variantChildren:s.variantChildren[m.id],variantFailed:s.variantFailed[m.id],isLoadingVariants:s.loadingVariants.has(m.id),isExpanded:!1,onToggleExpand:v,onSelect:w,variantFilters:s.variantFilters}))),(d?x:s.hasMore)&&Q.createElement(r_,null,Q.createElement(o_,{disabled:s.loadingMore,onClick:async()=>{d?f(m=>m+1):await s.loadMore()}},s.loadingMore?"Loading...":"Load More"))))):Q.createElement(eh,null,Q.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."))))};je();import ot,{useState as th,useMemo as dC,useCallback as gC}from"react";import{styled as Nt}from"storybook/theming";ct();var m_=Nt.div({display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}),h_=Nt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`,flexWrap:"wrap"})),x_=Nt(hn)({width:"auto",minWidth:"200px"}),y_=Nt(bo)({fontSize:"13px",minWidth:"250px"}),b_=Nt.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}})),S_=Nt.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}})),w_=Nt.div({flex:1,overflow:"auto"}),v_=Nt.table(({theme:e})=>({width:"100%",borderCollapse:"collapse",fontSize:"13px"})),k_=Nt.thead(({theme:e})=>({position:"sticky",top:0,backgroundColor:e.background.app,zIndex:1})),oc=Nt.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}`})),C_=Nt.tbody({}),T_=Nt.tr(({theme:e,mapped:t})=>({backgroundColor:t?"transparent":`${e.color.warning}05`,"&:hover":{backgroundColor:e.background.hoverable}})),ic=Nt.td(({theme:e})=>({padding:"14px 20px",borderBottom:`1px solid ${e.appBorderColor}`,verticalAlign:"middle"})),I_=Nt.div({display:"flex",flexDirection:"column",gap:"2px"}),F_=Nt.div(({theme:e})=>({fontWeight:500,color:e.color.defaultText})),E_=Nt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),A_=Nt.div(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumlight,fontWeight:t?500:400,display:"flex",alignItems:"center",gap:"6px"})),P_=Nt.div({display:"flex",alignItems:"center",gap:"8px"}),L_=Nt.span(({theme:e,mapped:t})=>({width:"10px",height:"10px",borderRadius:"50%",backgroundColor:t?e.color.positive:e.color.mediumlight})),M_=Nt.span(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumdark,fontWeight:500})),fC=Nt.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`}})),B_=Nt.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px",padding:"40px"})),D_=Nt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),mC=({stories:e,loading:t,onLink:n,onUnlink:r,projectId:o})=>{let[i,s]=th("all"),[a,u]=th(""),[c,l]=th(!0),d=dC(()=>{let T=new Set;return e.forEach(E=>{E.componentTitle&&T.add(E.componentTitle)}),Array.from(T).sort()},[e]),g=dC(()=>e.filter(T=>{if(i!=="all"&&T.componentTitle!==i||!c&&!T.figmaMapping)return!1;if(a){let E=a.toLowerCase();return T.name.toLowerCase().includes(E)||T.title.toLowerCase().includes(E)||(T.figmaMapping?.figmaFrameName?.toLowerCase().includes(E)??!1)}return!0}),[e,i,a,c]),p=gC(async T=>{try{let E=V(),I=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${E}/api/mappings?projectId=${o}&storyId=${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${I}`}})).ok)throw new Error("Failed to delete mapping");r(T)}catch(E){console.error("[ViewAllMappingsTab] Error unlinking:",E)}},[o,r]),f=gC(()=>{let T=e.filter(R=>R.figmaMapping).map(R=>({storyId:R.id,storyName:R.name,storyTitle:R.title,figmaNodeId:R.figmaMapping.figmaNodeId,figmaFrameName:R.figmaMapping.figmaFrameName})),E=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),I=URL.createObjectURL(E),D=document.createElement("a");D.href=I,D.download=`figma-mappings-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(D),D.click(),document.body.removeChild(D),URL.revokeObjectURL(I)},[e]);if(t)return ot.createElement(D_,null,"Loading mappings...");let k=e.filter(T=>T.figmaMapping).length;return ot.createElement(m_,null,ot.createElement(h_,null,ot.createElement(x_,{value:i,onChange:T=>s(T.target.value)},ot.createElement("option",{value:"all"},"All Components"),d.map(T=>ot.createElement("option",{key:T,value:T},T))),ot.createElement(y_,{type:"text",placeholder:"\u{1F50D} Search stories or Figma components...",value:a,onChange:T=>u(T.target.value)}),ot.createElement(b_,{active:c,onClick:()=>l(!c)},c?"\u2611":"\u2610"," Show unmapped"),ot.createElement(S_,{onClick:f,disabled:k===0},"\u{1F4E5} Export JSON")),g.length===0?ot.createElement(B_,null,ot.createElement("span",null,"\u{1F4ED}"),a?"No stories match your search":"No stories found"):ot.createElement(w_,null,ot.createElement(v_,null,ot.createElement(k_,null,ot.createElement("tr",null,ot.createElement(oc,{style:{width:"35%"}},"Story"),ot.createElement(oc,{style:{width:"35%"}},"Figma Component"),ot.createElement(oc,{style:{width:"15%"}},"Status"),ot.createElement(oc,{style:{width:"15%"}},"Actions"))),ot.createElement(C_,null,g.map(T=>ot.createElement(T_,{key:T.id,mapped:!!T.figmaMapping},ot.createElement(ic,null,ot.createElement(I_,null,ot.createElement(F_,null,T.name),ot.createElement(E_,null,T.title))),ot.createElement(ic,null,ot.createElement(A_,{mapped:!!T.figmaMapping},T.figmaMapping?ot.createElement(ot.Fragment,null,ot.createElement("span",null,"\u{1F3A8}"),T.figmaMapping.figmaFrameName):"\u2014")),ot.createElement(ic,null,ot.createElement(P_,null,ot.createElement(L_,{mapped:!!T.figmaMapping}),ot.createElement(M_,{mapped:!!T.figmaMapping},T.figmaMapping?"Mapped":"Unmapped"))),ot.createElement(ic,null,T.figmaMapping?ot.createElement(fC,{variant:"unlink",onClick:()=>p(T.id)},"Unlink"):ot.createElement(fC,{variant:"link",onClick:()=>n(T.id)},"Link"))))))))};import Fe,{useState as pc,useMemo as vC}from"react";import{styled as dt}from"storybook/theming";import hC from"react";import{styled as xC,keyframes as R_}from"storybook/theming";var z_=R_`
|
|
42
42
|
0% { transform: rotate(0deg); }
|
|
43
43
|
100% { transform: rotate(360deg); }
|
|
44
|
-
`,B_=fC.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${M_} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),D_=fC.button(({theme:e,variant:t="default",disabled:n})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"5px 12px",fontSize:"12px",fontWeight:600,border:`1px solid ${e.color.medium}`,borderRadius:"5px",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.2s",whiteSpace:"nowrap",...t==="default"&&{backgroundColor:e.background.content,color:e.color.defaultText,"&:hover":n?{}:{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":n?{}:{color:e.color.defaultText,backgroundColor:e.background.hoverable}}})),Fr=({loading:e=!1,disabled:t=!1,onClick:n,variant:r="default",children:o,loadingText:i})=>dC.createElement(D_,{variant:r,disabled:t||e,onClick:n},e&&dC.createElement(B_,null),e&&i?i:o);je();import ln from"react";import{styled as aa}from"storybook/theming";var gC=aa.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"})),R_=aa.div({display:"flex",alignItems:"center",gap:"12px"}),sc=aa.span({whiteSpace:"nowrap"}),mC=aa.div({display:"flex",alignItems:"center",gap:"8px"}),ac=aa.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),lc=({inputTokens:e,outputTokens:t,costUsd:n,compact:r=!1})=>{let o=e+t,i=n*Cw;return r?ln.createElement(gC,null,ln.createElement(sc,null,o.toLocaleString()," tokens"),ln.createElement(mC,null,ln.createElement(ac,null,"$",n.toFixed(4)),ln.createElement("span",null,"\xB7"),ln.createElement(ac,null,"\u20AA",i.toFixed(2)))):ln.createElement(gC,null,ln.createElement(R_,null,ln.createElement(sc,null,e.toLocaleString()," input"),ln.createElement("span",null,"+"),ln.createElement(sc,null,t.toLocaleString()," output"),ln.createElement("span",null,"="),ln.createElement(sc,null,ln.createElement("strong",null,o.toLocaleString())," tokens")),ln.createElement(mC,null,ln.createElement(ac,null,"$",n.toFixed(4)),ln.createElement("span",null,"\xB7"),ln.createElement(ac,null,"\u20AA",i.toFixed(2))))};import Un from"react";import{styled as Mo}from"storybook/theming";function nh(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var z_=Mo.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),hC=Mo.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),N_=Mo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),O_=Mo.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})),__=Mo.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),$_=Mo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),U_=Mo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),j_=Mo.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),xC=({data:e,color:t,compact:n})=>n?Un.createElement(hC,{color:t},e.summary):Un.createElement(z_,null,Un.createElement(hC,{color:t},e.summary),e.mappings&&e.mappings.length>0&&Un.createElement(N_,null,e.mappings.map((r,o)=>Un.createElement(Un.Fragment,{key:o},Un.createElement(O_,null,r.from," ",Un.createElement(__,null,"\u2192")," ",r.to)))),e.candidates!=null&&e.candidates>1&&Un.createElement($_,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&Un.createElement(Un.Fragment,null,e.defaults.map((r,o)=>Un.createElement(U_,{key:o},Un.createElement(j_,null,r.choice),Un.createElement("span",null,"\u2014 ",r.why)))));var H_=dt.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),W_=dt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),V_=dt.div({display:"flex",flexDirection:"column",gap:"4px"}),G_=dt.div({display:"flex",alignItems:"center",gap:"10px"}),q_=dt.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"})),bC=dt.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})),Y_=dt.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),K_=dt.div({display:"flex",gap:"8px"}),X_=dt.div(({theme:e})=>({display:"flex",alignItems:"center",padding:"12px 24px",gap:"12px",borderBottom:`1px solid ${e.appBorderColor}`})),Q_=dt(bo)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),J_=dt.div({display:"flex",gap:"4px"}),cc=dt.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}})),Z_=dt.div({display:"flex",flexDirection:"column",flex:1,padding:"16px 24px",gap:"8px",overflowY:"auto"}),e$=dt.div(({theme:e,dimmed:t})=>({display:"flex",alignItems:"center",padding:"12px 16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"10px",gap:"12px",backgroundColor:e.background.content,opacity:t?.6:1,transition:"opacity 0.15s",position:"relative",zIndex:0,"&:hover":{zIndex:10}})),t$=dt.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}`}})),n$=dt.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"})),uc=dt.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}`})),r$=dt.img({width:"100%",height:"100%",objectFit:"contain"}),CC=dt.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)"}}})),SC=dt.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),wC=dt.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"})),rh=dt.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"})),Yte=dt.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"})),o$=dt.div(({theme:e})=>({flexShrink:0,color:e.color.mediumlight,fontSize:"14px"})),i$=dt.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})),s$=dt.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}})),a$=dt.div(({theme:e})=>({padding:"16px 0",marginTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",gap:"8px"})),l$=dt.div({display:"flex",flexWrap:"wrap",gap:"6px"}),c$=dt.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})),u$=dt.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})),p$=dt.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"}})),Kte=dt.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})),vC=({src:e,alt:t})=>{let[n,r]=pc(!1);return Fe.createElement(Fe.Fragment,null,!n&&Fe.createElement(CC,null),Fe.createElement(r$,{src:e,alt:t,onLoad:()=>r(!0),style:n?void 0:{position:"absolute",opacity:0}}))};function kC(e){return e>=90?"high":e>=70?"medium":"low"}function d$(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var TC=({results:e,stories:t,onApply:n,onCancel:r,onRerun:o,isApplying:i,isRerunning:s,source:a,resolveThumbnail:u,resolveStoryScreenshot:c,isCapturingScreenshots:l,onBrowse:d})=>{let[f,p]=pc(()=>{let v=new Set;for(let C of e.mappings)C.confidence>=90&&v.add(C.storyId);return v}),[g,k]=pc(""),[T,E]=pc("all"),I=yC(()=>{let v=new Map;for(let C of t)v.set(C.id,{name:C.name,title:C.title});return v},[t]),D=yC(()=>{let v=e.mappings;if(T!=="all"&&(v=v.filter(C=>kC(C.confidence)===T)),g.trim()){let C=g.toLowerCase();v=v.filter(m=>{let F=I.get(m.storyId);return F?.name.toLowerCase().includes(C)||F?.title.toLowerCase().includes(C)||m.componentSetName.toLowerCase().includes(C)||m.figmaFrameName.toLowerCase().includes(C)})}return v},[e.mappings,T,g,I]),R=v=>{p(C=>{let m=new Set(C);return m.has(v)?m.delete(v):m.add(v),m})},$=()=>{let v=e.mappings.filter(C=>f.has(C.storyId));n(v)},P=e.mappings.filter(v=>v.confidence>=90).length,z=e.mappings.filter(v=>v.confidence>=70&&v.confidence<90).length,x=e.mappings.filter(v=>v.confidence<70).length,w=e.usage;return Fe.createElement(H_,null,Fe.createElement(W_,null,Fe.createElement(V_,null,Fe.createElement(G_,null,Fe.createElement(q_,null,"Auto-Map Results"),Fe.createElement(bC,{variant:"success"},e.stats.matched," matched"),e.unmatched.length>0&&Fe.createElement(bC,{variant:"danger"},e.unmatched.length," unmatched"),a&&Fe.createElement(u$,{variant:a},a==="cache"?"Loaded from cache":"Fresh analysis")),Fe.createElement(Y_,null,"Review matches below. Uncheck any incorrect mappings before applying.")),Fe.createElement(K_,null,a==="cache"&&o&&Fe.createElement(p$,{onClick:o,disabled:s},s?"Re-running...":"Re-run LLM"),Fe.createElement(Fr,{onClick:r,variant:"ghost"},"Cancel"),Fe.createElement(Fr,{loading:i,onClick:$,loadingText:"Applying..."},"Apply ",f.size," Selected"))),Fe.createElement(X_,null,Fe.createElement(Q_,{type:"text",placeholder:"Filter stories...",value:g,onChange:v=>k(v.target.value)}),Fe.createElement(J_,null,Fe.createElement(cc,{active:T==="all",onClick:()=>E("all")},"All ",e.mappings.length),P>0&&Fe.createElement(cc,{active:T==="high",onClick:()=>E("high")},"\u226590% (",P,")"),z>0&&Fe.createElement(cc,{active:T==="medium",onClick:()=>E("medium")},"70-89% (",z,")"),x>0&&Fe.createElement(cc,{active:T==="low",onClick:()=>E("low")},"<70% (",x,")"))),Fe.createElement(Z_,null,D.map(v=>{let C=I.get(v.storyId),m=kC(v.confidence),F=f.has(v.storyId),S=m==="low";return Fe.createElement(e$,{key:v.storyId,dimmed:S&&!F},Fe.createElement(t$,{checked:F,onClick:()=>R(v.storyId)},F?"\u2713":""),(()=>{let b=c?.(v.storyId);return b?Fe.createElement(uc,null,Fe.createElement(vC,{src:b,alt:C?.name||v.storyId})):l?Fe.createElement(uc,null,Fe.createElement(CC,null)):Fe.createElement(n$,{bgColor:S?"#f1f5f9":"#eff6ff"},Fe.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:S?"#94a3b8":"#3b82f6"}},(C?.name||"?").substring(0,4)))})(),Fe.createElement(SC,null,Fe.createElement(wC,null,C?.name||v.storyId),Fe.createElement(rh,null,C?.title||"")),Fe.createElement(o$,null,"\u2192"),(()=>{let b=u?.(v.figmaNodeId),A=nh(v.reason),L=A.summary+(A.candidates?` (${A.candidates} candidates)`:"");return b?Fe.createElement(uc,{title:L},Fe.createElement(vC,{src:b,alt:v.figmaFrameName})):Fe.createElement(uc,{title:L},Fe.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:"#94a3b8"}},"No thumbnail"))})(),Fe.createElement(SC,null,Fe.createElement(wC,null,v.componentSetName),Fe.createElement(rh,null,v.figmaFrameName),Fe.createElement(xC,{data:nh(v.reason),color:d$(m)})),Fe.createElement(i$,{level:m},v.confidence,"%"),d&&Fe.createElement(s$,{onClick:()=>d(v.componentSetName)},"Browse"))}),e.unmatched.length>0&&Fe.createElement(a$,null,Fe.createElement(rh,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),Fe.createElement(l$,null,e.unmatched.map(v=>{let C=I.get(v);return Fe.createElement(c$,{key:v},Fe.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),C?`${C.name} (${C.title})`:v)})))),w&&a!=="cache"&&Fe.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},Fe.createElement(lc,{inputTokens:w.inputTokens||0,outputTokens:w.outputTokens||0,costUsd:w.costUsd||0})))};je();Oe();import{useState as Bo,useCallback as Do,useRef as f$}from"react";import{useStorybookApi as g$}from"storybook/manager-api";function IC({projectId:e}){let t=g$(),n=f$(null),[r,o]=Bo(!1),[i,s]=Bo(!1),[a,u]=Bo(!1),[c,l]=Bo(null),[d,f]=Bo(null),[p,g]=Bo(null),[k,T]=Bo(""),[E,I]=Bo(null),D=Do(async()=>{let C=await fetch("/index.json");if(!C.ok)throw new Error("Failed to fetch Storybook index");let m=await C.json(),F=m.entries||m.stories||{},S=Object.keys(F).filter(L=>F[L].type==="story");y.debug(`[useAutoMap] Found ${S.length} stories in index.json`);let b=[];for(let L of S){let B=F[L],N=t.getData(L),h={...N?.initialArgs||{}},j=N?.argTypes||{};for(let[W,M]of Object.entries(j))if(!(W in h)){let K=M;if(K.defaultValue!==void 0)h[W]=K.defaultValue;else if(K.table?.defaultValue?.summary!==void 0){let ee=K.table.defaultValue.summary;ee==="false"?h[W]=!1:ee==="true"?h[W]=!0:h[W]=ee}}b.push({id:L,name:B.name||L.split("--").pop()||L,title:B.title||"",initialArgs:h,argTypes:j})}let A=b.filter(L=>Object.keys(L.initialArgs).length>0);return y.debug(`[useAutoMap] Manifest: ${b.length} stories, ${A.length} with args`),b},[t]),R=Do(async()=>{if(!e)return!1;try{let C=V(),m=localStorage.getItem("uicopilot_session_token");if(!m)return!1;let F=await fetch(`${C}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${m}`}});if(!F.ok)return!1;let S=await F.json();return S.hasSuggestions&&S.mappings?.length>0?(f(S),I("cache"),T(`Loaded ${S.mappings.length} saved suggestions`),y.debug(`[useAutoMap] Loaded ${S.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),$=Do(async C=>{o(!0),T("Collecting story information...");let m;try{if(m=await D(),C?.length&&(m=m.filter(S=>!C.includes(S.id)),y.debug(`[useAutoMap] After excluding mapped: ${m.length} stories`)),m.length===0){l("No unmapped stories found"),o(!1);return}g(m)}catch(S){l(S instanceof Error?S.message:"Failed to collect story manifest"),o(!1);return}o(!1),s(!0),T(`Analyzing ${m.length} stories against Figma components...`);let F=new AbortController;n.current=F;try{let S=V(),b=localStorage.getItem("uicopilot_session_token");if(!b)throw new Error("Not authenticated");let A=await fetch(`${S}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({projectId:e,stories:m.map(B=>({id:B.id,name:B.name,title:B.title,initialArgs:B.initialArgs,argTypes:B.argTypes}))}),signal:F.signal});if(!A.ok){let B=await A.json();throw new Error(B.error||"Auto-map failed")}let L=await A.json();f(L),I("llm"),T(`Found ${L.stats.matched} matches (${L.stats.highConfidence} high confidence)`),y.debug(`[useAutoMap] Results: ${L.stats.matched}/${L.stats.total} matched, ${L.unmatched.length} unmatched`)}catch(S){if(S instanceof DOMException&&S.name==="AbortError"){T("Cancelled");return}l(S instanceof Error?S.message:"Auto-map failed")}finally{s(!1),n.current=null}},[e,D]),P=Do(async C=>{if(!e)return;if(l(null),f(null),I(null),o(!0),T("Checking for existing suggestions..."),await R()){o(!1);return}await $(C)},[e,R,$]),z=Do(async C=>{e&&(l(null),f(null),I(null),await $(C))},[e,$]),x=Do(async C=>{if(!(!e||C.length===0)){u(!0),T(`Applying ${C.length} mappings...`);try{let m=V(),F=localStorage.getItem("uicopilot_session_token");if(!F)throw new Error("Not authenticated");let S=0;for(let b of C)try{(await fetch(`${m}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`},body:JSON.stringify({projectId:e,storyId:b.storyId,figmaNodeId:b.figmaNodeId,name:b.figmaFrameName||b.componentSetName})})).ok?S++:y.warn(`[useAutoMap] Failed to apply mapping for ${b.storyId}`)}catch(A){y.error(`[useAutoMap] Error applying mapping for ${b.storyId}:`,A)}T(`Applied ${S}/${C.length} mappings`),y.debug(`[useAutoMap] Applied ${S}/${C.length} mappings`)}catch(m){l(m instanceof Error?m.message:"Failed to apply mappings")}finally{u(!1)}}},[e]),w=Do(()=>{n.current?.abort()},[]),v=Do(()=>{f(null),g(null),l(null),T(""),I(null)},[]);return{collectAndMap:P,rerun:z,loadExisting:R,applyMappings:x,cancel:w,reset:v,isCollecting:r,isMapping:i,isApplying:a,error:c,results:d,manifest:p,progress:k,source:E}}Oe();import{useState as oh,useEffect as m$,useRef as FC}from"react";var EC=2;async function h$(e,t){try{let n=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`,{signal:t});return n.ok&&(await n.json()).screenshot||null}catch{return null}}function AC(e){let[t,n]=oh({}),[r,o]=oh(0),[i,s]=oh(!1),a=FC(null),u=FC(""),c=e.join(",");return m$(()=>{if(!e.length||c===u.current)return;u.current=c,n({}),o(0),s(!0);let l=new AbortController;a.current=l;let d=0;return(async()=>{for(let p=0;p<e.length&&!l.signal.aborted;p+=EC){let g=e.slice(p,p+EC),k=await Promise.all(g.map(E=>h$(E,l.signal).then(I=>({id:E,img:I}))));if(l.signal.aborted)break;let T={};for(let{id:E,img:I}of k)d++,I&&(T[E]=I);Object.keys(T).length>0&&n(E=>({...E,...T})),o(d)}s(!1),y.debug(`[useStoryScreenshots] Captured ${d}/${e.length} screenshots`)})().catch(()=>s(!1)),()=>{l.abort()}},[c]),{screenshots:t,isCapturing:i,progress:{done:r,total:e.length}}}import ke,{useState as ih,useEffect as la,useMemo as x$,useCallback as y$}from"react";import{styled as b$}from"storybook/theming";Oe();var S$=b$.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"}})),ji=({isOpen:e,onClose:t,onSelect:n,projectId:r,stories:o=[],currentStoryId:i,onStoryChange:s,multiSelect:a=!1,onMultiSelect:u,initialSearch:c})=>{let l=Zs({projectId:r||"",enabled:e&&!!r}),d=ke.useRef(!1);la(()=>{e&&c&&!d.current&&(l.setSearch(c),d.current=!0),e||(d.current=!1)},[e,c]);let[f,p]=ih(new Set),[g,k]=ih(i||o[0]?.id||"");la(()=>{i&&k(i)},[i]);let T=50,[E,I]=ih({}),D=y$(C=>{I(m=>({...m,[C]:(m[C]||1)+1}))},[]);la(()=>{I({})},[l.variantFilters]),la(()=>{l.expandedSets.forEach(C=>{let m=l.variantChildren[C];if(!m||m.length===0)return;let F=m;l.variantFilters.some(A=>A.value)&&(F=m.filter(A=>A.variantProperties?l.variantFilters.every(L=>L.value?A.variantProperties?.[L.property]===L.value:!0):!1));let S=E[C]||1,b=F.slice(0,S*T).map(A=>A.id);b.length>0&&l.fetchVariantThumbnails(C,b)})},[l.expandedSets,l.variantChildren,l.variantFilters,E]),la(()=>{p(new Set)},[g]);let R=x$(()=>{let C=[];return l.filteredFrames.forEach(m=>{if(m.type==="COMPONENT_SET"&&m.children){let F=l.variantFilters.some(S=>S.value)?m.children.filter(S=>S.variantProperties?l.variantFilters.every(b=>b.value?S.variantProperties?.[b.property]===b.value:!0):!1):m.children;C.push(...F)}else C.push(m)}),C},[l.filteredFrames,l.variantFilters]),$=C=>{if(a)p(m=>{let F=new Set(m);return F.has(C.id)?F.delete(C.id):F.add(C.id),F});else{let m=l.resolveThumbnail(C.id);try{n({...C,thumbnail:m})}catch(F){y.error("[ComponentBrowserModal] onSelect threw error:",F)}t()}},P=()=>{let C=R.map(F=>F.id),m=C.every(F=>f.has(F));p(m?new Set:new Set(C))},z=()=>{if(u&&f.size>0){let C=R.filter(m=>f.has(m.id)).map(m=>({...m,thumbnail:l.resolveThumbnail(m.id)}));u(C),p(new Set)}},x=C=>{k(C),s?.(C)},w=C=>{C.target===C.currentTarget&&t()},v=o.find(C=>C.id===g);return e?ke.createElement(fk,{onClick:w},ke.createElement(gk,null,ke.createElement(mk,null,ke.createElement(hk,null,"Link Figma Frames"),ke.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},ke.createElement("button",{onClick:()=>l.refresh(),disabled:l.isLoading,style:{padding:"4px 8px",fontSize:"12px",cursor:l.isLoading?"not-allowed":"pointer",background:"transparent",border:"1px solid #ccc",borderRadius:"4px"},title:"Refresh from Figma"},"Refresh"),ke.createElement(xk,{onClick:t},"\xD7"))),ke.createElement(yk,null,l.error&&ke.createElement(Tk,null,l.error),!l.error&&ke.createElement(ke.Fragment,null,o.length>0&&ke.createElement(zk,null,ke.createElement(Nk,null,"Story:"),ke.createElement(Ok,{value:g,onChange:C=>x(C.target.value)},o.map(C=>ke.createElement("option",{key:C.id,value:C.id},C.name,C.mappingsCount?` (${C.mappingsCount} linked)`:""))),v?.mappingsCount?ke.createElement(_k,{hasMapping:!0},v.mappingsCount," frames linked"):null),ke.createElement(kk,null,ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showComponentSets,onChange:C=>l.setShowComponentSets(C.target.checked)}),"Component Sets"),ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showFrames,onChange:C=>l.setShowFrames(C.target.checked)}),"Frames"),ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showComponents,onChange:C=>l.setShowComponents(C.target.checked)}),"Components"),l.availablePages.length>1&&ke.createElement($i,{isActive:!!l.figmaPage,value:l.figmaPage,onChange:C=>l.setFigmaPage(C.target.value),style:{marginLeft:"auto"}},ke.createElement("option",{value:""},"All pages"),l.availablePages.map(C=>ke.createElement("option",{key:C,value:C},C)))),l.filterSuggestion&&ke.createElement($k,null,ke.createElement(Uk,null,"AI suggests:"),ke.createElement(jk,null,Object.entries(l.filterSuggestion.suggestedFilters).map(([C,m])=>`${C}=${m}`).join(", ")),ke.createElement(Hk,{onClick:l.applySuggestedFilters},"Apply"),ke.createElement(Wk,{onClick:l.dismissFilterSuggestion},"Dismiss")),l.filterSuggestionLoading&&ke.createElement(Vk,null,"Matching story args to Figma filters..."),l.availableFilters.length>0&&ke.createElement(tc,null,ke.createElement(ia,null,"Filters:"),l.availableFilters.map(({property:C,values:m})=>{let F=l.variantFilters.find(S=>S.property===C);return ke.createElement($i,{key:C,isActive:!!F?.value,value:F?.value||"",onChange:S=>l.handleFilterChange(C,S.target.value)},ke.createElement("option",{value:""},C),m.map(S=>ke.createElement("option",{key:S,value:S},C,"=",S)))}),l.variantFilters.some(C=>C.value)&&ke.createElement(nc,{onClick:l.clearFilters},"Clear All")),ke.createElement(bk,{type:"text",placeholder:"Search frames...",value:l.search,onChange:C=>l.setSearch(C.target.value),autoFocus:!0}),a&&R.length>0&&ke.createElement(Gk,null,ke.createElement(qk,{onClick:P},f.size===R.length?"Deselect All":"Select All Visible"),ke.createElement(Yk,null,f.size>0?`${f.size} selected of `:"Showing ",R.length," frames")),l.isLoading&&ke.createElement(Om,null,Array.from({length:6}).map((C,m)=>ke.createElement(Rk,{key:m},ke.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},ke.createElement(ec,{width:"100%",height:"100%"})),ke.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},ke.createElement(ec,{width:"80%",height:"16px"}),ke.createElement(ec,{width:"50%",height:"12px"}))))),!l.isLoading&&l.filteredFrames.length===0&&ke.createElement(Ck,null,l.search?"No frames match your search":"No frames found in this Figma file"),!l.isLoading&&l.filteredFrames.length>0&&ke.createElement(Om,null,l.filteredFrames.map(C=>ke.createElement(sa,{key:C.id,frame:C,thumbnail:l.thumbnails[C.id],thumbnails:l.thumbnails,variantThumbnails:l.variantThumbnails[C.id],variantChildren:l.variantChildren[C.id],variantFailed:l.variantFailed[C.id],isLoadingVariants:l.loadingVariants.has(C.id),isExpanded:l.expandedSets.has(C.id),isNew:l.recentlyAdded.has(C.name),onToggleExpand:l.toggleExpanded,onSelect:$,multiSelect:a,selectedFrames:f,variantFilters:l.variantFilters,variantPage:E[C.id]||1,onShowMore:D})),l.hasMore&&ke.createElement(S$,{onClick:l.loadMore,disabled:l.loadingMore},l.loadingMore?"Loading...":`Show more (${l.totalFrames-l.frames.length} remaining)`)))),a&&ke.createElement(Kk,null,ke.createElement(Xk,{disabled:f.size===0,onClick:z},"Link ",f.size," Selected")))):null};Ce();ct();var v$=en.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}),k$=en.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"})),C$=en.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),T$=en.div({display:"flex",alignItems:"center",gap:"20px"}),I$=en.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),F$=en.div({display:"flex",gap:"4px"}),PC=en(yo)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),E$=en(Cn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),A$=en.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),P$=en.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),L$=en.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),M$=en.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),B$=en.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),D$=en.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),R$=en.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),z$=en.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),N$=en.div(({theme:e})=>({width:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",opacity:.6})),O$=en.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"}})),LC=en.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"}})),MC=({isOpen:e,onClose:t,projectId:n})=>{let[r,o]=Hi("map"),[i,s]=Hi([]),[a,u]=Hi(!0),[c,l]=Hi(null),[d,f]=Hi(!1),[p,g]=Hi(null),k=IC({projectId:n}),{refreshMappings:T}=nt(),{featureFlags:E}=ce(),I=et.useMemo(()=>k.results?.mappings.map(b=>b.storyId)||[],[k.results]),D=AC(I),R=Ro(async()=>{u(!0);try{let b=await fetch("/index.json");if(!b.ok)throw new Error("Failed to fetch index.json");let A=await b.json(),L=A.entries||A.stories||{},B=Object.entries(L).filter(([,h])=>h.type==="story").map(([h,j])=>({id:h,name:j.name||h.split("--").pop()||h,title:j.title||"",importPath:j.importPath,componentTitle:j.title?.split("/").slice(0,-1).join("/")||j.title,figmaMapping:null}));try{let h=V(),j=localStorage.getItem("uicopilot_session_token"),W=await ne(`${h}/api/mappings?projectId=${n}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${j}`}});if(W.ok){let M=await W.json(),K=new Map((M.mappings||[]).map(ee=>[ee.storyId,ee]));B.forEach(ee=>{let fe=K.get(ee.id);fe&&fe.figmaNodeId&&(ee.figmaMapping={figmaNodeId:fe.figmaNodeId,figmaFrameName:fe.name||fe.figmaFrameName||""})})}}catch(h){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",h)}s(B);let N=B.find(h=>!h.figmaMapping);N?l(N.id):B.length>0&&l(B[0].id)}catch(b){console.error("[StoryMappingAssistant] Error fetching stories:",b)}finally{u(!1)}},[n]);w$(()=>{e&&R()},[e,R]);let $=Ro((b,A,L)=>{s(h=>h.map(j=>j.id===b?{...j,figmaMapping:{figmaNodeId:A,figmaFrameName:L}}:j));let B=i.findIndex(h=>h.id===b),N=i.find((h,j)=>j>B&&!h.figmaMapping);N&&l(N.id)},[i]),P=Ro(b=>{s(A=>A.map(L=>L.id===b?{...L,figmaMapping:null}:L))},[]),z=Ro(b=>{l(b),o("map")},[]),x=Ro(()=>{let b=i.filter(A=>A.figmaMapping).map(A=>A.id);k.collectAndMap(b)},[i,k]),w=Ro(()=>{let b=i.filter(A=>A.figmaMapping).map(A=>A.id);f(!1),k.rerun(b)},[i,k]),v=Ro(async b=>{await k.applyMappings(b),f(!1),k.reset(),R(),T()},[k,R,T]),C=Ro(()=>{f(!1),k.reset()},[k]);et.useEffect(()=>{k.results&&f(!0)},[k.results]);let m=b=>{b.target===b.currentTarget&&t()};if(!e)return null;let F=i.filter(b=>b.figmaMapping).length,S=i.length;return et.createElement(et.Fragment,null,et.createElement(v$,{onClick:m},et.createElement(k$,{onClick:b=>b.stopPropagation()},et.createElement(C$,null,et.createElement(T$,null,et.createElement(I$,null,et.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),et.createElement(F$,null,et.createElement(PC,{active:r==="map",onClick:()=>o("map")},"Map Stories"),et.createElement(PC,{active:r==="view",onClick:()=>o("view")},"View All Mappings"))),et.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},E.enableAutoMap&&!d&&!k.isCollecting&&!k.isMapping&&et.createElement(O$,{onClick:x,disabled:a||i.length===0},et.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},et.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),et.createElement("path",{d:"M2 17l10 5 10-5"}),et.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),et.createElement(E$,{onClick:t},"\xD7"))),et.createElement(A$,null,(k.isCollecting||k.isMapping)&&et.createElement(M$,null,et.createElement(B$,null,et.createElement(z$,null,et.createElement(N$,null)),et.createElement(D$,null,"Auto-mapping stories to Figma"),et.createElement(R$,null,k.progress),et.createElement(Fr,{onClick:k.cancel,variant:"ghost"},"Cancel"))),d&&k.results&&et.createElement(TC,{results:k.results,stories:i,onApply:v,onCancel:C,onRerun:w,isApplying:k.isApplying,isRerunning:k.isCollecting||k.isMapping,source:k.source,resolveThumbnail:b=>k.results?.thumbnailUrls?.[b],resolveStoryScreenshot:b=>D.screenshots[b],isCapturingScreenshots:D.isCapturing,onBrowse:b=>g(b)}),!d&&!k.isCollecting&&!k.isMapping&&(r==="map"?et.createElement(aC,{stories:i,loading:a,selectedStoryId:c,onSelectStory:l,onStoryMapped:$,projectId:n}):et.createElement(pC,{stories:i,loading:a,onLink:z,onUnlink:P,projectId:n}))),et.createElement(P$,null,et.createElement(L$,null,et.createElement("span",null,"Total: ",S," stories"),et.createElement(LC,{type:"mapped"},et.createElement("span",{className:"dot"}),F," mapped"),et.createElement(LC,{type:"unmapped"},et.createElement("span",{className:"dot"}),S-F," unmapped"))))),et.createElement(ji,{isOpen:!!p,onClose:()=>g(null),onSelect:()=>g(null),projectId:n,initialSearch:p||void 0}))};ct();var BC=Zn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",transition:"border-color 0.2s, box-shadow 0.2s","&:hover":{borderColor:e.color.mediumlight}})),$$=Zn.div(({theme:e})=>({width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{width:"16px",height:"16px"}})),U$=Zn.div({display:"flex",alignItems:"center",gap:"12px",flex:1}),j$=Zn.div({display:"flex",alignItems:"center",gap:"8px"}),H$=Zn.div(({theme:e})=>({width:"60px",height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),W$=Zn.div(({theme:e,percent:t,state:n})=>({width:`${t}%`,height:"100%",borderRadius:"2px",backgroundColor:n==="complete"?e.color.positive:n==="partial"?e.color.warning:e.color.mediumlight,transition:"width 0.3s ease"})),V$=Zn.span(({theme:e,state:t})=>({fontSize:"12px",fontWeight:600,color:t==="complete"?e.color.positive:t==="partial"?e.color.warning:e.color.mediumdark,whiteSpace:"nowrap"})),G$=Zn.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),q$=Zn(du)({padding:"4px 10px",fontSize:"12px",fontWeight:600,marginLeft:"auto"}),Y$=Zn(du)(({theme:e})=>({padding:"4px 10px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.negative||"#dc2626","&:hover":{textDecoration:"none",backgroundColor:"rgba(220, 38, 38, 0.08)"}})),K$=Zn.span(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontStyle:"italic"})),X$=Zn.div(({theme:e})=>({width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"figma-mapping-spin 0.8s linear infinite","@keyframes figma-mapping-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),Q$=Zn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),DC=()=>{let[e,t]=dc(!1),[n,r]=dc({totalStories:0,mappedStories:0,loading:!0}),{selectedProjectId:o}=Je(),{sessionToken:i}=we();_$(()=>{o&&i?s():r({totalStories:0,mappedStories:0,loading:!1})},[o,i]);let s=async()=>{r($=>({...$,loading:!0}));try{let $=await fetch("/index.json");if(!$.ok)throw new Error("Failed to fetch Storybook index");let P=await $.json(),z=P.entries||P.stories||{},x=Object.keys(z).filter(F=>z[F].type==="story").length,w=Object.keys(z).filter(F=>z[F].type==="story"),v=V(),C=await ne(`${v}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}}),m=0;if(C.ok){let F=await C.json(),S=F.mappings||F||[];if(Array.isArray(S)){let b=new Set(S.map(A=>A.storyId).filter(Boolean));m=w.filter(A=>b.has(A)).length}else{let b=await ne(`${v}/api/mappings/stats?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(b.ok){let A=await b.json();m=Math.min(A.mappedStoriesCount||0,x)}}}r({totalStories:x,mappedStories:m,loading:!1})}catch($){console.error("[FigmaMappingsSection] Error fetching stats:",$),r(P=>({...P,loading:!1}))}},[a,u]=dc(!1),[c,l]=dc(!1),d=async()=>{!o||!i||l(!0)},f=async()=>{l(!1),u(!0);try{let $=V(),P=await ne(`${$}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(!P.ok)throw new Error("Failed to fetch mappings");let x=(await P.json()).mappings||[];await Promise.all(x.map(w=>ne(`${$}/api/mappings?id=${encodeURIComponent(w.id)}`,{method:"DELETE",headers:{Authorization:`Bearer ${i}`}}))),s()}catch($){console.error("[FigmaMappingsSection] Unlink all failed:",$)}finally{u(!1)}},p=()=>t(!0),g=()=>{t(!1),o&&i&&s()};if(!o)return kt.createElement(BC,null,kt.createElement(K$,null,"Select a project to link Figma designs"));let{totalStories:k,loading:T}=n,E=Math.min(n.mappedStories,k),I=E===0?"none":E>=k?"complete":"partial",D=k>0?Math.min(100,Math.round(E/k*100)):0,R=I==="none"?"Link designs":"Manage";return kt.createElement(kt.Fragment,null,kt.createElement(BC,null,kt.createElement($$,null,kt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},kt.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"}),kt.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"}),kt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),kt.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"}),kt.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"}))),kt.createElement(U$,null,kt.createElement(G$,null,"Figma Mappings"),kt.createElement(j$,null,T?kt.createElement(kt.Fragment,null,kt.createElement(X$,null),kt.createElement(Q$,null,"Loading...")):kt.createElement(kt.Fragment,null,kt.createElement(H$,null,kt.createElement(W$,{percent:D,state:I})),kt.createElement(V$,{state:I},`${E}/${k}`)))),E>0&&kt.createElement(Y$,{onClick:d,disabled:T||a},a?"Unlinking...":"Unlink All"),kt.createElement(q$,{onClick:p,disabled:T},R)),e&&kt.createElement(MC,{isOpen:e,onClose:g,projectId:o}),kt.createElement(_r,{isOpen:c,title:"Unlink All Mappings",message:`Unlink all ${n.mappedStories} Figma mappings?`,confirmLabel:"Unlink All",variant:"danger",onConfirm:f,onCancel:()=>l(!1)}))};import le,{useState as Wi,useEffect as fc,useCallback as RC,useRef as sh}from"react";import{styled as er}from"storybook/theming";Ce();je();ct();var ah=er.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",fontSize:"12px"})),lh=er.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),ch=er.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),Xne=er(Rr)({padding:"5px 12px",fontSize:"12px"}),uh=er.div(({theme:e})=>({display:"flex",gap:"16px",color:e.color.mediumdark,marginBottom:"4px"})),gc=er.span(({theme:e})=>({whiteSpace:"nowrap","& strong":{color:e.color.defaultText,fontWeight:600}})),J$=er.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})),Z$=er.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),ph=er.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),e4=er.span(({theme:e})=>({color:e.color.mediumdark,fontSize:"12px"})),mc=er.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),hc=er.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"3px",transition:"width 0.5s ease"})),zo=er.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText})),zC=new Set,NC=()=>{let{userRole:e,featureFlags:t}=ce(),[n,r]=Wi(null),[o,i]=Wi(!0),[s,a]=Wi(!1),[u,c]=Wi(!1),[l,d]=Wi(!1),[f,p]=Wi(!1),{selectedProjectId:g,projects:k}=Je(),{sessionToken:T}=we(),E=sh(null),I=sh(null),D=sh(null),R=RC(()=>{E.current&&(clearInterval(E.current),E.current=null),I.current&&(clearInterval(I.current),I.current=null),D.current&&(clearTimeout(D.current),D.current=null)},[]);fc(()=>R,[R]);let $=RC(async()=>{if(!(!g||!T))try{let S=V(),b=await ne(`${S}/api/figma/cache-status?projectId=${g}`,{headers:{Authorization:`Bearer ${T}`}});if(b.ok){let A=await b.json();r(A)}}catch(S){console.error("[FigmaCacheSection] Error:",S)}finally{i(!1)}},[g,T]);fc(()=>{$()},[$]),fc(()=>{if(o||s||!n||n.structureStatus!=="none"||!g||zC.has(g))return;let S=k.find(A=>A.id===g);(S?.figmaFileUrl||S?.figmaFileId)&&(zC.add(g),P())},[o,s,n?.structureStatus,g,k]),fc(()=>{let S=n?.thumbnailProgress?.status,b=n?.enrichmentProgress?.status,A=n?.thumbnailProgress?.cached??0,L=n?.thumbnailProgress?.total??0,B=S==="in-progress"||S==="pending"||L>0&&A<L,N=b==="in-progress"||b==="pending",h=!n?.thumbnailProgress&&n?.structureStatus==="cached";if(!(B||N||h)||!n||n.structureStatus==="none")return;let W=setInterval(()=>{$()},3e3);return()=>{clearInterval(W)}},[n?.thumbnailProgress?.status,n?.thumbnailProgress?.cached,n?.thumbnailProgress?.total,n?.enrichmentProgress?.status,n?.structureStatus,$]);let P=async()=>{if(!(!g||!T)){a(!0);try{let S=V();await ne(`${S}/api/figma/frames?projectId=${g}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${T}`}},6e4),await new Promise(b=>setTimeout(b,1e3)),await $(),setTimeout(async()=>{await $()},3e3)}catch(S){console.error("[FigmaCacheSection] Reload error:",S)}finally{a(!1)}}},z=async()=>{if(!(!g||!T)){c(!0);try{let S=V(),b=await ne(`${S}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:g})});console.log("[FigmaCacheSection] Cache invalidate response:",b.status),await ne(`${S}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:g})}).catch(()=>{}),r({structureStatus:"none",structureCachedAt:null,componentSetCount:0,componentCount:0,pageCount:0,pages:[],cacheDiff:null,thumbnailProgress:null,enrichmentProgress:null})}catch(S){console.error("[FigmaCacheSection] Clear cache error:",S)}finally{c(!1)}}},x=async()=>{if(!(!g||!T)){R(),d(!0);try{let S=V();await ne(`${S}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:g})}),E.current=setInterval(async()=>{await $()},3e3),I.current=setInterval(()=>{(n?.enrichmentProgress?.status==="complete"||n?.enrichmentProgress?.status==="error")&&(R(),d(!1),$())},3e3),D.current=setTimeout(()=>{R(),d(!1)},6e5)}catch(S){console.error("[FigmaCacheSection] Enrich error:",S),R(),d(!1)}}},w=async()=>{if(!(!g||!T)){p(!0);try{let S=V();await ne(`${S}/api/figma/cancel`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:g})}),await $()}catch(S){console.error("[FigmaCacheSection] Cancel error:",S)}finally{p(!1),d(!1),a(!1)}}},v=n?.thumbnailProgress?.status==="in-progress"||n?.enrichmentProgress?.status==="in-progress";if(!g)return null;if(o)return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache")),le.createElement(uh,null,le.createElement(gc,null,"Loading cache status\u2026")),le.createElement(mc,null,le.createElement(hc,{percent:100,style:{opacity:.3}})));if(!n||n.structureStatus==="none")return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache"),le.createElement(Fr,{loading:s,onClick:P,loadingText:"Loading..."},"\u21BB Load")),s?le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:30,style:{animation:"none",width:"100%",opacity:.3}})),le.createElement(zo,null,le.createElement("span",null,"Downloading structure from Figma... this may take 30-60 seconds"))):le.createElement(uh,null,le.createElement(gc,null,"No cache \u2014 click Load to fetch from Figma")));let C=S=>{let b=Date.now()-new Date(S).getTime(),A=Math.floor(b/6e4);if(A<1)return"just now";if(A<60)return`${A}m ago`;let L=Math.floor(A/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`},m=n.cacheDiff,F=m&&(m.added.length>0||m.removed.length>0||m.renamed.length>0);return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache"," ",le.createElement(J$,{status:n.structureStatus},n.structureStatus)),le.createElement("div",{style:{display:"flex",gap:"6px"}},e==="admin"&&le.createElement(Fr,{loading:l,onClick:x,loadingText:"Enriching..."},"Enrich"),le.createElement(Fr,{loading:u,onClick:z,variant:"ghost",loadingText:"Clearing..."},"Clear"),le.createElement(Fr,{loading:s,onClick:P,loadingText:"Reloading..."},"\u21BB Reload"),v&&le.createElement(Fr,{loading:f,onClick:w,variant:"ghost",loadingText:"Cancelling..."},"\u2715 Cancel"))),s&&le.createElement(zo,null,le.createElement("span",null,"Downloading structure from Figma...")),le.createElement(uh,null,le.createElement(gc,null,le.createElement("strong",null,n.componentSetCount)," component sets"),le.createElement(gc,null,le.createElement("strong",null,n.pageCount)," pages"),n.structureCachedAt&&le.createElement(e4,null,"Updated ",C(n.structureCachedAt))),F&&le.createElement(Z$,null,"Since last reload:"," ",m.added.length>0&&le.createElement(ph,{type:"added"},"+",m.added.length," added"),m.added.length>0&&m.removed.length>0&&" \xB7 ",m.removed.length>0&&le.createElement(ph,{type:"removed"},"\u2212",m.removed.length," removed"),(m.added.length>0||m.removed.length>0)&&m.renamed.length>0&&" \xB7 ",m.renamed.length>0&&le.createElement(ph,{type:"renamed"},m.renamed.length," renamed")),n.thumbnailProgress&&n.thumbnailProgress.status==="in-progress"&&le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:n.thumbnailProgress.total>0?Math.round(n.thumbnailProgress.cached/n.thumbnailProgress.total*100):0})),le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: caching to CDN\u2026",n.thumbnailProgress.currentName&&le.createElement(le.Fragment,null," ",n.thumbnailProgress.currentName)),le.createElement("span",null,n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," variants"))),n.thumbnailProgress&&n.thumbnailProgress.status==="complete"&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: ",n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," cached to CDN \u2713")),(!n.thumbnailProgress||n.thumbnailProgress.status==="pending"&&n.thumbnailProgress.cached===0)&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: not yet cached",n.thumbnailProgress?.total?` (${n.thumbnailProgress.total} components)`:""," \u2014 click Reload to generate")),n.thumbnailProgress&&n.thumbnailProgress.status==="pending"&&n.thumbnailProgress.cached>0&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: ",n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," cached to CDN (partial)")),n.enrichmentProgress&&n.enrichmentProgress.status==="in-progress"&&le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:n.enrichmentProgress.total>0?Math.round(n.enrichmentProgress.enriched/n.enrichmentProgress.total*100):0})),le.createElement(zo,null,le.createElement("span",null,"AI descriptions: generating\u2026",n.enrichmentProgress.currentName&&le.createElement(le.Fragment,null," ",n.enrichmentProgress.currentName)),le.createElement("span",null,n.enrichmentProgress.enriched," of ",n.enrichmentProgress.total," component sets"))),n.enrichmentProgress&&n.enrichmentProgress.status==="complete"&&le.createElement(le.Fragment,null,le.createElement(zo,null,le.createElement("span",null,"AI descriptions: ",n.enrichmentProgress.enriched," of ",n.enrichmentProgress.total," component sets \u2713"))),n.enrichmentProgress&&n.enrichmentProgress.status==="processing"&&t.showCosts&&n.enrichmentProgress.costUsd!=null&&n.enrichmentProgress.costUsd>0&&le.createElement("div",{style:{marginTop:"6px"}},le.createElement(lc,{inputTokens:n.enrichmentProgress.inputTokens||0,outputTokens:n.enrichmentProgress.outputTokens||0,costUsd:n.enrichmentProgress.costUsd,compact:!0})))};import xt,{useState as Vi}from"react";import{styled as Ur}from"storybook/theming";Ce();je();ct();var dh=Ur.div({padding:"12px 16px"}),t4=Ur.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),OC=Ur.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),_C=Ur.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:se,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),n4=Ur.div({display:"flex",gap:"8px",alignItems:"center"}),r4=Ur.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:se,boxShadow:`0 0 0 1px ${se}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),$C=Ur.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":e==="error"?"#dc2626":"#6b7280",marginTop:"6px",display:"block",lineHeight:1.4})),o4=Ur.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:se,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),i4=Ur.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})),s4=Ur.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),UC=({onConnected:e})=>{let{sessionToken:t}=we(),[n,r]=Vi(!1),[o,i]=Vi(""),[s,a]=Vi(!1),[u,c]=Vi(null),[l,d]=Vi(null),[f,p]=Vi(!1),g=async()=>{if(!(!o.trim()||!t)){a(!0),c(null);try{let k=V(),T=await ne(`${k}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({token:o.trim()})}),E=await T.json();if(!T.ok){c({type:"error",message:E.error||"Failed to save token"});return}d(E.figmaUser?.handle||E.figmaUser?.email||"Connected"),c({type:"success",message:`Connected as ${E.figmaUser?.handle||"Figma user"}`}),i(""),e?.()}catch{c({type:"error",message:"Failed to connect. Check your token and try again."})}finally{a(!1)}}};return l?xt.createElement(dh,null,xt.createElement(OC,null,"Figma Personal Access Token"),xt.createElement(i4,null,xt.createElement("span",null,"\u2713 Connected as ",xt.createElement("strong",null,l)),xt.createElement(s4,{onClick:()=>{d(null),c(null)}},"Change token"))):n?xt.createElement(dh,null,xt.createElement(t4,null,xt.createElement(OC,null,"Figma Personal Access Token"),xt.createElement(_C,{onClick:()=>p(!f)},f?"Hide instructions":"How to generate")),f&&xt.createElement(o4,null,xt.createElement("ol",null,xt.createElement("li",null,"Open ",xt.createElement("a",{href:"https://www.figma.com/settings",target:"_blank",rel:"noopener noreferrer"},"Figma Settings")),xt.createElement("li",null,"Click the ",xt.createElement("strong",null,"Security")," tab"),xt.createElement("li",null,"Scroll to ",xt.createElement("strong",null,"Personal access tokens")),xt.createElement("li",null,"Click ",xt.createElement("strong",null,"Generate new token")),xt.createElement("li",null,"Enable ",xt.createElement("strong",null,"File content: Read only")," under Scopes"),xt.createElement("li",null,"Copy the token and paste it below"))),xt.createElement(n4,null,xt.createElement(r4,{type:"password",value:o,onChange:k=>i(k.target.value),placeholder:"figd_...",onKeyDown:k=>{k.key==="Enter"&&o.trim()&&g()}}),xt.createElement(Yt,{onClick:g,disabled:!o.trim()||s},s?"Verifying...":"Save & Verify")),u&&xt.createElement($C,{variant:u.type},u.message),xt.createElement($C,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):xt.createElement(dh,null,xt.createElement(_C,{onClick:()=>r(!0)},"Or use a Personal Access Token \u2192"))};Ce();je();ct();var l4=yt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yt.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"}),yt.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"}),yt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),yt.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"}),yt.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"})),fh=Er.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",marginBottom:"16px",backgroundColor:e.background.content})),c4=Er.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),u4=Er.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),p4=Er.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),gh=Er.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),d4=Er.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.base==="dark"?"rgba(0, 204, 102, 0.2)":"rgba(0, 204, 102, 0.1)",border:`1px solid ${e.color.positive}`,borderRadius:"8px",margin:"12px 16px",display:"flex",alignItems:"center",justifyContent:"space-between"})),f4=Er.div({display:"flex",alignItems:"center",gap:"8px"}),g4=Er(kn)(({theme:e})=>({backgroundColor:`${e.base==="dark"?"rgba(197, 48, 48, 0.15)":"rgba(254, 178, 178, 0.3)"} !important`,color:`${e.color.negative} !important`,border:`1px solid ${e.color.negative} !important`,padding:"6px 12px !important",fontSize:"12px !important"})),m4=Er.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),hre=Er.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"8px 16px",backgroundColor:"#A259FF",color:"#fff",border:"none",borderRadius:"6px",fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{backgroundColor:"#8a3de8"}}),h4=Er.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}})),HC=({hideHeader:e=!1})=>{let{sessionToken:t}=we(),[n,r]=xc(!1),[o,i]=xc(()=>{try{let p=sessionStorage.getItem("uicopilot_figma_connection");if(p){let{connected:g,ts:k}=JSON.parse(p);if(Date.now()-k<300*1e3)return g}}catch{}return null}),[s,a]=xc(!1),[u,c]=xc(!1);a4(()=>{if(!t)return;let p=V();ne(`${p}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${t}`}}).then(g=>g.json()).then(g=>{let k=!!g.connected;a(!!g.expired),i(k);try{sessionStorage.setItem("uicopilot_figma_connection",JSON.stringify({connected:k,ts:Date.now()}))}catch{}}).catch(()=>i(!1))},[t]);let l=jC(()=>{let p=V(),g=`${p}/api/auth/figma/login?addon=true`;window.open(g,"figma-oauth","width=600,height=700,left=200,top=100");let k=setInterval(async()=>{try{(await(await ne(`${p}/api/figma/connection-status`,{headers:t?{Authorization:`Bearer ${t}`}:{}})).json()).connected&&(clearInterval(k),i(!0))}catch{}},2e3);setTimeout(()=>clearInterval(k),300*1e3)},[t]),d=jC(async()=>{try{r(!0);let p=V(),g=await ne(`${p}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(g.ok||g.status===404){i(!1);try{sessionStorage.removeItem("uicopilot_figma_connection")}catch{}}}catch{}finally{r(!1)}},[t]),f=e?null:yt.createElement(c4,null,yt.createElement(u4,null,l4),yt.createElement(p4,null,"Figma Integration"));return o===null?yt.createElement(fh,null,f,yt.createElement(gh,null,yt.createElement("div",{style:{padding:"16px",fontSize:"13px",color:"#9ca3af"}},"Checking Figma connection..."))):o===!1?yt.createElement(fh,null,f,yt.createElement(gh,null,yt.createElement(m4,null,s&&yt.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:"#92400e"}},"\u26A0\uFE0F Your Figma access has expired. Please reconnect."),yt.createElement(Yt,{onClick:l,style:{width:"100%"}},s?"Reconnect Figma":"Connect with Figma"),yt.createElement(h4,null,"or"),yt.createElement(UC,{onConnected:()=>i(!0)})))):yt.createElement(fh,null,f,yt.createElement(d4,null,yt.createElement(f4,null,yt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),yt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to Figma")),yt.createElement(g4,{onClick:()=>c(!0),disabled:n},n?"Disconnecting...":"Disconnect")),yt.createElement(_r,{isOpen:u,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:()=>{c(!1),d()},onCancel:()=>c(!1)}),yt.createElement(gh,null,yt.createElement(dk,null),yt.createElement(DC,null),yt.createElement(NC,null)))};Ce();Rn();var b4=fr.div({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:1e3,display:"flex",justifyContent:"center",alignItems:"flex-start",paddingTop:"32px"}),S4=fr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"14px",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.22)",width:"520px",maxWidth:"94%",maxHeight:"calc(100vh - 64px)",overflow:"auto",position:"relative"})),w4=fr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",position:"sticky",top:0,backgroundColor:e.background.content,borderRadius:"14px 14px 0 0",zIndex:1})),v4=fr.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),k4=fr(Cn)({fontSize:"18px",padding:"2px 8px",lineHeight:1,background:"transparent",border:"none"}),C4=fr.div({display:"flex",flexDirection:"column",gap:"16px",padding:"0 20px 20px"}),WC=fr.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"14px",padding:"16px",borderRadius:"12px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),VC=fr.div({display:"flex",alignItems:"center",gap:"10px"}),GC=fr.h3(({theme:e})=>({margin:0,fontSize:"14px",fontWeight:600,color:e.color.defaultText,flex:1})),T4=fr.div({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:se,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,letterSpacing:"0.3px",flexShrink:0}),I4=fr.div({width:"22px",height:"22px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center","& svg":{width:"22px",height:"22px"}}),qC=fr.div(({theme:e})=>({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"}})),YC=({onClose:e})=>{let{isConnected:t}=we(),{selectedProjectId:n}=Je(),r=y4(t);return x4(()=>{!r.current&&t&&n&&e(),r.current=t},[t,n,e]),Lt.createElement(b4,{onClick:e},Lt.createElement(S4,{onClick:o=>o.stopPropagation()},Lt.createElement(w4,null,Lt.createElement(v4,null,"Settings"),Lt.createElement(k4,{onClick:e,title:"Close settings"},"\xD7")),Lt.createElement(C4,null,Lt.createElement(WC,null,Lt.createElement(VC,null,Lt.createElement(T4,null,"UI"),Lt.createElement(GC,null,Ft.NAME)),Lt.createElement(qC,null,Lt.createElement(ak,{onConnect:e}),t&&Lt.createElement(uk,null))),t&&n&&Lt.createElement(WC,null,Lt.createElement(VC,null,Lt.createElement(I4,null,Lt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Lt.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"}),Lt.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"}),Lt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),Lt.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"}),Lt.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"}))),Lt.createElement(GC,null,"Figma Integration")),Lt.createElement(qC,null,Lt.createElement(HC,{hideHeader:!0}))))))};import gt,{useEffect as o1,useMemo as Z4,useState as e3,useRef as t3}from"react";import{styled as Hn,keyframes as n3}from"storybook/theming";Ce();Rn();Ce();import Xt,{useState as F4}from"react";import{styled as jn}from"storybook/theming";var so=[{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.5",provider:"anthropic",description:"Latest Claude model, best balance of speed and quality"},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",provider:"anthropic",description:"Previous generation Sonnet"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet",provider:"anthropic",description:"Best balance of speed and quality"},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",provider:"anthropic",description:"Fastest, most affordable"},{id:"claude-3-opus-20240229",name:"Claude 3 Opus",provider:"anthropic",description:"Most capable Claude 3 model"},{id:"gpt-5.2",name:"GPT-5.2 Thinking",provider:"openai",description:"47% cheaper, reasoning"},{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Instant",provider:"openai",description:"86% cheaper (default)"},{id:"gpt-4o",name:"GPT-4o",provider:"openai",description:"GPT-4 multimodal flagship"},{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai",description:"GPT-4 affordable model"},{id:"o1-preview",name:"o1 Preview",provider:"openai",description:"Reasoning model (slower, advanced)"},{id:"o1-mini",name:"o1 Mini",provider:"openai",description:"Faster reasoning model"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"Fast & cheap, great vision"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"Best Gemini quality"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"google",description:"Previous gen, very fast"}];var E4=jn.div({display:"flex",alignItems:"center",gap:"8px",width:"100%"}),A4=jn.div({display:"inline-flex",flexWrap:"nowrap",gap:"4px",alignItems:"center"}),P4=jn.div(({theme:e,disabled:t,provider:n})=>{let r={anthropic:{background:"#D4A574",text:"#ffffff"},openai:{background:e.color.positive||"#10b981",text:"#ffffff"},google:{background:"#4285F4",text:"#ffffff"}},o=n?r[n]:r.anthropic;return{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:o.background,color:o.text,fontSize:"11px",fontWeight:500,borderRadius:"12px",opacity:t?.6:1,cursor:t?"not-allowed":"default",transition:"opacity 0.15s"}}),L4=jn.button(({theme:e,disabled:t})=>({background:"none",border:"none",color:e.color.inverseText,fontSize:"12px",cursor:t?"not-allowed":"pointer",padding:"0 2px",lineHeight:1,opacity:t?.5:.8,transition:"opacity 0.15s","&:hover":{opacity:t?.5:1}})),M4=jn.div({position:"relative",display:"inline-block"}),B4=jn.button(({disabled:e,isOpen:t,theme:n})=>({padding:`${n.layoutMargin*.8}px 32px ${n.layoutMargin*.8}px ${n.layoutMargin}px`,fontSize:n.typography.size.s2,fontFamily:n.typography.fonts.base,fontWeight:500,color:n.color.defaultText,backgroundColor:n.input.background,border:`1px solid ${t?n.color.secondary:n.appBorderColor}`,borderRadius:n.appBorderRadius,cursor:e?"not-allowed":"pointer",opacity:e?.6:1,whiteSpace:"nowrap",display:"flex",gap:`${n.layoutMargin*.8}px`,alignItems:"center",justifyContent:"space-between",minWidth:"200px",transition:"border-color 0.15s, box-shadow 0.15s",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","&:hover":{borderColor:e?n.appBorderColor:n.color.mediumdark}})),D4=jn.div(({theme:e})=>({position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:e.base==="dark"?"0 4px 12px rgba(0, 0, 0, 0.3)":"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"280px",overflowY:"auto"})),mh=jn.div(({theme:e})=>({borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),hh=jn.div(({theme:e})=>({padding:"8px 12px",fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:e.background.app})),R4=jn.div(({theme:e,disabled:t})=>({padding:"8px 12px",fontSize:"12px",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,display:"flex",alignItems:"center",gap:"8px",transition:"background-color 0.15s",color:e.color.defaultText,"&:hover":{backgroundColor:t?"transparent":e.background.hoverable}})),z4=jn.input({cursor:"pointer",flexShrink:0,"&:disabled":{cursor:"not-allowed"}}),N4=jn.div({flex:1,minWidth:0}),O4=jn.div({fontSize:"12px",fontWeight:500,marginBottom:"2px"}),_4=jn.div(({theme:e})=>({fontSize:"10px",color:e.textMutedColor,lineHeight:"1.2"})),$4=5,KC=()=>{let{selectedModels:e,toggleModel:t,isReviewing:n}=ce(),[r,o]=F4(!1),i=so.filter(p=>p.provider==="anthropic"&&!e.includes(p.id)),s=so.filter(p=>p.provider==="openai"&&!e.includes(p.id)),a=so.filter(p=>p.provider==="google"&&!e.includes(p.id)),u=so.filter(p=>e.includes(p.id)),c=e.length<$4,l=(p,g)=>{g.stopPropagation(),e.length>1&&!n&&t(p)},d=p=>{let g=e.includes(p);g&&e.length===1||!g&&!c||n||(t(p),o(!1))},f=p=>{let g=e.includes(p.id),k=g&&e.length===1,T=n||k||!g&&!c;return Xt.createElement(R4,{key:p.id,disabled:T,onClick:()=>d(p.id)},Xt.createElement(z4,{type:"checkbox",checked:g,disabled:T,onChange:()=>{},onClick:E=>E.stopPropagation()}),Xt.createElement(N4,null,Xt.createElement(O4,null,p.name),p.description&&Xt.createElement(_4,null,p.description)))};return Xt.createElement(E4,null,Xt.createElement(M4,null,Xt.createElement(B4,{disabled:n,isOpen:r,onClick:()=>o(!r)},Xt.createElement("span",null,"Select model"),Xt.createElement("span",null,r?"\u25B2":"\u25BC")),r&&Xt.createElement(D4,null,Xt.createElement(mh,null,Xt.createElement(hh,null,"Anthropic"),i.map(f)),Xt.createElement(mh,null,Xt.createElement(hh,null,"OpenAI"),s.map(f)),Xt.createElement(mh,null,Xt.createElement(hh,null,"Google"),a.map(f)))),Xt.createElement(A4,null,u.map(p=>Xt.createElement(P4,{key:p.id,disabled:n,provider:p.provider},p.name,e.length>1&&Xt.createElement(L4,{disabled:n,onClick:g=>l(p.id,g),title:"Remove model"},"\xD7")))))};import ze,{useState as U4,useEffect as j4}from"react";import{styled as tn,keyframes as Gi}from"storybook/theming";Ce();var H4=Gi`
|
|
44
|
+
`,N_=xC.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${z_} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),O_=xC.button(({theme:e,variant:t="default",disabled:n})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"5px 12px",fontSize:"12px",fontWeight:600,border:`1px solid ${e.color.medium}`,borderRadius:"5px",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.2s",whiteSpace:"nowrap",...t==="default"&&{backgroundColor:e.background.content,color:e.color.defaultText,"&:hover":n?{}:{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":n?{}:{color:e.color.defaultText,backgroundColor:e.background.hoverable}}})),Fr=({loading:e=!1,disabled:t=!1,onClick:n,variant:r="default",children:o,loadingText:i})=>hC.createElement(O_,{variant:r,disabled:t||e,onClick:n},e&&hC.createElement(N_,null),e&&i?i:o);je();import ln from"react";import{styled as la}from"storybook/theming";var yC=la.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"})),__=la.div({display:"flex",alignItems:"center",gap:"12px"}),sc=la.span({whiteSpace:"nowrap"}),bC=la.div({display:"flex",alignItems:"center",gap:"8px"}),ac=la.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),lc=({inputTokens:e,outputTokens:t,costUsd:n,compact:r=!1})=>{let o=e+t,i=n*Tw;return r?ln.createElement(yC,null,ln.createElement(sc,null,o.toLocaleString()," tokens"),ln.createElement(bC,null,ln.createElement(ac,null,"$",n.toFixed(4)),ln.createElement("span",null,"\xB7"),ln.createElement(ac,null,"\u20AA",i.toFixed(2)))):ln.createElement(yC,null,ln.createElement(__,null,ln.createElement(sc,null,e.toLocaleString()," input"),ln.createElement("span",null,"+"),ln.createElement(sc,null,t.toLocaleString()," output"),ln.createElement("span",null,"="),ln.createElement(sc,null,ln.createElement("strong",null,o.toLocaleString())," tokens")),ln.createElement(bC,null,ln.createElement(ac,null,"$",n.toFixed(4)),ln.createElement("span",null,"\xB7"),ln.createElement(ac,null,"\u20AA",i.toFixed(2))))};import Un from"react";import{styled as Mo}from"storybook/theming";function nh(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var $_=Mo.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),SC=Mo.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),U_=Mo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),j_=Mo.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})),H_=Mo.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),W_=Mo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),V_=Mo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),G_=Mo.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),wC=({data:e,color:t,compact:n})=>n?Un.createElement(SC,{color:t},e.summary):Un.createElement($_,null,Un.createElement(SC,{color:t},e.summary),e.mappings&&e.mappings.length>0&&Un.createElement(U_,null,e.mappings.map((r,o)=>Un.createElement(Un.Fragment,{key:o},Un.createElement(j_,null,r.from," ",Un.createElement(H_,null,"\u2192")," ",r.to)))),e.candidates!=null&&e.candidates>1&&Un.createElement(W_,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&Un.createElement(Un.Fragment,null,e.defaults.map((r,o)=>Un.createElement(V_,{key:o},Un.createElement(G_,null,r.choice),Un.createElement("span",null,"\u2014 ",r.why)))));var q_=dt.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),Y_=dt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),K_=dt.div({display:"flex",flexDirection:"column",gap:"4px"}),X_=dt.div({display:"flex",alignItems:"center",gap:"10px"}),Q_=dt.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"})),kC=dt.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})),J_=dt.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),Z_=dt.div({display:"flex",gap:"8px"}),e$=dt.div(({theme:e})=>({display:"flex",alignItems:"center",padding:"12px 24px",gap:"12px",borderBottom:`1px solid ${e.appBorderColor}`})),t$=dt(bo)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),n$=dt.div({display:"flex",gap:"4px"}),cc=dt.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}})),r$=dt.div({display:"flex",flexDirection:"column",flex:1,padding:"16px 24px",gap:"8px",overflowY:"auto"}),o$=dt.div(({theme:e,dimmed:t})=>({display:"flex",alignItems:"center",padding:"12px 16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"10px",gap:"12px",backgroundColor:e.background.content,opacity:t?.6:1,transition:"opacity 0.15s",position:"relative",zIndex:0,"&:hover":{zIndex:10}})),i$=dt.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}`}})),s$=dt.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"})),uc=dt.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}`})),a$=dt.img({width:"100%",height:"100%",objectFit:"contain"}),EC=dt.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)"}}})),CC=dt.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),TC=dt.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"})),rh=dt.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"})),Jte=dt.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"})),l$=dt.div(({theme:e})=>({flexShrink:0,color:e.color.mediumlight,fontSize:"14px"})),c$=dt.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})),u$=dt.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}})),p$=dt.div(({theme:e})=>({padding:"16px 0",marginTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",gap:"8px"})),d$=dt.div({display:"flex",flexWrap:"wrap",gap:"6px"}),g$=dt.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})),f$=dt.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})),m$=dt.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"}})),Zte=dt.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})),IC=({src:e,alt:t})=>{let[n,r]=pc(!1);return Fe.createElement(Fe.Fragment,null,!n&&Fe.createElement(EC,null),Fe.createElement(a$,{src:e,alt:t,onLoad:()=>r(!0),style:n?void 0:{position:"absolute",opacity:0}}))};function FC(e){return e>=90?"high":e>=70?"medium":"low"}function h$(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var AC=({results:e,stories:t,onApply:n,onCancel:r,onRerun:o,isApplying:i,isRerunning:s,source:a,resolveThumbnail:u,resolveStoryScreenshot:c,isCapturingScreenshots:l,onBrowse:d})=>{let[g,p]=pc(()=>{let v=new Set;for(let C of e.mappings)C.confidence>=90&&v.add(C.storyId);return v}),[f,k]=pc(""),[T,E]=pc("all"),I=vC(()=>{let v=new Map;for(let C of t)v.set(C.id,{name:C.name,title:C.title});return v},[t]),D=vC(()=>{let v=e.mappings;if(T!=="all"&&(v=v.filter(C=>FC(C.confidence)===T)),f.trim()){let C=f.toLowerCase();v=v.filter(m=>{let F=I.get(m.storyId);return F?.name.toLowerCase().includes(C)||F?.title.toLowerCase().includes(C)||m.componentSetName.toLowerCase().includes(C)||m.figmaFrameName.toLowerCase().includes(C)})}return v},[e.mappings,T,f,I]),R=v=>{p(C=>{let m=new Set(C);return m.has(v)?m.delete(v):m.add(v),m})},$=()=>{let v=e.mappings.filter(C=>g.has(C.storyId));n(v)},P=e.mappings.filter(v=>v.confidence>=90).length,z=e.mappings.filter(v=>v.confidence>=70&&v.confidence<90).length,x=e.mappings.filter(v=>v.confidence<70).length,w=e.usage;return Fe.createElement(q_,null,Fe.createElement(Y_,null,Fe.createElement(K_,null,Fe.createElement(X_,null,Fe.createElement(Q_,null,"Auto-Map Results"),Fe.createElement(kC,{variant:"success"},e.stats.matched," matched"),e.unmatched.length>0&&Fe.createElement(kC,{variant:"danger"},e.unmatched.length," unmatched"),a&&Fe.createElement(f$,{variant:a},a==="cache"?"Loaded from cache":"Fresh analysis")),Fe.createElement(J_,null,"Review matches below. Uncheck any incorrect mappings before applying.")),Fe.createElement(Z_,null,a==="cache"&&o&&Fe.createElement(m$,{onClick:o,disabled:s},s?"Re-running...":"Re-run LLM"),Fe.createElement(Fr,{onClick:r,variant:"ghost"},"Cancel"),Fe.createElement(Fr,{loading:i,onClick:$,loadingText:"Applying..."},"Apply ",g.size," Selected"))),Fe.createElement(e$,null,Fe.createElement(t$,{type:"text",placeholder:"Filter stories...",value:f,onChange:v=>k(v.target.value)}),Fe.createElement(n$,null,Fe.createElement(cc,{active:T==="all",onClick:()=>E("all")},"All ",e.mappings.length),P>0&&Fe.createElement(cc,{active:T==="high",onClick:()=>E("high")},"\u226590% (",P,")"),z>0&&Fe.createElement(cc,{active:T==="medium",onClick:()=>E("medium")},"70-89% (",z,")"),x>0&&Fe.createElement(cc,{active:T==="low",onClick:()=>E("low")},"<70% (",x,")"))),Fe.createElement(r$,null,D.map(v=>{let C=I.get(v.storyId),m=FC(v.confidence),F=g.has(v.storyId),S=m==="low";return Fe.createElement(o$,{key:v.storyId,dimmed:S&&!F},Fe.createElement(i$,{checked:F,onClick:()=>R(v.storyId)},F?"\u2713":""),(()=>{let b=c?.(v.storyId);return b?Fe.createElement(uc,null,Fe.createElement(IC,{src:b,alt:C?.name||v.storyId})):l?Fe.createElement(uc,null,Fe.createElement(EC,null)):Fe.createElement(s$,{bgColor:S?"#f1f5f9":"#eff6ff"},Fe.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:S?"#94a3b8":"#3b82f6"}},(C?.name||"?").substring(0,4)))})(),Fe.createElement(CC,null,Fe.createElement(TC,null,C?.name||v.storyId),Fe.createElement(rh,null,C?.title||"")),Fe.createElement(l$,null,"\u2192"),(()=>{let b=u?.(v.figmaNodeId),A=nh(v.reason),L=A.summary+(A.candidates?` (${A.candidates} candidates)`:"");return b?Fe.createElement(uc,{title:L},Fe.createElement(IC,{src:b,alt:v.figmaFrameName})):Fe.createElement(uc,{title:L},Fe.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:"#94a3b8"}},"No thumbnail"))})(),Fe.createElement(CC,null,Fe.createElement(TC,null,v.componentSetName),Fe.createElement(rh,null,v.figmaFrameName),Fe.createElement(wC,{data:nh(v.reason),color:h$(m)})),Fe.createElement(c$,{level:m},v.confidence,"%"),d&&Fe.createElement(u$,{onClick:()=>d(v.componentSetName)},"Browse"))}),e.unmatched.length>0&&Fe.createElement(p$,null,Fe.createElement(rh,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),Fe.createElement(d$,null,e.unmatched.map(v=>{let C=I.get(v);return Fe.createElement(g$,{key:v},Fe.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),C?`${C.name} (${C.title})`:v)})))),w&&a!=="cache"&&Fe.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},Fe.createElement(lc,{inputTokens:w.inputTokens||0,outputTokens:w.outputTokens||0,costUsd:w.costUsd||0})))};je();Oe();import{useState as Bo,useCallback as Do,useRef as x$}from"react";import{useStorybookApi as y$}from"storybook/manager-api";function PC({projectId:e}){let t=y$(),n=x$(null),[r,o]=Bo(!1),[i,s]=Bo(!1),[a,u]=Bo(!1),[c,l]=Bo(null),[d,g]=Bo(null),[p,f]=Bo(null),[k,T]=Bo(""),[E,I]=Bo(null),D=Do(async()=>{let C=await fetch("/index.json");if(!C.ok)throw new Error("Failed to fetch Storybook index");let m=await C.json(),F=m.entries||m.stories||{},S=Object.keys(F).filter(L=>F[L].type==="story");y.debug(`[useAutoMap] Found ${S.length} stories in index.json`);let b=[];for(let L of S){let B=F[L],N=t.getData(L),h={...N?.initialArgs||{}},j=N?.argTypes||{};for(let[W,M]of Object.entries(j))if(!(W in h)){let K=M;if(K.defaultValue!==void 0)h[W]=K.defaultValue;else if(K.table?.defaultValue?.summary!==void 0){let ee=K.table.defaultValue.summary;ee==="false"?h[W]=!1:ee==="true"?h[W]=!0:h[W]=ee}}b.push({id:L,name:B.name||L.split("--").pop()||L,title:B.title||"",initialArgs:h,argTypes:j})}let A=b.filter(L=>Object.keys(L.initialArgs).length>0);return y.debug(`[useAutoMap] Manifest: ${b.length} stories, ${A.length} with args`),b},[t]),R=Do(async()=>{if(!e)return!1;try{let C=V(),m=localStorage.getItem("uicopilot_session_token");if(!m)return!1;let F=await fetch(`${C}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${m}`}});if(!F.ok)return!1;let S=await F.json();return S.hasSuggestions&&S.mappings?.length>0?(g(S),I("cache"),T(`Loaded ${S.mappings.length} saved suggestions`),y.debug(`[useAutoMap] Loaded ${S.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),$=Do(async C=>{o(!0),T("Collecting story information...");let m;try{if(m=await D(),C?.length&&(m=m.filter(S=>!C.includes(S.id)),y.debug(`[useAutoMap] After excluding mapped: ${m.length} stories`)),m.length===0){l("No unmapped stories found"),o(!1);return}f(m)}catch(S){l(S instanceof Error?S.message:"Failed to collect story manifest"),o(!1);return}o(!1),s(!0),T(`Analyzing ${m.length} stories against Figma components...`);let F=new AbortController;n.current=F;try{let S=V(),b=localStorage.getItem("uicopilot_session_token");if(!b)throw new Error("Not authenticated");let A=await fetch(`${S}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b}`},body:JSON.stringify({projectId:e,stories:m.map(B=>({id:B.id,name:B.name,title:B.title,initialArgs:B.initialArgs,argTypes:B.argTypes}))}),signal:F.signal});if(!A.ok){let B=await A.json();throw new Error(B.error||"Auto-map failed")}let L=await A.json();g(L),I("llm"),T(`Found ${L.stats.matched} matches (${L.stats.highConfidence} high confidence)`),y.debug(`[useAutoMap] Results: ${L.stats.matched}/${L.stats.total} matched, ${L.unmatched.length} unmatched`)}catch(S){if(S instanceof DOMException&&S.name==="AbortError"){T("Cancelled");return}l(S instanceof Error?S.message:"Auto-map failed")}finally{s(!1),n.current=null}},[e,D]),P=Do(async C=>{if(!e)return;if(l(null),g(null),I(null),o(!0),T("Checking for existing suggestions..."),await R()){o(!1);return}await $(C)},[e,R,$]),z=Do(async C=>{e&&(l(null),g(null),I(null),await $(C))},[e,$]),x=Do(async C=>{if(!(!e||C.length===0)){u(!0),T(`Applying ${C.length} mappings...`);try{let m=V(),F=localStorage.getItem("uicopilot_session_token");if(!F)throw new Error("Not authenticated");let S=0;for(let b of C)try{(await fetch(`${m}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`},body:JSON.stringify({projectId:e,storyId:b.storyId,figmaNodeId:b.figmaNodeId,name:b.figmaFrameName||b.componentSetName})})).ok?S++:y.warn(`[useAutoMap] Failed to apply mapping for ${b.storyId}`)}catch(A){y.error(`[useAutoMap] Error applying mapping for ${b.storyId}:`,A)}T(`Applied ${S}/${C.length} mappings`),y.debug(`[useAutoMap] Applied ${S}/${C.length} mappings`)}catch(m){l(m instanceof Error?m.message:"Failed to apply mappings")}finally{u(!1)}}},[e]),w=Do(()=>{n.current?.abort()},[]),v=Do(()=>{g(null),f(null),l(null),T(""),I(null)},[]);return{collectAndMap:P,rerun:z,loadExisting:R,applyMappings:x,cancel:w,reset:v,isCollecting:r,isMapping:i,isApplying:a,error:c,results:d,manifest:p,progress:k,source:E}}Oe();import{useState as oh,useEffect as b$,useRef as LC}from"react";var MC=2;async function S$(e,t){try{let n=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`,{signal:t});return n.ok&&(await n.json()).screenshot||null}catch{return null}}function BC(e){let[t,n]=oh({}),[r,o]=oh(0),[i,s]=oh(!1),a=LC(null),u=LC(""),c=e.join(",");return b$(()=>{if(!e.length||c===u.current)return;u.current=c,n({}),o(0),s(!0);let l=new AbortController;a.current=l;let d=0;return(async()=>{for(let p=0;p<e.length&&!l.signal.aborted;p+=MC){let f=e.slice(p,p+MC),k=await Promise.all(f.map(E=>S$(E,l.signal).then(I=>({id:E,img:I}))));if(l.signal.aborted)break;let T={};for(let{id:E,img:I}of k)d++,I&&(T[E]=I);Object.keys(T).length>0&&n(E=>({...E,...T})),o(d)}s(!1),y.debug(`[useStoryScreenshots] Captured ${d}/${e.length} screenshots`)})().catch(()=>s(!1)),()=>{l.abort()}},[c]),{screenshots:t,isCapturing:i,progress:{done:r,total:e.length}}}import ke,{useState as ih,useEffect as ca,useMemo as w$,useCallback as v$}from"react";import{styled as k$}from"storybook/theming";Oe();var C$=k$.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"}})),Hi=({isOpen:e,onClose:t,onSelect:n,projectId:r,stories:o=[],currentStoryId:i,onStoryChange:s,multiSelect:a=!1,onMultiSelect:u,initialSearch:c})=>{let l=ea({projectId:r||"",enabled:e&&!!r}),d=ke.useRef(!1);ca(()=>{e&&c&&!d.current&&(l.setSearch(c),d.current=!0),e||(d.current=!1)},[e,c]);let[g,p]=ih(new Set),[f,k]=ih(i||o[0]?.id||"");ca(()=>{i&&k(i)},[i]);let T=50,[E,I]=ih({}),D=v$(C=>{I(m=>({...m,[C]:(m[C]||1)+1}))},[]);ca(()=>{I({})},[l.variantFilters]),ca(()=>{l.expandedSets.forEach(C=>{let m=l.variantChildren[C];if(!m||m.length===0)return;let F=m;l.variantFilters.some(A=>A.value)&&(F=m.filter(A=>A.variantProperties?l.variantFilters.every(L=>L.value?A.variantProperties?.[L.property]===L.value:!0):!1));let S=E[C]||1,b=F.slice(0,S*T).map(A=>A.id);b.length>0&&l.fetchVariantThumbnails(C,b)})},[l.expandedSets,l.variantChildren,l.variantFilters,E]),ca(()=>{p(new Set)},[f]);let R=w$(()=>{let C=[];return l.filteredFrames.forEach(m=>{if(m.type==="COMPONENT_SET"&&m.children){let F=l.variantFilters.some(S=>S.value)?m.children.filter(S=>S.variantProperties?l.variantFilters.every(b=>b.value?S.variantProperties?.[b.property]===b.value:!0):!1):m.children;C.push(...F)}else C.push(m)}),C},[l.filteredFrames,l.variantFilters]),$=C=>{if(a)p(m=>{let F=new Set(m);return F.has(C.id)?F.delete(C.id):F.add(C.id),F});else{let m=l.resolveThumbnail(C.id);try{n({...C,thumbnail:m})}catch(F){y.error("[ComponentBrowserModal] onSelect threw error:",F)}t()}},P=()=>{let C=R.map(F=>F.id),m=C.every(F=>g.has(F));p(m?new Set:new Set(C))},z=()=>{if(u&&g.size>0){let C=R.filter(m=>g.has(m.id)).map(m=>({...m,thumbnail:l.resolveThumbnail(m.id)}));u(C),p(new Set)}},x=C=>{k(C),s?.(C)},w=C=>{C.target===C.currentTarget&&t()},v=o.find(C=>C.id===f);return e?ke.createElement(xk,{onClick:w},ke.createElement(yk,null,ke.createElement(bk,null,ke.createElement(Sk,null,"Link Figma Frames"),ke.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},ke.createElement("button",{onClick:()=>l.refresh(),disabled:l.isLoading,style:{padding:"4px 8px",fontSize:"12px",cursor:l.isLoading?"not-allowed":"pointer",background:"transparent",border:"1px solid #ccc",borderRadius:"4px"},title:"Refresh from Figma"},"Refresh"),ke.createElement(wk,{onClick:t},"\xD7"))),ke.createElement(vk,null,l.error&&ke.createElement(Ak,null,l.error),!l.error&&ke.createElement(ke.Fragment,null,o.length>0&&ke.createElement($k,null,ke.createElement(Uk,null,"Story:"),ke.createElement(jk,{value:f,onChange:C=>x(C.target.value)},o.map(C=>ke.createElement("option",{key:C.id,value:C.id},C.name,C.mappingsCount?` (${C.mappingsCount} linked)`:""))),v?.mappingsCount?ke.createElement(Hk,{hasMapping:!0},v.mappingsCount," frames linked"):null),ke.createElement(Fk,null,ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showComponentSets,onChange:C=>l.setShowComponentSets(C.target.checked)}),"Component Sets"),ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showFrames,onChange:C=>l.setShowFrames(C.target.checked)}),"Frames"),ke.createElement(Zl,null,ke.createElement("input",{type:"checkbox",checked:l.showComponents,onChange:C=>l.setShowComponents(C.target.checked)}),"Components"),l.availablePages.length>1&&ke.createElement(Ui,{isActive:!!l.figmaPage,value:l.figmaPage,onChange:C=>l.setFigmaPage(C.target.value),style:{marginLeft:"auto"}},ke.createElement("option",{value:""},"All pages"),l.availablePages.map(C=>ke.createElement("option",{key:C,value:C},C)))),l.filterSuggestion&&ke.createElement(Wk,null,ke.createElement(Vk,null,"AI suggests:"),ke.createElement(Gk,null,Object.entries(l.filterSuggestion.suggestedFilters).map(([C,m])=>`${C}=${m}`).join(", ")),ke.createElement(qk,{onClick:l.applySuggestedFilters},"Apply"),ke.createElement(Yk,{onClick:l.dismissFilterSuggestion},"Dismiss")),l.filterSuggestionLoading&&ke.createElement(Kk,null,"Matching story args to Figma filters..."),l.availableFilters.length>0&&ke.createElement(tc,null,ke.createElement(sa,null,"Filters:"),l.availableFilters.map(({property:C,values:m})=>{let F=l.variantFilters.find(S=>S.property===C);return ke.createElement(Ui,{key:C,isActive:!!F?.value,value:F?.value||"",onChange:S=>l.handleFilterChange(C,S.target.value)},ke.createElement("option",{value:""},C),m.map(S=>ke.createElement("option",{key:S,value:S},C,"=",S)))}),l.variantFilters.some(C=>C.value)&&ke.createElement(nc,{onClick:l.clearFilters},"Clear All")),ke.createElement(kk,{type:"text",placeholder:"Search frames...",value:l.search,onChange:C=>l.setSearch(C.target.value),autoFocus:!0}),a&&R.length>0&&ke.createElement(Xk,null,ke.createElement(Qk,{onClick:P},g.size===R.length?"Deselect All":"Select All Visible"),ke.createElement(Jk,null,g.size>0?`${g.size} selected of `:"Showing ",R.length," frames")),l.isLoading&&ke.createElement(Om,null,Array.from({length:6}).map((C,m)=>ke.createElement(_k,{key:m},ke.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},ke.createElement(ec,{width:"100%",height:"100%"})),ke.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},ke.createElement(ec,{width:"80%",height:"16px"}),ke.createElement(ec,{width:"50%",height:"12px"}))))),!l.isLoading&&l.filteredFrames.length===0&&ke.createElement(Ek,null,l.search?"No frames match your search":"No frames found in this Figma file"),!l.isLoading&&l.filteredFrames.length>0&&ke.createElement(Om,null,l.filteredFrames.map(C=>ke.createElement(aa,{key:C.id,frame:C,thumbnail:l.thumbnails[C.id],thumbnails:l.thumbnails,variantThumbnails:l.variantThumbnails[C.id],variantChildren:l.variantChildren[C.id],variantFailed:l.variantFailed[C.id],isLoadingVariants:l.loadingVariants.has(C.id),isExpanded:l.expandedSets.has(C.id),isNew:l.recentlyAdded.has(C.name),onToggleExpand:l.toggleExpanded,onSelect:$,multiSelect:a,selectedFrames:g,variantFilters:l.variantFilters,variantPage:E[C.id]||1,onShowMore:D})),l.hasMore&&ke.createElement(C$,{onClick:l.loadMore,disabled:l.loadingMore},l.loadingMore?"Loading...":`Show more (${l.totalFrames-l.frames.length} remaining)`)))),a&&ke.createElement(Zk,null,ke.createElement(eC,{disabled:g.size===0,onClick:z},"Link ",g.size," Selected")))):null};Ce();ct();var I$=en.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}),F$=en.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"})),E$=en.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),A$=en.div({display:"flex",alignItems:"center",gap:"20px"}),P$=en.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),L$=en.div({display:"flex",gap:"4px"}),DC=en(yo)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),M$=en(Cn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),B$=en.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),D$=en.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),R$=en.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),z$=en.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),N$=en.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),O$=en.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),_$=en.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),$$=en.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),U$=en.div(({theme:e})=>({width:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",opacity:.6})),j$=en.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"}})),RC=en.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"}})),zC=({isOpen:e,onClose:t,projectId:n})=>{let[r,o]=Wi("map"),[i,s]=Wi([]),[a,u]=Wi(!0),[c,l]=Wi(null),[d,g]=Wi(!1),[p,f]=Wi(null),k=PC({projectId:n}),{refreshMappings:T}=nt(),{featureFlags:E}=ce(),I=et.useMemo(()=>k.results?.mappings.map(b=>b.storyId)||[],[k.results]),D=BC(I),R=Ro(async()=>{u(!0);try{let b=await fetch("/index.json");if(!b.ok)throw new Error("Failed to fetch index.json");let A=await b.json(),L=A.entries||A.stories||{},B=Object.entries(L).filter(([,h])=>h.type==="story").map(([h,j])=>({id:h,name:j.name||h.split("--").pop()||h,title:j.title||"",importPath:j.importPath,componentTitle:j.title?.split("/").slice(0,-1).join("/")||j.title,figmaMapping:null}));try{let h=V(),j=localStorage.getItem("uicopilot_session_token"),W=await ne(`${h}/api/mappings?projectId=${n}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${j}`}});if(W.ok){let M=await W.json(),K=new Map((M.mappings||[]).map(ee=>[ee.storyId,ee]));B.forEach(ee=>{let ge=K.get(ee.id);ge&&ge.figmaNodeId&&(ee.figmaMapping={figmaNodeId:ge.figmaNodeId,figmaFrameName:ge.name||ge.figmaFrameName||""})})}}catch(h){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",h)}s(B);let N=B.find(h=>!h.figmaMapping);N?l(N.id):B.length>0&&l(B[0].id)}catch(b){console.error("[StoryMappingAssistant] Error fetching stories:",b)}finally{u(!1)}},[n]);T$(()=>{e&&R()},[e,R]);let $=Ro((b,A,L)=>{s(h=>h.map(j=>j.id===b?{...j,figmaMapping:{figmaNodeId:A,figmaFrameName:L}}:j));let B=i.findIndex(h=>h.id===b),N=i.find((h,j)=>j>B&&!h.figmaMapping);N&&l(N.id)},[i]),P=Ro(b=>{s(A=>A.map(L=>L.id===b?{...L,figmaMapping:null}:L))},[]),z=Ro(b=>{l(b),o("map")},[]),x=Ro(()=>{let b=i.filter(A=>A.figmaMapping).map(A=>A.id);k.collectAndMap(b)},[i,k]),w=Ro(()=>{let b=i.filter(A=>A.figmaMapping).map(A=>A.id);g(!1),k.rerun(b)},[i,k]),v=Ro(async b=>{await k.applyMappings(b),g(!1),k.reset(),R(),T()},[k,R,T]),C=Ro(()=>{g(!1),k.reset()},[k]);et.useEffect(()=>{k.results&&g(!0)},[k.results]);let m=b=>{b.target===b.currentTarget&&t()};if(!e)return null;let F=i.filter(b=>b.figmaMapping).length,S=i.length;return et.createElement(et.Fragment,null,et.createElement(I$,{onClick:m},et.createElement(F$,{onClick:b=>b.stopPropagation()},et.createElement(E$,null,et.createElement(A$,null,et.createElement(P$,null,et.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),et.createElement(L$,null,et.createElement(DC,{active:r==="map",onClick:()=>o("map")},"Map Stories"),et.createElement(DC,{active:r==="view",onClick:()=>o("view")},"View All Mappings"))),et.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},E.enableAutoMap&&!d&&!k.isCollecting&&!k.isMapping&&et.createElement(j$,{onClick:x,disabled:a||i.length===0},et.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},et.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),et.createElement("path",{d:"M2 17l10 5 10-5"}),et.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),et.createElement(M$,{onClick:t},"\xD7"))),et.createElement(B$,null,(k.isCollecting||k.isMapping)&&et.createElement(z$,null,et.createElement(N$,null,et.createElement($$,null,et.createElement(U$,null)),et.createElement(O$,null,"Auto-mapping stories to Figma"),et.createElement(_$,null,k.progress),et.createElement(Fr,{onClick:k.cancel,variant:"ghost"},"Cancel"))),d&&k.results&&et.createElement(AC,{results:k.results,stories:i,onApply:v,onCancel:C,onRerun:w,isApplying:k.isApplying,isRerunning:k.isCollecting||k.isMapping,source:k.source,resolveThumbnail:b=>k.results?.thumbnailUrls?.[b],resolveStoryScreenshot:b=>D.screenshots[b],isCapturingScreenshots:D.isCapturing,onBrowse:b=>f(b)}),!d&&!k.isCollecting&&!k.isMapping&&(r==="map"?et.createElement(pC,{stories:i,loading:a,selectedStoryId:c,onSelectStory:l,onStoryMapped:$,projectId:n}):et.createElement(mC,{stories:i,loading:a,onLink:z,onUnlink:P,projectId:n}))),et.createElement(D$,null,et.createElement(R$,null,et.createElement("span",null,"Total: ",S," stories"),et.createElement(RC,{type:"mapped"},et.createElement("span",{className:"dot"}),F," mapped"),et.createElement(RC,{type:"unmapped"},et.createElement("span",{className:"dot"}),S-F," unmapped"))))),et.createElement(Hi,{isOpen:!!p,onClose:()=>f(null),onSelect:()=>f(null),projectId:n,initialSearch:p||void 0}))};ct();var NC=Zn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",transition:"border-color 0.2s, box-shadow 0.2s","&:hover":{borderColor:e.color.mediumlight}})),W$=Zn.div(({theme:e})=>({width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{width:"16px",height:"16px"}})),V$=Zn.div({display:"flex",alignItems:"center",gap:"12px",flex:1}),G$=Zn.div({display:"flex",alignItems:"center",gap:"8px"}),q$=Zn.div(({theme:e})=>({width:"60px",height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),Y$=Zn.div(({theme:e,percent:t,state:n})=>({width:`${t}%`,height:"100%",borderRadius:"2px",backgroundColor:n==="complete"?e.color.positive:n==="partial"?e.color.warning:e.color.mediumlight,transition:"width 0.3s ease"})),K$=Zn.span(({theme:e,state:t})=>({fontSize:"12px",fontWeight:600,color:t==="complete"?e.color.positive:t==="partial"?e.color.warning:e.color.mediumdark,whiteSpace:"nowrap"})),X$=Zn.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),Q$=Zn(du)({padding:"4px 10px",fontSize:"12px",fontWeight:600,marginLeft:"auto"}),J$=Zn(du)(({theme:e})=>({padding:"4px 10px",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.negative||"#dc2626","&:hover":{textDecoration:"none",backgroundColor:"rgba(220, 38, 38, 0.08)"}})),Z$=Zn.span(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontStyle:"italic"})),e4=Zn.div(({theme:e})=>({width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"figma-mapping-spin 0.8s linear infinite","@keyframes figma-mapping-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),t4=Zn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),OC=()=>{let[e,t]=dc(!1),[n,r]=dc({totalStories:0,mappedStories:0,loading:!0}),{selectedProjectId:o}=Je(),{sessionToken:i}=we();H$(()=>{o&&i?s():r({totalStories:0,mappedStories:0,loading:!1})},[o,i]);let s=async()=>{r($=>({...$,loading:!0}));try{let $=await fetch("/index.json");if(!$.ok)throw new Error("Failed to fetch Storybook index");let P=await $.json(),z=P.entries||P.stories||{},x=Object.keys(z).filter(F=>z[F].type==="story").length,w=Object.keys(z).filter(F=>z[F].type==="story"),v=V(),C=await ne(`${v}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}}),m=0;if(C.ok){let F=await C.json(),S=F.mappings||F||[];if(Array.isArray(S)){let b=new Set(S.map(A=>A.storyId).filter(Boolean));m=w.filter(A=>b.has(A)).length}else{let b=await ne(`${v}/api/mappings/stats?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(b.ok){let A=await b.json();m=Math.min(A.mappedStoriesCount||0,x)}}}r({totalStories:x,mappedStories:m,loading:!1})}catch($){console.error("[FigmaMappingsSection] Error fetching stats:",$),r(P=>({...P,loading:!1}))}},[a,u]=dc(!1),[c,l]=dc(!1),d=async()=>{!o||!i||l(!0)},g=async()=>{l(!1),u(!0);try{let $=V(),P=await ne(`${$}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(!P.ok)throw new Error("Failed to fetch mappings");let x=(await P.json()).mappings||[];await Promise.all(x.map(w=>ne(`${$}/api/mappings?id=${encodeURIComponent(w.id)}`,{method:"DELETE",headers:{Authorization:`Bearer ${i}`}}))),s()}catch($){console.error("[FigmaMappingsSection] Unlink all failed:",$)}finally{u(!1)}},p=()=>t(!0),f=()=>{t(!1),o&&i&&s()};if(!o)return kt.createElement(NC,null,kt.createElement(Z$,null,"Select a project to link Figma designs"));let{totalStories:k,loading:T}=n,E=Math.min(n.mappedStories,k),I=E===0?"none":E>=k?"complete":"partial",D=k>0?Math.min(100,Math.round(E/k*100)):0,R=I==="none"?"Link designs":"Manage";return kt.createElement(kt.Fragment,null,kt.createElement(NC,null,kt.createElement(W$,null,kt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},kt.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"}),kt.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"}),kt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),kt.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"}),kt.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"}))),kt.createElement(V$,null,kt.createElement(X$,null,"Figma Mappings"),kt.createElement(G$,null,T?kt.createElement(kt.Fragment,null,kt.createElement(e4,null),kt.createElement(t4,null,"Loading...")):kt.createElement(kt.Fragment,null,kt.createElement(q$,null,kt.createElement(Y$,{percent:D,state:I})),kt.createElement(K$,{state:I},`${E}/${k}`)))),E>0&&kt.createElement(J$,{onClick:d,disabled:T||a},a?"Unlinking...":"Unlink All"),kt.createElement(Q$,{onClick:p,disabled:T},R)),e&&kt.createElement(zC,{isOpen:e,onClose:f,projectId:o}),kt.createElement(_r,{isOpen:c,title:"Unlink All Mappings",message:`Unlink all ${n.mappedStories} Figma mappings?`,confirmLabel:"Unlink All",variant:"danger",onConfirm:g,onCancel:()=>l(!1)}))};import le,{useState as Vi,useEffect as gc,useCallback as _C,useRef as sh}from"react";import{styled as er}from"storybook/theming";Ce();je();ct();var ah=er.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",fontSize:"12px"})),lh=er.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),ch=er.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),ere=er(Rr)({padding:"5px 12px",fontSize:"12px"}),uh=er.div(({theme:e})=>({display:"flex",gap:"16px",color:e.color.mediumdark,marginBottom:"4px"})),fc=er.span(({theme:e})=>({whiteSpace:"nowrap","& strong":{color:e.color.defaultText,fontWeight:600}})),n4=er.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})),r4=er.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),ph=er.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),o4=er.span(({theme:e})=>({color:e.color.mediumdark,fontSize:"12px"})),mc=er.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),hc=er.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"3px",transition:"width 0.5s ease"})),zo=er.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText})),$C=new Set,UC=()=>{let{userRole:e,featureFlags:t}=ce(),[n,r]=Vi(null),[o,i]=Vi(!0),[s,a]=Vi(!1),[u,c]=Vi(!1),[l,d]=Vi(!1),[g,p]=Vi(!1),{selectedProjectId:f,projects:k}=Je(),{sessionToken:T}=we(),E=sh(null),I=sh(null),D=sh(null),R=_C(()=>{E.current&&(clearInterval(E.current),E.current=null),I.current&&(clearInterval(I.current),I.current=null),D.current&&(clearTimeout(D.current),D.current=null)},[]);gc(()=>R,[R]);let $=_C(async()=>{if(!(!f||!T))try{let S=V(),b=await ne(`${S}/api/figma/cache-status?projectId=${f}`,{headers:{Authorization:`Bearer ${T}`}});if(b.ok){let A=await b.json();r(A)}}catch(S){console.error("[FigmaCacheSection] Error:",S)}finally{i(!1)}},[f,T]);gc(()=>{$()},[$]),gc(()=>{if(o||s||!n||n.structureStatus!=="none"||!f||$C.has(f))return;let S=k.find(A=>A.id===f);(S?.figmaFileUrl||S?.figmaFileId)&&($C.add(f),P())},[o,s,n?.structureStatus,f,k]),gc(()=>{let S=n?.thumbnailProgress?.status,b=n?.enrichmentProgress?.status,A=n?.thumbnailProgress?.cached??0,L=n?.thumbnailProgress?.total??0,B=S==="in-progress"||S==="pending"||L>0&&A<L,N=b==="in-progress"||b==="pending",h=!n?.thumbnailProgress&&n?.structureStatus==="cached";if(!(B||N||h)||!n||n.structureStatus==="none")return;let W=setInterval(()=>{$()},3e3);return()=>{clearInterval(W)}},[n?.thumbnailProgress?.status,n?.thumbnailProgress?.cached,n?.thumbnailProgress?.total,n?.enrichmentProgress?.status,n?.structureStatus,$]);let P=async()=>{if(!(!f||!T)){a(!0);try{let S=V();await ne(`${S}/api/figma/frames?projectId=${f}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${T}`}},6e4),await new Promise(b=>setTimeout(b,1e3)),await $(),setTimeout(async()=>{await $()},3e3)}catch(S){console.error("[FigmaCacheSection] Reload error:",S)}finally{a(!1)}}},z=async()=>{if(!(!f||!T)){c(!0);try{let S=V(),b=await ne(`${S}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:f})});console.log("[FigmaCacheSection] Cache invalidate response:",b.status),await ne(`${S}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:f})}).catch(()=>{}),r({structureStatus:"none",structureCachedAt:null,componentSetCount:0,componentCount:0,pageCount:0,pages:[],cacheDiff:null,thumbnailProgress:null,enrichmentProgress:null})}catch(S){console.error("[FigmaCacheSection] Clear cache error:",S)}finally{c(!1)}}},x=async()=>{if(!(!f||!T)){R(),d(!0);try{let S=V();await ne(`${S}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:f})}),E.current=setInterval(async()=>{await $()},3e3),I.current=setInterval(()=>{(n?.enrichmentProgress?.status==="complete"||n?.enrichmentProgress?.status==="error")&&(R(),d(!1),$())},3e3),D.current=setTimeout(()=>{R(),d(!1)},6e5)}catch(S){console.error("[FigmaCacheSection] Enrich error:",S),R(),d(!1)}}},w=async()=>{if(!(!f||!T)){p(!0);try{let S=V();await ne(`${S}/api/figma/cancel`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:f})}),await $()}catch(S){console.error("[FigmaCacheSection] Cancel error:",S)}finally{p(!1),d(!1),a(!1)}}},v=n?.thumbnailProgress?.status==="in-progress"||n?.enrichmentProgress?.status==="in-progress";if(!f)return null;if(o)return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache")),le.createElement(uh,null,le.createElement(fc,null,"Loading cache status\u2026")),le.createElement(mc,null,le.createElement(hc,{percent:100,style:{opacity:.3}})));if(!n||n.structureStatus==="none")return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache"),le.createElement(Fr,{loading:s,onClick:P,loadingText:"Loading..."},"\u21BB Load")),s?le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:30,style:{animation:"none",width:"100%",opacity:.3}})),le.createElement(zo,null,le.createElement("span",null,"Downloading structure from Figma... this may take 30-60 seconds"))):le.createElement(uh,null,le.createElement(fc,null,"No cache \u2014 click Load to fetch from Figma")));let C=S=>{let b=Date.now()-new Date(S).getTime(),A=Math.floor(b/6e4);if(A<1)return"just now";if(A<60)return`${A}m ago`;let L=Math.floor(A/60);return L<24?`${L}h ago`:`${Math.floor(L/24)}d ago`},m=n.cacheDiff,F=m&&(m.added.length>0||m.removed.length>0||m.renamed.length>0);return le.createElement(ah,null,le.createElement(lh,null,le.createElement(ch,null,"Figma Cache"," ",le.createElement(n4,{status:n.structureStatus},n.structureStatus)),le.createElement("div",{style:{display:"flex",gap:"6px"}},e==="admin"&&le.createElement(Fr,{loading:l,onClick:x,loadingText:"Enriching..."},"Enrich"),le.createElement(Fr,{loading:u,onClick:z,variant:"ghost",loadingText:"Clearing..."},"Clear"),le.createElement(Fr,{loading:s,onClick:P,loadingText:"Reloading..."},"\u21BB Reload"),v&&le.createElement(Fr,{loading:g,onClick:w,variant:"ghost",loadingText:"Cancelling..."},"\u2715 Cancel"))),s&&le.createElement(zo,null,le.createElement("span",null,"Downloading structure from Figma...")),le.createElement(uh,null,le.createElement(fc,null,le.createElement("strong",null,n.componentSetCount)," component sets"),le.createElement(fc,null,le.createElement("strong",null,n.pageCount)," pages"),n.structureCachedAt&&le.createElement(o4,null,"Updated ",C(n.structureCachedAt))),F&&le.createElement(r4,null,"Since last reload:"," ",m.added.length>0&&le.createElement(ph,{type:"added"},"+",m.added.length," added"),m.added.length>0&&m.removed.length>0&&" \xB7 ",m.removed.length>0&&le.createElement(ph,{type:"removed"},"\u2212",m.removed.length," removed"),(m.added.length>0||m.removed.length>0)&&m.renamed.length>0&&" \xB7 ",m.renamed.length>0&&le.createElement(ph,{type:"renamed"},m.renamed.length," renamed")),n.thumbnailProgress&&n.thumbnailProgress.status==="in-progress"&&le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:n.thumbnailProgress.total>0?Math.round(n.thumbnailProgress.cached/n.thumbnailProgress.total*100):0})),le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: caching to CDN\u2026",n.thumbnailProgress.currentName&&le.createElement(le.Fragment,null," ",n.thumbnailProgress.currentName)),le.createElement("span",null,n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," variants"))),n.thumbnailProgress&&n.thumbnailProgress.status==="complete"&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: ",n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," cached to CDN \u2713")),(!n.thumbnailProgress||n.thumbnailProgress.status==="pending"&&n.thumbnailProgress.cached===0)&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: not yet cached",n.thumbnailProgress?.total?` (${n.thumbnailProgress.total} components)`:""," \u2014 click Reload to generate")),n.thumbnailProgress&&n.thumbnailProgress.status==="pending"&&n.thumbnailProgress.cached>0&&le.createElement(zo,null,le.createElement("span",null,"Variant thumbnails: ",n.thumbnailProgress.cached," of ",n.thumbnailProgress.total," cached to CDN (partial)")),n.enrichmentProgress&&n.enrichmentProgress.status==="in-progress"&&le.createElement(le.Fragment,null,le.createElement(mc,null,le.createElement(hc,{percent:n.enrichmentProgress.total>0?Math.round(n.enrichmentProgress.enriched/n.enrichmentProgress.total*100):0})),le.createElement(zo,null,le.createElement("span",null,"AI descriptions: generating\u2026",n.enrichmentProgress.currentName&&le.createElement(le.Fragment,null," ",n.enrichmentProgress.currentName)),le.createElement("span",null,n.enrichmentProgress.enriched," of ",n.enrichmentProgress.total," component sets"))),n.enrichmentProgress&&n.enrichmentProgress.status==="complete"&&le.createElement(le.Fragment,null,le.createElement(zo,null,le.createElement("span",null,"AI descriptions: ",n.enrichmentProgress.enriched," of ",n.enrichmentProgress.total," component sets \u2713"))),n.enrichmentProgress&&n.enrichmentProgress.status==="processing"&&t.showCosts&&n.enrichmentProgress.costUsd!=null&&n.enrichmentProgress.costUsd>0&&le.createElement("div",{style:{marginTop:"6px"}},le.createElement(lc,{inputTokens:n.enrichmentProgress.inputTokens||0,outputTokens:n.enrichmentProgress.outputTokens||0,costUsd:n.enrichmentProgress.costUsd,compact:!0})))};import xt,{useState as Gi}from"react";import{styled as Ur}from"storybook/theming";Ce();je();ct();var dh=Ur.div({padding:"12px 16px"}),i4=Ur.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),jC=Ur.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),HC=Ur.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:se,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),s4=Ur.div({display:"flex",gap:"8px",alignItems:"center"}),a4=Ur.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:se,boxShadow:`0 0 0 1px ${se}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),WC=Ur.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":e==="error"?"#dc2626":"#6b7280",marginTop:"6px",display:"block",lineHeight:1.4})),l4=Ur.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:se,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),c4=Ur.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})),u4=Ur.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),VC=({onConnected:e})=>{let{sessionToken:t}=we(),[n,r]=Gi(!1),[o,i]=Gi(""),[s,a]=Gi(!1),[u,c]=Gi(null),[l,d]=Gi(null),[g,p]=Gi(!1),f=async()=>{if(!(!o.trim()||!t)){a(!0),c(null);try{let k=V(),T=await ne(`${k}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({token:o.trim()})}),E=await T.json();if(!T.ok){c({type:"error",message:E.error||"Failed to save token"});return}d(E.figmaUser?.handle||E.figmaUser?.email||"Connected"),c({type:"success",message:`Connected as ${E.figmaUser?.handle||"Figma user"}`}),i(""),e?.()}catch{c({type:"error",message:"Failed to connect. Check your token and try again."})}finally{a(!1)}}};return l?xt.createElement(dh,null,xt.createElement(jC,null,"Figma Personal Access Token"),xt.createElement(c4,null,xt.createElement("span",null,"\u2713 Connected as ",xt.createElement("strong",null,l)),xt.createElement(u4,{onClick:()=>{d(null),c(null)}},"Change token"))):n?xt.createElement(dh,null,xt.createElement(i4,null,xt.createElement(jC,null,"Figma Personal Access Token"),xt.createElement(HC,{onClick:()=>p(!g)},g?"Hide instructions":"How to generate")),g&&xt.createElement(l4,null,xt.createElement("ol",null,xt.createElement("li",null,"Open ",xt.createElement("a",{href:"https://www.figma.com/settings",target:"_blank",rel:"noopener noreferrer"},"Figma Settings")),xt.createElement("li",null,"Click the ",xt.createElement("strong",null,"Security")," tab"),xt.createElement("li",null,"Scroll to ",xt.createElement("strong",null,"Personal access tokens")),xt.createElement("li",null,"Click ",xt.createElement("strong",null,"Generate new token")),xt.createElement("li",null,"Enable ",xt.createElement("strong",null,"File content: Read only")," under Scopes"),xt.createElement("li",null,"Copy the token and paste it below"))),xt.createElement(s4,null,xt.createElement(a4,{type:"password",value:o,onChange:k=>i(k.target.value),placeholder:"figd_...",onKeyDown:k=>{k.key==="Enter"&&o.trim()&&f()}}),xt.createElement(Yt,{onClick:f,disabled:!o.trim()||s},s?"Verifying...":"Save & Verify")),u&&xt.createElement(WC,{variant:u.type},u.message),xt.createElement(WC,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):xt.createElement(dh,null,xt.createElement(HC,{onClick:()=>r(!0)},"Or use a Personal Access Token \u2192"))};Ce();je();ct();var d4=yt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},yt.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"}),yt.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"}),yt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),yt.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"}),yt.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"})),gh=Er.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",marginBottom:"16px",backgroundColor:e.background.content})),g4=Er.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),f4=Er.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),m4=Er.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),fh=Er.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),h4=Er.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.base==="dark"?"rgba(0, 204, 102, 0.2)":"rgba(0, 204, 102, 0.1)",border:`1px solid ${e.color.positive}`,borderRadius:"8px",margin:"12px 16px",display:"flex",alignItems:"center",justifyContent:"space-between"})),x4=Er.div({display:"flex",alignItems:"center",gap:"8px"}),y4=Er(kn)(({theme:e})=>({backgroundColor:`${e.base==="dark"?"rgba(197, 48, 48, 0.15)":"rgba(254, 178, 178, 0.3)"} !important`,color:`${e.color.negative} !important`,border:`1px solid ${e.color.negative} !important`,padding:"6px 12px !important",fontSize:"12px !important"})),b4=Er.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),Sre=Er.button({display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",width:"100%",padding:"8px 16px",backgroundColor:"#A259FF",color:"#fff",border:"none",borderRadius:"6px",fontSize:"13px",fontWeight:600,cursor:"pointer","&:hover":{backgroundColor:"#8a3de8"}}),S4=Er.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}})),qC=({hideHeader:e=!1})=>{let{sessionToken:t}=we(),[n,r]=xc(!1),[o,i]=xc(()=>{try{let p=sessionStorage.getItem("uicopilot_figma_connection");if(p){let{connected:f,ts:k}=JSON.parse(p);if(Date.now()-k<300*1e3)return f}}catch{}return null}),[s,a]=xc(!1),[u,c]=xc(!1);p4(()=>{if(!t)return;let p=V();ne(`${p}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${t}`}}).then(f=>f.json()).then(f=>{let k=!!f.connected;a(!!f.expired),i(k);try{sessionStorage.setItem("uicopilot_figma_connection",JSON.stringify({connected:k,ts:Date.now()}))}catch{}}).catch(()=>i(!1))},[t]);let l=GC(()=>{let p=V(),f=`${p}/api/auth/figma/login?addon=true`;window.open(f,"figma-oauth","width=600,height=700,left=200,top=100");let k=setInterval(async()=>{try{(await(await ne(`${p}/api/figma/connection-status`,{headers:t?{Authorization:`Bearer ${t}`}:{}})).json()).connected&&(clearInterval(k),i(!0))}catch{}},2e3);setTimeout(()=>clearInterval(k),300*1e3)},[t]),d=GC(async()=>{try{r(!0);let p=V(),f=await ne(`${p}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(f.ok||f.status===404){i(!1);try{sessionStorage.removeItem("uicopilot_figma_connection")}catch{}}}catch{}finally{r(!1)}},[t]),g=e?null:yt.createElement(g4,null,yt.createElement(f4,null,d4),yt.createElement(m4,null,"Figma Integration"));return o===null?yt.createElement(gh,null,g,yt.createElement(fh,null,yt.createElement("div",{style:{padding:"16px",fontSize:"13px",color:"#9ca3af"}},"Checking Figma connection..."))):o===!1?yt.createElement(gh,null,g,yt.createElement(fh,null,yt.createElement(b4,null,s&&yt.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:"#92400e"}},"\u26A0\uFE0F Your Figma access has expired. Please reconnect."),yt.createElement(Yt,{onClick:l,style:{width:"100%"}},s?"Reconnect Figma":"Connect with Figma"),yt.createElement(S4,null,"or"),yt.createElement(VC,{onConnected:()=>i(!0)})))):yt.createElement(gh,null,g,yt.createElement(h4,null,yt.createElement(x4,null,yt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),yt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to Figma")),yt.createElement(y4,{onClick:()=>c(!0),disabled:n},n?"Disconnecting...":"Disconnect")),yt.createElement(_r,{isOpen:u,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:()=>{c(!1),d()},onCancel:()=>c(!1)}),yt.createElement(fh,null,yt.createElement(hk,null),yt.createElement(OC,null),yt.createElement(UC,null)))};Ce();Rn();var k4=gr.div({position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.4)",zIndex:1e3,display:"flex",justifyContent:"center",alignItems:"flex-start",paddingTop:"32px"}),C4=gr.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"14px",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.22)",width:"520px",maxWidth:"94%",maxHeight:"calc(100vh - 64px)",overflow:"auto",position:"relative"})),T4=gr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px 12px",position:"sticky",top:0,backgroundColor:e.background.content,borderRadius:"14px 14px 0 0",zIndex:1})),I4=gr.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),F4=gr(Cn)({fontSize:"18px",padding:"2px 8px",lineHeight:1,background:"transparent",border:"none"}),E4=gr.div({display:"flex",flexDirection:"column",gap:"16px",padding:"0 20px 20px"}),YC=gr.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"14px",padding:"16px",borderRadius:"12px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),KC=gr.div({display:"flex",alignItems:"center",gap:"10px"}),XC=gr.h3(({theme:e})=>({margin:0,fontSize:"14px",fontWeight:600,color:e.color.defaultText,flex:1})),A4=gr.div({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:se,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,letterSpacing:"0.3px",flexShrink:0}),P4=gr.div({width:"22px",height:"22px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center","& svg":{width:"22px",height:"22px"}}),QC=gr.div(({theme:e})=>({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"}})),JC=({onClose:e})=>{let{isConnected:t}=we(),{selectedProjectId:n}=Je(),r=v4(t);return w4(()=>{!r.current&&t&&n&&e(),r.current=t},[t,n,e]),Lt.createElement(k4,{onClick:e},Lt.createElement(C4,{onClick:o=>o.stopPropagation()},Lt.createElement(T4,null,Lt.createElement(I4,null,"Settings"),Lt.createElement(F4,{onClick:e,title:"Close settings"},"\xD7")),Lt.createElement(E4,null,Lt.createElement(YC,null,Lt.createElement(KC,null,Lt.createElement(A4,null,"UI"),Lt.createElement(XC,null,Ft.NAME)),Lt.createElement(QC,null,Lt.createElement(pk,{onConnect:e}),t&&Lt.createElement(fk,null))),t&&n&&Lt.createElement(YC,null,Lt.createElement(KC,null,Lt.createElement(P4,null,Lt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Lt.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"}),Lt.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"}),Lt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),Lt.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"}),Lt.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"}))),Lt.createElement(XC,null,"Figma Integration")),Lt.createElement(QC,null,Lt.createElement(qC,{hideHeader:!0}))))))};import ft,{useEffect as l1,useMemo as r3,useState as o3,useRef as i3}from"react";import{styled as Hn,keyframes as s3}from"storybook/theming";Ce();Rn();Ce();import Xt,{useState as L4}from"react";import{styled as jn}from"storybook/theming";var so=[{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.5",provider:"anthropic",description:"Latest Claude model, best balance of speed and quality"},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",provider:"anthropic",description:"Previous generation Sonnet"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet",provider:"anthropic",description:"Best balance of speed and quality"},{id:"claude-haiku-4-5-20251001",name:"Claude Haiku 4.5",provider:"anthropic",description:"Fastest, most affordable"},{id:"claude-3-opus-20240229",name:"Claude 3 Opus",provider:"anthropic",description:"Most capable Claude 3 model"},{id:"gpt-5.2",name:"GPT-5.2 Thinking",provider:"openai",description:"47% cheaper, reasoning"},{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Instant",provider:"openai",description:"86% cheaper (default)"},{id:"gpt-4o",name:"GPT-4o",provider:"openai",description:"GPT-4 multimodal flagship"},{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai",description:"GPT-4 affordable model"},{id:"o1-preview",name:"o1 Preview",provider:"openai",description:"Reasoning model (slower, advanced)"},{id:"o1-mini",name:"o1 Mini",provider:"openai",description:"Faster reasoning model"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"Fast & cheap, great vision"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"Best Gemini quality"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash",provider:"google",description:"Previous gen, very fast"}];var M4=jn.div({display:"flex",alignItems:"center",gap:"8px",width:"100%"}),B4=jn.div({display:"inline-flex",flexWrap:"nowrap",gap:"4px",alignItems:"center"}),D4=jn.div(({theme:e,disabled:t,provider:n})=>{let r={anthropic:{background:"#D4A574",text:"#ffffff"},openai:{background:e.color.positive||"#10b981",text:"#ffffff"},google:{background:"#4285F4",text:"#ffffff"}},o=n?r[n]:r.anthropic;return{display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 8px",backgroundColor:o.background,color:o.text,fontSize:"11px",fontWeight:500,borderRadius:"12px",opacity:t?.6:1,cursor:t?"not-allowed":"default",transition:"opacity 0.15s"}}),R4=jn.button(({theme:e,disabled:t})=>({background:"none",border:"none",color:e.color.inverseText,fontSize:"12px",cursor:t?"not-allowed":"pointer",padding:"0 2px",lineHeight:1,opacity:t?.5:.8,transition:"opacity 0.15s","&:hover":{opacity:t?.5:1}})),z4=jn.div({position:"relative",display:"inline-block"}),N4=jn.button(({disabled:e,isOpen:t,theme:n})=>({padding:`${n.layoutMargin*.8}px 32px ${n.layoutMargin*.8}px ${n.layoutMargin}px`,fontSize:n.typography.size.s2,fontFamily:n.typography.fonts.base,fontWeight:500,color:n.color.defaultText,backgroundColor:n.input.background,border:`1px solid ${t?n.color.secondary:n.appBorderColor}`,borderRadius:n.appBorderRadius,cursor:e?"not-allowed":"pointer",opacity:e?.6:1,whiteSpace:"nowrap",display:"flex",gap:`${n.layoutMargin*.8}px`,alignItems:"center",justifyContent:"space-between",minWidth:"200px",transition:"border-color 0.15s, box-shadow 0.15s",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","&:hover":{borderColor:e?n.appBorderColor:n.color.mediumdark}})),O4=jn.div(({theme:e})=>({position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,boxShadow:e.base==="dark"?"0 4px 12px rgba(0, 0, 0, 0.3)":"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"280px",overflowY:"auto"})),mh=jn.div(({theme:e})=>({borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),hh=jn.div(({theme:e})=>({padding:"8px 12px",fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:e.background.app})),_4=jn.div(({theme:e,disabled:t})=>({padding:"8px 12px",fontSize:"12px",cursor:t?"not-allowed":"pointer",opacity:t?.5:1,display:"flex",alignItems:"center",gap:"8px",transition:"background-color 0.15s",color:e.color.defaultText,"&:hover":{backgroundColor:t?"transparent":e.background.hoverable}})),$4=jn.input({cursor:"pointer",flexShrink:0,"&:disabled":{cursor:"not-allowed"}}),U4=jn.div({flex:1,minWidth:0}),j4=jn.div({fontSize:"12px",fontWeight:500,marginBottom:"2px"}),H4=jn.div(({theme:e})=>({fontSize:"10px",color:e.textMutedColor,lineHeight:"1.2"})),W4=5,ZC=()=>{let{selectedModels:e,toggleModel:t,isReviewing:n}=ce(),[r,o]=L4(!1),i=so.filter(p=>p.provider==="anthropic"&&!e.includes(p.id)),s=so.filter(p=>p.provider==="openai"&&!e.includes(p.id)),a=so.filter(p=>p.provider==="google"&&!e.includes(p.id)),u=so.filter(p=>e.includes(p.id)),c=e.length<W4,l=(p,f)=>{f.stopPropagation(),e.length>1&&!n&&t(p)},d=p=>{let f=e.includes(p);f&&e.length===1||!f&&!c||n||(t(p),o(!1))},g=p=>{let f=e.includes(p.id),k=f&&e.length===1,T=n||k||!f&&!c;return Xt.createElement(_4,{key:p.id,disabled:T,onClick:()=>d(p.id)},Xt.createElement($4,{type:"checkbox",checked:f,disabled:T,onChange:()=>{},onClick:E=>E.stopPropagation()}),Xt.createElement(U4,null,Xt.createElement(j4,null,p.name),p.description&&Xt.createElement(H4,null,p.description)))};return Xt.createElement(M4,null,Xt.createElement(z4,null,Xt.createElement(N4,{disabled:n,isOpen:r,onClick:()=>o(!r)},Xt.createElement("span",null,"Select model"),Xt.createElement("span",null,r?"\u25B2":"\u25BC")),r&&Xt.createElement(O4,null,Xt.createElement(mh,null,Xt.createElement(hh,null,"Anthropic"),i.map(g)),Xt.createElement(mh,null,Xt.createElement(hh,null,"OpenAI"),s.map(g)),Xt.createElement(mh,null,Xt.createElement(hh,null,"Google"),a.map(g)))),Xt.createElement(B4,null,u.map(p=>Xt.createElement(D4,{key:p.id,disabled:n,provider:p.provider},p.name,e.length>1&&Xt.createElement(R4,{disabled:n,onClick:f=>l(p.id,f),title:"Remove model"},"\xD7")))))};import ze,{useState as V4,useEffect as G4}from"react";import{styled as tn,keyframes as qi}from"storybook/theming";Ce();var q4=qi`
|
|
45
45
|
0%, 100% {
|
|
46
46
|
opacity: 1;
|
|
47
47
|
transform: scale(1);
|
|
@@ -50,20 +50,20 @@ ${at}`).join(`
|
|
|
50
50
|
opacity: 0.4;
|
|
51
51
|
transform: scale(0.8);
|
|
52
52
|
}
|
|
53
|
-
`,
|
|
53
|
+
`,Y4=qi`
|
|
54
54
|
0% { transform: rotate(0deg); }
|
|
55
55
|
100% { transform: rotate(360deg); }
|
|
56
|
-
`,
|
|
56
|
+
`,n1=qi`
|
|
57
57
|
0% { opacity: 0; transform: translateY(2px); }
|
|
58
58
|
100% { opacity: 1; transform: translateY(0); }
|
|
59
|
-
`,
|
|
59
|
+
`,K4=qi`
|
|
60
60
|
0%, 100% {
|
|
61
61
|
opacity: 1;
|
|
62
62
|
}
|
|
63
63
|
50% {
|
|
64
64
|
opacity: 0.6;
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,X4=qi`
|
|
67
67
|
0% {
|
|
68
68
|
transform: translateY(0) rotate(0deg) scale(1);
|
|
69
69
|
opacity: 1;
|
|
@@ -75,27 +75,27 @@ ${at}`).join(`
|
|
|
75
75
|
transform: translateY(60px) rotate(720deg) scale(0.5);
|
|
76
76
|
opacity: 0;
|
|
77
77
|
}
|
|
78
|
-
`;var
|
|
78
|
+
`;var Yre=tn.div({display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}),xh=tn.div({display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}),Kre=tn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.6}px`,padding:`${e.layoutMargin*.4}px ${e.layoutMargin}px`,borderRadius:e.appBorderRadius,backgroundColor:e.background.hoverable||"#f3f4f6",border:`1px solid ${e.appBorderColor}`,fontSize:e.typography.size.s1,fontWeight:e.typography.weight.regular,color:e.textMutedColor,animation:`${n1} 0.3s ease-out`})),Q4=qi`
|
|
79
79
|
from { transform: rotate(0deg); }
|
|
80
80
|
to { transform: rotate(360deg); }
|
|
81
|
-
`,Gre=tn.div(({theme:e})=>({width:"12px",height:"12px",borderRadius:"50%",border:"2px solid transparent",borderTopColor:e.textMutedColor,animation:`${q4} 0.8s linear infinite`,flexShrink:0})),XC=tn.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.5}px`,padding:`${e.layoutMargin*.3}px ${e.layoutMargin*.9}px`,borderRadius:e.appBorderRadius*2,backgroundColor:e.base==="dark"?"rgba(220, 38, 38, 0.18)":"#fee2e2",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.negative||"#dc2626",whiteSpace:"nowrap"})),Y4=tn.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.5}px`,padding:`${e.layoutMargin*.3}px ${e.layoutMargin*.9}px`,borderRadius:e.appBorderRadius*2,backgroundColor:e.base==="dark"?"rgba(22, 163, 74, 0.18)":"#dcfce7",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.positive||"#16a34a",whiteSpace:"nowrap",position:"relative",overflow:"visible"})),qre=tn.span(({delay:e,left:t,color:n,size:r})=>({position:"absolute",top:"-10px",left:`${t}%`,width:`${r}px`,height:`${r}px`,backgroundColor:n,borderRadius:r>6?"50%":"2px",animation:`${G4} 2.5s ease-out ${e}s forwards`,pointerEvents:"none",zIndex:1e3}));var ca=tn.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"14px",fontWeight:300})),ua=tn.span(({theme:e,color:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",fontWeight:500,color:t??e.color.mediumdark,whiteSpace:"nowrap"})),QC=tn.span(({theme:e,color:t})=>({fontSize:"12px",color:t??e.color.mediumdark})),pa=tn.span(({color:e})=>({fontWeight:700,color:e})),K4=tn.div(({tint:e,theme:t})=>({display:"inline-flex",alignItems:"center",gap:`${t.layoutMargin*.6}px`,padding:`${t.layoutMargin*.3}px ${t.layoutMargin}px`,borderRadius:t.appBorderRadius*2,backgroundColor:`${e}1a`,border:`1px solid ${e}33`,"& .score-label":{fontSize:t.typography.size.s1,color:t.textMutedColor},"& .score-value":{fontFamily:t.typography.fonts.mono,fontSize:t.typography.size.s2,fontWeight:t.typography.weight.bold,color:e,lineHeight:1},"& .score-dot":{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e}})),Yre=tn.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"12px"})),Kre=tn.span(({color:e=se})=>({display:"inline-block",fontSize:"12px",color:e,animation:`${H4} 1.2s ease-in-out infinite`,marginRight:"4px"})),Xre=tn.span(({theme:e,variant:t="muted"})=>({fontSize:"12px",fontWeight:700,color:(()=>{switch(t){case"issues":return se;case"score-high":return"#16a34a";case"score-medium":return"#ca8a04";case"score-low":return"#dc2626";case"cost":return"#7c3aed";case"tokens":return e.color.mediumdark;case"analyzing":return se;case"verifying":return"#7c3aed";default:return e.color.mediumdark}})(),whiteSpace:"nowrap",...t==="analyzing"||t==="verifying"?{animation:`${V4} 1.5s ease-in-out infinite`}:{}})),Qre=tn.span(({theme:e})=>({fontSize:"12px",fontWeight:400,color:e.color.mediumdark})),Jre=tn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark,fontWeight:400})),X4=tn.span({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",animation:`${W4} 1.2s linear infinite`,flexShrink:0}),Q4=({color:e=se})=>ze.createElement(X4,null,ze.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},Array.from({length:8}).map((t,n)=>{let o=n*360/8*Math.PI/180,i=12+Math.cos(o)*4,s=12+Math.sin(o)*4,a=12+Math.cos(o)*10,u=12+Math.sin(o)*10;return ze.createElement("line",{key:n,x1:i,y1:s,x2:a,y2:u,stroke:e,strokeWidth:2,strokeLinecap:"round",opacity:.3+n/8*.7})}))),Zre=tn.span(({color:e="#6b7280"})=>({fontSize:"12px",fontWeight:500,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",animation:`${JC} 0.3s ease-out`}));function J4(e){let[t,n]=U4(0);return j4(()=>{if(!e){n(0);return}let r=setInterval(()=>{n(o=>o+1)},1e3);return()=>clearInterval(r)},[e]),t}var ZC=({isReviewing:e,isValidating:t,streamingStatus:n,issueCount:r=0,score:o,visualSimilarity:i,costUsd:s,inputTokens:a,outputTokens:u,showTimer:c=!0,cacheCreationTokens:l,cacheReadTokens:d,durationSeconds:f})=>{let p=J4(e||t),{featureFlags:g}=ce(),k=g.showCosts,T=3.65,E=P=>P<.01?`$${P.toFixed(4)}`:P<.1?`$${P.toFixed(3)}`:`$${P.toFixed(2)}`,I=P=>{let z=P*T;return z<.01?`\u20AA${z.toFixed(4)}`:z<.1?`\u20AA${z.toFixed(3)}`:`\u20AA${z.toFixed(2)}`},D=P=>P>=1e3?`${(P/1e3).toFixed(1)}K`:P.toString(),R=P=>P>=80?"score-high":P>=50?"score-medium":"score-low",$=P=>P>=80?"high":P>=50?"medium":"low";if(e)return ze.createElement(xh,null,ze.createElement("span",{style:{fontSize:"12px",color:"#9ca3af"}},p,"s \xB7 Esc to stop"));if(t)return ze.createElement(xh,null,ze.createElement(XC,null,ze.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ze.createElement(ca,null,"|"),ze.createElement(ua,null,ze.createElement(Q4,{color:"#7c3aed"}),ze.createElement(pa,{color:"#7c3aed"},"Verifying...")),c&&ze.createElement(ze.Fragment,null,ze.createElement(ca,null,"|"),ze.createElement(ua,null,ze.createElement("span",{style:{color:"#6b7280"}},p,"s"))));if(r>0||o!==void 0){let P=(a||0)+(u||0),z=(d||0)>0,x=z&&a?Math.round(d/a*100):0,w=Math.max(o??0,i??0),v=m=>m>=80?"#16a34a":m>=50?"#ca8a04":"#dc2626",C=m=>m>=100?"\u25CF":m>=50?"\u25D0":"\u25CB";return ze.createElement(xh,null,r===0?ze.createElement(Y4,null,ze.createElement("span",null,"\u2713"),"Perfect!"):ze.createElement(XC,null,ze.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ze.createElement(K4,{tint:v(w),title:`MQM compliance: ${o??0}% | Visual similarity: ${i??0}%`},ze.createElement("span",{className:"score-dot"}),ze.createElement("span",{className:"score-label"},"Score"),ze.createElement("span",{className:"score-value"},w)),k&&s!==void 0&&s>0&&ze.createElement(ze.Fragment,null,ze.createElement(ca,null,"|"),ze.createElement(ua,null,ze.createElement(pa,{color:"#16a34a"},E(s)),ze.createElement("span",{style:{color:"#6b7280"}},"/"),ze.createElement(pa,{color:"#16a34a"},I(s)))),k&&P>0&&ze.createElement(ze.Fragment,null,ze.createElement(ca,null,"|"),ze.createElement(ua,{title:`Input: ${a?.toLocaleString()||0} \xB7 Output: ${u?.toLocaleString()||0}${z?` \xB7 Cached: ${d?.toLocaleString()}`:""}`},ze.createElement(QC,{color:"#7c3aed"},"#"),ze.createElement(pa,{color:"#7c3aed"},D(P)),ze.createElement("span",{style:{color:"#6b7280"}},"tokens"),z&&ze.createElement("span",{style:{color:"#16a34a",marginLeft:"4px"}},"\u26A1",x,"%"))),f!==void 0&&f>0&&ze.createElement(ze.Fragment,null,ze.createElement(ca,null,"|"),ze.createElement(ua,null,ze.createElement(QC,{color:"#6b7280"},"\u23F1"),ze.createElement(pa,{color:"#6b7280"},f,"s"))))}return null};var r3=Hn.div({display:"flex",flexDirection:"column",gap:"12px",marginBottom:"16px"}),coe=Hn.div({display:"flex",gap:"8px",alignItems:"center"}),o3=n3({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}),i3=Hn.span({display:"inline-block",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.35)",borderTopColor:"#ffffff",animation:`${o3} 0.8s linear infinite`,marginRight:"8px",verticalAlign:"middle"}),s3=Hn.span({display:"inline-flex",alignItems:"center",marginRight:"8px","& svg":{width:"16px",height:"16px"}}),a3=Hn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin}px`,padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.2}px`,borderRadius:e.appBorderRadius*2,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)",flexWrap:"wrap"})),l3=Hn.button(({theme:e,variant:t="orange",disabled:n})=>{let r={green:n?e.textMutedColor:e.color.positive||"#10b981",purple:n?e.textMutedColor:"#7c3aed",yellow:n?e.textMutedColor:"#c4b5fd",orange:n?e.textMutedColor:Ua},o=t==="purple"||t==="yellow"?"124, 58, 237":"255, 107, 53";return{width:"auto",backgroundColor:r[t],color:e.color.inverseText,border:"none",padding:`${e.layoutMargin*.7}px ${e.layoutMargin*1.4}px`,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,borderRadius:e.appBorderRadius,cursor:n?"not-allowed":"pointer",opacity:n?.6:1,whiteSpace:"nowrap",transition:"all 0.2s",boxShadow:n?"none":`0 2px 6px rgba(${o}, 0.3)`,flexShrink:0,"&:hover":{opacity:n?.6:.9,transform:n?"none":"translateY(-1px)",boxShadow:n?"none":`0 4px 10px rgba(${o}, 0.4)`}}}),c3=Hn.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",color:e.color.warning||"#f59e0b",display:"flex",alignItems:"center",gap:"6px"})),u3=Hn.div({marginLeft:"auto",display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",minWidth:0}),p3=Hn(hn)({width:"auto",minWidth:"180px",maxWidth:"260px"}),d3=Hn.div({display:"flex",gap:"16px",alignItems:"center",marginTop:"4px"}),e1=Hn.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.defaultText,cursor:"pointer",userSelect:"none"})),t1=Hn.div(({theme:e,checked:t})=>({width:"32px",height:"18px",borderRadius:"9px",backgroundColor:t?Ua:e.appBorderColor||"#d1d5db",position:"relative",transition:"background-color 0.2s ease",flexShrink:0})),n1=Hn.div(({checked:e})=>({width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",position:"absolute",top:"2px",left:e?"16px":"2px",transition:"left 0.2s ease",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.2)"})),r1=Hn.input({position:"absolute",opacity:0,width:0,height:0}),f3=()=>{let[e,t]=e3(0),n=t3();o1(()=>(n.current=setInterval(()=>t(s=>s+1),1e3),()=>clearInterval(n.current)),[]);let r=Math.floor(e/60),o=e%60,i=`${r}:${o.toString().padStart(2,"0")}`;return gt.createElement("span",{style:{fontFamily:"ui-monospace, monospace",fontSize:"12px",opacity:.8,fontVariantNumeric:"tabular-nums"}},i)},yh=()=>{let{sessionToken:e}=Us(),{usageData:t}=we(),{selectedProjectId:n}=no(),{currentMapping:r,hasMapping:o}=ni(),{loadingMapping:i,currentStoryId:s}=nt(),{startReview:a,cancelReview:u,isReviewing:c}=gm(),{isLoadingScreenshots:l}=ei(),{storybookImageUrl:d,figmaImageUrl:f,currentReviewId:p,reviewHistory:g,setReviewDetailTab:k,setReviewResults:T,setFigmaImageUrl:E,setStorybookImageUrl:I,setFullPrompt:D,setFullResponse:R,includeTextComparison:$,setIncludeTextComparison:P,usePromptCache:z,setUsePromptCache:x,isValidating:w,validationUsage:v,isGenerating:C,isApplying:m,streamingStatus:F,featureFlags:S,userRole:b,roleOverride:A,isReviewing:L}=ce(),B=t?.reviewCredits??Math.floor(t?.creditBalance??0),N=g.find(ge=>ge.id===p),j=(N?.issues||[]).filter(ge=>!ge.dismissed).length,W=N?.complianceScore,M=N?.visualSimilarity,K=(N?.costUsd||0)+(v?.costUsd||0),ee=(N?.inputTokens||0)+(v?.inputTokens||0),fe=(N?.outputTokens||0)+(v?.outputTokens||0),xe=Z4(()=>{let ge=s?g.filter(me=>me.storyId===s):g,tt=ge.filter(me=>!me.parentReviewId).sort((me,ie)=>new Date(ie.createdAt).getTime()-new Date(me.createdAt).getTime()),he=ge.filter(me=>me.parentReviewId),oe=[];for(let me of tt){oe.push(me);let ie=he.filter(O=>O.parentReviewId===me.id).sort((O,U)=>(O.iterationNumber||0)-(U.iterationNumber||0));oe.push(...ie)}let Y=he.filter(me=>!tt.some(ie=>ie.id===me.parentReviewId));return oe.push(...Y),oe},[g,s]);o1(()=>{if(!c)return;let ge=tt=>{tt.key==="Escape"&&(tt.preventDefault(),u())};return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[c,u]);let ae=o&&r?.figmaNodeId,Ke=C||m,be=B>0,Te=!!(e&&n&&!c&&!l&&!Ke&&s&&d&&ae&&f&&be),te=async(ge=!1)=>{if(!s){console.error("[ReviewActions] No story selected");return}try{k("chat"),await a({isIteration:ge,parentReviewId:ge?p:void 0})}catch(tt){console.error("[ReviewActions] Review error:",tt)}},Me=()=>te(!1),Ae=ge=>{let tt=ge.target.value;if(tt){let he=g.find(oe=>oe.id===tt);he&&(T({id:he.id,componentId:he.componentId,storyId:he.storyId,modelId:he.modelId,complianceScore:he.complianceScore,issuesCount:he.issuesCount,issues:he.issues,createdAt:new Date(he.createdAt),visualSimilarity:he.visualSimilarity,timestamp:new Date(he.createdAt).toISOString(),costUsd:he.costUsd,inputTokens:he.inputTokens,outputTokens:he.outputTokens,cacheCreationTokens:he.cacheCreationTokens,cacheReadTokens:he.cacheReadTokens,reviewDurationMs:he.reviewDurationMs}),he.figmaImageData&&E(he.figmaImageData),he.storybookImageData&&I(he.storybookImageData),(A??b)==="admin"&&(D(he.aiPrompt||""),R(he.aiResponse||"")),k("issues"))}},pe=ge=>{let tt=new Date(ge),oe=new Date().getTime()-tt.getTime(),Y=Math.floor(oe/6e4),me=Math.floor(oe/36e5),ie=Math.floor(oe/864e5);return Y<1?"Just now":Y<60?`${Y}m ago`:me<24?`${me}h ago`:ie<7?`${ie}d ago`:tt.toLocaleDateString()},Pt=ge=>ge?ge.includes("haiku")?"Haiku":ge.includes("sonnet")?"Sonnet":ge.includes("opus")?"Opus":ge.includes("gpt-4o-mini")?"GPT-4o mini":ge.includes("gpt-4o")?"GPT-4o":ge.includes("gpt-4")?"GPT-4":ge.includes("o3")?"o3":ge.includes("o1")?"o1":ge.split("-")[0]||"":"",nn=ge=>{let tt=ge.split("--"),he=tt[tt.length-1]||ge;return he.charAt(0).toUpperCase()+he.slice(1)},Mr=(A??b)==="admin";return gt.createElement("div",null,gt.createElement(r3,null,S.enableModelSelection&>.createElement(KC,null),Mr&>.createElement(d3,null,gt.createElement(e1,{title:"Compare text content between Figma design and Storybook component"},gt.createElement(r1,{type:"checkbox",checked:$,onChange:ge=>P(ge.target.checked)}),gt.createElement(t1,{checked:$},gt.createElement(n1,{checked:$})),"Compare text"),S.showCosts&>.createElement(e1,{title:"Cache prompt for 5 min to reduce costs on repeat reviews (dev optimization)"},gt.createElement(r1,{type:"checkbox",checked:z,onChange:ge=>x(ge.target.checked)}),gt.createElement(t1,{checked:z},gt.createElement(n1,{checked:z})),"Cache prompt")),gt.createElement(a3,null,gt.createElement(l3,{variant:c?"yellow":"purple",disabled:c?!1:!Te,onClick:c?u:Me,title:c?"Click to stop review":e?n?s?ae?l?"Loading screenshots...":Ke?"Wait for fixes to complete...":d?f?be?"Review this component implementation":"No credits \u2014 click \u26A1 in the toolbar to get more":"Waiting for Figma design image...":"Waiting for Storybook screenshot...":'Figma mapping required - use "Map to Figma" in the Review tab':"No story selected":"Please select a project first":`Please connect to ${Ft.NAME} first`},c?gt.createElement(gt.Fragment,null,gt.createElement(i3,null),"Reviewing",gt.createElement(f3,null)):gt.createElement(gt.Fragment,null,gt.createElement(s3,null,gt.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},gt.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),gt.createElement("circle",{cx:"12",cy:"12",r:"3"}))),"Review")),L?null:w||N?gt.createElement(ZC,{isReviewing:!1,isValidating:w,streamingStatus:F,issueCount:j,score:W,visualSimilarity:M,costUsd:K||N?.costUsd,inputTokens:ee||N?.inputTokens,outputTokens:fe||N?.outputTokens,cacheCreationTokens:N?.cacheCreationTokens,cacheReadTokens:N?.cacheReadTokens,durationSeconds:N?.reviewDurationMs?Math.round(N.reviewDurationMs/1e3):void 0}):null,xe.length>0&>.createElement(u3,null,gt.createElement(p3,{value:p||"",onChange:Ae,title:"Review history"},gt.createElement("option",{value:""},"Select a review..."),xe.map(ge=>{let tt=!!ge.parentReviewId,he=tt?" \u21B3 ":"\u25CF ",oe=tt&&ge.iterationNumber?`Iter ${ge.iterationNumber} - `:"",Y=ge.issuesCount??ge.issues?.length??0,me=ge.complianceScore??"--",ie=Pt(ge.modelId);return gt.createElement("option",{key:ge.id,value:ge.id},he,oe,pe(ge.createdAt)," - ",Y," issues (",me,"%)",ie?` \xB7 ${ie}`:"",ge.storyId?` \xB7 ${nn(ge.storyId)}`:"")}))))),!ae&&!i&>.createElement(c3,null,'\u26A0\uFE0F Figma mapping required. Use "Map to Figma" button to link this story to a Figma frame before reviewing.'))};import doe,{useState as foe}from"react";import{styled as i1}from"storybook/theming";var hoe=i1.div(({theme:e})=>({display:"flex",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"12px",gap:"4px"})),xoe=i1(yo)({padding:"8px 12px",fontSize:"12px"});import Soe,{useState as woe}from"react";import{styled as bh}from"storybook/theming";Ce();je();Oe();ct();var Eoe=bh.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px",backgroundColor:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",fontSize:"13px"})),Aoe=bh(Rr)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),Poe=bh.span(({theme:e})=>({color:e.textMutedColor,fontSize:"12px",flex:1}));import Boe from"react";import{styled as g3}from"storybook/theming";var zoe=g3.div(({theme:e})=>({border:`2px dashed ${e.appBorderColor}`,borderRadius:"8px",padding:"40px",textAlign:"center",marginBottom:"20px",backgroundColor:e.background.app}));Ce();import _oe from"react";import{styled as jr}from"storybook/theming";var joe=jr.div(({theme:e})=>({marginBottom:"16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content})),Hoe=jr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`})),Woe=jr.div({display:"flex",alignItems:"center",gap:"8px",flex:1}),Voe=jr.div(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Goe=jr.div(({theme:e})=>({flex:1,height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden",marginLeft:"12px"})),qoe=jr.div(({theme:e,progress:t})=>({height:"100%",backgroundColor:t===100?e.color.positive||"#10b981":e.color.secondary,width:`${t}%`,transition:"width 0.3s ease, background-color 0.3s ease"})),Yoe=jr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontWeight:500,minWidth:"40px",textAlign:"right"})),Koe=jr.div(({theme:e})=>({padding:"16px",backgroundColor:e.background.app,textAlign:"center"})),Xoe=jr.div(({theme:e})=>({display:"inline-block",width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:e.color.secondary,borderRadius:"50%",animation:"spin 0.8s linear infinite",marginLeft:"8px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),Qoe=jr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"}));Ce();import eie,{useState as tie}from"react";import{styled as Hr}from"storybook/theming";var oie=Hr.div(({theme:e})=>{let t=(e.base==="dark","102, 126, 234");return{padding:"10px 12px",backgroundColor:`rgba(${t}, 0.08)`,borderRadius:"6px",marginBottom:"16px",border:`1px solid rgba(${t}, 0.2)`}}),iie=Hr.div({display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",userSelect:"none"}),sie=Hr.div({display:"flex",alignItems:"center",gap:"8px"}),aie=Hr.span({fontSize:"12px",opacity:.7}),lie=Hr.span({fontSize:"13px",fontWeight:500}),cie=Hr.div(({score:e,theme:t})=>({display:"inline-block",padding:"4px 10px",borderRadius:"12px",fontSize:"13px",fontWeight:600,backgroundColor:e>=90?t.color.positive||"#10b981":e>=70?t.color.warning||"#f59e0b":t.color.negative||"#ef4444",color:t.color.inverseText})),uie=Hr.div({marginTop:"12px",fontSize:"11px"}),pie=Hr.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px",marginBottom:"8px"}),die=Hr.div(({status:e,theme:t})=>({display:"flex",alignItems:"center",gap:"4px",color:e==="success"?"inherit":e==="success"?t.color.positive||"#10b981":e==="warning"?t.color.warning||"#f59e0b":t.color.negative||"#ef4444"})),fie=Hr.span({fontSize:"12px"});Oe();je();import Qt from"react";import{styled as ss}from"storybook/theming";import Lr,{useEffect as nW}from"react";import{styled as Ea}from"storybook/theming";Ce();import di,{useState as P6}from"react";import{styled as Zi}from"storybook/theming";var s1={fontBase:'"Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontMono:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',sizeXs:"11px",sizeSm:"12px",sizeMd:"13px",sizeLg:"14px",sizeXl:"16px",weightRegular:400,weightMedium:500,weightBold:600};function a1(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var m3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,x3={};function yc(e,t){return((t||x3).jsx?h3:m3).test(e)}var y3=/[ \t\n\f\r]/g;function Sh(e){return typeof e=="object"?e.type==="text"?l1(e.value):!1:l1(e)}function l1(e){return e.replace(y3,"")===""}var ao=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ao.prototype.normal={};ao.prototype.property={};ao.prototype.space=void 0;function wh(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new ao(n,r,t)}function da(e){return e.toLowerCase()}var cn=class{constructor(t,n){this.attribute=n,this.property=t}};cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;var fa={};Se(fa,{boolean:()=>Ge,booleanish:()=>_t,commaOrSpaceSeparated:()=>Wn,commaSeparated:()=>No,number:()=>X,overloadedBoolean:()=>bc,spaceSeparated:()=>wt});var b3=0,Ge=ii(),_t=ii(),bc=ii(),X=ii(),wt=ii(),No=ii(),Wn=ii();function ii(){return 2**++b3}var vh=Object.keys(fa),si=class extends cn{constructor(t,n,r,o){let i=-1;if(super(t,n),c1(this,"space",o),typeof r=="number")for(;++i<vh.length;){let s=vh[i];c1(this,vh[i],(r&fa[s])===fa[s])}}};si.prototype.defined=!0;function c1(e,t,n){n&&(e[t]=n)}function gr(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let i=new si(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[da(r)]=r,n[da(i.attribute)]=r}return new ao(t,n,e.space)}var kh=gr({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:wt,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:X,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:wt,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:_t,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Sc(e,t){return t in e?e[t]:t}function wc(e,t){return Sc(e,t.toLowerCase())}var u1=gr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:No,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:wt,autoFocus:Ge,autoPlay:Ge,blocking:wt,capture:null,charSet:null,checked:Ge,cite:null,className:wt,cols:X,colSpan:null,content:null,contentEditable:_t,controls:Ge,controlsList:wt,coords:X|No,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:bc,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:wt,height:X,hidden:bc,high:X,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:wt,itemRef:wt,itemScope:Ge,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:X,pattern:null,ping:wt,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:wt,required:Ge,reversed:Ge,rows:X,rowSpan:X,sandbox:wt,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:_t,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:X,security:null,unselectable:null},space:"html",transform:wc});var p1=gr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wn,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:wt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:No,g2:No,glyphName:No,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wn,rev:Wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wn,requiredFeatures:Wn,requiredFonts:Wn,requiredFormats:Wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wn,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Sc});var Ch=gr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Th=gr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wc});var Ih=gr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Fh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var S3=/[A-Z]/g,d1=/-[a-z]/g,w3=/^data[-\w.:]+$/i;function Eh(e,t){let n=da(t),r=t,o=cn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&w3.test(t)){if(t.charAt(4)==="-"){let i=t.slice(5).replace(d1,k3);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=t.slice(4);if(!d1.test(i)){let s=i.replace(S3,v3);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=si}return new o(r,t)}function v3(e){return"-"+e.toLowerCase()}function k3(e){return e.charAt(1).toUpperCase()}var f1=wh([kh,u1,Ch,Th,Ih],"html"),vc=wh([kh,p1,Ch,Th,Ih],"svg");function g1(e){return e.join(" ").trim()}var A1=$a(T1(),1);var Cc=I1("end"),qi=I1("start");function I1(e){return t;function t(n){let r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Lh(e){let t=qi(e),n=Cc(e);if(t&&n)return{start:t,end:n}}function Oo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?F1(e.position):"start"in e||"end"in e?F1(e):"line"in e||"column"in e?Mh(e):""}function Mh(e){return E1(e&&e.line)+":"+E1(e&&e.column)}function F1(e){return Mh(e&&e.start)+"-"+Mh(e&&e.end)}function E1(e){return e&&typeof e=="number"?e:1}var Wt=class extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){let u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){let u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}let a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=Oo(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;var Bh={}.hasOwnProperty,K3=new Map,X3=/[A-Z]/g,Q3=new Set(["table","tbody","thead","tfoot","tr"]),J3=new Set(["td","th"]),P1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dh(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=sU(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=iU(n,t.jsx,t.jsxs)}let o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?vc:f1,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=L1(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function L1(e,t,n){if(t.type==="element")return Z3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return eU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return nU(e,t,n);if(t.type==="mdxjsEsm")return tU(e,t);if(t.type==="root")return rU(e,t,n);if(t.type==="text")return oU(e,t)}function Z3(e,t,n){let r=e.schema,o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=vc,e.schema=o),e.ancestors.push(t);let i=B1(e,t.tagName,!1),s=aU(e,t),a=zh(e,t);return Q3.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Sh(u):!0})),M1(e,s,i,t),Rh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function eU(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ma(e,t.position)}function tU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ma(e,t.position)}function nU(e,t,n){let r=e.schema,o=r;t.name==="svg"&&r.space==="html"&&(o=vc,e.schema=o),e.ancestors.push(t);let i=t.name===null?e.Fragment:B1(e,t.name,!0),s=lU(e,t),a=zh(e,t);return M1(e,s,i,t),Rh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function rU(e,t,n){let r={};return Rh(r,zh(e,t)),e.create(t,e.Fragment,r,n)}function oU(e,t){return t.value}function M1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Rh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function iU(e,t,n){return r;function r(o,i,s,a){let c=Array.isArray(s.children)?n:t;return a?c(i,s,a):c(i,s)}}function sU(e,t){return n;function n(r,o,i,s){let a=Array.isArray(i.children),u=qi(r);return t(o,i,s,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function aU(e,t){let n={},r,o;for(o in t.properties)if(o!=="children"&&Bh.call(t.properties,o)){let i=cU(e,o,t.properties[o]);if(i){let[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&J3.has(t.tagName)?r=a:n[s]=a}}if(r){let i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function lU(e,t){let n={};for(let r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){let i=r.data.estree.body[0];i.type;let s=i.expression;s.type;let a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ma(e,t.position);else{let o=r.name,i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){let a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else ma(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function zh(e,t){let n=[],r=-1,o=e.passKeys?new Map:K3;for(;++r<t.children.length;){let i=t.children[r],s;if(e.passKeys){let u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){let c=o.get(u)||0;s=u+"-"+c,o.set(u,c+1)}}let a=L1(e,i,s);a!==void 0&&n.push(a)}return n}function cU(e,t,n){let r=Eh(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?a1(n):g1(n)),r.property==="style"){let o=typeof n=="object"?n:uU(e,String(n));return e.stylePropertyNameCase==="css"&&(o=pU(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?Fh[r.property]||r.property:r.attribute,n]}}function uU(e,t){try{return(0,A1.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let r=n,o=new Wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=P1+"#cannot-parse-style-attribute",o}}function B1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){let o=t.split("."),i=-1,s;for(;++i<o.length;){let a=yc(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=s}else r=yc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){let o=r.value;return Bh.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);ma(e)}function ma(e,t){let n=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=P1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function pU(e){let t={},n;for(n in e)Bh.call(e,n)&&(t[dU(n)]=e[n]);return t}function dU(e){let t=e.replace(X3,fU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function fU(e){return"-"+e.toLowerCase()}var ha={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};import{Fragment as w6,jsx as v6,jsxs as k6}from"react/jsx-runtime";import{useEffect as Tde,useState as Ide}from"react";var gU={};function Nh(e,t){let n=t||gU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return R1(e,r,o)}function R1(e,t,n){if(mU(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return D1(e.children,t,n)}return Array.isArray(e)?D1(e,t,n):""}function D1(e,t,n){let r=[],o=-1;for(;++o<e.length;)r[o]=R1(e[o],t,n);return r.join("")}function mU(e){return!!(e&&typeof e=="object")}var z1=document.createElement("i");function Yi(e){let t="&"+e+";";z1.innerHTML=t;let n=z1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gn(e,t,n,r){let o=e.length,i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Fn(e,t){return e.length>0?(gn(e,e.length,0,t),e):t}var N1={}.hasOwnProperty;function O1(e){let t={},n=-1;for(;++n<e.length;)hU(t,e[n]);return t}function hU(e,t){let n;for(n in t){let o=(N1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],s;if(i)for(s in i){N1.call(o,s)||(o[s]=[]);let a=i[s];xU(o[s],Array.isArray(a)?a:a?[a]:[])}}}function xU(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);gn(e,0,0,r)}function Tc(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function lo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var tr=_o(/[A-Za-z]/),un=_o(/[\dA-Za-z]/),_1=_o(/[#-'*+\--9=?A-Z^-~]/);function xa(e){return e!==null&&(e<32||e===127)}var ya=_o(/\d/),$1=_o(/[\dA-Fa-f]/),U1=_o(/[!-/:-@[-`{-~]/);function ue(e){return e!==null&&e<-2}function Vt(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}var j1=_o(/\p{P}|\p{S}/u),H1=_o(/\s/);function _o(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mr(e){let t=[],n=-1,r=0,o=0;for(;++n<e.length;){let i=e.charCodeAt(n),s="";if(i===37&&un(e.charCodeAt(n+1))&&un(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){let a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){let o=r?r-1:Number.POSITIVE_INFINITY,i=0;return s;function s(u){return He(u)?(e.enter(n),a(u)):t(u)}function a(u){return He(u)&&i++<o?(e.consume(u),a):(e.exit(n),t(u))}}var W1={tokenize:yU};function yU(e){let t=e.attempt(this.parser.constructs.contentInitial,r,o),n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),qe(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){let u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ue(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}var G1={tokenize:bU},V1={tokenize:SU};function bU(e){let t=this,n=[],r=0,o,i,s;return a;function a(D){if(r<n.length){let R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,u,c)(D)}return c(D)}function u(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&I();let R=t.events.length,$=R,P;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){P=t.events[$][1].end;break}E(r);let z=R;for(;z<t.events.length;)t.events[z][1].end={...P},z++;return gn(t.events,$+1,0,t.events.slice(R)),t.events.length=z,c(D)}return a(D)}function c(D){if(r===n.length){if(!o)return f(D);if(o.currentConstruct&&o.currentConstruct.concrete)return g(D);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(V1,l,d)(D)}function l(D){return o&&I(),E(r),f(D)}function d(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(D)}function f(D){return t.containerState={},e.attempt(V1,p,g)(D)}function p(D){return r++,n.push([t.currentConstruct,t.containerState]),f(D)}function g(D){if(D===null){o&&I(),E(0),e.consume(D);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),k(D)}function k(D){if(D===null){T(e.exit("chunkFlow"),!0),E(0),e.consume(D);return}return ue(D)?(e.consume(D),T(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(D),k)}function T(D,R){let $=t.sliceStream(D);if(R&&$.push(null),D.previous=i,i&&(i.next=D),i=D,o.defineSkip(D.start),o.write($),t.parser.lazy[D.start.line]){let P=o.events.length;for(;P--;)if(o.events[P][1].start.offset<s&&(!o.events[P][1].end||o.events[P][1].end.offset>s))return;let z=t.events.length,x=z,w,v;for(;x--;)if(t.events[x][0]==="exit"&&t.events[x][1].type==="chunkFlow"){if(w){v=t.events[x][1].end;break}w=!0}for(E(r),P=z;P<t.events.length;)t.events[P][1].end={...v},P++;gn(t.events,x+1,0,t.events.slice(z)),t.events.length=P}}function E(D){let R=n.length;for(;R-- >D;){let $=n[R];t.containerState=$[1],$[0].exit.call(t,e)}n.length=D}function I(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function SU(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Oh(e){if(e===null||Vt(e)||H1(e))return 1;if(j1(e))return 2}function Ki(e,t,n){let r=[],o=-1;for(;++o<e.length;){let i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}var ba={name:"attention",resolveAll:wU,tokenize:vU};function wU(e,t){let n=-1,r,o,i,s,a,u,c,l;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};q1(d,-u),q1(f,u),s={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:u>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Fn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Fn(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=Fn(c,Ki(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Fn(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(l=2,c=Fn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,gn(e,r-1,n-r+3,c),n=r+c.length-l-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function vU(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Oh(r),i;return s;function s(u){return i=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===i)return e.consume(u),a;let c=e.exit("attentionSequence"),l=Oh(u),d=!l||l===2&&o||n.includes(u),f=!o||o===2&&l||n.includes(r);return c._open=!!(i===42?d:d&&(o||!f)),c._close=!!(i===42?f:f&&(l||!d)),t(u)}}function q1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var _h={name:"autolink",tokenize:kU};function kU(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return tr(p)?(e.consume(p),s):p===64?n(p):c(p)}function s(p){return p===43||p===45||p===46||un(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||un(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||xa(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),l):_1(p)?(e.consume(p),c):n(p)}function l(p){return un(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,l):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||un(p))&&r++<63){let g=p===45?f:d;return e.consume(p),g}return n(p)}}var $o={partial:!0,tokenize:CU};function CU(e,t,n){return r;function r(i){return He(i)?qe(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ue(i)?t(i):n(i)}}var Ic={continuation:{tokenize:IU},exit:FU,name:"blockQuote",tokenize:TU};function TU(e,t,n){let r=this;return o;function o(s){if(s===62){let a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return He(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function IU(e,t,n){let r=this;return o;function o(s){return He(s)?qe(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Ic,t,n)(s)}}function FU(e){e.exit("blockQuote")}var Fc={name:"characterEscape",tokenize:EU};function EU(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return U1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}var Ec={name:"characterReference",tokenize:AU};function AU(e,t,n){let r=this,o=0,i,s;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=un,l(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=$1,l):(e.enter("characterReferenceValue"),i=7,s=ya,l(d))}function l(d){if(d===59&&o){let f=e.exit("characterReferenceValue");return s===un&&!Yi(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(d)&&o++<i?(e.consume(d),l):n(d)}}var Y1={partial:!0,tokenize:LU},Ac={concrete:!0,name:"codeFenced",tokenize:PU};function PU(e,t,n){let r=this,o={partial:!0,tokenize:$},i=0,s=0,a;return u;function u(P){return c(P)}function c(P){let z=r.events[r.events.length-1];return i=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,a=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(P)}function l(P){return P===a?(s++,e.consume(P),l):s<3?n(P):(e.exit("codeFencedFenceSequence"),He(P)?qe(e,d,"whitespace")(P):d(P))}function d(P){return P===null||ue(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(Y1,k,R)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(P))}function f(P){return P===null||ue(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(P)):He(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,p,"whitespace")(P)):P===96&&P===a?n(P):(e.consume(P),f)}function p(P){return P===null||ue(P)?d(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(P))}function g(P){return P===null||ue(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(P)):P===96&&P===a?n(P):(e.consume(P),g)}function k(P){return e.attempt(o,R,T)(P)}function T(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),E}function E(P){return i>0&&He(P)?qe(e,I,"linePrefix",i+1)(P):I(P)}function I(P){return P===null||ue(P)?e.check(Y1,k,R)(P):(e.enter("codeFlowValue"),D(P))}function D(P){return P===null||ue(P)?(e.exit("codeFlowValue"),I(P)):(e.consume(P),D)}function R(P){return e.exit("codeFenced"),t(P)}function $(P,z,x){let w=0;return v;function v(b){return P.enter("lineEnding"),P.consume(b),P.exit("lineEnding"),C}function C(b){return P.enter("codeFencedFence"),He(b)?qe(P,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):m(b)}function m(b){return b===a?(P.enter("codeFencedFenceSequence"),F(b)):x(b)}function F(b){return b===a?(w++,P.consume(b),F):w>=s?(P.exit("codeFencedFenceSequence"),He(b)?qe(P,S,"whitespace")(b):S(b)):x(b)}function S(b){return b===null||ue(b)?(P.exit("codeFencedFence"),z(b)):x(b)}}}function LU(e,t,n){let r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}var Sa={name:"codeIndented",tokenize:BU},MU={partial:!0,tokenize:DU};function BU(e,t,n){let r=this;return o;function o(c){return e.enter("codeIndented"),qe(e,i,"linePrefix",5)(c)}function i(c){let l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?u(c):ue(c)?e.attempt(MU,s,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ue(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),t(c)}}function DU(e,t,n){let r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):ue(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):qe(e,i,"linePrefix",5)(s)}function i(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):ue(s)?o(s):n(s)}}var $h={name:"codeText",previous:zU,resolve:RU,tokenize:NU};function RU(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function zU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NU(e,t,n){let r=this,o=0,i,s;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),u(f)}function u(f){return f===96?(e.consume(f),o++,u):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(s=e.enter("codeTextSequence"),i=0,d(f)):ue(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),l(f))}function l(f){return f===null||f===32||f===96||ue(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),l)}function d(f){return f===96?(e.consume(f),i++,d):i===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",l(f))}}var Pc=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){let r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){let o=n||0;this.setCursor(Math.trunc(t));let i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&wa(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),wa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wa(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let n=this.left.splice(t,Number.POSITIVE_INFINITY);wa(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);wa(this.left,n.reverse())}}};function wa(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lc(e){let t={},n=-1,r,o,i,s,a,u,c,l=new Pc(e);for(;++n<l.length;){for(;n in t;)n=t[n];if(r=l.get(n),n&&r[1].type==="chunkFlow"&&l.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,OU(l,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=l.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(l.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(r[1].end={...l.get(o)[1].start},a=l.slice(o,n),a.unshift(r),l.splice(o,n-o+1,a))}}return gn(e,0,Number.POSITIVE_INFINITY,l.slice(0)),!c}function OU(e,t){let n=e.get(t)[1],r=e.get(t)[2],o=t-1,i=[],s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));let a=s.events,u=[],c={},l,d,f=-1,p=n,g=0,k=0,T=[k];for(;p;){for(;e.get(++o)[1]!==p;);i.push(o),p._tokenizer||(l=r.sliceStream(p),p.next||l.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(l),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(k=f+1,T.push(k),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):T.pop(),f=T.length;f--;){let E=a.slice(T[f],T[f+1]),I=i.pop();u.push([I,I+E.length-1]),e.splice(I,2,E)}for(u.reverse(),f=-1;++f<u.length;)c[g+u[f][0]]=g+u[f][1],g+=u[f][1]-u[f][0]-1;return c}var Uh={resolve:$U,tokenize:UU},_U={partial:!0,tokenize:jU};function $U(e){return Lc(e),e}function UU(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):ue(a)?e.check(_U,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function jU(e,t,n){let r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),qe(e,i,"linePrefix")}function i(s){if(s===null||ue(s))return n(s);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Mc(e,t,n,r,o,i,s,a,u){let c=u||Number.POSITIVE_INFINITY,l=0;return d;function d(E){return E===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(E),e.exit(i),f):E===null||E===32||E===41||xa(E)?n(E):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),k(E))}function f(E){return E===62?(e.enter(i),e.consume(E),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(a),f(E)):E===null||E===60||ue(E)?n(E):(e.consume(E),E===92?g:p)}function g(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function k(E){return!l&&(E===null||E===41||Vt(E))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(E)):l<c&&E===40?(e.consume(E),l++,k):E===41?(e.consume(E),l--,k):E===null||E===32||E===40||xa(E)?n(E):(e.consume(E),E===92?T:k)}function T(E){return E===40||E===41||E===92?(e.consume(E),k):k(E)}}function Bc(e,t,n,r,o,i){let s=this,a=0,u;return c;function c(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),l}function l(p){return a>999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):ue(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||ue(p)||a++>999?(e.exit("chunkString"),l(p)):(e.consume(p),u||(u=!He(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function Dc(e,t,n,r,o,i){let s;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(o),e.consume(f),e.exit(o),s=f===40?41:f,u):n(f)}function u(f){return f===s?(e.enter(o),e.consume(f),e.exit(o),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===s?(e.exit(i),u(s)):f===null?n(f):ue(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),qe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(f))}function l(f){return f===s||f===null||ue(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:l)}function d(f){return f===s||f===92?(e.consume(f),l):l(f)}}function li(e,t){let n;return r;function r(o){return ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):He(o)?qe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var jh={name:"definition",tokenize:WU},HU={partial:!0,tokenize:VU};function WU(e,t,n){let r=this,o;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Bc.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=lo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return Vt(p)?li(e,c)(p):c(p)}function c(p){return Mc(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function l(p){return e.attempt(HU,d,d)(p)}function d(p){return He(p)?qe(e,f,"whitespace")(p):f(p)}function f(p){return p===null||ue(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function VU(e,t,n){return r;function r(a){return Vt(a)?li(e,o)(a):n(a)}function o(a){return Dc(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return He(a)?qe(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ue(a)?t(a):n(a)}}var Hh={name:"hardBreakEscape",tokenize:GU};function GU(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ue(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}var Wh={name:"headingAtx",resolve:qU,tokenize:YU};function qU(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},gn(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function YU(e,t,n){let r=0;return o;function o(l){return e.enter("atxHeading"),i(l)}function i(l){return e.enter("atxHeadingSequence"),s(l)}function s(l){return l===35&&r++<6?(e.consume(l),s):l===null||Vt(l)?(e.exit("atxHeadingSequence"),a(l)):n(l)}function a(l){return l===35?(e.enter("atxHeadingSequence"),u(l)):l===null||ue(l)?(e.exit("atxHeading"),t(l)):He(l)?qe(e,a,"whitespace")(l):(e.enter("atxHeadingText"),c(l))}function u(l){return l===35?(e.consume(l),u):(e.exit("atxHeadingSequence"),a(l))}function c(l){return l===null||l===35||Vt(l)?(e.exit("atxHeadingText"),a(l)):(e.consume(l),c)}}var K1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Vh=["pre","script","style","textarea"];var Gh={concrete:!0,name:"htmlFlow",resolveTo:QU,tokenize:JU},KU={partial:!0,tokenize:e5},XU={partial:!0,tokenize:ZU};function QU(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function JU(e,t,n){let r=this,o,i,s,a,u;return c;function c(M){return l(M)}function l(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),i=!0,k):M===63?(e.consume(M),o=3,r.interrupt?t:h):tr(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function f(M){return M===45?(e.consume(M),o=2,p):M===91?(e.consume(M),o=5,a=0,g):tr(M)?(e.consume(M),o=4,r.interrupt?t:h):n(M)}function p(M){return M===45?(e.consume(M),r.interrupt?t:h):n(M)}function g(M){let K="CDATA[";return M===K.charCodeAt(a++)?(e.consume(M),a===K.length?r.interrupt?t:m:g):n(M)}function k(M){return tr(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function T(M){if(M===null||M===47||M===62||Vt(M)){let K=M===47,ee=s.toLowerCase();return!K&&!i&&Vh.includes(ee)?(o=1,r.interrupt?t(M):m(M)):K1.includes(s.toLowerCase())?(o=6,K?(e.consume(M),E):r.interrupt?t(M):m(M)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?I(M):D(M))}return M===45||un(M)?(e.consume(M),s+=String.fromCharCode(M),T):n(M)}function E(M){return M===62?(e.consume(M),r.interrupt?t:m):n(M)}function I(M){return He(M)?(e.consume(M),I):v(M)}function D(M){return M===47?(e.consume(M),v):M===58||M===95||tr(M)?(e.consume(M),R):He(M)?(e.consume(M),D):v(M)}function R(M){return M===45||M===46||M===58||M===95||un(M)?(e.consume(M),R):$(M)}function $(M){return M===61?(e.consume(M),P):He(M)?(e.consume(M),$):D(M)}function P(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),u=M,z):He(M)?(e.consume(M),P):x(M)}function z(M){return M===u?(e.consume(M),u=null,w):M===null||ue(M)?n(M):(e.consume(M),z)}function x(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Vt(M)?$(M):(e.consume(M),x)}function w(M){return M===47||M===62||He(M)?D(M):n(M)}function v(M){return M===62?(e.consume(M),C):n(M)}function C(M){return M===null||ue(M)?m(M):He(M)?(e.consume(M),C):n(M)}function m(M){return M===45&&o===2?(e.consume(M),A):M===60&&o===1?(e.consume(M),L):M===62&&o===4?(e.consume(M),j):M===63&&o===3?(e.consume(M),h):M===93&&o===5?(e.consume(M),N):ue(M)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(KU,W,F)(M)):M===null||ue(M)?(e.exit("htmlFlowData"),F(M)):(e.consume(M),m)}function F(M){return e.check(XU,S,W)(M)}function S(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),b}function b(M){return M===null||ue(M)?F(M):(e.enter("htmlFlowData"),m(M))}function A(M){return M===45?(e.consume(M),h):m(M)}function L(M){return M===47?(e.consume(M),s="",B):m(M)}function B(M){if(M===62){let K=s.toLowerCase();return Vh.includes(K)?(e.consume(M),j):m(M)}return tr(M)&&s.length<8?(e.consume(M),s+=String.fromCharCode(M),B):m(M)}function N(M){return M===93?(e.consume(M),h):m(M)}function h(M){return M===62?(e.consume(M),j):M===45&&o===2?(e.consume(M),h):m(M)}function j(M){return M===null||ue(M)?(e.exit("htmlFlowData"),W(M)):(e.consume(M),j)}function W(M){return e.exit("htmlFlow"),t(M)}}function ZU(e,t,n){let r=this;return o;function o(s){return ue(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function e5(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt($o,t,n)}}var qh={name:"htmlText",tokenize:t5};function t5(e,t,n){let r=this,o,i,s;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),$):h===63?(e.consume(h),D):tr(h)?(e.consume(h),x):n(h)}function c(h){return h===45?(e.consume(h),l):h===91?(e.consume(h),i=0,g):tr(h)?(e.consume(h),I):n(h)}function l(h){return h===45?(e.consume(h),p):n(h)}function d(h){return h===null?n(h):h===45?(e.consume(h),f):ue(h)?(s=d,L(h)):(e.consume(h),d)}function f(h){return h===45?(e.consume(h),p):d(h)}function p(h){return h===62?A(h):h===45?f(h):d(h)}function g(h){let j="CDATA[";return h===j.charCodeAt(i++)?(e.consume(h),i===j.length?k:g):n(h)}function k(h){return h===null?n(h):h===93?(e.consume(h),T):ue(h)?(s=k,L(h)):(e.consume(h),k)}function T(h){return h===93?(e.consume(h),E):k(h)}function E(h){return h===62?A(h):h===93?(e.consume(h),E):k(h)}function I(h){return h===null||h===62?A(h):ue(h)?(s=I,L(h)):(e.consume(h),I)}function D(h){return h===null?n(h):h===63?(e.consume(h),R):ue(h)?(s=D,L(h)):(e.consume(h),D)}function R(h){return h===62?A(h):D(h)}function $(h){return tr(h)?(e.consume(h),P):n(h)}function P(h){return h===45||un(h)?(e.consume(h),P):z(h)}function z(h){return ue(h)?(s=z,L(h)):He(h)?(e.consume(h),z):A(h)}function x(h){return h===45||un(h)?(e.consume(h),x):h===47||h===62||Vt(h)?w(h):n(h)}function w(h){return h===47?(e.consume(h),A):h===58||h===95||tr(h)?(e.consume(h),v):ue(h)?(s=w,L(h)):He(h)?(e.consume(h),w):A(h)}function v(h){return h===45||h===46||h===58||h===95||un(h)?(e.consume(h),v):C(h)}function C(h){return h===61?(e.consume(h),m):ue(h)?(s=C,L(h)):He(h)?(e.consume(h),C):w(h)}function m(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),o=h,F):ue(h)?(s=m,L(h)):He(h)?(e.consume(h),m):(e.consume(h),S)}function F(h){return h===o?(e.consume(h),o=void 0,b):h===null?n(h):ue(h)?(s=F,L(h)):(e.consume(h),F)}function S(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||Vt(h)?w(h):(e.consume(h),S)}function b(h){return h===47||h===62||Vt(h)?w(h):n(h)}function A(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function L(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),B}function B(h){return He(h)?qe(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):N(h)}function N(h){return e.enter("htmlTextData"),s(h)}}var ci={name:"labelEnd",resolveAll:i5,resolveTo:s5,tokenize:a5},n5={tokenize:l5},r5={tokenize:c5},o5={tokenize:u5};function i5(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&gn(e,0,e.length,n),e}function s5(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);let u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},l={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",u,t],["enter",c,t]],a=Fn(a,e.slice(i+1,i+r+3)),a=Fn(a,[["enter",l,t]]),a=Fn(a,Ki(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=Fn(a,[["exit",l,t],e[s-2],e[s-1],["exit",c,t]]),a=Fn(a,e.slice(s+1)),a=Fn(a,[["exit",u,t]]),gn(e,i,e.length,a),e}function a5(e,t,n){let r=this,o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(f){return i?i._inactive?d(f):(s=r.parser.defined.includes(lo(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),u):n(f)}function u(f){return f===40?e.attempt(n5,l,s?l:d)(f):f===91?e.attempt(r5,l,s?c:d)(f):s?l(f):d(f)}function c(f){return e.attempt(o5,l,d)(f)}function l(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function l5(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),o}function o(d){return Vt(d)?li(e,i)(d):i(d)}function i(d){return d===41?l(d):Mc(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Vt(d)?li(e,u)(d):l(d)}function a(d){return n(d)}function u(d){return d===34||d===39||d===40?Dc(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):l(d)}function c(d){return Vt(d)?li(e,l)(d):l(d)}function l(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function c5(e,t,n){let r=this;return o;function o(a){return Bc.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(lo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function u5(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}var Yh={name:"labelStartImage",resolveAll:ci.resolveAll,tokenize:p5};function p5(e,t,n){let r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}var Kh={name:"labelStartLink",resolveAll:ci.resolveAll,tokenize:d5};function d5(e,t,n){let r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}var va={name:"lineEnding",tokenize:f5};function f5(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}var ui={name:"thematicBreak",tokenize:g5};function g5(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||ue(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===o?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),He(c)?qe(e,a,"whitespace")(c):a(c))}}var Sn={continuation:{tokenize:y5},exit:S5,name:"list",tokenize:x5},m5={partial:!0,tokenize:w5},h5={partial:!0,tokenize:b5};function x5(e,t,n){let r=this,o=r.events[r.events.length-1],i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(p){let g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:ya(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ui,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return ya(p)&&++s<10?(e.consume(p),u):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check($o,r.interrupt?n:l,e.attempt(m5,f,d))}function l(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function d(p){return He(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function y5(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check($o,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!He(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(h5,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(Sn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function b5(e,t,n){let r=this;return qe(e,o,"listItemIndent",r.containerState.size+1);function o(i){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function S5(e){e.exit(this.containerState.type)}function w5(e,t,n){let r=this;return qe(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){let s=r.events[r.events.length-1];return!He(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}var Rc={name:"setextUnderline",resolveTo:v5,tokenize:k5};function v5(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);let s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function k5(e,t,n){let r=this,o;return i;function i(c){let l=r.events.length,d;for(;l--;)if(r.events[l][1].type!=="lineEnding"&&r.events[l][1].type!=="linePrefix"&&r.events[l][1].type!=="content"){d=r.events[l][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),o=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),He(c)?qe(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||ue(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}var X1={tokenize:C5};function C5(e){let t=this,n=e.attempt($o,r,e.attempt(this.parser.constructs.flowInitial,o,qe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Uh,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var Q1={resolveAll:tT()},J1=eT("string"),Z1=eT("text");function eT(e){return{resolveAll:tT(e==="text"?T5:void 0),tokenize:t};function t(n){let r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(l){return c(l)?i(l):a(l)}function a(l){if(l===null){n.consume(l);return}return n.enter("data"),n.consume(l),u}function u(l){return c(l)?(n.exit("data"),i(l)):(n.consume(l),u)}function c(l){if(l===null)return!0;let d=o[l],f=-1;if(d)for(;++f<d.length;){let p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function tT(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function T5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){let r=e[n-1][1],o=t.sliceStream(r),i=o.length,s=-1,a=0,u;for(;i--;){let c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)u=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){let c={type:n===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}var Xh={};Se(Xh,{attentionMarkers:()=>B5,contentInitial:()=>F5,disable:()=>D5,document:()=>I5,flow:()=>A5,flowInitial:()=>E5,insideSpan:()=>M5,string:()=>P5,text:()=>L5});var I5={42:Sn,43:Sn,45:Sn,48:Sn,49:Sn,50:Sn,51:Sn,52:Sn,53:Sn,54:Sn,55:Sn,56:Sn,57:Sn,62:Ic},F5={91:jh},E5={[-2]:Sa,[-1]:Sa,32:Sa},A5={35:Wh,42:ui,45:[Rc,ui],60:Gh,61:Rc,95:ui,96:Ac,126:Ac},P5={38:Ec,92:Fc},L5={[-5]:va,[-4]:va,[-3]:va,33:Yh,38:Ec,42:ba,60:[_h,qh],91:Kh,92:[Hh,Fc],93:ci,95:ba,96:$h},M5={null:[ba,Q1]},B5={null:[42,95]},D5={null:[]};function nT(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},o={},i=[],s=[],a=[],u=!0,c={attempt:w(z),check:w(x),consume:R,enter:$,exit:P,interrupt:w(x,{interrupt:!0})},l={code:null,containerState:{},defineSkip:E,events:[],now:T,parser:e,previous:null,sliceSerialize:g,sliceStream:k,write:p},d=t.tokenize.call(l,c),f;return t.resolveAll&&i.push(t),l;function p(F){return s=Fn(s,F),I(),s[s.length-1]!==null?[]:(v(t,0),l.events=Ki(i,l.events,l),l.events)}function g(F,S){return z5(k(F),S)}function k(F){return R5(s,F)}function T(){let{_bufferIndex:F,_index:S,line:b,column:A,offset:L}=r;return{_bufferIndex:F,_index:S,line:b,column:A,offset:L}}function E(F){o[F.line]=F.column,m()}function I(){let F;for(;r._index<s.length;){let S=s[r._index];if(typeof S=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<S.length;)D(S.charCodeAt(r._bufferIndex));else D(S)}}function D(F){u=void 0,f=F,d=d(F)}function R(F){ue(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,m()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=F,u=!0}function $(F,S){let b=S||{};return b.type=F,b.start=T(),l.events.push(["enter",b,l]),a.push(b),b}function P(F){let S=a.pop();return S.end=T(),l.events.push(["exit",S,l]),S}function z(F,S){v(F,S.from)}function x(F,S){S.restore()}function w(F,S){return b;function b(A,L,B){let N,h,j,W;return Array.isArray(A)?K(A):"tokenize"in A?K([A]):M(A);function M(ae){return Ke;function Ke(be){let Te=be!==null&&ae[be],te=be!==null&&ae.null,Me=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(te)?te:te?[te]:[]];return K(Me)(be)}}function K(ae){return N=ae,h=0,ae.length===0?B:ee(ae[h])}function ee(ae){return Ke;function Ke(be){return W=C(),j=ae,ae.partial||(l.currentConstruct=ae),ae.name&&l.parser.constructs.disable.null.includes(ae.name)?xe(be):ae.tokenize.call(S?Object.assign(Object.create(l),S):l,c,fe,xe)(be)}}function fe(ae){return u=!0,F(j,W),L}function xe(ae){return u=!0,W.restore(),++h<N.length?ee(N[h]):B}}}function v(F,S){F.resolveAll&&!i.includes(F)&&i.push(F),F.resolve&&gn(l.events,S,l.events.length-S,F.resolve(l.events.slice(S),l)),F.resolveTo&&(l.events=F.resolveTo(l.events,l))}function C(){let F=T(),S=l.previous,b=l.currentConstruct,A=l.events.length,L=Array.from(a);return{from:A,restore:B};function B(){r=F,l.previous=S,l.currentConstruct=b,l.events.length=A,a=L,m()}}function m(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function R5(e,t){let n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex,s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function z5(e,t){let n=-1,r=[],o;for(;++n<e.length;){let i=e[n],s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
81
|
+
`,Xre=tn.div(({theme:e})=>({width:"12px",height:"12px",borderRadius:"50%",border:"2px solid transparent",borderTopColor:e.textMutedColor,animation:`${Q4} 0.8s linear infinite`,flexShrink:0})),e1=tn.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.5}px`,padding:`${e.layoutMargin*.3}px ${e.layoutMargin*.9}px`,borderRadius:e.appBorderRadius*2,backgroundColor:e.base==="dark"?"rgba(220, 38, 38, 0.18)":"#fee2e2",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.negative||"#dc2626",whiteSpace:"nowrap"})),J4=tn.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:`${e.layoutMargin*.5}px`,padding:`${e.layoutMargin*.3}px ${e.layoutMargin*.9}px`,borderRadius:e.appBorderRadius*2,backgroundColor:e.base==="dark"?"rgba(22, 163, 74, 0.18)":"#dcfce7",fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:e.color.positive||"#16a34a",whiteSpace:"nowrap",position:"relative",overflow:"visible"})),Qre=tn.span(({delay:e,left:t,color:n,size:r})=>({position:"absolute",top:"-10px",left:`${t}%`,width:`${r}px`,height:`${r}px`,backgroundColor:n,borderRadius:r>6?"50%":"2px",animation:`${X4} 2.5s ease-out ${e}s forwards`,pointerEvents:"none",zIndex:1e3}));var ua=tn.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"14px",fontWeight:300})),pa=tn.span(({theme:e,color:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",fontWeight:500,color:t??e.color.mediumdark,whiteSpace:"nowrap"})),t1=tn.span(({theme:e,color:t})=>({fontSize:"12px",color:t??e.color.mediumdark})),da=tn.span(({color:e})=>({fontWeight:700,color:e})),Z4=tn.div(({tint:e,theme:t})=>({display:"inline-flex",alignItems:"center",gap:`${t.layoutMargin*.6}px`,padding:`${t.layoutMargin*.3}px ${t.layoutMargin}px`,borderRadius:t.appBorderRadius*2,backgroundColor:`${e}1a`,border:`1px solid ${e}33`,"& .score-label":{fontSize:t.typography.size.s1,color:t.textMutedColor},"& .score-value":{fontFamily:t.typography.fonts.mono,fontSize:t.typography.size.s2,fontWeight:t.typography.weight.bold,color:e,lineHeight:1},"& .score-dot":{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e}})),Jre=tn.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"12px"})),Zre=tn.span(({color:e=se})=>({display:"inline-block",fontSize:"12px",color:e,animation:`${q4} 1.2s ease-in-out infinite`,marginRight:"4px"})),eoe=tn.span(({theme:e,variant:t="muted"})=>({fontSize:"12px",fontWeight:700,color:(()=>{switch(t){case"issues":return se;case"score-high":return"#16a34a";case"score-medium":return"#ca8a04";case"score-low":return"#dc2626";case"cost":return"#7c3aed";case"tokens":return e.color.mediumdark;case"analyzing":return se;case"verifying":return"#7c3aed";default:return e.color.mediumdark}})(),whiteSpace:"nowrap",...t==="analyzing"||t==="verifying"?{animation:`${K4} 1.5s ease-in-out infinite`}:{}})),toe=tn.span(({theme:e})=>({fontSize:"12px",fontWeight:400,color:e.color.mediumdark})),noe=tn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark,fontWeight:400})),e3=tn.span({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",animation:`${Y4} 1.2s linear infinite`,flexShrink:0}),t3=({color:e=se})=>ze.createElement(e3,null,ze.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},Array.from({length:8}).map((t,n)=>{let o=n*360/8*Math.PI/180,i=12+Math.cos(o)*4,s=12+Math.sin(o)*4,a=12+Math.cos(o)*10,u=12+Math.sin(o)*10;return ze.createElement("line",{key:n,x1:i,y1:s,x2:a,y2:u,stroke:e,strokeWidth:2,strokeLinecap:"round",opacity:.3+n/8*.7})}))),roe=tn.span(({color:e="#6b7280"})=>({fontSize:"12px",fontWeight:500,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",animation:`${n1} 0.3s ease-out`}));function n3(e){let[t,n]=V4(0);return G4(()=>{if(!e){n(0);return}let r=setInterval(()=>{n(o=>o+1)},1e3);return()=>clearInterval(r)},[e]),t}var r1=({isReviewing:e,isValidating:t,streamingStatus:n,issueCount:r=0,score:o,visualSimilarity:i,costUsd:s,inputTokens:a,outputTokens:u,showTimer:c=!0,cacheCreationTokens:l,cacheReadTokens:d,durationSeconds:g})=>{let p=n3(e||t),{featureFlags:f}=ce(),k=f.showCosts,T=3.65,E=P=>P<.01?`$${P.toFixed(4)}`:P<.1?`$${P.toFixed(3)}`:`$${P.toFixed(2)}`,I=P=>{let z=P*T;return z<.01?`\u20AA${z.toFixed(4)}`:z<.1?`\u20AA${z.toFixed(3)}`:`\u20AA${z.toFixed(2)}`},D=P=>P>=1e3?`${(P/1e3).toFixed(1)}K`:P.toString(),R=P=>P>=80?"score-high":P>=50?"score-medium":"score-low",$=P=>P>=80?"high":P>=50?"medium":"low";if(e)return ze.createElement(xh,null,ze.createElement("span",{style:{fontSize:"12px",color:"#9ca3af"}},p,"s \xB7 Esc to stop"));if(t)return ze.createElement(xh,null,ze.createElement(e1,null,ze.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ze.createElement(ua,null,"|"),ze.createElement(pa,null,ze.createElement(t3,{color:"#7c3aed"}),ze.createElement(da,{color:"#7c3aed"},"Verifying...")),c&&ze.createElement(ze.Fragment,null,ze.createElement(ua,null,"|"),ze.createElement(pa,null,ze.createElement("span",{style:{color:"#6b7280"}},p,"s"))));if(r>0||o!==void 0){let P=(a||0)+(u||0),z=(d||0)>0,x=z&&a?Math.round(d/a*100):0,w=Math.max(o??0,i??0),v=m=>m>=80?"#16a34a":m>=50?"#ca8a04":"#dc2626",C=m=>m>=100?"\u25CF":m>=50?"\u25D0":"\u25CB";return ze.createElement(xh,null,r===0?ze.createElement(J4,null,ze.createElement("span",null,"\u2713"),"Perfect!"):ze.createElement(e1,null,ze.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ze.createElement(Z4,{tint:v(w),title:`MQM compliance: ${o??0}% | Visual similarity: ${i??0}%`},ze.createElement("span",{className:"score-dot"}),ze.createElement("span",{className:"score-label"},"Score"),ze.createElement("span",{className:"score-value"},w)),k&&s!==void 0&&s>0&&ze.createElement(ze.Fragment,null,ze.createElement(ua,null,"|"),ze.createElement(pa,null,ze.createElement(da,{color:"#16a34a"},E(s)),ze.createElement("span",{style:{color:"#6b7280"}},"/"),ze.createElement(da,{color:"#16a34a"},I(s)))),k&&P>0&&ze.createElement(ze.Fragment,null,ze.createElement(ua,null,"|"),ze.createElement(pa,{title:`Input: ${a?.toLocaleString()||0} \xB7 Output: ${u?.toLocaleString()||0}${z?` \xB7 Cached: ${d?.toLocaleString()}`:""}`},ze.createElement(t1,{color:"#7c3aed"},"#"),ze.createElement(da,{color:"#7c3aed"},D(P)),ze.createElement("span",{style:{color:"#6b7280"}},"tokens"),z&&ze.createElement("span",{style:{color:"#16a34a",marginLeft:"4px"}},"\u26A1",x,"%"))),g!==void 0&&g>0&&ze.createElement(ze.Fragment,null,ze.createElement(ua,null,"|"),ze.createElement(pa,null,ze.createElement(t1,{color:"#6b7280"},"\u23F1"),ze.createElement(da,{color:"#6b7280"},g,"s"))))}return null};var a3=Hn.div({display:"flex",flexDirection:"column",gap:"12px",marginBottom:"16px"}),goe=Hn.div({display:"flex",gap:"8px",alignItems:"center"}),l3=s3({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}),c3=Hn.span({display:"inline-block",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.35)",borderTopColor:"#ffffff",animation:`${l3} 0.8s linear infinite`,marginRight:"8px",verticalAlign:"middle"}),u3=Hn.span({display:"inline-flex",alignItems:"center",marginRight:"8px","& svg":{width:"16px",height:"16px"}}),p3=Hn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin}px`,padding:`${e.layoutMargin*.8}px ${e.layoutMargin*1.2}px`,borderRadius:e.appBorderRadius*2,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)",flexWrap:"wrap"})),d3=Hn.button(({theme:e,variant:t="orange",disabled:n})=>{let r={green:n?e.textMutedColor:e.color.positive||"#10b981",purple:n?e.textMutedColor:"#7c3aed",yellow:n?e.textMutedColor:"#c4b5fd",orange:n?e.textMutedColor:ja},o=t==="purple"||t==="yellow"?"124, 58, 237":"255, 107, 53";return{width:"auto",backgroundColor:r[t],color:e.color.inverseText,border:"none",padding:`${e.layoutMargin*.7}px ${e.layoutMargin*1.4}px`,fontSize:e.typography.size.s2,fontWeight:e.typography.weight.bold,borderRadius:e.appBorderRadius,cursor:n?"not-allowed":"pointer",opacity:n?.6:1,whiteSpace:"nowrap",transition:"all 0.2s",boxShadow:n?"none":`0 2px 6px rgba(${o}, 0.3)`,flexShrink:0,"&:hover":{opacity:n?.6:.9,transform:n?"none":"translateY(-1px)",boxShadow:n?"none":`0 4px 10px rgba(${o}, 0.4)`}}}),g3=Hn.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",color:e.color.warning||"#f59e0b",display:"flex",alignItems:"center",gap:"6px"})),f3=Hn.div({marginLeft:"auto",display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",minWidth:0}),m3=Hn(hn)({width:"auto",minWidth:"180px",maxWidth:"260px"}),h3=Hn.div({display:"flex",gap:"16px",alignItems:"center",marginTop:"4px"}),o1=Hn.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.defaultText,cursor:"pointer",userSelect:"none"})),i1=Hn.div(({theme:e,checked:t})=>({width:"32px",height:"18px",borderRadius:"9px",backgroundColor:t?ja:e.appBorderColor||"#d1d5db",position:"relative",transition:"background-color 0.2s ease",flexShrink:0})),s1=Hn.div(({checked:e})=>({width:"14px",height:"14px",borderRadius:"50%",backgroundColor:"#fff",position:"absolute",top:"2px",left:e?"16px":"2px",transition:"left 0.2s ease",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.2)"})),a1=Hn.input({position:"absolute",opacity:0,width:0,height:0}),x3=()=>{let[e,t]=o3(0),n=i3();l1(()=>(n.current=setInterval(()=>t(s=>s+1),1e3),()=>clearInterval(n.current)),[]);let r=Math.floor(e/60),o=e%60,i=`${r}:${o.toString().padStart(2,"0")}`;return ft.createElement("span",{style:{fontFamily:"ui-monospace, monospace",fontSize:"12px",opacity:.8,fontVariantNumeric:"tabular-nums"}},i)},yh=()=>{let{sessionToken:e}=js(),{usageData:t}=we(),{selectedProjectId:n}=no(),{currentMapping:r,hasMapping:o}=ni(),{loadingMapping:i,currentStoryId:s}=nt(),{startReview:a,cancelReview:u,isReviewing:c}=fm(),{isLoadingScreenshots:l}=ei(),{storybookImageUrl:d,figmaImageUrl:g,currentReviewId:p,reviewHistory:f,setReviewDetailTab:k,setReviewResults:T,setFigmaImageUrl:E,setStorybookImageUrl:I,setFullPrompt:D,setFullResponse:R,includeTextComparison:$,setIncludeTextComparison:P,usePromptCache:z,setUsePromptCache:x,isValidating:w,validationUsage:v,isGenerating:C,isApplying:m,streamingStatus:F,featureFlags:S,userRole:b,roleOverride:A,isReviewing:L}=ce(),B=t?.reviewCredits??Math.floor(t?.creditBalance??0),N=f.find(fe=>fe.id===p),j=(N?.issues||[]).filter(fe=>!fe.dismissed).length,W=N?.complianceScore,M=N?.visualSimilarity,K=(N?.costUsd||0)+(v?.costUsd||0),ee=(N?.inputTokens||0)+(v?.inputTokens||0),ge=(N?.outputTokens||0)+(v?.outputTokens||0),xe=r3(()=>{let fe=s?f.filter(me=>me.storyId===s):f,tt=fe.filter(me=>!me.parentReviewId).sort((me,ie)=>new Date(ie.createdAt).getTime()-new Date(me.createdAt).getTime()),he=fe.filter(me=>me.parentReviewId),oe=[];for(let me of tt){oe.push(me);let ie=he.filter(O=>O.parentReviewId===me.id).sort((O,U)=>(O.iterationNumber||0)-(U.iterationNumber||0));oe.push(...ie)}let Y=he.filter(me=>!tt.some(ie=>ie.id===me.parentReviewId));return oe.push(...Y),oe},[f,s]);l1(()=>{if(!c)return;let fe=tt=>{tt.key==="Escape"&&(tt.preventDefault(),u())};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[c,u]);let ae=o&&r?.figmaNodeId,Ke=C||m,be=B>0,Te=!!(e&&n&&!c&&!l&&!Ke&&s&&d&&ae&&g&&be),te=async(fe=!1)=>{if(!s){console.error("[ReviewActions] No story selected");return}try{k("chat"),await a({isIteration:fe,parentReviewId:fe?p:void 0})}catch(tt){console.error("[ReviewActions] Review error:",tt)}},Me=()=>te(!1),Ae=fe=>{let tt=fe.target.value;if(tt){let he=f.find(oe=>oe.id===tt);he&&(T({id:he.id,componentId:he.componentId,storyId:he.storyId,modelId:he.modelId,complianceScore:he.complianceScore,issuesCount:he.issuesCount,issues:he.issues,createdAt:new Date(he.createdAt),visualSimilarity:he.visualSimilarity,timestamp:new Date(he.createdAt).toISOString(),costUsd:he.costUsd,inputTokens:he.inputTokens,outputTokens:he.outputTokens,cacheCreationTokens:he.cacheCreationTokens,cacheReadTokens:he.cacheReadTokens,reviewDurationMs:he.reviewDurationMs}),he.figmaImageData&&E(he.figmaImageData),he.storybookImageData&&I(he.storybookImageData),(A??b)==="admin"&&(D(he.aiPrompt||""),R(he.aiResponse||"")),k("issues"))}},pe=fe=>{let tt=new Date(fe),oe=new Date().getTime()-tt.getTime(),Y=Math.floor(oe/6e4),me=Math.floor(oe/36e5),ie=Math.floor(oe/864e5);return Y<1?"Just now":Y<60?`${Y}m ago`:me<24?`${me}h ago`:ie<7?`${ie}d ago`:tt.toLocaleDateString()},Pt=fe=>fe?fe.includes("haiku")?"Haiku":fe.includes("sonnet")?"Sonnet":fe.includes("opus")?"Opus":fe.includes("gpt-4o-mini")?"GPT-4o mini":fe.includes("gpt-4o")?"GPT-4o":fe.includes("gpt-4")?"GPT-4":fe.includes("o3")?"o3":fe.includes("o1")?"o1":fe.split("-")[0]||"":"",nn=fe=>{let tt=fe.split("--"),he=tt[tt.length-1]||fe;return he.charAt(0).toUpperCase()+he.slice(1)},Mr=(A??b)==="admin";return ft.createElement("div",null,ft.createElement(a3,null,S.enableModelSelection&&ft.createElement(ZC,null),Mr&&ft.createElement(h3,null,ft.createElement(o1,{title:"Compare text content between Figma design and Storybook component"},ft.createElement(a1,{type:"checkbox",checked:$,onChange:fe=>P(fe.target.checked)}),ft.createElement(i1,{checked:$},ft.createElement(s1,{checked:$})),"Compare text"),S.showCosts&&ft.createElement(o1,{title:"Cache prompt for 5 min to reduce costs on repeat reviews (dev optimization)"},ft.createElement(a1,{type:"checkbox",checked:z,onChange:fe=>x(fe.target.checked)}),ft.createElement(i1,{checked:z},ft.createElement(s1,{checked:z})),"Cache prompt")),ft.createElement(p3,null,ft.createElement(d3,{variant:c?"yellow":"purple",disabled:c?!1:!Te,onClick:c?u:Me,title:c?"Click to stop review":e?n?s?ae?l?"Loading screenshots...":Ke?"Wait for fixes to complete...":d?g?be?"Review this component implementation":"No credits \u2014 click \u26A1 in the toolbar to get more":"Waiting for Figma design image...":"Waiting for Storybook screenshot...":'Figma mapping required - use "Map to Figma" in the Review tab':"No story selected":"Please select a project first":`Please connect to ${Ft.NAME} first`},c?ft.createElement(ft.Fragment,null,ft.createElement(c3,null),"Reviewing",ft.createElement(x3,null)):ft.createElement(ft.Fragment,null,ft.createElement(u3,null,ft.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},ft.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),ft.createElement("circle",{cx:"12",cy:"12",r:"3"}))),"Review")),L?null:w||N?ft.createElement(r1,{isReviewing:!1,isValidating:w,streamingStatus:F,issueCount:j,score:W,visualSimilarity:M,costUsd:K||N?.costUsd,inputTokens:ee||N?.inputTokens,outputTokens:ge||N?.outputTokens,cacheCreationTokens:N?.cacheCreationTokens,cacheReadTokens:N?.cacheReadTokens,durationSeconds:N?.reviewDurationMs?Math.round(N.reviewDurationMs/1e3):void 0}):null,xe.length>0&&ft.createElement(f3,null,ft.createElement(m3,{value:p||"",onChange:Ae,title:"Review history"},ft.createElement("option",{value:""},"Select a review..."),xe.map(fe=>{let tt=!!fe.parentReviewId,he=tt?" \u21B3 ":"\u25CF ",oe=tt&&fe.iterationNumber?`Iter ${fe.iterationNumber} - `:"",Y=fe.issuesCount??fe.issues?.length??0,me=fe.complianceScore??"--",ie=Pt(fe.modelId);return ft.createElement("option",{key:fe.id,value:fe.id},he,oe,pe(fe.createdAt)," - ",Y," issues (",me,"%)",ie?` \xB7 ${ie}`:"",fe.storyId?` \xB7 ${nn(fe.storyId)}`:"")}))))),!ae&&!i&&ft.createElement(g3,null,'\u26A0\uFE0F Figma mapping required. Use "Map to Figma" button to link this story to a Figma frame before reviewing.'))};import hoe,{useState as xoe}from"react";import{styled as c1}from"storybook/theming";var Soe=c1.div(({theme:e})=>({display:"flex",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"12px",gap:"4px"})),woe=c1(yo)({padding:"8px 12px",fontSize:"12px"});import Coe,{useState as Toe}from"react";import{styled as bh}from"storybook/theming";Ce();je();Oe();ct();var Moe=bh.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px",backgroundColor:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",fontSize:"13px"})),Boe=bh(Rr)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),Doe=bh.span(({theme:e})=>({color:e.textMutedColor,fontSize:"12px",flex:1}));import Noe from"react";import{styled as y3}from"storybook/theming";var $oe=y3.div(({theme:e})=>({border:`2px dashed ${e.appBorderColor}`,borderRadius:"8px",padding:"40px",textAlign:"center",marginBottom:"20px",backgroundColor:e.background.app}));Ce();import Hoe from"react";import{styled as jr}from"storybook/theming";var Goe=jr.div(({theme:e})=>({marginBottom:"16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content})),qoe=jr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`})),Yoe=jr.div({display:"flex",alignItems:"center",gap:"8px",flex:1}),Koe=jr.div(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Xoe=jr.div(({theme:e})=>({flex:1,height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden",marginLeft:"12px"})),Qoe=jr.div(({theme:e,progress:t})=>({height:"100%",backgroundColor:t===100?e.color.positive||"#10b981":e.color.secondary,width:`${t}%`,transition:"width 0.3s ease, background-color 0.3s ease"})),Joe=jr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontWeight:500,minWidth:"40px",textAlign:"right"})),Zoe=jr.div(({theme:e})=>({padding:"16px",backgroundColor:e.background.app,textAlign:"center"})),eie=jr.div(({theme:e})=>({display:"inline-block",width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:e.color.secondary,borderRadius:"50%",animation:"spin 0.8s linear infinite",marginLeft:"8px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),tie=jr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"}));Ce();import oie,{useState as iie}from"react";import{styled as Hr}from"storybook/theming";var lie=Hr.div(({theme:e})=>{let t=(e.base==="dark","102, 126, 234");return{padding:"10px 12px",backgroundColor:`rgba(${t}, 0.08)`,borderRadius:"6px",marginBottom:"16px",border:`1px solid rgba(${t}, 0.2)`}}),cie=Hr.div({display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",userSelect:"none"}),uie=Hr.div({display:"flex",alignItems:"center",gap:"8px"}),pie=Hr.span({fontSize:"12px",opacity:.7}),die=Hr.span({fontSize:"13px",fontWeight:500}),gie=Hr.div(({score:e,theme:t})=>({display:"inline-block",padding:"4px 10px",borderRadius:"12px",fontSize:"13px",fontWeight:600,backgroundColor:e>=90?t.color.positive||"#10b981":e>=70?t.color.warning||"#f59e0b":t.color.negative||"#ef4444",color:t.color.inverseText})),fie=Hr.div({marginTop:"12px",fontSize:"11px"}),mie=Hr.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px",marginBottom:"8px"}),hie=Hr.div(({status:e,theme:t})=>({display:"flex",alignItems:"center",gap:"4px",color:e==="success"?"inherit":e==="success"?t.color.positive||"#10b981":e==="warning"?t.color.warning||"#f59e0b":t.color.negative||"#ef4444"})),xie=Hr.span({fontSize:"12px"});Oe();je();import Qt from"react";import{styled as as}from"storybook/theming";import Lr,{useEffect as sW}from"react";import{styled as Aa}from"storybook/theming";Ce();import di,{useState as D6}from"react";import{styled as es}from"storybook/theming";var u1={fontBase:'"Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontMono:'"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace',sizeXs:"11px",sizeSm:"12px",sizeMd:"13px",sizeLg:"14px",sizeXl:"16px",weightRegular:400,weightMedium:500,weightBold:600};function p1(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var b3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,S3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,w3={};function yc(e,t){return((t||w3).jsx?S3:b3).test(e)}var v3=/[ \t\n\f\r]/g;function Sh(e){return typeof e=="object"?e.type==="text"?d1(e.value):!1:d1(e)}function d1(e){return e.replace(v3,"")===""}var ao=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ao.prototype.normal={};ao.prototype.property={};ao.prototype.space=void 0;function wh(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new ao(n,r,t)}function ga(e){return e.toLowerCase()}var cn=class{constructor(t,n){this.attribute=n,this.property=t}};cn.prototype.attribute="";cn.prototype.booleanish=!1;cn.prototype.boolean=!1;cn.prototype.commaOrSpaceSeparated=!1;cn.prototype.commaSeparated=!1;cn.prototype.defined=!1;cn.prototype.mustUseProperty=!1;cn.prototype.number=!1;cn.prototype.overloadedBoolean=!1;cn.prototype.property="";cn.prototype.spaceSeparated=!1;cn.prototype.space=void 0;var fa={};Se(fa,{boolean:()=>Ge,booleanish:()=>_t,commaOrSpaceSeparated:()=>Wn,commaSeparated:()=>No,number:()=>X,overloadedBoolean:()=>bc,spaceSeparated:()=>wt});var k3=0,Ge=ii(),_t=ii(),bc=ii(),X=ii(),wt=ii(),No=ii(),Wn=ii();function ii(){return 2**++k3}var vh=Object.keys(fa),si=class extends cn{constructor(t,n,r,o){let i=-1;if(super(t,n),g1(this,"space",o),typeof r=="number")for(;++i<vh.length;){let s=vh[i];g1(this,vh[i],(r&fa[s])===fa[s])}}};si.prototype.defined=!0;function g1(e,t,n){n&&(e[t]=n)}function fr(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let i=new si(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[ga(r)]=r,n[ga(i.attribute)]=r}return new ao(t,n,e.space)}var kh=fr({properties:{ariaActiveDescendant:null,ariaAtomic:_t,ariaAutoComplete:null,ariaBusy:_t,ariaChecked:_t,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:_t,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:_t,ariaFlowTo:wt,ariaGrabbed:_t,ariaHasPopup:null,ariaHidden:_t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:X,ariaLive:null,ariaModal:_t,ariaMultiLine:_t,ariaMultiSelectable:_t,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:_t,ariaReadOnly:_t,ariaRelevant:null,ariaRequired:_t,ariaRoleDescription:wt,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:_t,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Sc(e,t){return t in e?e[t]:t}function wc(e,t){return Sc(e,t.toLowerCase())}var f1=fr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:No,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:wt,autoFocus:Ge,autoPlay:Ge,blocking:wt,capture:null,charSet:null,checked:Ge,cite:null,className:wt,cols:X,colSpan:null,content:null,contentEditable:_t,controls:Ge,controlsList:wt,coords:X|No,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:bc,draggable:_t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:wt,height:X,hidden:bc,high:X,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:wt,itemRef:wt,itemScope:Ge,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ge,optimum:X,pattern:null,ping:wt,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:wt,required:Ge,reversed:Ge,rows:X,rowSpan:X,sandbox:wt,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:_t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:_t,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:_t,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ge,disableRemotePlayback:Ge,prefix:null,property:null,results:X,security:null,unselectable:null},space:"html",transform:wc});var m1=fr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Wn,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:wt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:No,g2:No,glyphName:No,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:Wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wn,rev:Wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wn,requiredFeatures:Wn,requiredFonts:Wn,requiredFormats:Wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:Wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wn,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Sc});var Ch=fr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Th=fr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wc});var Ih=fr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Fh={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var C3=/[A-Z]/g,h1=/-[a-z]/g,T3=/^data[-\w.:]+$/i;function Eh(e,t){let n=ga(t),r=t,o=cn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&T3.test(t)){if(t.charAt(4)==="-"){let i=t.slice(5).replace(h1,F3);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=t.slice(4);if(!h1.test(i)){let s=i.replace(C3,I3);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=si}return new o(r,t)}function I3(e){return"-"+e.toLowerCase()}function F3(e){return e.charAt(1).toUpperCase()}var x1=wh([kh,f1,Ch,Th,Ih],"html"),vc=wh([kh,m1,Ch,Th,Ih],"svg");function y1(e){return e.join(" ").trim()}var B1=Ua(A1(),1);var Cc=P1("end"),Yi=P1("start");function P1(e){return t;function t(n){let r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Lh(e){let t=Yi(e),n=Cc(e);if(t&&n)return{start:t,end:n}}function Oo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?L1(e.position):"start"in e||"end"in e?L1(e):"line"in e||"column"in e?Mh(e):""}function Mh(e){return M1(e&&e.line)+":"+M1(e&&e.column)}function L1(e){return Mh(e&&e.start)+"-"+Mh(e&&e.end)}function M1(e){return e&&typeof e=="number"?e:1}var Wt=class extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){let u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){let u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}let a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=Oo(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;var Bh={}.hasOwnProperty,Z3=new Map,eU=/[A-Z]/g,tU=new Set(["table","tbody","thead","tfoot","tr"]),nU=new Set(["td","th"]),D1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dh(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=uU(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=cU(n,t.jsx,t.jsxs)}let o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?vc:x1,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=R1(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function R1(e,t,n){if(t.type==="element")return rU(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return oU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return sU(e,t,n);if(t.type==="mdxjsEsm")return iU(e,t);if(t.type==="root")return aU(e,t,n);if(t.type==="text")return lU(e,t)}function rU(e,t,n){let r=e.schema,o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=vc,e.schema=o),e.ancestors.push(t);let i=N1(e,t.tagName,!1),s=pU(e,t),a=zh(e,t);return tU.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Sh(u):!0})),z1(e,s,i,t),Rh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function oU(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ha(e,t.position)}function iU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ha(e,t.position)}function sU(e,t,n){let r=e.schema,o=r;t.name==="svg"&&r.space==="html"&&(o=vc,e.schema=o),e.ancestors.push(t);let i=t.name===null?e.Fragment:N1(e,t.name,!0),s=dU(e,t),a=zh(e,t);return z1(e,s,i,t),Rh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function aU(e,t,n){let r={};return Rh(r,zh(e,t)),e.create(t,e.Fragment,r,n)}function lU(e,t){return t.value}function z1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Rh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function cU(e,t,n){return r;function r(o,i,s,a){let c=Array.isArray(s.children)?n:t;return a?c(i,s,a):c(i,s)}}function uU(e,t){return n;function n(r,o,i,s){let a=Array.isArray(i.children),u=Yi(r);return t(o,i,s,a,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function pU(e,t){let n={},r,o;for(o in t.properties)if(o!=="children"&&Bh.call(t.properties,o)){let i=gU(e,o,t.properties[o]);if(i){let[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&nU.has(t.tagName)?r=a:n[s]=a}}if(r){let i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function dU(e,t){let n={};for(let r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){let i=r.data.estree.body[0];i.type;let s=i.expression;s.type;let a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ha(e,t.position);else{let o=r.name,i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){let a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else ha(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function zh(e,t){let n=[],r=-1,o=e.passKeys?new Map:Z3;for(;++r<t.children.length;){let i=t.children[r],s;if(e.passKeys){let u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){let c=o.get(u)||0;s=u+"-"+c,o.set(u,c+1)}}let a=R1(e,i,s);a!==void 0&&n.push(a)}return n}function gU(e,t,n){let r=Eh(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?p1(n):y1(n)),r.property==="style"){let o=typeof n=="object"?n:fU(e,String(n));return e.stylePropertyNameCase==="css"&&(o=mU(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?Fh[r.property]||r.property:r.attribute,n]}}function fU(e,t){try{return(0,B1.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let r=n,o=new Wt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=D1+"#cannot-parse-style-attribute",o}}function N1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){let o=t.split("."),i=-1,s;for(;++i<o.length;){let a=yc(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=s}else r=yc(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){let o=r.value;return Bh.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);ha(e)}function ha(e,t){let n=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=D1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function mU(e){let t={},n;for(n in e)Bh.call(e,n)&&(t[hU(n)]=e[n]);return t}function hU(e){let t=e.replace(eU,xU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function xU(e){return"-"+e.toLowerCase()}var xa={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};import{Fragment as T6,jsx as I6,jsxs as F6}from"react/jsx-runtime";import{useEffect as Ade,useState as Pde}from"react";var yU={};function Nh(e,t){let n=t||yU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return _1(e,r,o)}function _1(e,t,n){if(bU(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return O1(e.children,t,n)}return Array.isArray(e)?O1(e,t,n):""}function O1(e,t,n){let r=[],o=-1;for(;++o<e.length;)r[o]=_1(e[o],t,n);return r.join("")}function bU(e){return!!(e&&typeof e=="object")}var $1=document.createElement("i");function Ki(e){let t="&"+e+";";$1.innerHTML=t;let n=$1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function fn(e,t,n,r){let o=e.length,i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Fn(e,t){return e.length>0?(fn(e,e.length,0,t),e):t}var U1={}.hasOwnProperty;function j1(e){let t={},n=-1;for(;++n<e.length;)SU(t,e[n]);return t}function SU(e,t){let n;for(n in t){let o=(U1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],s;if(i)for(s in i){U1.call(o,s)||(o[s]=[]);let a=i[s];wU(o[s],Array.isArray(a)?a:a?[a]:[])}}}function wU(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);fn(e,0,0,r)}function Tc(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function lo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var tr=_o(/[A-Za-z]/),un=_o(/[\dA-Za-z]/),H1=_o(/[#-'*+\--9=?A-Z^-~]/);function ya(e){return e!==null&&(e<32||e===127)}var ba=_o(/\d/),W1=_o(/[\dA-Fa-f]/),V1=_o(/[!-/:-@[-`{-~]/);function ue(e){return e!==null&&e<-2}function Vt(e){return e!==null&&(e<0||e===32)}function He(e){return e===-2||e===-1||e===32}var G1=_o(/\p{P}|\p{S}/u),q1=_o(/\s/);function _o(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mr(e){let t=[],n=-1,r=0,o=0;for(;++n<e.length;){let i=e.charCodeAt(n),s="";if(i===37&&un(e.charCodeAt(n+1))&&un(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){let a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){let o=r?r-1:Number.POSITIVE_INFINITY,i=0;return s;function s(u){return He(u)?(e.enter(n),a(u)):t(u)}function a(u){return He(u)&&i++<o?(e.consume(u),a):(e.exit(n),t(u))}}var Y1={tokenize:vU};function vU(e){let t=e.attempt(this.parser.constructs.contentInitial,r,o),n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),qe(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){let u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ue(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}var X1={tokenize:kU},K1={tokenize:CU};function kU(e){let t=this,n=[],r=0,o,i,s;return a;function a(D){if(r<n.length){let R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,u,c)(D)}return c(D)}function u(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&I();let R=t.events.length,$=R,P;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){P=t.events[$][1].end;break}E(r);let z=R;for(;z<t.events.length;)t.events[z][1].end={...P},z++;return fn(t.events,$+1,0,t.events.slice(R)),t.events.length=z,c(D)}return a(D)}function c(D){if(r===n.length){if(!o)return g(D);if(o.currentConstruct&&o.currentConstruct.concrete)return f(D);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(K1,l,d)(D)}function l(D){return o&&I(),E(r),g(D)}function d(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,f(D)}function g(D){return t.containerState={},e.attempt(K1,p,f)(D)}function p(D){return r++,n.push([t.currentConstruct,t.containerState]),g(D)}function f(D){if(D===null){o&&I(),E(0),e.consume(D);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),k(D)}function k(D){if(D===null){T(e.exit("chunkFlow"),!0),E(0),e.consume(D);return}return ue(D)?(e.consume(D),T(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(D),k)}function T(D,R){let $=t.sliceStream(D);if(R&&$.push(null),D.previous=i,i&&(i.next=D),i=D,o.defineSkip(D.start),o.write($),t.parser.lazy[D.start.line]){let P=o.events.length;for(;P--;)if(o.events[P][1].start.offset<s&&(!o.events[P][1].end||o.events[P][1].end.offset>s))return;let z=t.events.length,x=z,w,v;for(;x--;)if(t.events[x][0]==="exit"&&t.events[x][1].type==="chunkFlow"){if(w){v=t.events[x][1].end;break}w=!0}for(E(r),P=z;P<t.events.length;)t.events[P][1].end={...v},P++;fn(t.events,x+1,0,t.events.slice(z)),t.events.length=P}}function E(D){let R=n.length;for(;R-- >D;){let $=n[R];t.containerState=$[1],$[0].exit.call(t,e)}n.length=D}function I(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function CU(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Oh(e){if(e===null||Vt(e)||q1(e))return 1;if(G1(e))return 2}function Xi(e,t,n){let r=[],o=-1;for(;++o<e.length;){let i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}var Sa={name:"attention",resolveAll:TU,tokenize:IU};function TU(e,t){let n=-1,r,o,i,s,a,u,c,l;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},g={...e[n][1].start};Q1(d,-u),Q1(g,u),s={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:u>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Fn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Fn(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=Fn(c,Xi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Fn(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(l=2,c=Fn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,fn(e,r-1,n-r+3,c),n=r+c.length-l-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function IU(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Oh(r),i;return s;function s(u){return i=u,e.enter("attentionSequence"),a(u)}function a(u){if(u===i)return e.consume(u),a;let c=e.exit("attentionSequence"),l=Oh(u),d=!l||l===2&&o||n.includes(u),g=!o||o===2&&l||n.includes(r);return c._open=!!(i===42?d:d&&(o||!g)),c._close=!!(i===42?g:g&&(l||!d)),t(u)}}function Q1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var _h={name:"autolink",tokenize:FU};function FU(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return tr(p)?(e.consume(p),s):p===64?n(p):c(p)}function s(p){return p===43||p===45||p===46||un(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||un(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ya(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),l):H1(p)?(e.consume(p),c):n(p)}function l(p){return un(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,l):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):g(p)}function g(p){if((p===45||un(p))&&r++<63){let f=p===45?g:d;return e.consume(p),f}return n(p)}}var $o={partial:!0,tokenize:EU};function EU(e,t,n){return r;function r(i){return He(i)?qe(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ue(i)?t(i):n(i)}}var Ic={continuation:{tokenize:PU},exit:LU,name:"blockQuote",tokenize:AU};function AU(e,t,n){let r=this;return o;function o(s){if(s===62){let a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return He(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function PU(e,t,n){let r=this;return o;function o(s){return He(s)?qe(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Ic,t,n)(s)}}function LU(e){e.exit("blockQuote")}var Fc={name:"characterEscape",tokenize:MU};function MU(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return V1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}var Ec={name:"characterReference",tokenize:BU};function BU(e,t,n){let r=this,o=0,i,s;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),u}function u(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=un,l(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=W1,l):(e.enter("characterReferenceValue"),i=7,s=ba,l(d))}function l(d){if(d===59&&o){let g=e.exit("characterReferenceValue");return s===un&&!Ki(r.sliceSerialize(g))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(d)&&o++<i?(e.consume(d),l):n(d)}}var J1={partial:!0,tokenize:RU},Ac={concrete:!0,name:"codeFenced",tokenize:DU};function DU(e,t,n){let r=this,o={partial:!0,tokenize:$},i=0,s=0,a;return u;function u(P){return c(P)}function c(P){let z=r.events[r.events.length-1];return i=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,a=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(P)}function l(P){return P===a?(s++,e.consume(P),l):s<3?n(P):(e.exit("codeFencedFenceSequence"),He(P)?qe(e,d,"whitespace")(P):d(P))}function d(P){return P===null||ue(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(J1,k,R)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(P))}function g(P){return P===null||ue(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(P)):He(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,p,"whitespace")(P)):P===96&&P===a?n(P):(e.consume(P),g)}function p(P){return P===null||ue(P)?d(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(P))}function f(P){return P===null||ue(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(P)):P===96&&P===a?n(P):(e.consume(P),f)}function k(P){return e.attempt(o,R,T)(P)}function T(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),E}function E(P){return i>0&&He(P)?qe(e,I,"linePrefix",i+1)(P):I(P)}function I(P){return P===null||ue(P)?e.check(J1,k,R)(P):(e.enter("codeFlowValue"),D(P))}function D(P){return P===null||ue(P)?(e.exit("codeFlowValue"),I(P)):(e.consume(P),D)}function R(P){return e.exit("codeFenced"),t(P)}function $(P,z,x){let w=0;return v;function v(b){return P.enter("lineEnding"),P.consume(b),P.exit("lineEnding"),C}function C(b){return P.enter("codeFencedFence"),He(b)?qe(P,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):m(b)}function m(b){return b===a?(P.enter("codeFencedFenceSequence"),F(b)):x(b)}function F(b){return b===a?(w++,P.consume(b),F):w>=s?(P.exit("codeFencedFenceSequence"),He(b)?qe(P,S,"whitespace")(b):S(b)):x(b)}function S(b){return b===null||ue(b)?(P.exit("codeFencedFence"),z(b)):x(b)}}}function RU(e,t,n){let r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}var wa={name:"codeIndented",tokenize:NU},zU={partial:!0,tokenize:OU};function NU(e,t,n){let r=this;return o;function o(c){return e.enter("codeIndented"),qe(e,i,"linePrefix",5)(c)}function i(c){let l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?u(c):ue(c)?e.attempt(zU,s,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ue(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),t(c)}}function OU(e,t,n){let r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):ue(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):qe(e,i,"linePrefix",5)(s)}function i(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):ue(s)?o(s):n(s)}}var $h={name:"codeText",previous:$U,resolve:_U,tokenize:UU};function _U(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function $U(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function UU(e,t,n){let r=this,o=0,i,s;return a;function a(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),o++,u):(e.exit("codeTextSequence"),c(g))}function c(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),c):g===96?(s=e.enter("codeTextSequence"),i=0,d(g)):ue(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),c):(e.enter("codeTextData"),l(g))}function l(g){return g===null||g===32||g===96||ue(g)?(e.exit("codeTextData"),c(g)):(e.consume(g),l)}function d(g){return g===96?(e.consume(g),i++,d):i===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(s.type="codeTextData",l(g))}}var Pc=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){let r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){let o=n||0;this.setCursor(Math.trunc(t));let i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&va(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),va(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),va(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let n=this.left.splice(t,Number.POSITIVE_INFINITY);va(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);va(this.left,n.reverse())}}};function va(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lc(e){let t={},n=-1,r,o,i,s,a,u,c,l=new Pc(e);for(;++n<l.length;){for(;n in t;)n=t[n];if(r=l.get(n),n&&r[1].type==="chunkFlow"&&l.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,jU(l,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=l.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(l.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[1].type==="listItemIndent"))break;o&&(r[1].end={...l.get(o)[1].start},a=l.slice(o,n),a.unshift(r),l.splice(o,n-o+1,a))}}return fn(e,0,Number.POSITIVE_INFINITY,l.slice(0)),!c}function jU(e,t){let n=e.get(t)[1],r=e.get(t)[2],o=t-1,i=[],s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));let a=s.events,u=[],c={},l,d,g=-1,p=n,f=0,k=0,T=[k];for(;p;){for(;e.get(++o)[1]!==p;);i.push(o),p._tokenizer||(l=r.sliceStream(p),p.next||l.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(l),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(k=g+1,T.push(k),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):T.pop(),g=T.length;g--;){let E=a.slice(T[g],T[g+1]),I=i.pop();u.push([I,I+E.length-1]),e.splice(I,2,E)}for(u.reverse(),g=-1;++g<u.length;)c[f+u[g][0]]=f+u[g][1],f+=u[g][1]-u[g][0]-1;return c}var Uh={resolve:WU,tokenize:VU},HU={partial:!0,tokenize:GU};function WU(e){return Lc(e),e}function VU(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):ue(a)?e.check(HU,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function GU(e,t,n){let r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),qe(e,i,"linePrefix")}function i(s){if(s===null||ue(s))return n(s);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Mc(e,t,n,r,o,i,s,a,u){let c=u||Number.POSITIVE_INFINITY,l=0;return d;function d(E){return E===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(E),e.exit(i),g):E===null||E===32||E===41||ya(E)?n(E):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),k(E))}function g(E){return E===62?(e.enter(i),e.consume(E),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===62?(e.exit("chunkString"),e.exit(a),g(E)):E===null||E===60||ue(E)?n(E):(e.consume(E),E===92?f:p)}function f(E){return E===60||E===62||E===92?(e.consume(E),p):p(E)}function k(E){return!l&&(E===null||E===41||Vt(E))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(E)):l<c&&E===40?(e.consume(E),l++,k):E===41?(e.consume(E),l--,k):E===null||E===32||E===40||ya(E)?n(E):(e.consume(E),E===92?T:k)}function T(E){return E===40||E===41||E===92?(e.consume(E),k):k(E)}}function Bc(e,t,n,r,o,i){let s=this,a=0,u;return c;function c(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),l}function l(p){return a>999||p===null||p===91||p===93&&!u||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):ue(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||ue(p)||a++>999?(e.exit("chunkString"),l(p)):(e.consume(p),u||(u=!He(p)),p===92?g:d)}function g(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function Dc(e,t,n,r,o,i){let s;return a;function a(g){return g===34||g===39||g===40?(e.enter(r),e.enter(o),e.consume(g),e.exit(o),s=g===40?41:g,u):n(g)}function u(g){return g===s?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):(e.enter(i),c(g))}function c(g){return g===s?(e.exit(i),u(s)):g===null?n(g):ue(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),qe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(g))}function l(g){return g===s||g===null||ue(g)?(e.exit("chunkString"),c(g)):(e.consume(g),g===92?d:l)}function d(g){return g===s||g===92?(e.consume(g),l):l(g)}}function li(e,t){let n;return r;function r(o){return ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):He(o)?qe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var jh={name:"definition",tokenize:YU},qU={partial:!0,tokenize:KU};function YU(e,t,n){let r=this,o;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Bc.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=lo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return Vt(p)?li(e,c)(p):c(p)}function c(p){return Mc(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function l(p){return e.attempt(qU,d,d)(p)}function d(p){return He(p)?qe(e,g,"whitespace")(p):g(p)}function g(p){return p===null||ue(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function KU(e,t,n){return r;function r(a){return Vt(a)?li(e,o)(a):n(a)}function o(a){return Dc(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return He(a)?qe(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ue(a)?t(a):n(a)}}var Hh={name:"hardBreakEscape",tokenize:XU};function XU(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ue(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}var Wh={name:"headingAtx",resolve:QU,tokenize:JU};function QU(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},fn(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function JU(e,t,n){let r=0;return o;function o(l){return e.enter("atxHeading"),i(l)}function i(l){return e.enter("atxHeadingSequence"),s(l)}function s(l){return l===35&&r++<6?(e.consume(l),s):l===null||Vt(l)?(e.exit("atxHeadingSequence"),a(l)):n(l)}function a(l){return l===35?(e.enter("atxHeadingSequence"),u(l)):l===null||ue(l)?(e.exit("atxHeading"),t(l)):He(l)?qe(e,a,"whitespace")(l):(e.enter("atxHeadingText"),c(l))}function u(l){return l===35?(e.consume(l),u):(e.exit("atxHeadingSequence"),a(l))}function c(l){return l===null||l===35||Vt(l)?(e.exit("atxHeadingText"),a(l)):(e.consume(l),c)}}var Z1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Vh=["pre","script","style","textarea"];var Gh={concrete:!0,name:"htmlFlow",resolveTo:t5,tokenize:n5},ZU={partial:!0,tokenize:o5},e5={partial:!0,tokenize:r5};function t5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function n5(e,t,n){let r=this,o,i,s,a,u;return c;function c(M){return l(M)}function l(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),g):M===47?(e.consume(M),i=!0,k):M===63?(e.consume(M),o=3,r.interrupt?t:h):tr(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function g(M){return M===45?(e.consume(M),o=2,p):M===91?(e.consume(M),o=5,a=0,f):tr(M)?(e.consume(M),o=4,r.interrupt?t:h):n(M)}function p(M){return M===45?(e.consume(M),r.interrupt?t:h):n(M)}function f(M){let K="CDATA[";return M===K.charCodeAt(a++)?(e.consume(M),a===K.length?r.interrupt?t:m:f):n(M)}function k(M){return tr(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function T(M){if(M===null||M===47||M===62||Vt(M)){let K=M===47,ee=s.toLowerCase();return!K&&!i&&Vh.includes(ee)?(o=1,r.interrupt?t(M):m(M)):Z1.includes(s.toLowerCase())?(o=6,K?(e.consume(M),E):r.interrupt?t(M):m(M)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?I(M):D(M))}return M===45||un(M)?(e.consume(M),s+=String.fromCharCode(M),T):n(M)}function E(M){return M===62?(e.consume(M),r.interrupt?t:m):n(M)}function I(M){return He(M)?(e.consume(M),I):v(M)}function D(M){return M===47?(e.consume(M),v):M===58||M===95||tr(M)?(e.consume(M),R):He(M)?(e.consume(M),D):v(M)}function R(M){return M===45||M===46||M===58||M===95||un(M)?(e.consume(M),R):$(M)}function $(M){return M===61?(e.consume(M),P):He(M)?(e.consume(M),$):D(M)}function P(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),u=M,z):He(M)?(e.consume(M),P):x(M)}function z(M){return M===u?(e.consume(M),u=null,w):M===null||ue(M)?n(M):(e.consume(M),z)}function x(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Vt(M)?$(M):(e.consume(M),x)}function w(M){return M===47||M===62||He(M)?D(M):n(M)}function v(M){return M===62?(e.consume(M),C):n(M)}function C(M){return M===null||ue(M)?m(M):He(M)?(e.consume(M),C):n(M)}function m(M){return M===45&&o===2?(e.consume(M),A):M===60&&o===1?(e.consume(M),L):M===62&&o===4?(e.consume(M),j):M===63&&o===3?(e.consume(M),h):M===93&&o===5?(e.consume(M),N):ue(M)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(ZU,W,F)(M)):M===null||ue(M)?(e.exit("htmlFlowData"),F(M)):(e.consume(M),m)}function F(M){return e.check(e5,S,W)(M)}function S(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),b}function b(M){return M===null||ue(M)?F(M):(e.enter("htmlFlowData"),m(M))}function A(M){return M===45?(e.consume(M),h):m(M)}function L(M){return M===47?(e.consume(M),s="",B):m(M)}function B(M){if(M===62){let K=s.toLowerCase();return Vh.includes(K)?(e.consume(M),j):m(M)}return tr(M)&&s.length<8?(e.consume(M),s+=String.fromCharCode(M),B):m(M)}function N(M){return M===93?(e.consume(M),h):m(M)}function h(M){return M===62?(e.consume(M),j):M===45&&o===2?(e.consume(M),h):m(M)}function j(M){return M===null||ue(M)?(e.exit("htmlFlowData"),W(M)):(e.consume(M),j)}function W(M){return e.exit("htmlFlow"),t(M)}}function r5(e,t,n){let r=this;return o;function o(s){return ue(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function o5(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt($o,t,n)}}var qh={name:"htmlText",tokenize:i5};function i5(e,t,n){let r=this,o,i,s;return a;function a(h){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(h),u}function u(h){return h===33?(e.consume(h),c):h===47?(e.consume(h),$):h===63?(e.consume(h),D):tr(h)?(e.consume(h),x):n(h)}function c(h){return h===45?(e.consume(h),l):h===91?(e.consume(h),i=0,f):tr(h)?(e.consume(h),I):n(h)}function l(h){return h===45?(e.consume(h),p):n(h)}function d(h){return h===null?n(h):h===45?(e.consume(h),g):ue(h)?(s=d,L(h)):(e.consume(h),d)}function g(h){return h===45?(e.consume(h),p):d(h)}function p(h){return h===62?A(h):h===45?g(h):d(h)}function f(h){let j="CDATA[";return h===j.charCodeAt(i++)?(e.consume(h),i===j.length?k:f):n(h)}function k(h){return h===null?n(h):h===93?(e.consume(h),T):ue(h)?(s=k,L(h)):(e.consume(h),k)}function T(h){return h===93?(e.consume(h),E):k(h)}function E(h){return h===62?A(h):h===93?(e.consume(h),E):k(h)}function I(h){return h===null||h===62?A(h):ue(h)?(s=I,L(h)):(e.consume(h),I)}function D(h){return h===null?n(h):h===63?(e.consume(h),R):ue(h)?(s=D,L(h)):(e.consume(h),D)}function R(h){return h===62?A(h):D(h)}function $(h){return tr(h)?(e.consume(h),P):n(h)}function P(h){return h===45||un(h)?(e.consume(h),P):z(h)}function z(h){return ue(h)?(s=z,L(h)):He(h)?(e.consume(h),z):A(h)}function x(h){return h===45||un(h)?(e.consume(h),x):h===47||h===62||Vt(h)?w(h):n(h)}function w(h){return h===47?(e.consume(h),A):h===58||h===95||tr(h)?(e.consume(h),v):ue(h)?(s=w,L(h)):He(h)?(e.consume(h),w):A(h)}function v(h){return h===45||h===46||h===58||h===95||un(h)?(e.consume(h),v):C(h)}function C(h){return h===61?(e.consume(h),m):ue(h)?(s=C,L(h)):He(h)?(e.consume(h),C):w(h)}function m(h){return h===null||h===60||h===61||h===62||h===96?n(h):h===34||h===39?(e.consume(h),o=h,F):ue(h)?(s=m,L(h)):He(h)?(e.consume(h),m):(e.consume(h),S)}function F(h){return h===o?(e.consume(h),o=void 0,b):h===null?n(h):ue(h)?(s=F,L(h)):(e.consume(h),F)}function S(h){return h===null||h===34||h===39||h===60||h===61||h===96?n(h):h===47||h===62||Vt(h)?w(h):(e.consume(h),S)}function b(h){return h===47||h===62||Vt(h)?w(h):n(h)}function A(h){return h===62?(e.consume(h),e.exit("htmlTextData"),e.exit("htmlText"),t):n(h)}function L(h){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),B}function B(h){return He(h)?qe(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):N(h)}function N(h){return e.enter("htmlTextData"),s(h)}}var ci={name:"labelEnd",resolveAll:c5,resolveTo:u5,tokenize:p5},s5={tokenize:d5},a5={tokenize:g5},l5={tokenize:f5};function c5(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&fn(e,0,e.length,n),e}function u5(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);let u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},l={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",u,t],["enter",c,t]],a=Fn(a,e.slice(i+1,i+r+3)),a=Fn(a,[["enter",l,t]]),a=Fn(a,Xi(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=Fn(a,[["exit",l,t],e[s-2],e[s-1],["exit",c,t]]),a=Fn(a,e.slice(s+1)),a=Fn(a,[["exit",u,t]]),fn(e,i,e.length,a),e}function p5(e,t,n){let r=this,o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(g){return i?i._inactive?d(g):(s=r.parser.defined.includes(lo(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(s5,l,s?l:d)(g):g===91?e.attempt(a5,l,s?c:d)(g):s?l(g):d(g)}function c(g){return e.attempt(l5,l,d)(g)}function l(g){return t(g)}function d(g){return i._balanced=!0,n(g)}}function d5(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),o}function o(d){return Vt(d)?li(e,i)(d):i(d)}function i(d){return d===41?l(d):Mc(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Vt(d)?li(e,u)(d):l(d)}function a(d){return n(d)}function u(d){return d===34||d===39||d===40?Dc(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):l(d)}function c(d){return Vt(d)?li(e,l)(d):l(d)}function l(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function g5(e,t,n){let r=this;return o;function o(a){return Bc.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(lo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function f5(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}var Yh={name:"labelStartImage",resolveAll:ci.resolveAll,tokenize:m5};function m5(e,t,n){let r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}var Kh={name:"labelStartLink",resolveAll:ci.resolveAll,tokenize:h5};function h5(e,t,n){let r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}var ka={name:"lineEnding",tokenize:x5};function x5(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}var ui={name:"thematicBreak",tokenize:y5};function y5(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(e.enter("thematicBreakSequence"),u(c)):r>=3&&(c===null||ue(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===o?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),He(c)?qe(e,a,"whitespace")(c):a(c))}}var Sn={continuation:{tokenize:v5},exit:C5,name:"list",tokenize:w5},b5={partial:!0,tokenize:T5},S5={partial:!0,tokenize:k5};function w5(e,t,n){let r=this,o=r.events[r.events.length-1],i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(p){let f=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:ba(p)){if(r.containerState.type||(r.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ui,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return ba(p)&&++s<10?(e.consume(p),u):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check($o,r.interrupt?n:l,e.attempt(b5,g,d))}function l(p){return r.containerState.initialBlankLine=!0,i++,g(p)}function d(p){return He(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),g):n(p)}function g(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function v5(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check($o,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!He(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(S5,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(Sn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function k5(e,t,n){let r=this;return qe(e,o,"listItemIndent",r.containerState.size+1);function o(i){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function C5(e){e.exit(this.containerState.type)}function T5(e,t,n){let r=this;return qe(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){let s=r.events[r.events.length-1];return!He(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}var Rc={name:"setextUnderline",resolveTo:I5,tokenize:F5};function I5(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);let s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function F5(e,t,n){let r=this,o;return i;function i(c){let l=r.events.length,d;for(;l--;)if(r.events[l][1].type!=="lineEnding"&&r.events[l][1].type!=="linePrefix"&&r.events[l][1].type!=="content"){d=r.events[l][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),o=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),He(c)?qe(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||ue(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}var eT={tokenize:E5};function E5(e){let t=this,n=e.attempt($o,r,e.attempt(this.parser.constructs.flowInitial,o,qe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Uh,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var tT={resolveAll:iT()},nT=oT("string"),rT=oT("text");function oT(e){return{resolveAll:iT(e==="text"?A5:void 0),tokenize:t};function t(n){let r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(l){return c(l)?i(l):a(l)}function a(l){if(l===null){n.consume(l);return}return n.enter("data"),n.consume(l),u}function u(l){return c(l)?(n.exit("data"),i(l)):(n.consume(l),u)}function c(l){if(l===null)return!0;let d=o[l],g=-1;if(d)for(;++g<d.length;){let p=d[g];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function iT(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function A5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){let r=e[n-1][1],o=t.sliceStream(r),i=o.length,s=-1,a=0,u;for(;i--;){let c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)u=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){let c={type:n===e.length||u||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}var Xh={};Se(Xh,{attentionMarkers:()=>N5,contentInitial:()=>L5,disable:()=>O5,document:()=>P5,flow:()=>B5,flowInitial:()=>M5,insideSpan:()=>z5,string:()=>D5,text:()=>R5});var P5={42:Sn,43:Sn,45:Sn,48:Sn,49:Sn,50:Sn,51:Sn,52:Sn,53:Sn,54:Sn,55:Sn,56:Sn,57:Sn,62:Ic},L5={91:jh},M5={[-2]:wa,[-1]:wa,32:wa},B5={35:Wh,42:ui,45:[Rc,ui],60:Gh,61:Rc,95:ui,96:Ac,126:Ac},D5={38:Ec,92:Fc},R5={[-5]:ka,[-4]:ka,[-3]:ka,33:Yh,38:Ec,42:Sa,60:[_h,qh],91:Kh,92:[Hh,Fc],93:ci,95:Sa,96:$h},z5={null:[Sa,tT]},N5={null:[42,95]},O5={null:[]};function sT(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},o={},i=[],s=[],a=[],u=!0,c={attempt:w(z),check:w(x),consume:R,enter:$,exit:P,interrupt:w(x,{interrupt:!0})},l={code:null,containerState:{},defineSkip:E,events:[],now:T,parser:e,previous:null,sliceSerialize:f,sliceStream:k,write:p},d=t.tokenize.call(l,c),g;return t.resolveAll&&i.push(t),l;function p(F){return s=Fn(s,F),I(),s[s.length-1]!==null?[]:(v(t,0),l.events=Xi(i,l.events,l),l.events)}function f(F,S){return $5(k(F),S)}function k(F){return _5(s,F)}function T(){let{_bufferIndex:F,_index:S,line:b,column:A,offset:L}=r;return{_bufferIndex:F,_index:S,line:b,column:A,offset:L}}function E(F){o[F.line]=F.column,m()}function I(){let F;for(;r._index<s.length;){let S=s[r._index];if(typeof S=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<S.length;)D(S.charCodeAt(r._bufferIndex));else D(S)}}function D(F){u=void 0,g=F,d=d(F)}function R(F){ue(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,m()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=F,u=!0}function $(F,S){let b=S||{};return b.type=F,b.start=T(),l.events.push(["enter",b,l]),a.push(b),b}function P(F){let S=a.pop();return S.end=T(),l.events.push(["exit",S,l]),S}function z(F,S){v(F,S.from)}function x(F,S){S.restore()}function w(F,S){return b;function b(A,L,B){let N,h,j,W;return Array.isArray(A)?K(A):"tokenize"in A?K([A]):M(A);function M(ae){return Ke;function Ke(be){let Te=be!==null&&ae[be],te=be!==null&&ae.null,Me=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(te)?te:te?[te]:[]];return K(Me)(be)}}function K(ae){return N=ae,h=0,ae.length===0?B:ee(ae[h])}function ee(ae){return Ke;function Ke(be){return W=C(),j=ae,ae.partial||(l.currentConstruct=ae),ae.name&&l.parser.constructs.disable.null.includes(ae.name)?xe(be):ae.tokenize.call(S?Object.assign(Object.create(l),S):l,c,ge,xe)(be)}}function ge(ae){return u=!0,F(j,W),L}function xe(ae){return u=!0,W.restore(),++h<N.length?ee(N[h]):B}}}function v(F,S){F.resolveAll&&!i.includes(F)&&i.push(F),F.resolve&&fn(l.events,S,l.events.length-S,F.resolve(l.events.slice(S),l)),F.resolveTo&&(l.events=F.resolveTo(l.events,l))}function C(){let F=T(),S=l.previous,b=l.currentConstruct,A=l.events.length,L=Array.from(a);return{from:A,restore:B};function B(){r=F,l.previous=S,l.currentConstruct=b,l.events.length=A,a=L,m()}}function m(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function _5(e,t){let n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex,s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function $5(e,t){let n=-1,r=[],o;for(;++n<e.length;){let i=e[n],s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
82
82
|
`;break}case-3:{s=`\r
|
|
83
|
-
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function Qh(e){let r={constructs:O1([Xh,...(e||{}).extensions||[]]),content:o(W1),defined:[],document:o(G1),flow:o(X1),lazy:{},string:o(J1),text:o(Z1)};return r;function o(i){return s;function s(a){return nT(r,i,a)}}}function Jh(e){for(;!Lc(e););return e}var rT=/[\0\t\n\r]/g;function Zh(){let e=1,t="",n=!0,r;return o;function o(i,s,a){let u=[],c,l,d,f,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(rT.lastIndex=d,c=rT.exec(i),f=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(f),!c){t=i.slice(d);break}if(p===10&&d===f&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),d<f&&(u.push(i.slice(d,f)),e+=f-d),p){case 0:{u.push(65533),e++;break}case 9:{for(l=Math.ceil(e/4)*4,u.push(-2);e++<l;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}var N5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function oT(e){return e.replace(N5,O5)}function O5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return Tc(n.slice(i?2:1),i?16:10)}return Yi(n)||e}var sT={}.hasOwnProperty;function ex(e,t,n){return typeof t!="string"&&(n=t,t=void 0),_5(n)(Jh(Qh(n).document().write(Zh()(e,t,!0))))}function _5(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ge),autolinkProtocol:w,autolinkEmail:w,atxHeading:i(pe),blockQuote:i(be),characterEscape:w,characterReference:w,codeFenced:i(Te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Te,s),codeText:i(te,s),codeTextData:w,data:w,codeFlowValue:w,definition:i(Me),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Ae),hardBreakEscape:i(Pt),hardBreakTrailing:i(Pt),htmlFlow:i(nn,s),htmlFlowData:w,htmlText:i(nn,s),htmlTextData:w,image:i(Mr),label:s,link:i(ge),listItem:i(he),listItemValue:f,listOrdered:i(tt,d),listUnordered:i(tt),paragraph:i(oe),reference:M,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Y),thematicBreak:i(ie)},exit:{atxHeading:u(),atxHeadingSequence:$,autolink:u(),autolinkEmail:Ke,autolinkProtocol:ae,blockQuote:u(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:fe,characterReference:xe,codeFenced:u(T),codeFencedFence:k,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:v,codeIndented:u(E),codeText:u(b),codeTextData:v,data:v,definition:u(),definitionDestinationString:R,definitionLabelString:I,definitionTitleString:D,emphasis:u(),hardBreakEscape:u(m),hardBreakTrailing:u(m),htmlFlow:u(F),htmlFlowData:v,htmlText:u(S),htmlTextData:v,image:u(L),label:N,labelText:B,lineEnding:C,link:u(A),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:K,resourceDestinationString:h,resourceTitleString:j,resource:W,setextHeading:u(x),setextHeadingLineSequence:z,setextHeadingText:P,strong:u(),thematicBreak:u()}};aT(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(O){let U={type:"root",children:[]},H={stack:[U],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:l,data:n},Be=[],_e=-1;for(;++_e<O.length;)if(O[_e][1].type==="listOrdered"||O[_e][1].type==="listUnordered")if(O[_e][0]==="enter")Be.push(_e);else{let bt=Be.pop();_e=o(O,bt,_e)}for(_e=-1;++_e<O.length;){let bt=t[O[_e][0]];sT.call(bt,O[_e][1].type)&&bt[O[_e][1].type].call(Object.assign({sliceSerialize:O[_e][2].sliceSerialize},H),O[_e][1])}if(H.tokenStack.length>0){let bt=H.tokenStack[H.tokenStack.length-1];(bt[1]||iT).call(H,void 0,bt[0])}for(U.position={start:Uo(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Uo(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e<t.transforms.length;)U=t.transforms[_e](U)||U;return U}function o(O,U,H){let Be=U-1,_e=-1,bt=!1,Gn,nr,En,mo;for(;++Be<=H;){let wn=O[Be];switch(wn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wn[0]==="enter"?_e++:_e--,mo=void 0;break}case"lineEndingBlank":{wn[0]==="enter"&&(Gn&&!mo&&!_e&&!En&&(En=Be),mo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mo=void 0}if(!_e&&wn[0]==="enter"&&wn[1].type==="listItemPrefix"||_e===-1&&wn[0]==="exit"&&(wn[1].type==="listUnordered"||wn[1].type==="listOrdered")){if(Gn){let Br=Be;for(nr=void 0;Br--;){let rn=O[Br];if(rn[1].type==="lineEnding"||rn[1].type==="lineEndingBlank"){if(rn[0]==="exit")continue;nr&&(O[nr][1].type="lineEndingBlank",bt=!0),rn[1].type="lineEnding",nr=Br}else if(!(rn[1].type==="linePrefix"||rn[1].type==="blockQuotePrefix"||rn[1].type==="blockQuotePrefixWhitespace"||rn[1].type==="blockQuoteMarker"||rn[1].type==="listItemIndent"))break}En&&(!nr||En<nr)&&(Gn._spread=!0),Gn.end=Object.assign({},nr?O[nr][1].start:wn[1].end),O.splice(nr||Be,0,["exit",Gn,wn[2]]),Be++,H++}if(wn[1].type==="listItemPrefix"){let Br={type:"listItem",_spread:!1,start:Object.assign({},wn[1].start),end:void 0};Gn=Br,O.splice(Be,0,["enter",Br,wn[2]]),Be++,H++,En=void 0,mo=!0}}}return O[U][1]._spread=bt,H}function i(O,U){return H;function H(Be){a.call(this,O(Be),Be),U&&U.call(this,Be)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(O,U,H){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([U,H||void 0]),O.position={start:Uo(U.start),end:void 0}}function u(O){return U;function U(H){O&&O.call(this,H),c.call(this,H)}}function c(O,U){let H=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==O.type&&(U?U.call(this,O,Be[0]):(Be[1]||iT).call(this,O,Be[0]));else throw new Error("Cannot close `"+O.type+"` ("+Oo({start:O.start,end:O.end})+"): it\u2019s not open");H.position.end=Uo(O.end)}function l(){return Nh(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(O){if(this.data.expectingFirstListItemValue){let U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),U=this.stack[this.stack.length-1];U.lang=O}function g(){let O=this.resume(),U=this.stack[this.stack.length-1];U.meta=O}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O.replace(/(\r?\n|\r)$/g,"")}function I(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=lo(this.sliceSerialize(O)).toLowerCase()}function D(){let O=this.resume(),U=this.stack[this.stack.length-1];U.title=O}function R(){let O=this.resume(),U=this.stack[this.stack.length-1];U.url=O}function $(O){let U=this.stack[this.stack.length-1];if(!U.depth){let H=this.sliceSerialize(O).length;U.depth=H}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function z(O){let U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function x(){this.data.setextHeadingSlurpLineEnding=void 0}function w(O){let H=this.stack[this.stack.length-1].children,Be=H[H.length-1];(!Be||Be.type!=="text")&&(Be=me(),Be.position={start:Uo(O.start),end:void 0},H.push(Be)),this.stack.push(Be)}function v(O){let U=this.stack.pop();U.value+=this.sliceSerialize(O),U.position.end=Uo(O.end)}function C(O){let U=this.stack[this.stack.length-1];if(this.data.atHardBreak){let H=U.children[U.children.length-1];H.position.end=Uo(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(w.call(this,O),v.call(this,O))}function m(){this.data.atHardBreak=!0}function F(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function S(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function b(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function A(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let U=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=U,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function L(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let U=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=U,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function B(O){let U=this.sliceSerialize(O),H=this.stack[this.stack.length-2];H.label=oT(U),H.identifier=lo(U).toLowerCase()}function N(){let O=this.stack[this.stack.length-1],U=this.resume(),H=this.stack[this.stack.length-1];if(this.data.inReference=!0,H.type==="link"){let Be=O.children;H.children=Be}else H.alt=U}function h(){let O=this.resume(),U=this.stack[this.stack.length-1];U.url=O}function j(){let O=this.resume(),U=this.stack[this.stack.length-1];U.title=O}function W(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function K(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=lo(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function ee(O){this.data.characterReferenceType=O.type}function fe(O){let U=this.sliceSerialize(O),H=this.data.characterReferenceType,Be;H?(Be=Tc(U,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Yi(U);let _e=this.stack[this.stack.length-1];_e.value+=Be}function xe(O){let U=this.stack.pop();U.position.end=Uo(O.end)}function ae(O){v.call(this,O);let U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(O)}function Ke(O){v.call(this,O);let U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(O)}function be(){return{type:"blockquote",children:[]}}function Te(){return{type:"code",lang:null,meta:null,value:""}}function te(){return{type:"inlineCode",value:""}}function Me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function Pt(){return{type:"break"}}function nn(){return{type:"html",value:""}}function Mr(){return{type:"image",title:null,url:"",alt:null}}function ge(){return{type:"link",title:null,url:"",children:[]}}function tt(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function he(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function Y(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Uo(e){return{line:e.line,column:e.column,offset:e.offset}}function aT(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?aT(e,r):$5(e,r)}}function $5(e,t){let n;for(n in t)if(sT.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r);break}}}function iT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Oo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Oo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Oo({start:t.start,end:t.end})+") is still open")}function zc(e){let t=this;t.parser=n;function n(r){return ex(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function lT(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function cT(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
84
|
-
`}]}function
|
|
85
|
-
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function
|
|
83
|
+
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function Qh(e){let r={constructs:j1([Xh,...(e||{}).extensions||[]]),content:o(Y1),defined:[],document:o(X1),flow:o(eT),lazy:{},string:o(nT),text:o(rT)};return r;function o(i){return s;function s(a){return sT(r,i,a)}}}function Jh(e){for(;!Lc(e););return e}var aT=/[\0\t\n\r]/g;function Zh(){let e=1,t="",n=!0,r;return o;function o(i,s,a){let u=[],c,l,d,g,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(aT.lastIndex=d,c=aT.exec(i),g=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(g),!c){t=i.slice(d);break}if(p===10&&d===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),d<g&&(u.push(i.slice(d,g)),e+=g-d),p){case 0:{u.push(65533),e++;break}case 9:{for(l=Math.ceil(e/4)*4,u.push(-2);e++<l;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}d=g+1}return a&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}var U5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lT(e){return e.replace(U5,j5)}function j5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return Tc(n.slice(i?2:1),i?16:10)}return Ki(n)||e}var uT={}.hasOwnProperty;function ex(e,t,n){return typeof t!="string"&&(n=t,t=void 0),H5(n)(Jh(Qh(n).document().write(Zh()(e,t,!0))))}function H5(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(fe),autolinkProtocol:w,autolinkEmail:w,atxHeading:i(pe),blockQuote:i(be),characterEscape:w,characterReference:w,codeFenced:i(Te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Te,s),codeText:i(te,s),codeTextData:w,data:w,codeFlowValue:w,definition:i(Me),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(Ae),hardBreakEscape:i(Pt),hardBreakTrailing:i(Pt),htmlFlow:i(nn,s),htmlFlowData:w,htmlText:i(nn,s),htmlTextData:w,image:i(Mr),label:s,link:i(fe),listItem:i(he),listItemValue:g,listOrdered:i(tt,d),listUnordered:i(tt),paragraph:i(oe),reference:M,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Y),thematicBreak:i(ie)},exit:{atxHeading:u(),atxHeadingSequence:$,autolink:u(),autolinkEmail:Ke,autolinkProtocol:ae,blockQuote:u(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:ge,characterReference:xe,codeFenced:u(T),codeFencedFence:k,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:v,codeIndented:u(E),codeText:u(b),codeTextData:v,data:v,definition:u(),definitionDestinationString:R,definitionLabelString:I,definitionTitleString:D,emphasis:u(),hardBreakEscape:u(m),hardBreakTrailing:u(m),htmlFlow:u(F),htmlFlowData:v,htmlText:u(S),htmlTextData:v,image:u(L),label:N,labelText:B,lineEnding:C,link:u(A),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:K,resourceDestinationString:h,resourceTitleString:j,resource:W,setextHeading:u(x),setextHeadingLineSequence:z,setextHeadingText:P,strong:u(),thematicBreak:u()}};pT(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(O){let U={type:"root",children:[]},H={stack:[U],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:l,data:n},Be=[],_e=-1;for(;++_e<O.length;)if(O[_e][1].type==="listOrdered"||O[_e][1].type==="listUnordered")if(O[_e][0]==="enter")Be.push(_e);else{let bt=Be.pop();_e=o(O,bt,_e)}for(_e=-1;++_e<O.length;){let bt=t[O[_e][0]];uT.call(bt,O[_e][1].type)&&bt[O[_e][1].type].call(Object.assign({sliceSerialize:O[_e][2].sliceSerialize},H),O[_e][1])}if(H.tokenStack.length>0){let bt=H.tokenStack[H.tokenStack.length-1];(bt[1]||cT).call(H,void 0,bt[0])}for(U.position={start:Uo(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Uo(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e<t.transforms.length;)U=t.transforms[_e](U)||U;return U}function o(O,U,H){let Be=U-1,_e=-1,bt=!1,Gn,nr,En,mo;for(;++Be<=H;){let wn=O[Be];switch(wn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{wn[0]==="enter"?_e++:_e--,mo=void 0;break}case"lineEndingBlank":{wn[0]==="enter"&&(Gn&&!mo&&!_e&&!En&&(En=Be),mo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mo=void 0}if(!_e&&wn[0]==="enter"&&wn[1].type==="listItemPrefix"||_e===-1&&wn[0]==="exit"&&(wn[1].type==="listUnordered"||wn[1].type==="listOrdered")){if(Gn){let Br=Be;for(nr=void 0;Br--;){let rn=O[Br];if(rn[1].type==="lineEnding"||rn[1].type==="lineEndingBlank"){if(rn[0]==="exit")continue;nr&&(O[nr][1].type="lineEndingBlank",bt=!0),rn[1].type="lineEnding",nr=Br}else if(!(rn[1].type==="linePrefix"||rn[1].type==="blockQuotePrefix"||rn[1].type==="blockQuotePrefixWhitespace"||rn[1].type==="blockQuoteMarker"||rn[1].type==="listItemIndent"))break}En&&(!nr||En<nr)&&(Gn._spread=!0),Gn.end=Object.assign({},nr?O[nr][1].start:wn[1].end),O.splice(nr||Be,0,["exit",Gn,wn[2]]),Be++,H++}if(wn[1].type==="listItemPrefix"){let Br={type:"listItem",_spread:!1,start:Object.assign({},wn[1].start),end:void 0};Gn=Br,O.splice(Be,0,["enter",Br,wn[2]]),Be++,H++,En=void 0,mo=!0}}}return O[U][1]._spread=bt,H}function i(O,U){return H;function H(Be){a.call(this,O(Be),Be),U&&U.call(this,Be)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(O,U,H){this.stack[this.stack.length-1].children.push(O),this.stack.push(O),this.tokenStack.push([U,H||void 0]),O.position={start:Uo(U.start),end:void 0}}function u(O){return U;function U(H){O&&O.call(this,H),c.call(this,H)}}function c(O,U){let H=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==O.type&&(U?U.call(this,O,Be[0]):(Be[1]||cT).call(this,O,Be[0]));else throw new Error("Cannot close `"+O.type+"` ("+Oo({start:O.start,end:O.end})+"): it\u2019s not open");H.position.end=Uo(O.end)}function l(){return Nh(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function g(O){if(this.data.expectingFirstListItemValue){let U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(O),10),this.data.expectingFirstListItemValue=void 0}}function p(){let O=this.resume(),U=this.stack[this.stack.length-1];U.lang=O}function f(){let O=this.resume(),U=this.stack[this.stack.length-1];U.meta=O}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O.replace(/(\r?\n|\r)$/g,"")}function I(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=lo(this.sliceSerialize(O)).toLowerCase()}function D(){let O=this.resume(),U=this.stack[this.stack.length-1];U.title=O}function R(){let O=this.resume(),U=this.stack[this.stack.length-1];U.url=O}function $(O){let U=this.stack[this.stack.length-1];if(!U.depth){let H=this.sliceSerialize(O).length;U.depth=H}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function z(O){let U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function x(){this.data.setextHeadingSlurpLineEnding=void 0}function w(O){let H=this.stack[this.stack.length-1].children,Be=H[H.length-1];(!Be||Be.type!=="text")&&(Be=me(),Be.position={start:Uo(O.start),end:void 0},H.push(Be)),this.stack.push(Be)}function v(O){let U=this.stack.pop();U.value+=this.sliceSerialize(O),U.position.end=Uo(O.end)}function C(O){let U=this.stack[this.stack.length-1];if(this.data.atHardBreak){let H=U.children[U.children.length-1];H.position.end=Uo(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(w.call(this,O),v.call(this,O))}function m(){this.data.atHardBreak=!0}function F(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function S(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function b(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function A(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let U=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=U,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function L(){let O=this.stack[this.stack.length-1];if(this.data.inReference){let U=this.data.referenceType||"shortcut";O.type+="Reference",O.referenceType=U,delete O.url,delete O.title}else delete O.identifier,delete O.label;this.data.referenceType=void 0}function B(O){let U=this.sliceSerialize(O),H=this.stack[this.stack.length-2];H.label=lT(U),H.identifier=lo(U).toLowerCase()}function N(){let O=this.stack[this.stack.length-1],U=this.resume(),H=this.stack[this.stack.length-1];if(this.data.inReference=!0,H.type==="link"){let Be=O.children;H.children=Be}else H.alt=U}function h(){let O=this.resume(),U=this.stack[this.stack.length-1];U.url=O}function j(){let O=this.resume(),U=this.stack[this.stack.length-1];U.title=O}function W(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function K(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=lo(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function ee(O){this.data.characterReferenceType=O.type}function ge(O){let U=this.sliceSerialize(O),H=this.data.characterReferenceType,Be;H?(Be=Tc(U,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=Ki(U);let _e=this.stack[this.stack.length-1];_e.value+=Be}function xe(O){let U=this.stack.pop();U.position.end=Uo(O.end)}function ae(O){v.call(this,O);let U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(O)}function Ke(O){v.call(this,O);let U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(O)}function be(){return{type:"blockquote",children:[]}}function Te(){return{type:"code",lang:null,meta:null,value:""}}function te(){return{type:"inlineCode",value:""}}function Me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function Pt(){return{type:"break"}}function nn(){return{type:"html",value:""}}function Mr(){return{type:"image",title:null,url:"",alt:null}}function fe(){return{type:"link",title:null,url:"",children:[]}}function tt(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function he(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function oe(){return{type:"paragraph",children:[]}}function Y(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}function Uo(e){return{line:e.line,column:e.column,offset:e.offset}}function pT(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?pT(e,r):W5(e,r)}}function W5(e,t){let n;for(n in t)if(uT.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r);break}}}function cT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Oo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Oo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Oo({start:t.start,end:t.end})+") is still open")}function zc(e){let t=this;t.parser=n;function n(r){return ex(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function dT(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function gT(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
84
|
+
`}]}function fT(e,t){let n=t.value?t.value+`
|
|
85
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function mT(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hT(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xT(e,t){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=mr(r.toLowerCase()),i=e.footnoteOrder.indexOf(r),s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+1,a+=1,e.footnoteCounts.set(r,a);let u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,u);let c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function yT(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bT(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nc(e,t){let n=t.referenceType,r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];let o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});let s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function ST(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nc(e,t);let o={src:mr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);let i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function wT(e,t){let n={src:mr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function vT(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function kT(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nc(e,t);let o={href:mr(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);let i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function CT(e,t){let n={href:mr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function TT(e,t,n){let r=e.all(t),o=n?V5(n):IT(t),i={},s=[];if(typeof t.checked=="boolean"){let l=r[0],d;l&&l.type==="element"&&l.tagName==="p"?d=l:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let l=r[a];(o||a!==0||l.type!=="element"||l.tagName!=="p")&&s.push({type:"text",value:`
|
|
86
86
|
`}),l.type==="element"&&l.tagName==="p"&&!o?s.push(...l.children):s.push(l)}let u=r[r.length-1];u&&(o||u.type!=="element"||u.tagName!=="p")&&s.push({type:"text",value:`
|
|
87
|
-
`});let c={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,c),e.applyData(t,c)}function
|
|
87
|
+
`});let c={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,c),e.applyData(t,c)}function V5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=IT(n[r])}return t}function IT(e){let t=e.spread;return t??e.children.length>1}function FT(e,t){let n={},r=e.all(t),o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){let s=r[o];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function ET(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AT(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function PT(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LT(e,t){let n=e.all(t),r=n.shift(),o=[];if(r){let s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),o.push(s)}if(n.length>0){let s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Yi(t.children[1]),u=Cc(t.children[t.children.length-1]);a&&u&&(s.position={start:a,end:u}),o.push(s)}let i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function MT(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length,u=-1,c=[];for(;++u<a;){let d=t.children[u],g={},p=s?s[u]:void 0;p&&(g.align=p);let f={type:"element",tagName:i,properties:g,children:[]};d&&(f.children=e.all(d),e.patch(d,f),f=e.applyData(d,f)),c.push(f)}let l={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function BT(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function RT(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),o=0,i=[];for(;r;)i.push(DT(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(DT(t.slice(o),o>0,!1)),i.join("")}function DT(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===9||i===32;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===9||i===32;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function zT(e,t){let n={type:"text",value:RT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function NT(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var OT={blockquote:dT,break:gT,code:fT,delete:mT,emphasis:hT,footnoteReference:xT,heading:yT,html:bT,imageReference:ST,image:wT,inlineCode:vT,linkReference:kT,link:CT,listItem:TT,list:FT,paragraph:ET,root:AT,strong:PT,table:LT,tableCell:BT,tableRow:MT,text:zT,thematicBreak:NT,toml:Oc,yaml:Oc,definition:Oc,footnoteDefinition:Oc};function Oc(){}var _T=typeof self=="object"?self:globalThis,K5=(e,t)=>{let n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);let[i,s]=t[o];switch(i){case 0:case-1:return n(s,o);case 1:{let a=n([],o);for(let u of s)a.push(r(u));return a}case 2:{let a=n({},o);for(let[u,c]of s)a[r(u)]=r(c);return a}case 3:return n(new Date(s),o);case 4:{let{source:a,flags:u}=s;return n(new RegExp(a,u),o)}case 5:{let a=n(new Map,o);for(let[u,c]of s)a.set(r(u),r(c));return a}case 6:{let a=n(new Set,o);for(let u of s)a.add(r(u));return a}case 7:{let{name:a,message:u}=s;return n(new _T[a](u),o)}case 8:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{let{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new _T[i](s),o)};return r},rx=e=>K5(new Map,e)(0);var Qi="",{toString:X5}={},{keys:Q5}=Object,Ca=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let n=X5.call(e).slice(8,-1);switch(n){case"Array":return[1,Qi];case"Object":return[2,Qi];case"Date":return[3,Qi];case"RegExp":return[4,Qi];case"Map":return[5,Qi];case"Set":return[6,Qi];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},$c=([e,t])=>e===0&&(t==="function"||t==="symbol"),J5=(e,t,n,r)=>{let o=(s,a)=>{let u=r.push(s)-1;return n.set(a,u),u},i=s=>{if(n.has(s))return n.get(s);let[a,u]=Ca(s);switch(a){case 0:{let l=s;switch(u){case"bigint":a=8,l=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);l=null;break;case"undefined":return o([-1],s)}return o([a,l],s)}case 1:{if(u){let g=s;return u==="DataView"?g=new Uint8Array(s.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(s)),o([u,[...g]],s)}let l=[],d=o([a,l],s);for(let g of s)l.push(i(g));return d}case 2:{if(u)switch(u){case"BigInt":return o([u,s.toString()],s);case"Boolean":case"Number":case"String":return o([u,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());let l=[],d=o([a,l],s);for(let g of Q5(s))(e||!$c(Ca(s[g])))&&l.push([i(g),i(s[g])]);return d}case 3:return o([a,s.toISOString()],s);case 4:{let{source:l,flags:d}=s;return o([a,{source:l,flags:d}],s)}case 5:{let l=[],d=o([a,l],s);for(let[g,p]of s)(e||!($c(Ca(g))||$c(Ca(p))))&&l.push([i(g),i(p)]);return d}case 6:{let l=[],d=o([a,l],s);for(let g of s)(e||!$c(Ca(g)))&&l.push(i(g));return d}}let{message:c}=s;return o([a,{name:u,message:c}],s)};return i},ox=(e,{json:t,lossy:n}={})=>{let r=[];return J5(!(t||n),!!t,new Map,r)(e),r};var Ji=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?rx(ox(e,t)):structuredClone(e):(e,t)=>rx(ox(e,t));function Z5(e,t){let n=[{type:"text",value:"\u21A9"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function e6(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function WT(e){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Z5,r=e.options.footnoteBackLabel||e6,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],u=-1;for(;++u<e.footnoteOrder.length;){let c=e.footnoteById.get(e.footnoteOrder[u]);if(!c)continue;let l=e.all(c),d=String(c.identifier).toUpperCase(),g=mr(d.toLowerCase()),p=0,f=[],k=e.footnoteCounts.get(d);for(;k!==void 0&&++p<=k;){f.length>0&&f.push({type:"text",value:" "});let I=typeof n=="string"?n:n(u,p);typeof I=="string"&&(I={type:"text",value:I}),f.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,p),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}let T=l[l.length-1];if(T&&T.type==="element"&&T.tagName==="p"){let I=T.children[T.children.length-1];I&&I.type==="text"?I.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...f)}else l.push(...f);let E={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(l,!0)};e.patch(c,E),a.push(E)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ji(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
88
88
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
89
|
-
`}]}}var Uc=(function(e){if(e==null)return
|
|
89
|
+
`}]}}var Uc=(function(e){if(e==null)return o6;if(typeof e=="function")return jc(e);if(typeof e=="object")return Array.isArray(e)?t6(e):n6(e);if(typeof e=="string")return r6(e);throw new Error("Expected function, string, or object as test")});function t6(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Uc(e[n]);return jc(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function n6(e){let t=e;return jc(n);function n(r){let o=r,i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function r6(e){return jc(t);function t(n){return n&&n.type===e}}function jc(e){return t;function t(n,r,o){return!!(i6(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function o6(){return!0}function i6(e){return e!==null&&typeof e=="object"&&"type"in e}var VT=[],ix=!0,Hc=!1,sx="skip";function ax(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;let i=Uc(o),s=r?-1:1;a(e,void 0,[])();function a(u,c,l){let d=u&&typeof u=="object"?u:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return g;function g(){let p=VT,f,k,T;if((!t||i(u,c,l[l.length-1]||void 0))&&(p=s6(n(u,l)),p[0]===Hc))return p;if("children"in u&&u.children){let E=u;if(E.children&&p[0]!==sx)for(k=(r?E.children.length:-1)+s,T=l.concat(E);k>-1&&k<E.children.length;){let I=E.children[k];if(f=a(I,k,T)(),f[0]===Hc)return f;k=typeof f[1]=="number"?f[1]:k+s}}return p}}}function s6(e){return Array.isArray(e)?e:typeof e=="number"?[ix,e]:e==null?VT:[e]}function Ta(e,t,n,r){let o,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,o=n):(i=t,s=n,o=r),ax(e,i,a,o);function a(u,c){let l=c[c.length-1],d=l?l.children.indexOf(u):void 0;return s(u,d,l)}}var lx={}.hasOwnProperty,a6={};function qT(e,t){let n=t||a6,r=new Map,o=new Map,i=new Map,s={...OT,...n.handlers},a={all:c,applyData:c6,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:u,options:n,patch:l6,wrap:p6};return Ta(e,function(l){if(l.type==="definition"||l.type==="footnoteDefinition"){let d=l.type==="definition"?r:o,g=String(l.identifier).toUpperCase();d.has(g)||d.set(g,l)}}),a;function u(l,d){let g=l.type,p=a.handlers[g];if(lx.call(a.handlers,g)&&p)return p(a,l,d);if(a.options.passThrough&&a.options.passThrough.includes(g)){if("children"in l){let{children:k,...T}=l,E=Ji(T);return E.children=a.all(l),E}return Ji(l)}return(a.options.unknownHandler||u6)(a,l,d)}function c(l){let d=[];if("children"in l){let g=l.children,p=-1;for(;++p<g.length;){let f=a.one(g[p],l);if(f){if(p&&g[p-1].type==="break"&&(!Array.isArray(f)&&f.type==="text"&&(f.value=GT(f.value)),!Array.isArray(f)&&f.type==="element")){let k=f.children[0];k&&k.type==="text"&&(k.value=GT(k.value))}Array.isArray(f)?d.push(...f):d.push(f)}}}return d}}function l6(e,t){e.position&&(t.position=Lh(e))}function c6(e,t){let n=t;if(e&&e.data){let r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{let s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,Ji(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function u6(e,t){let n=t.data||{},r="value"in t&&!(lx.call(n,"hProperties")||lx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function p6(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:`
|
|
90
90
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
91
91
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
92
|
-
`}),n}function
|
|
93
|
-
`},o)),i}function Vc(e,t){return e&&"run"in e?async function(n,r){let o=Wc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Wc(n,{file:r,...e||t})}}function cx(e){if(e)throw e}var Yc=$a(JT(),1);function Ta(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ux(){let e=[],t={run:n,use:r};return t;function n(...o){let i=-1,s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(u,...c){let l=e[++i],d=-1;if(u){s(u);return}for(;++d<o.length;)(c[d]===null||c[d]===void 0)&&(c[d]=o[d]);o=c,l?ZT(l,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function ZT(e,t){let n;return r;function r(...s){let a=e.length>s.length,u;a&&s.push(o);try{u=e.apply(this,s)}catch(c){let l=c;if(a&&n)throw l;return o(l)}a||(u&&u.then&&typeof u.then=="function"?u.then(i,o):u instanceof Error?o(u):i(u))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}var Ar={basename:l6,dirname:c6,extname:u6,join:p6,sep:"/"};function l6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ia(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function c6(e){if(Ia(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function u6(e){Ia(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){let a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function p6(...e){let t=-1,n;for(;++t<e.length;)Ia(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":d6(n)}function d6(e){Ia(e);let t=e.codePointAt(0)===47,n=f6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function f6(e,t){let n="",r=0,o=-1,i=0,s=-1,a,u;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Ia(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var eI={cwd:g6};function g6(){return"/"}function Ji(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function tI(e){if(typeof e=="string")e=new URL(e);else if(!Ji(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return m6(e)}function m6(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let r=t.codePointAt(n+2);if(r===70||r===102){let o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}var px=["history","path","basename","stem","extname","dirname"],pi=class{constructor(t){let n;t?Ji(t)?n={path:t}:typeof t=="string"||h6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":eI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<px.length;){let i=px[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)px.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Ar.basename(this.path):void 0}set basename(t){fx(t,"basename"),dx(t,"basename"),this.path=Ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ar.dirname(this.path):void 0}set dirname(t){nI(this.basename,"dirname"),this.path=Ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ar.extname(this.path):void 0}set extname(t){if(dx(t,"extname"),nI(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ji(t)&&(t=tI(t)),fx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ar.basename(this.path,this.extname):void 0}set stem(t){fx(t,"stem"),dx(t,"stem"),this.path=Ar.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){let o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){let o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){let o=new Wt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}};function dx(e,t){if(e&&e.includes(Ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ar.sep+"`")}function fx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nI(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function h6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var rI=(function(e){let r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i});var x6={}.hasOwnProperty,xx=class e extends rI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ux()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];t.use(...r)}return t.data((0,Yc.default)(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(hx("data",this.frozen),this.namespace[t]=n,this):x6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(hx("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;let t=this;for(;++this.freezeIndex<this.attachers.length;){let[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let n=qc(t),r=this.parser||this.Parser;return gx("parse",r),r(String(n),n)}process(t,n){let r=this;return this.freeze(),gx("process",this.parser||this.Parser),mx("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){let a=qc(t),u=r.parse(a);r.run(u,a,function(l,d,f){if(l||!d||!f)return c(l);let p=d,g=r.stringify(p,f);b6(g)?f.value=g:f.result=g,c(l,f)});function c(l,d){l||!d?s(l):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),gx("processSync",this.parser||this.Parser),mx("processSync",this.compiler||this.Compiler),this.process(t,o),iI("processSync","process",n),r;function o(i,s){n=!0,cx(i),r=s}}run(t,n,r){oI(t),this.freeze();let o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){let u=qc(n);o.run(t,u,c);function c(l,d,f){let p=d||t;l?a(l):s?s(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),iI("runSync","run",r),o;function i(s,a){cx(s),o=a,r=!0}}stringify(t,n){this.freeze();let r=qc(n),o=this.compiler||this.Compiler;return mx("stringify",o),oI(t),o(t,r)}use(t,...n){let r=this.attachers,o=this.namespace;if(hx("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[l,...d]=c;u(l,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(o.settings=(0,Yc.default)(!0,o.settings,c.settings))}function a(c){let l=-1;if(c!=null)if(Array.isArray(c))for(;++l<c.length;){let d=c[l];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,l){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...l]);else if(l.length>0){let[p,...g]=l,k=r[f][1];Ta(k)&&Ta(p)&&(p=(0,Yc.default)(!0,k,p)),r[f]=[c,p,...g]}}}},yx=new xx().freeze();function gx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function mx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function hx(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oI(e){if(!Ta(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function iI(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qc(e){return y6(e)?e:new pi(e)}function y6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function b6(e){return typeof e=="string"||S6(e)}function S6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var C6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",sI=[],aI={allowDangerousHtml:!0},T6=/^(https?|ircs?|mailto|xmpp)$/i,I6=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bx(e){let t=F6(e),n=E6(e);return A6(t.runSync(t.parse(n),n),e)}function F6(e){let t=e.rehypePlugins||sI,n=e.remarkPlugins||sI,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...aI}:aI;return yx().use(zc).use(n).use(Vc,r).use(t)}function E6(e){let t=e.children||"",n=new pi;return typeof t=="string"?n.value=t:(""+t,void 0),n}function A6(e,t){let n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||lI;for(let l of I6)Object.hasOwn(t,l.from)&&(""+l.from+(l.to?"use `"+l.to+"` instead":"remove it")+C6+l.id,void 0);return n&&i&&void 0,Ca(e,c),Dh(e,{Fragment:w6,components:o,ignoreInvalidStyle:!0,jsx:v6,jsxs:k6,passKeys:!0,passNode:!0});function c(l,d,f){if(l.type==="raw"&&f&&typeof d=="number")return s?f.children.splice(d,1):f.children[d]={type:"text",value:l.value},d;if(l.type==="element"){let p;for(p in ha)if(Object.hasOwn(ha,p)&&Object.hasOwn(l.properties,p)){let g=l.properties[p],k=ha[p];(k===null||k.includes(l.tagName))&&(l.properties[p]=u(String(g||""),p,l))}}if(l.type==="element"){let p=n?!n.includes(l.tagName):i?i.includes(l.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(l,d,f)),p&&f&&typeof d=="number")return a&&l.children?f.children.splice(d,1,...l.children):f.children.splice(d,1),d}}}function lI(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||T6.test(e.slice(0,t))?e:""}Ce();var L6=Zi.div({display:"flex",flexDirection:"column",gap:"12px"}),M6=Zi.div({display:"flex",justifyContent:"space-between",alignItems:"center"}),B6=Zi.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),D6=Zi(kn)({padding:"6px 12px",fontSize:"12px"}),R6=Zi.div(({theme:e})=>({backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"12px",fontSize:"12px",color:e.color.defaultText,overflowY:"auto",maxHeight:"400px",lineHeight:"1.6","& h1, & h2, & h3, & h4":{marginTop:"16px",marginBottom:"8px",fontWeight:600,color:e.color.defaultText},"& h1":{fontSize:"18px"},"& h2":{fontSize:"16px"},"& h3":{fontSize:"14px"},"& h4":{fontSize:"13px"},"& p":{margin:"8px 0"},"& ul, & ol":{paddingLeft:"20px",margin:"8px 0"},"& li":{margin:"4px 0"},"& code":{backgroundColor:e.background.app,padding:"2px 4px",borderRadius:"3px",fontFamily:s1.fontMono,fontSize:"11px"},"& pre":{backgroundColor:e.background.app,padding:"8px",borderRadius:"4px",overflowX:"auto","& code":{backgroundColor:"transparent",padding:0}},"& strong":{fontWeight:600},"& blockquote":{borderLeft:`3px solid ${e.color.secondary}`,paddingLeft:"12px",margin:"8px 0",color:e.color.mediumdark}})),z6=Zi.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),Sx=()=>{let{fullPrompt:e,userRole:t,roleOverride:n}=ce(),[r,o]=P6(!1);if((n??t)!=="admin")return null;let s=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch(a){console.error("Failed to copy:",a)}};return e?di.createElement(L6,null,di.createElement(M6,null,di.createElement(B6,null,"Full Prompt"),di.createElement(D6,{onClick:s,disabled:r},r?"\u2713 Copied!":"\u{1F4CB} Copy")),di.createElement(R6,null,di.createElement(bx,null,e))):di.createElement(z6,null,"No prompt available. Generate a prompt or run a review to see the full prompt here.")};import co,{useRef as N6}from"react";import{styled as Pr}from"storybook/theming";Ce();var O6=Pr.div({display:"flex",flexDirection:"column",gap:"8px"}),Yde=Pr.div(({theme:e,variant:t,value:n})=>{let o=t==="issues"?n===0?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n<=3?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n<=6?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"}:n>=80?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n>=60?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n>=40?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"};return{fontSize:"11px",fontWeight:700,color:o.text,backgroundColor:o.bg,padding:"3px 10px",borderRadius:"12px",border:`1px solid ${o.border}`,whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"6px"}}),_6=Pr.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"6px",maxHeight:"200px",overflowY:"auto",scrollBehavior:"smooth",padding:"6px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app})),$6=Pr.div(({role:e,theme:t})=>({padding:"8px 10px",borderRadius:"4px",fontSize:"11px",lineHeight:"1.4",backgroundColor:e==="system"?t.background.hoverable:t.background.content,border:`1px solid ${t.appBorderColor}`,color:t.color.defaultText})),Kde=Pr.div(({theme:e})=>({fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:e.color.mediumdark,marginBottom:"6px",letterSpacing:"0.5px"})),cI=Pr.div(({theme:e})=>({whiteSpace:"pre-wrap",wordWrap:"break-word",fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',fontSize:"10px","& .section-header":{fontSize:"11px",fontWeight:700,color:e.color.secondary,marginTop:"8px",marginBottom:"4px",display:"block"},"& .issue-header":{fontWeight:600,marginTop:"6px",marginBottom:"2px",display:"block"},"& .severity-critical":{color:e.color.negative||"#dc2626",fontWeight:700},"& .severity-major":{color:e.color.warning||se,fontWeight:700},"& .severity-minor":{color:e.color.warning||"#ca8a04",fontWeight:700},"& .issue-type":{color:e.color.secondary,fontWeight:600},"& .source-tag":{color:e.base==="dark"?"#22d3ee":"#0891b2",backgroundColor:e.base==="dark"?"rgba(34, 211, 238, 0.2)":"#cffafe",padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600},"& .field-label":{color:e.textMutedColor,fontWeight:600},"& .field-value":{color:e.color.defaultText},"& .score":{fontSize:"11px",fontWeight:700,color:e.color.positive||"#16a34a",display:"inline-block",padding:"1px 6px",backgroundColor:e.background.positive||"#dcfce7",borderRadius:"3px"},"& .score-low":{color:e.color.negative||"#dc2626",backgroundColor:e.background.negative||"#fee2e2"},"& .score-medium":{color:e.color.warning||se,backgroundColor:e.background.warning||"#ffedd5"}})),U6=Pr.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),j6=Pr.div(({theme:e})=>({padding:"12px 16px",borderRadius:"8px",backgroundColor:e.background.positive||"#dcfce7",border:`1px solid ${e.color.positive||"#86efac"}`,color:e.color.positive||"#166534",fontSize:"13px",fontWeight:500,lineHeight:1.5,marginBottom:"12px"})),H6=Pr.div({fontWeight:700,fontSize:"14px",marginBottom:"4px",display:"flex",alignItems:"center",gap:"6px"}),W6=Pr.div(({theme:e})=>({fontSize:"12px",opacity:.9,color:e.color.positive||"#166534"})),Xde=Pr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",textAlign:"right"}));function V6(e){let t=e;return t=t.replace(/^(?:\*?\*?)?(?:##?)?\s*SCORE:\s*\d+.*$/gm,""),t=t.replace(/^(ISSUES:|SUMMARY:)/gm,'<span class="section-header">$1</span>'),t=t.replace(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g,(n,r,o,i,s)=>{let a=o.toLowerCase().includes("critical")?"severity-critical":o.toLowerCase().includes("major")?"severity-major":"severity-minor";return`<span class="issue-header"><span class="issue-type">[${r}]</span> <span class="${a}">[${o}]</span> <span class="source-tag">[${i}]</span> - ${s}</span>`}),t=t.replace(/^(Expected:|Actual:|Property:|Source:|Fix:|Visual Difference:)\s*(.+)/gm,'<span class="field-label">$1</span> <span class="field-value">$2</span>'),t}var wx=()=>{let{streamingMessages:e,fullResponse:t,reviewHistory:n,currentReviewId:r,userRole:o,roleOverride:i}=ce(),s=N6(null);if((i??o)!=="admin")return null;let u=r?n.find(g=>g.id===r):null,c=u?u.issues.length>0&&u.issues.every(g=>g.dismissed):!1,l=u&&(u.complianceScore===100||c),d=e.filter(g=>g.role==="assistant"||g.role==="system"&&g.content.includes("auto-dismissed")),f=d.length===0&&!!t;if(d.length===0&&!f)return co.createElement(U6,null,"No AI response yet. The AI's analysis will appear here as it streams.");let p=d.length>0?d:[{role:"assistant",content:t}];return co.createElement(O6,null,l&&co.createElement(j6,null,co.createElement(H6,null,"Component Matches Design"),co.createElement(W6,null,c&&u?.issues.length?`All ${u.issues.length} issue${u.issues.length===1?"":"s"} identified by the AI ${u.issues.length===1?"was":"were"} validated as false positive${u.issues.length===1?"":"s"} and auto-dismissed.`:"No design discrepancies found. The implementation matches the Figma design.")),co.createElement(_6,{ref:s},p.map((g,k)=>co.createElement($6,{key:k,role:g.role},g.role==="system"?co.createElement(cI,null,g.content):co.createElement(cI,{dangerouslySetInnerHTML:{__html:V6(g.content)}})))))};import hr from"react";import{styled as jo}from"storybook/theming";Ce();Oe();var G6=jo.div({display:"flex",flexDirection:"column",gap:"12px"}),q6=jo.div(({theme:e})=>({display:"flex",gap:"6px",borderBottom:`2px solid ${e.appBorderColor}`,overflowX:"auto",paddingBottom:"2px"})),Y6=jo.button(({theme:e,isActive:t,provider:n})=>{let o={anthropic:{background:"#D4A574",text:"#ffffff",hover:"#C49564"},openai:{background:e.color.positive||"#10b981",text:"#ffffff",hover:e.base==="dark"?"#34d399":"#059669"},google:{background:"#4285F4",text:"#ffffff",hover:"#3367D6"}}[n];return{display:"flex",alignItems:"center",gap:"6px",padding:"8px 16px",fontSize:"12px",fontWeight:600,color:t?o.text:e.textMutedColor,backgroundColor:t?o.background:"transparent",border:"none",borderRadius:"6px 6px 0 0",cursor:"pointer",whiteSpace:"nowrap",transition:"all 0.2s",opacity:t?1:.6,"&:hover":{opacity:1,backgroundColor:t?o.hover:e.background.hoverable}}}),uI=jo.div(({theme:e,variant:t,value:n})=>{let o=t==="issues"?n===0?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n<=3?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n<=6?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"}:n>=80?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n>=60?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n>=40?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"};return{fontSize:"10px",fontWeight:700,color:o.text,backgroundColor:o.bg,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${o.border}`,whiteSpace:"nowrap"}}),K6=jo.div(({theme:e})=>({padding:"12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app,minHeight:"200px",maxHeight:"400px",overflowY:"auto",scrollBehavior:"smooth"})),pI=jo.div(({theme:e})=>({fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordWrap:"break-word",fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',color:e.color.defaultText,"& .section-header":{fontSize:"13px",fontWeight:700,color:e.color.secondary,marginTop:"12px",marginBottom:"6px",display:"block"},"& .issue-header":{fontWeight:600,marginTop:"10px",marginBottom:"4px",display:"block"},"& .severity-critical":{color:e.color.negative||"#dc2626",fontWeight:700},"& .severity-major":{color:e.color.warning||se,fontWeight:700},"& .severity-minor":{color:e.color.warning||"#ca8a04",fontWeight:700},"& .issue-type":{color:e.color.secondary,fontWeight:600},"& .source-tag":{color:e.base==="dark"?"#22d3ee":"#0891b2",backgroundColor:e.base==="dark"?"rgba(34, 211, 238, 0.2)":"#cffafe",padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600},"& .field-label":{color:e.textMutedColor,fontWeight:600},"& .field-value":{color:e.color.defaultText},"& .score":{fontSize:"14px",fontWeight:700,color:e.color.positive||"#16a34a",display:"inline-block",padding:"2px 8px",backgroundColor:e.background.positive||"#dcfce7",borderRadius:"4px"},"& .score-low":{color:e.color.negative||"#dc2626",backgroundColor:e.background.negative||"#fee2e2"},"& .score-medium":{color:e.color.warning||se,backgroundColor:e.background.warning||"#ffedd5"}})),dI=jo.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),X6=jo.div({width:"12px",height:"12px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 0.8s linear infinite",display:"inline-block",marginLeft:"6px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}});function fI(e){let t=e;return t=t.replace(/^(ISSUES:|SCORE:|SUMMARY:)/gm,'<span class="section-header">$1</span>'),t=t.replace(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g,(n,r,o,i,s)=>{let a=o.toLowerCase().includes("critical")?"severity-critical":o.toLowerCase().includes("major")?"severity-major":"severity-minor";return`<span class="issue-header"><span class="issue-type">[${r}]</span> <span class="${a}">[${o}]</span> <span class="source-tag">[${i}]</span> - ${s}</span>`}),t=t.replace(/^(Expected:|Actual:|Property:|Source:|Fix:|Visual Difference:)\s*(.+)/gm,'<span class="field-label">$1</span> <span class="field-value">$2</span>'),t=t.replace(/SCORE:\s*(\d+)/g,(n,r)=>{let o=parseInt(r,10);return`SCORE: <span class="${o>=80?"score":o>=60?"score score-medium":"score score-low"}">${r}</span>`}),t}function Q6(e){let t=e.match(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-/g),n=t?t.length:0,r=e.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i),o=r?parseInt(r[1],10):null;return{issueCount:n,score:o}}var gI=()=>{let{multiModelResults:e,isReviewing:t,setActiveModelId:n,selectedModels:r,userRole:o,roleOverride:i}=ce();if((i??o)!=="admin")return null;hr.useEffect(()=>{e&&(y.debug("[ModelResultsTabs] multiModelResults:",e),Object.entries(e.byModel).forEach(([l,d])=>{y.debug(`[ModelResultsTabs] ${l}:`,{hasStreamingMessages:!!d.streamingMessages,streamingMessagesLength:d.streamingMessages?.length||0,streamingMessagesPreview:d.streamingMessages?.[0]?.content?.substring(0,100),hasFullResponse:!!d.fullResponse,fullResponsePreview:d.fullResponse?.substring(0,100)})}))},[e]);let a=e&&Object.keys(e.byModel).length>0?Object.keys(e.byModel):r,u=e?.activeModelId||(a.length>0?a[0]:""),c=e?.byModel||{};return a.length===0?hr.createElement(dI,null,"No models selected. Select multiple models to compare results."):hr.createElement(G6,null,hr.createElement(q6,null,a.map(l=>{let d=so.find(E=>E.id===l),f=c[l],g=Q6(t&&f?.streamingMessages&&f.streamingMessages.length>0?f.streamingMessages[0].content||"":f?.fullResponse?f.fullResponse:""),k=l===u;if(!d)return null;let T=t&&!f?.completed;return hr.createElement(Y6,{key:l,isActive:k,provider:d.provider,onClick:()=>n(l)},d.name,f&&g.issueCount>0&&hr.createElement(uI,{variant:"issues",value:g.issueCount},g.issueCount," issues"),f&&g.score!==null&&hr.createElement(uI,{variant:"score",value:g.score},"Score: ",g.score),T&&hr.createElement(X6,null))})),hr.createElement(K6,null,c[u]?.streamingMessages&&c[u].streamingMessages.length>0?c[u].streamingMessages.map((l,d)=>hr.createElement(pI,{key:d,dangerouslySetInnerHTML:{__html:fI(l.content)}})):c[u]?.fullResponse?hr.createElement(pI,{dangerouslySetInnerHTML:{__html:fI(c[u].fullResponse)}}):hr.createElement(dI,null,t?`Waiting for ${so.find(l=>l.id===u)?.name}...`:`No response yet for ${so.find(l=>l.id===u)?.name}`)))};import We from"react";import{styled as Ct}from"storybook/theming";Ce();Rn();Ce();import{useCallback as vx}from"react";Oe();function mI(){let{dismissIssue:e,undismissIssue:t,reviewHistory:n}=ce(),{sessionToken:r}=we(),o=vx(a=>{for(let u of n){let c=u.issues.find(l=>l.id===a);if(c)return c.dbId||c.id||null}return null},[n]),i=vx((a,u)=>{e(a,u,"user");let c=o(a);if(!c){y.debug("[useIssuePersistence] Dismiss skipped server sync \u2014 no dbId for",a);return}if(!r){y.debug("[useIssuePersistence] Dismiss skipped \u2014 no session token");return}Kl(c,!0,u,"user",r).then(l=>{l.success||y.warn("[useIssuePersistence] Dismiss server sync failed:",l.error)})},[e,o,r]),s=vx(a=>{t(a);let u=o(a);if(!u){y.debug("[useIssuePersistence] Undismiss skipped server sync \u2014 no dbId for",a);return}if(!r){y.debug("[useIssuePersistence] Undismiss skipped \u2014 no session token");return}Kl(u,!1,void 0,"user",r).then(c=>{c.success||y.warn("[useIssuePersistence] Undismiss server sync failed:",c.error)})},[t,o,r]);return{dismissAndSync:i,undismissAndSync:s}}import q,{useMemo as l8,useState as c8,useEffect as u8}from"react";import{styled as st,keyframes as p8}from"storybook/theming";import Z,{useState as Fx,useRef as Jj,useCallback as PI,memo as Zj}from"react";import{styled as Le}from"storybook/theming";import uo,{useState as J6}from"react";import{styled as po}from"storybook/theming";var Z6=po.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:9999}),ej=po.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"8px",padding:"24px",maxWidth:"500px",width:"90%",boxShadow:e.base==="dark"?"0 10px 40px rgba(0, 0, 0, 0.5)":"0 10px 40px rgba(0, 0, 0, 0.2)",border:`1px solid ${e.appBorderColor}`})),tj=po.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,marginTop:0,marginBottom:"12px"})),nj=po.p(({theme:e})=>({fontSize:"13px",color:e.textMutedColor,marginBottom:"16px",lineHeight:"1.5"})),rj=po.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px"})),oj=po.textarea(({theme:e})=>({width:"100%",minHeight:"80px",padding:"10px",fontSize:"13px",borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,color:e.color.defaultText,fontFamily:"inherit",resize:"vertical",marginBottom:"20px","&:focus":{outline:"none",borderColor:se,boxShadow:`0 0 0 3px ${e.base==="dark"?"rgba(124, 58, 237, 0.2)":"rgba(124, 58, 237, 0.1)"}`},"&::placeholder":{color:e.textMutedColor}})),ij=po.div({display:"flex",justifyContent:"flex-end",gap:"10px"}),sj=po(Yt)({}),aj=po(Rr)({}),hI=({isOpen:e,issueTitle:t,onConfirm:n,onCancel:r})=>{let[o,i]=J6("");if(!e)return null;let s=()=>{n(o.trim()||void 0),i("")},a=()=>{i(""),r()};return uo.createElement(Z6,{onClick:c=>{c.target===c.currentTarget&&a()}},uo.createElement(ej,null,uo.createElement(tj,null,"Dismiss as False Positive"),uo.createElement(nj,null,'Mark "',t,'" as a false positive. You can optionally provide a reason for dismissing this issue.'),uo.createElement(rj,{htmlFor:"dismiss-reason"},"Reason (optional)"),uo.createElement(oj,{id:"dismiss-reason",value:o,onChange:c=>i(c.target.value),placeholder:"e.g., This is intentional design, not an issue..."}),uo.createElement(ij,null,uo.createElement(aj,{onClick:a},"Cancel"),uo.createElement(sj,{onClick:s},"Dismiss Issue"))))};Ce();import Pe from"react";import{styled as it}from"storybook/theming";var Ne={outerBg:"#f0f0f0",borderBoxBg:"#fff",borderBoxStroke:"#999",paddingBg:"#dceefb",paddingStroke:"rgba(0,0,0,0.08)",contentStroke:"#888",text:"#333",dim:"#999",dash:"#aaa",blue:"#4a90d9",pink:"#e91e8c",err:"#d32f2f",errBg:"rgba(211,47,47,0.12)",ok:"#2e7d32"},lj=it.div(({theme:e})=>({marginTop:6,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,overflow:"hidden",maxWidth:340})),cj=it.div(({theme:e})=>({padding:"6px 10px",fontSize:11,fontWeight:500,color:e.color.defaultText,borderBottom:`1px solid ${e.appBorderColor}`})),uj=it.div({position:"relative",backgroundColor:Ne.outerBg,padding:"8px 12px 24px",fontFamily:"monospace",fontSize:11}),xfe=it.div({display:"flex",justifyContent:"space-between",alignItems:"center",color:Ne.dash,padding:"0 8px",height:18,fontSize:11}),yfe=it.div({position:"absolute",color:Ne.dash,fontSize:11,top:"50%",transform:"translateY(-50%)"},e=>({...e.side==="left"&&{left:8},...e.side==="right"&&{right:8}})),bfe=it.div(e=>({position:"absolute",backgroundColor:e.color,color:"#fff",fontSize:10,fontWeight:600,fontFamily:"monospace",padding:"1px 6px",borderRadius:3,zIndex:2,...e.side==="top"&&{top:4,left:"50%",transform:"translateX(-50%)"},...e.side==="bottom"&&{bottom:4,left:"50%",transform:"translateX(-50%)"},...e.side==="left"&&{left:4,top:"50%",transform:"translateY(-50%)"},...e.side==="right"&&{right:4,top:"50%",transform:"translateY(-50%)"}})),Sfe=it.div(e=>({position:"absolute",backgroundColor:e.color,zIndex:1,...e.orient==="v"&&{width:1,left:"50%"},...e.orient==="h"&&{height:1,top:"50%"},...e.side==="top"&&{top:18,height:10},...e.side==="bottom"&&{bottom:18,height:10},...e.side==="left"&&{left:30,width:20},...e.side==="right"&&{right:30,width:20}})),pj=it.div(e=>({position:"relative",backgroundColor:e.isErr?Ne.errBg:Ne.borderBoxBg,border:`1px solid ${e.isErr?Ne.err:Ne.borderBoxStroke}`,borderRadius:6,padding:0})),dj=it.div({display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 10px",fontSize:11,color:Ne.text}),fj=it.span({fontWeight:500,fontSize:11}),wfe=it.span({color:Ne.dash}),gj=it.div(e=>({position:"relative",backgroundColor:e.isErr?Ne.errBg:Ne.paddingBg,border:`1px solid ${e.isErr?Ne.err:Ne.paddingStroke}`,margin:"0 8px 8px",padding:"18px 28px"})),mj=it.span({position:"absolute",top:3,left:8,fontSize:10,fontWeight:500,color:Ne.text,fontStyle:"italic"}),Kc=it.span(e=>({position:"absolute",fontSize:11,fontFamily:"monospace",color:e.isErr?Ne.err:Ne.text,fontWeight:e.isErr?700:400,...e.side==="top"&&{top:3,left:"50%",transform:"translateX(-50%)"},...e.side==="bottom"&&{bottom:3,left:"50%",transform:"translateX(-50%)"},...e.side==="left"&&{left:8,top:"50%",transform:"translateY(-50%)"},...e.side==="right"&&{right:8,top:"50%",transform:"translateY(-50%)"}})),hj=it.div(e=>({backgroundColor:e.isErr?Ne.errBg:"#fff",border:`1.5px dashed ${e.isErr?Ne.err:Ne.contentStroke}`,display:"flex",alignItems:"center",justifyContent:"center",padding:"10px 20px",fontSize:11,fontFamily:"monospace",color:e.isErr?Ne.err:Ne.text,fontWeight:e.isErr?600:400})),xj=it.span({position:"absolute",bottom:4,right:8,fontSize:9,color:Ne.dim,fontFamily:"monospace"}),yj=it.div({display:"flex",alignItems:"center",gap:4,fontSize:10,fontWeight:600,color:Ne.ok,padding:"4px 8px 6px"}),vfe=it.div({fontSize:11,fontWeight:600,color:Ne.text,padding:"4px 12px 2px",display:"flex",alignItems:"center",gap:6}),kfe=it.span({fontSize:12,color:Ne.dim}),bj=it.img({maxWidth:"100%",maxHeight:40,objectFit:"contain",borderRadius:2}),Sj=it.div({fontSize:9,color:Ne.dim,marginTop:2}),wj=({property:e,currentValue:t,expectedValue:n,figmaContext:r,elementName:o})=>{let i=e.toLowerCase(),s=i.includes("padding"),a=i.includes("border")||i.includes("stroke")||i.includes("box-shadow"),u=i.includes("width")||i.includes("height")||i==="dimensions",c=i.includes("radius"),{figmaImageUrl:l}=ce(),d=r||{},p=!(!!r&&Object.keys(r).length>0)&&s?Aj(n):null,g=d.padding||p||{top:0,right:0,bottom:0,left:0},k=d.strokeWeight??(a?es(n)??0:0),T=d.width??(u?Pj(n)??"\u2014":"\u2014"),E=d.height??(u?Lj(n)??"\u2014":"\u2014");return Pe.createElement(Pe.Fragment,null,Pe.createElement(uj,null,Pe.createElement(pj,{isErr:a},Pe.createElement(dj,null,Pe.createElement(fj,null,"Border"),Pe.createElement("span",{style:{fontSize:11,fontFamily:"monospace",color:a?Ne.err:Ne.dim}},k)),Pe.createElement(gj,{isErr:s},Pe.createElement(mj,null,"Padding"),Pe.createElement(Kc,{side:"top",isErr:s},g.top),Pe.createElement(Kc,{side:"right",isErr:s},g.right),Pe.createElement(Kc,{side:"bottom",isErr:s},g.bottom),Pe.createElement(Kc,{side:"left",isErr:s},g.left),Pe.createElement(hj,{isErr:u,style:{flexDirection:"column",gap:4}},l&&Pe.createElement(bj,{src:l,alt:"Figma element"}),Pe.createElement(Sj,null,T," \xD7 ",E)))),Pe.createElement(xj,null,"border-box")),Pe.createElement(yj,null,"\u2192 ",n))},xI=it.div({backgroundColor:Ne.outerBg,padding:"24px 16px 16px",display:"flex",flexDirection:"column",alignItems:"center",gap:8}),vj=it.div({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"12px 20px"}),kx=it.span(e=>({fontSize:e.fSize||"42px",fontWeight:e.fWeight||"600",color:Ne.text,lineHeight:1,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif',position:"relative",zIndex:1})),kj=it.div({position:"absolute",border:`1.5px dashed ${Ne.err}`,pointerEvents:"none",zIndex:0}),Cj=it.div({position:"absolute",border:`1.5px dashed ${Ne.blue}`,pointerEvents:"none",zIndex:0}),yI=it.div(e=>({position:"absolute",backgroundColor:e.color,color:"#fff",fontSize:10,fontWeight:600,fontFamily:"monospace",padding:"2px 6px",borderRadius:3,zIndex:2,whiteSpace:"nowrap",...e.side==="left"&&{left:-4,top:"50%",transform:"translate(-100%, -50%)"},...e.side==="right"&&{right:-4,top:"50%",transform:"translate(100%, -50%)"}})),Cfe=it.div({fontSize:12,color:Ne.text,fontWeight:500,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif'}),Tj=it.div({display:"flex",alignItems:"center",gap:6,fontSize:10,fontFamily:"monospace"}),bI=it.span(e=>({padding:"1px 6px",borderRadius:3,fontWeight:600,fontSize:10,color:"#fff",backgroundColor:e.variant==="err"?Ne.err:Ne.ok})),Ij=it.div({display:"flex",alignItems:"flex-end",justifyContent:"center",gap:16,padding:"4px 0"}),SI=it.div({display:"flex",flexDirection:"column",alignItems:"center",gap:4}),wI=it.div(e=>({fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.3px",color:e.variant==="err"?Ne.err:Ne.ok})),vI=it.div(e=>({fontSize:10,fontFamily:"monospace",fontWeight:600,color:e.variant==="err"?Ne.err:Ne.ok,textDecoration:e.variant==="err"?"line-through":"none"})),Fj=it.span({fontSize:16,color:Ne.dim,paddingBottom:20}),kI=it.div(e=>({fontSize:9,color:e.color,fontFamily:"monospace",textAlign:"center",marginTop:2}));function CI(e){return e>=800?"ExtraBold":e>=700?"Bold":e>=600?"Semibold":e>=500?"Medium":e>=400?"Regular":e>=300?"Light":"Thin"}var Ej=({property:e,currentValue:t,expectedValue:n,figmaContext:r})=>{let o=r||{},i=e.toLowerCase(),s=i.includes("size"),a=i.includes("weight"),u=i.includes("lineheight")||i.includes("line-height"),c=i.includes("text")||i.includes("content"),l=i.includes("family"),d=s||u,f=o.fontSize??(s?es(n):14),p=o.fontWeight??(a?es(n):600),k=(o.lineHeight??(u?es(n):null))||Math.round((f||14)*1.43),T=`${Math.min(Math.max(f||14,24),48)}px`;if(d)return Pe.createElement(Pe.Fragment,null,Pe.createElement(xI,null,Pe.createElement(vj,null,Pe.createElement(Cj,{style:{top:-6,left:0,right:0,bottom:-6}}),Pe.createElement(kj,{style:{top:2,left:8,right:8,bottom:2}}),Pe.createElement(yI,{color:s?Ne.err:"#7b3030",side:"left"},s?t:`${f}px`),Pe.createElement(yI,{color:u?Ne.err:"#7b3030",side:"right"},u?t:`${k}px`),Pe.createElement(kx,{fSize:T,fWeight:String(p||600)},"Ag")),Pe.createElement("div",{style:{display:"flex",gap:16,justifyContent:"center"}},Pe.createElement(kI,{color:Ne.err},"\u2508\u2508 font-size",s?" \u2717":""),Pe.createElement(kI,{color:Ne.blue},"\u2508\u2508 line-height",u?" \u2717":"")),Pe.createElement(Tj,null,Pe.createElement(bI,{variant:"err"},t),Pe.createElement("span",{style:{color:Ne.dim}},"\u2192"),Pe.createElement(bI,{variant:"ok"},n))));let E=a?t:String(p||600),I=a?n:E,D=es(t),R=es(n);return Pe.createElement(Pe.Fragment,null,Pe.createElement(xI,null,Pe.createElement(Ij,null,Pe.createElement(SI,null,Pe.createElement(wI,{variant:"err"},"Current"),Pe.createElement(kx,{fSize:T,fWeight:a?E:String(p||600),style:{color:Ne.err}},c?t:"Ag"),Pe.createElement(vI,{variant:"err"},a&&D?`${t} (${CI(D)})`:t)),Pe.createElement(Fj,null,"\u2192"),Pe.createElement(SI,null,Pe.createElement(wI,{variant:"ok"},"Figma"),Pe.createElement(kx,{fSize:T,fWeight:a?I:String(p||600),style:{color:Ne.ok}},c?n:"Ag"),Pe.createElement(vI,{variant:"ok"},a&&R?`${n} (${CI(R)})`:n)))))};function Aj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/g);if(!t)return null;let n=t.map(r=>parseFloat(r));return n.length===1?{top:n[0],right:n[0],bottom:n[0],left:n[0]}:n.length===2?{top:n[0],right:n[1],bottom:n[0],left:n[1]}:n.length===3?{top:n[0],right:n[1],bottom:n[2],left:n[1]}:n.length>=4?{top:n[0],right:n[1],bottom:n[2],left:n[3]}:null}function es(e){let t=e.match(/(\d+(?:\.\d+)?)\s*(?:px)?/);return t?parseFloat(t[1]):null}function Pj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):null}function Lj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[2]):null}var TI=new Set(["fontSize","font-size","fontWeight","font-weight","lineHeight","line-height","letterSpacing","letter-spacing","fontFamily","font-family","textContent","text-content"]);function Mj(e){if(TI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return TI.has(t)}var II=e=>{let t=!!e.figmaContext&&Object.keys(e.figmaContext).length>0,n=Mj(e.property);return Pe.createElement(lj,null,Pe.createElement(cj,null,"\u25BE Layer properties",t?"":" (from review)"),n?Pe.createElement(Ej,{...e}):Pe.createElement(wj,{...e}))};import Wr from"react";import{styled as Vr}from"storybook/theming";var Bj={color:{text:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)",border:"rgba(59, 130, 246, 0.25)"},border:{text:"#10b981",bg:"rgba(16, 185, 129, 0.1)",border:"rgba(16, 185, 129, 0.25)"},spacing:{text:"#f97316",bg:"rgba(249, 115, 22, 0.1)",border:"rgba(249, 115, 22, 0.25)"},layout:{text:"#14b8a6",bg:"rgba(20, 184, 166, 0.1)",border:"rgba(20, 184, 166, 0.25)"},sizing:{text:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)",border:"rgba(139, 92, 246, 0.25)"},typography:{text:"#ec4899",bg:"rgba(236, 72, 153, 0.1)",border:"rgba(236, 72, 153, 0.25)"}},Dj=Vr.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"12px"}),Rj=Vr.div(({theme:e,category:t})=>{let n=Bj[t||""]||{text:e.textMutedColor,bg:"rgba(148, 163, 184, 0.1)",border:"rgba(148, 163, 184, 0.2)"};return{fontSize:"11px",fontWeight:500,color:n.text,backgroundColor:n.bg,padding:"2px 8px",borderRadius:"4px",border:`1px solid ${n.border}`}}),zj=Vr.div(({status:e})=>{let n=(()=>{switch(e){case"pending":return{bg:"rgba(148, 163, 184, 0.15)",text:"#64748b",dot:"#94a3b8"};case"applied":return{bg:"rgba(245, 158, 11, 0.1)",text:"#d97706",dot:"#f59e0b"};case"verified":return{bg:"rgba(16, 185, 129, 0.1)",text:"#059669",dot:"#10b981"};case"failed":return{bg:"rgba(239, 68, 68, 0.1)",text:"#dc2626",dot:"#ef4444"};default:return{bg:"rgba(148, 163, 184, 0.15)",text:"#64748b",dot:"#94a3b8"}}})();return{fontSize:"11px",fontWeight:500,color:n.text,backgroundColor:n.bg,padding:"2px 8px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"5px","&::before":{content:'""',display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:n.dot}}}),Nj=Vr.div({fontSize:"11px",fontWeight:500,color:"#059669",backgroundColor:"rgba(16, 185, 129, 0.1)",padding:"2px 8px",borderRadius:"4px",border:"1px solid rgba(16, 185, 129, 0.2)",display:"flex",alignItems:"center",gap:"5px","&::before":{content:'""',display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#10b981"}}),Oj=Vr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginLeft:"12px",paddingLeft:"12px",borderLeft:`1px solid ${e.appBorderColor}`})),_j=Vr.div({fontSize:"10px",fontWeight:600,color:"#0891b2",backgroundColor:"#ecfeff",padding:"2px 8px",borderRadius:"10px",border:"1px solid #0891b2",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u{1F9E0}"',fontSize:"9px"}}),$j=Vr.div({fontSize:"10px",fontWeight:600,color:"#7c3aed",backgroundColor:"#ede9fe",padding:"2px 8px",borderRadius:"10px",border:"1px solid #7c3aed",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u{1F50D}"',fontSize:"9px"}}),Uj=Vr.div({fontSize:"10px",fontWeight:600,color:"#d97706",backgroundColor:"#fef3c7",padding:"2px 8px",borderRadius:"10px",border:"1px solid #d97706",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u26A0\uFE0F"',fontSize:"9px"}}),jj=Vr.div(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontWeight:600,color:e.color.negative,backgroundColor:e.background.negative,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${e.color.negative}`})),Hj=Vr.span(({theme:e})=>({fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.textMutedColor,marginLeft:"auto"})),Wj=e=>{if(!e)return{};let t={};if(e.includes("+")){let n=e.split("+");for(let r of n)r.startsWith("programmatic-")?t.programmatic=r.replace("programmatic-","").replace("-detection",""):r==="ai"||r==="ai-review"?t.ai="AI Review":r==="ai-validation"&&(t.ai="AI Validation");return t}return e.startsWith("programmatic-")?t.programmatic=e.replace("programmatic-","").replace("-detection",""):e==="ai-review"?t.ai="AI Review":e==="ai-validation"&&(t.ai="AI Validation"),t},FI=({issue:e,modelDisplayName:t,showModel:n=!1,showDetection:r=!1,dominantDetector:o,showFilePath:i=!0,enableFilePath:s=!1,unreliable:a=!1,validationErrorMessage:u})=>{let c=Wj(e.detectedBy),l=o&&c.ai===o,d=r&&!l&&(c.ai||c.programmatic),f=e.generatedFix?.filePath||e.file;return Wr.createElement(Dj,null,Wr.createElement(Rj,{category:e.type},e.type),e.status!=="pending"&&Wr.createElement(zj,{status:e.status},e.status),n&&t&&Wr.createElement(Nj,null,t),d&&Wr.createElement(Oj,null,c.ai&&!l&&Wr.createElement(_j,null,c.ai),c.programmatic&&Wr.createElement($j,null,"Pre-filter: ",c.programmatic)),a&&Wr.createElement(Uj,{title:u},"Unreliable"),e.dismissed&&Wr.createElement(jj,null,"Dismissed"),i&&s&&f&&Wr.createElement(Hj,null,f))};import Vn from"react";import{styled as Ho}from"storybook/theming";var Vj=e=>{if(!e)return null;let n=(typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):String(e)).match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/);return n?n[0]:null},Gj=e=>e?typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):String(e):"",qj=Ho.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"2px",fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"8px",padding:"8px 10px",backgroundColor:e.background.app,borderRadius:"4px"})),Cx=Ho.div({display:"flex",gap:"8px",alignItems:"baseline"}),Tx=Ho.span(({theme:e})=>({color:e.textMutedColor,fontWeight:500,width:"60px",flexShrink:0,fontSize:"11px"})),Ix=Ho.span(({theme:e})=>({color:e.color.defaultText,fontFamily:"inherit",fontSize:"11px",fontWeight:500})),Yj=Ho(Ix)(({theme:e})=>({color:e.color.negative,textDecoration:"line-through",opacity:.7})),Kj=Ho(Ix)(({theme:e})=>({color:e.color.positive,fontWeight:600})),Xj=Ho.span(({color:e})=>({display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundImage:`
|
|
92
|
+
`}),n}function GT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Wc(e,t){let n=qT(e,t),r=n.one(e,void 0),o=WT(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&("children"in i,i.children.push({type:"text",value:`
|
|
93
|
+
`},o)),i}function Vc(e,t){return e&&"run"in e?async function(n,r){let o=Wc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Wc(n,{file:r,...e||t})}}function cx(e){if(e)throw e}var Yc=Ua(nI(),1);function Ia(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function ux(){let e=[],t={run:n,use:r};return t;function n(...o){let i=-1,s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(u,...c){let l=e[++i],d=-1;if(u){s(u);return}for(;++d<o.length;)(c[d]===null||c[d]===void 0)&&(c[d]=o[d]);o=c,l?rI(l,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function rI(e,t){let n;return r;function r(...s){let a=e.length>s.length,u;a&&s.push(o);try{u=e.apply(this,s)}catch(c){let l=c;if(a&&n)throw l;return o(l)}a||(u&&u.then&&typeof u.then=="function"?u.then(i,o):u instanceof Error?o(u):i(u))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}var Ar={basename:d6,dirname:g6,extname:f6,join:m6,sep:"/"};function d6(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fa(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function g6(e){if(Fa(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function f6(e){Fa(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){let a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function m6(...e){let t=-1,n;for(;++t<e.length;)Fa(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":h6(n)}function h6(e){Fa(e);let t=e.codePointAt(0)===47,n=x6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function x6(e,t){let n="",r=0,o=-1,i=0,s=-1,a,u;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Fa(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var oI={cwd:y6};function y6(){return"/"}function Zi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function iI(e){if(typeof e=="string")e=new URL(e);else if(!Zi(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return b6(e)}function b6(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let r=t.codePointAt(n+2);if(r===70||r===102){let o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}var px=["history","path","basename","stem","extname","dirname"],pi=class{constructor(t){let n;t?Zi(t)?n={path:t}:typeof t=="string"||S6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":oI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<px.length;){let i=px[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)px.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Ar.basename(this.path):void 0}set basename(t){gx(t,"basename"),dx(t,"basename"),this.path=Ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ar.dirname(this.path):void 0}set dirname(t){sI(this.basename,"dirname"),this.path=Ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ar.extname(this.path):void 0}set extname(t){if(dx(t,"extname"),sI(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zi(t)&&(t=iI(t)),gx(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ar.basename(this.path,this.extname):void 0}set stem(t){gx(t,"stem"),dx(t,"stem"),this.path=Ar.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){let o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){let o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){let o=new Wt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}};function dx(e,t){if(e&&e.includes(Ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ar.sep+"`")}function gx(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sI(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function S6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var aI=(function(e){let r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i});var w6={}.hasOwnProperty,xx=class e extends aI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=ux()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];t.use(...r)}return t.data((0,Yc.default)(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(hx("data",this.frozen),this.namespace[t]=n,this):w6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(hx("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;let t=this;for(;++this.freezeIndex<this.attachers.length;){let[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let n=qc(t),r=this.parser||this.Parser;return fx("parse",r),r(String(n),n)}process(t,n){let r=this;return this.freeze(),fx("process",this.parser||this.Parser),mx("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){let a=qc(t),u=r.parse(a);r.run(u,a,function(l,d,g){if(l||!d||!g)return c(l);let p=d,f=r.stringify(p,g);k6(f)?g.value=f:g.result=f,c(l,g)});function c(l,d){l||!d?s(l):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),fx("processSync",this.parser||this.Parser),mx("processSync",this.compiler||this.Compiler),this.process(t,o),cI("processSync","process",n),r;function o(i,s){n=!0,cx(i),r=s}}run(t,n,r){lI(t),this.freeze();let o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){let u=qc(n);o.run(t,u,c);function c(l,d,g){let p=d||t;l?a(l):s?s(p):r(void 0,p,g)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),cI("runSync","run",r),o;function i(s,a){cx(s),o=a,r=!0}}stringify(t,n){this.freeze();let r=qc(n),o=this.compiler||this.Compiler;return mx("stringify",o),lI(t),o(t,r)}use(t,...n){let r=this.attachers,o=this.namespace;if(hx("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")u(c,[]);else if(typeof c=="object")if(Array.isArray(c)){let[l,...d]=c;u(l,d)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(o.settings=(0,Yc.default)(!0,o.settings,c.settings))}function a(c){let l=-1;if(c!=null)if(Array.isArray(c))for(;++l<c.length;){let d=c[l];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,l){let d=-1,g=-1;for(;++d<r.length;)if(r[d][0]===c){g=d;break}if(g===-1)r.push([c,...l]);else if(l.length>0){let[p,...f]=l,k=r[g][1];Ia(k)&&Ia(p)&&(p=(0,Yc.default)(!0,k,p)),r[g]=[c,p,...f]}}}},yx=new xx().freeze();function fx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function mx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function hx(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function lI(e){if(!Ia(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cI(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qc(e){return v6(e)?e:new pi(e)}function v6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function k6(e){return typeof e=="string"||C6(e)}function C6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var E6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uI=[],pI={allowDangerousHtml:!0},A6=/^(https?|ircs?|mailto|xmpp)$/i,P6=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bx(e){let t=L6(e),n=M6(e);return B6(t.runSync(t.parse(n),n),e)}function L6(e){let t=e.rehypePlugins||uI,n=e.remarkPlugins||uI,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pI}:pI;return yx().use(zc).use(n).use(Vc,r).use(t)}function M6(e){let t=e.children||"",n=new pi;return typeof t=="string"?n.value=t:(""+t,void 0),n}function B6(e,t){let n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||dI;for(let l of P6)Object.hasOwn(t,l.from)&&(""+l.from+(l.to?"use `"+l.to+"` instead":"remove it")+E6+l.id,void 0);return n&&i&&void 0,Ta(e,c),Dh(e,{Fragment:T6,components:o,ignoreInvalidStyle:!0,jsx:I6,jsxs:F6,passKeys:!0,passNode:!0});function c(l,d,g){if(l.type==="raw"&&g&&typeof d=="number")return s?g.children.splice(d,1):g.children[d]={type:"text",value:l.value},d;if(l.type==="element"){let p;for(p in xa)if(Object.hasOwn(xa,p)&&Object.hasOwn(l.properties,p)){let f=l.properties[p],k=xa[p];(k===null||k.includes(l.tagName))&&(l.properties[p]=u(String(f||""),p,l))}}if(l.type==="element"){let p=n?!n.includes(l.tagName):i?i.includes(l.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(l,d,g)),p&&g&&typeof d=="number")return a&&l.children?g.children.splice(d,1,...l.children):g.children.splice(d,1),d}}}function dI(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||A6.test(e.slice(0,t))?e:""}Ce();var R6=es.div({display:"flex",flexDirection:"column",gap:"12px"}),z6=es.div({display:"flex",justifyContent:"space-between",alignItems:"center"}),N6=es.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),O6=es(kn)({padding:"6px 12px",fontSize:"12px"}),_6=es.div(({theme:e})=>({backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"12px",fontSize:"12px",color:e.color.defaultText,overflowY:"auto",maxHeight:"400px",lineHeight:"1.6","& h1, & h2, & h3, & h4":{marginTop:"16px",marginBottom:"8px",fontWeight:600,color:e.color.defaultText},"& h1":{fontSize:"18px"},"& h2":{fontSize:"16px"},"& h3":{fontSize:"14px"},"& h4":{fontSize:"13px"},"& p":{margin:"8px 0"},"& ul, & ol":{paddingLeft:"20px",margin:"8px 0"},"& li":{margin:"4px 0"},"& code":{backgroundColor:e.background.app,padding:"2px 4px",borderRadius:"3px",fontFamily:u1.fontMono,fontSize:"11px"},"& pre":{backgroundColor:e.background.app,padding:"8px",borderRadius:"4px",overflowX:"auto","& code":{backgroundColor:"transparent",padding:0}},"& strong":{fontWeight:600},"& blockquote":{borderLeft:`3px solid ${e.color.secondary}`,paddingLeft:"12px",margin:"8px 0",color:e.color.mediumdark}})),$6=es.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),Sx=()=>{let{fullPrompt:e,userRole:t,roleOverride:n}=ce(),[r,o]=D6(!1);if((n??t)!=="admin")return null;let s=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch(a){console.error("Failed to copy:",a)}};return e?di.createElement(R6,null,di.createElement(z6,null,di.createElement(N6,null,"Full Prompt"),di.createElement(O6,{onClick:s,disabled:r},r?"\u2713 Copied!":"\u{1F4CB} Copy")),di.createElement(_6,null,di.createElement(bx,null,e))):di.createElement($6,null,"No prompt available. Generate a prompt or run a review to see the full prompt here.")};import co,{useRef as U6}from"react";import{styled as Pr}from"storybook/theming";Ce();var j6=Pr.div({display:"flex",flexDirection:"column",gap:"8px"}),Jde=Pr.div(({theme:e,variant:t,value:n})=>{let o=t==="issues"?n===0?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n<=3?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n<=6?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"}:n>=80?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n>=60?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n>=40?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"};return{fontSize:"11px",fontWeight:700,color:o.text,backgroundColor:o.bg,padding:"3px 10px",borderRadius:"12px",border:`1px solid ${o.border}`,whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"6px"}}),H6=Pr.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"6px",maxHeight:"200px",overflowY:"auto",scrollBehavior:"smooth",padding:"6px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app})),W6=Pr.div(({role:e,theme:t})=>({padding:"8px 10px",borderRadius:"4px",fontSize:"11px",lineHeight:"1.4",backgroundColor:e==="system"?t.background.hoverable:t.background.content,border:`1px solid ${t.appBorderColor}`,color:t.color.defaultText})),Zde=Pr.div(({theme:e})=>({fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:e.color.mediumdark,marginBottom:"6px",letterSpacing:"0.5px"})),gI=Pr.div(({theme:e})=>({whiteSpace:"pre-wrap",wordWrap:"break-word",fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',fontSize:"10px","& .section-header":{fontSize:"11px",fontWeight:700,color:e.color.secondary,marginTop:"8px",marginBottom:"4px",display:"block"},"& .issue-header":{fontWeight:600,marginTop:"6px",marginBottom:"2px",display:"block"},"& .severity-critical":{color:e.color.negative||"#dc2626",fontWeight:700},"& .severity-major":{color:e.color.warning||se,fontWeight:700},"& .severity-minor":{color:e.color.warning||"#ca8a04",fontWeight:700},"& .issue-type":{color:e.color.secondary,fontWeight:600},"& .source-tag":{color:e.base==="dark"?"#22d3ee":"#0891b2",backgroundColor:e.base==="dark"?"rgba(34, 211, 238, 0.2)":"#cffafe",padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600},"& .field-label":{color:e.textMutedColor,fontWeight:600},"& .field-value":{color:e.color.defaultText},"& .score":{fontSize:"11px",fontWeight:700,color:e.color.positive||"#16a34a",display:"inline-block",padding:"1px 6px",backgroundColor:e.background.positive||"#dcfce7",borderRadius:"3px"},"& .score-low":{color:e.color.negative||"#dc2626",backgroundColor:e.background.negative||"#fee2e2"},"& .score-medium":{color:e.color.warning||se,backgroundColor:e.background.warning||"#ffedd5"}})),V6=Pr.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),G6=Pr.div(({theme:e})=>({padding:"12px 16px",borderRadius:"8px",backgroundColor:e.background.positive||"#dcfce7",border:`1px solid ${e.color.positive||"#86efac"}`,color:e.color.positive||"#166534",fontSize:"13px",fontWeight:500,lineHeight:1.5,marginBottom:"12px"})),q6=Pr.div({fontWeight:700,fontSize:"14px",marginBottom:"4px",display:"flex",alignItems:"center",gap:"6px"}),Y6=Pr.div(({theme:e})=>({fontSize:"12px",opacity:.9,color:e.color.positive||"#166534"})),ege=Pr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",textAlign:"right"}));function K6(e){let t=e;return t=t.replace(/^(?:\*?\*?)?(?:##?)?\s*SCORE:\s*\d+.*$/gm,""),t=t.replace(/^(ISSUES:|SUMMARY:)/gm,'<span class="section-header">$1</span>'),t=t.replace(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g,(n,r,o,i,s)=>{let a=o.toLowerCase().includes("critical")?"severity-critical":o.toLowerCase().includes("major")?"severity-major":"severity-minor";return`<span class="issue-header"><span class="issue-type">[${r}]</span> <span class="${a}">[${o}]</span> <span class="source-tag">[${i}]</span> - ${s}</span>`}),t=t.replace(/^(Expected:|Actual:|Property:|Source:|Fix:|Visual Difference:)\s*(.+)/gm,'<span class="field-label">$1</span> <span class="field-value">$2</span>'),t}var wx=()=>{let{streamingMessages:e,fullResponse:t,reviewHistory:n,currentReviewId:r,userRole:o,roleOverride:i}=ce(),s=U6(null);if((i??o)!=="admin")return null;let u=r?n.find(f=>f.id===r):null,c=u?u.issues.length>0&&u.issues.every(f=>f.dismissed):!1,l=u&&(u.complianceScore===100||c),d=e.filter(f=>f.role==="assistant"||f.role==="system"&&f.content.includes("auto-dismissed")),g=d.length===0&&!!t;if(d.length===0&&!g)return co.createElement(V6,null,"No AI response yet. The AI's analysis will appear here as it streams.");let p=d.length>0?d:[{role:"assistant",content:t}];return co.createElement(j6,null,l&&co.createElement(G6,null,co.createElement(q6,null,"Component Matches Design"),co.createElement(Y6,null,c&&u?.issues.length?`All ${u.issues.length} issue${u.issues.length===1?"":"s"} identified by the AI ${u.issues.length===1?"was":"were"} validated as false positive${u.issues.length===1?"":"s"} and auto-dismissed.`:"No design discrepancies found. The implementation matches the Figma design.")),co.createElement(H6,{ref:s},p.map((f,k)=>co.createElement(W6,{key:k,role:f.role},f.role==="system"?co.createElement(gI,null,f.content):co.createElement(gI,{dangerouslySetInnerHTML:{__html:K6(f.content)}})))))};import hr from"react";import{styled as jo}from"storybook/theming";Ce();Oe();var X6=jo.div({display:"flex",flexDirection:"column",gap:"12px"}),Q6=jo.div(({theme:e})=>({display:"flex",gap:"6px",borderBottom:`2px solid ${e.appBorderColor}`,overflowX:"auto",paddingBottom:"2px"})),J6=jo.button(({theme:e,isActive:t,provider:n})=>{let o={anthropic:{background:"#D4A574",text:"#ffffff",hover:"#C49564"},openai:{background:e.color.positive||"#10b981",text:"#ffffff",hover:e.base==="dark"?"#34d399":"#059669"},google:{background:"#4285F4",text:"#ffffff",hover:"#3367D6"}}[n];return{display:"flex",alignItems:"center",gap:"6px",padding:"8px 16px",fontSize:"12px",fontWeight:600,color:t?o.text:e.textMutedColor,backgroundColor:t?o.background:"transparent",border:"none",borderRadius:"6px 6px 0 0",cursor:"pointer",whiteSpace:"nowrap",transition:"all 0.2s",opacity:t?1:.6,"&:hover":{opacity:1,backgroundColor:t?o.hover:e.background.hoverable}}}),fI=jo.div(({theme:e,variant:t,value:n})=>{let o=t==="issues"?n===0?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n<=3?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n<=6?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"}:n>=80?{bg:e.background.positive||"#dcfce7",text:e.color.positive||"#166534",border:e.color.positive||"#86efac"}:n>=60?{bg:e.background.warning||"#fef3c7",text:e.color.warning||"#92400e",border:e.color.warning||"#fde68a"}:n>=40?{bg:e.background.warning||"#fed7aa",text:e.color.warning||"#9a3412",border:e.color.warning||"#fdba74"}:{bg:e.background.negative||"#fecaca",text:e.color.negative||"#991b1b",border:e.color.negative||"#fca5a5"};return{fontSize:"10px",fontWeight:700,color:o.text,backgroundColor:o.bg,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${o.border}`,whiteSpace:"nowrap"}}),Z6=jo.div(({theme:e})=>({padding:"12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app,minHeight:"200px",maxHeight:"400px",overflowY:"auto",scrollBehavior:"smooth"})),mI=jo.div(({theme:e})=>({fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordWrap:"break-word",fontFamily:'Monaco, Menlo, "Ubuntu Mono", monospace',color:e.color.defaultText,"& .section-header":{fontSize:"13px",fontWeight:700,color:e.color.secondary,marginTop:"12px",marginBottom:"6px",display:"block"},"& .issue-header":{fontWeight:600,marginTop:"10px",marginBottom:"4px",display:"block"},"& .severity-critical":{color:e.color.negative||"#dc2626",fontWeight:700},"& .severity-major":{color:e.color.warning||se,fontWeight:700},"& .severity-minor":{color:e.color.warning||"#ca8a04",fontWeight:700},"& .issue-type":{color:e.color.secondary,fontWeight:600},"& .source-tag":{color:e.base==="dark"?"#22d3ee":"#0891b2",backgroundColor:e.base==="dark"?"rgba(34, 211, 238, 0.2)":"#cffafe",padding:"2px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600},"& .field-label":{color:e.textMutedColor,fontWeight:600},"& .field-value":{color:e.color.defaultText},"& .score":{fontSize:"14px",fontWeight:700,color:e.color.positive||"#16a34a",display:"inline-block",padding:"2px 8px",backgroundColor:e.background.positive||"#dcfce7",borderRadius:"4px"},"& .score-low":{color:e.color.negative||"#dc2626",backgroundColor:e.background.negative||"#fee2e2"},"& .score-medium":{color:e.color.warning||se,backgroundColor:e.background.warning||"#ffedd5"}})),hI=jo.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),ej=jo.div({width:"12px",height:"12px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 0.8s linear infinite",display:"inline-block",marginLeft:"6px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}});function xI(e){let t=e;return t=t.replace(/^(ISSUES:|SCORE:|SUMMARY:)/gm,'<span class="section-header">$1</span>'),t=t.replace(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g,(n,r,o,i,s)=>{let a=o.toLowerCase().includes("critical")?"severity-critical":o.toLowerCase().includes("major")?"severity-major":"severity-minor";return`<span class="issue-header"><span class="issue-type">[${r}]</span> <span class="${a}">[${o}]</span> <span class="source-tag">[${i}]</span> - ${s}</span>`}),t=t.replace(/^(Expected:|Actual:|Property:|Source:|Fix:|Visual Difference:)\s*(.+)/gm,'<span class="field-label">$1</span> <span class="field-value">$2</span>'),t=t.replace(/SCORE:\s*(\d+)/g,(n,r)=>{let o=parseInt(r,10);return`SCORE: <span class="${o>=80?"score":o>=60?"score score-medium":"score score-low"}">${r}</span>`}),t}function tj(e){let t=e.match(/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-/g),n=t?t.length:0,r=e.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i),o=r?parseInt(r[1],10):null;return{issueCount:n,score:o}}var yI=()=>{let{multiModelResults:e,isReviewing:t,setActiveModelId:n,selectedModels:r,userRole:o,roleOverride:i}=ce();if((i??o)!=="admin")return null;hr.useEffect(()=>{e&&(y.debug("[ModelResultsTabs] multiModelResults:",e),Object.entries(e.byModel).forEach(([l,d])=>{y.debug(`[ModelResultsTabs] ${l}:`,{hasStreamingMessages:!!d.streamingMessages,streamingMessagesLength:d.streamingMessages?.length||0,streamingMessagesPreview:d.streamingMessages?.[0]?.content?.substring(0,100),hasFullResponse:!!d.fullResponse,fullResponsePreview:d.fullResponse?.substring(0,100)})}))},[e]);let a=e&&Object.keys(e.byModel).length>0?Object.keys(e.byModel):r,u=e?.activeModelId||(a.length>0?a[0]:""),c=e?.byModel||{};return a.length===0?hr.createElement(hI,null,"No models selected. Select multiple models to compare results."):hr.createElement(X6,null,hr.createElement(Q6,null,a.map(l=>{let d=so.find(E=>E.id===l),g=c[l],f=tj(t&&g?.streamingMessages&&g.streamingMessages.length>0?g.streamingMessages[0].content||"":g?.fullResponse?g.fullResponse:""),k=l===u;if(!d)return null;let T=t&&!g?.completed;return hr.createElement(J6,{key:l,isActive:k,provider:d.provider,onClick:()=>n(l)},d.name,g&&f.issueCount>0&&hr.createElement(fI,{variant:"issues",value:f.issueCount},f.issueCount," issues"),g&&f.score!==null&&hr.createElement(fI,{variant:"score",value:f.score},"Score: ",f.score),T&&hr.createElement(ej,null))})),hr.createElement(Z6,null,c[u]?.streamingMessages&&c[u].streamingMessages.length>0?c[u].streamingMessages.map((l,d)=>hr.createElement(mI,{key:d,dangerouslySetInnerHTML:{__html:xI(l.content)}})):c[u]?.fullResponse?hr.createElement(mI,{dangerouslySetInnerHTML:{__html:xI(c[u].fullResponse)}}):hr.createElement(hI,null,t?`Waiting for ${so.find(l=>l.id===u)?.name}...`:`No response yet for ${so.find(l=>l.id===u)?.name}`)))};import We from"react";import{styled as Ct}from"storybook/theming";Ce();Rn();Ce();import{useCallback as vx}from"react";Oe();function bI(){let{dismissIssue:e,undismissIssue:t,reviewHistory:n}=ce(),{sessionToken:r}=we(),o=vx(a=>{for(let u of n){let c=u.issues.find(l=>l.id===a);if(c)return c.dbId||c.id||null}return null},[n]),i=vx((a,u)=>{e(a,u,"user");let c=o(a);if(!c){y.debug("[useIssuePersistence] Dismiss skipped server sync \u2014 no dbId for",a);return}if(!r){y.debug("[useIssuePersistence] Dismiss skipped \u2014 no session token");return}Kl(c,!0,u,"user",r).then(l=>{l.success||y.warn("[useIssuePersistence] Dismiss server sync failed:",l.error)})},[e,o,r]),s=vx(a=>{t(a);let u=o(a);if(!u){y.debug("[useIssuePersistence] Undismiss skipped server sync \u2014 no dbId for",a);return}if(!r){y.debug("[useIssuePersistence] Undismiss skipped \u2014 no session token");return}Kl(u,!1,void 0,"user",r).then(c=>{c.success||y.warn("[useIssuePersistence] Undismiss server sync failed:",c.error)})},[t,o,r]);return{dismissAndSync:i,undismissAndSync:s}}import q,{useMemo as d8,useState as g8,useEffect as f8}from"react";import{styled as st,keyframes as m8}from"storybook/theming";import Z,{useState as Fx,useRef as nH,useCallback as DI,memo as rH}from"react";import{styled as Le}from"storybook/theming";import uo,{useState as nj}from"react";import{styled as po}from"storybook/theming";var rj=po.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:9999}),oj=po.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"8px",padding:"24px",maxWidth:"500px",width:"90%",boxShadow:e.base==="dark"?"0 10px 40px rgba(0, 0, 0, 0.5)":"0 10px 40px rgba(0, 0, 0, 0.2)",border:`1px solid ${e.appBorderColor}`})),ij=po.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,marginTop:0,marginBottom:"12px"})),sj=po.p(({theme:e})=>({fontSize:"13px",color:e.textMutedColor,marginBottom:"16px",lineHeight:"1.5"})),aj=po.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px"})),lj=po.textarea(({theme:e})=>({width:"100%",minHeight:"80px",padding:"10px",fontSize:"13px",borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,color:e.color.defaultText,fontFamily:"inherit",resize:"vertical",marginBottom:"20px","&:focus":{outline:"none",borderColor:se,boxShadow:`0 0 0 3px ${e.base==="dark"?"rgba(124, 58, 237, 0.2)":"rgba(124, 58, 237, 0.1)"}`},"&::placeholder":{color:e.textMutedColor}})),cj=po.div({display:"flex",justifyContent:"flex-end",gap:"10px"}),uj=po(Yt)({}),pj=po(Rr)({}),SI=({isOpen:e,issueTitle:t,onConfirm:n,onCancel:r})=>{let[o,i]=nj("");if(!e)return null;let s=()=>{n(o.trim()||void 0),i("")},a=()=>{i(""),r()};return uo.createElement(rj,{onClick:c=>{c.target===c.currentTarget&&a()}},uo.createElement(oj,null,uo.createElement(ij,null,"Dismiss as False Positive"),uo.createElement(sj,null,'Mark "',t,'" as a false positive. You can optionally provide a reason for dismissing this issue.'),uo.createElement(aj,{htmlFor:"dismiss-reason"},"Reason (optional)"),uo.createElement(lj,{id:"dismiss-reason",value:o,onChange:c=>i(c.target.value),placeholder:"e.g., This is intentional design, not an issue..."}),uo.createElement(cj,null,uo.createElement(pj,{onClick:a},"Cancel"),uo.createElement(uj,{onClick:s},"Dismiss Issue"))))};Ce();import Pe from"react";import{styled as it}from"storybook/theming";var Ne={outerBg:"#f0f0f0",borderBoxBg:"#fff",borderBoxStroke:"#999",paddingBg:"#dceefb",paddingStroke:"rgba(0,0,0,0.08)",contentStroke:"#888",text:"#333",dim:"#999",dash:"#aaa",blue:"#4a90d9",pink:"#e91e8c",err:"#d32f2f",errBg:"rgba(211,47,47,0.12)",ok:"#2e7d32"},dj=it.div(({theme:e})=>({marginTop:6,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,overflow:"hidden",maxWidth:340})),gj=it.div(({theme:e})=>({padding:"6px 10px",fontSize:11,fontWeight:500,color:e.color.defaultText,borderBottom:`1px solid ${e.appBorderColor}`})),fj=it.div({position:"relative",backgroundColor:Ne.outerBg,padding:"8px 12px 24px",fontFamily:"monospace",fontSize:11}),wge=it.div({display:"flex",justifyContent:"space-between",alignItems:"center",color:Ne.dash,padding:"0 8px",height:18,fontSize:11}),vge=it.div({position:"absolute",color:Ne.dash,fontSize:11,top:"50%",transform:"translateY(-50%)"},e=>({...e.side==="left"&&{left:8},...e.side==="right"&&{right:8}})),kge=it.div(e=>({position:"absolute",backgroundColor:e.color,color:"#fff",fontSize:10,fontWeight:600,fontFamily:"monospace",padding:"1px 6px",borderRadius:3,zIndex:2,...e.side==="top"&&{top:4,left:"50%",transform:"translateX(-50%)"},...e.side==="bottom"&&{bottom:4,left:"50%",transform:"translateX(-50%)"},...e.side==="left"&&{left:4,top:"50%",transform:"translateY(-50%)"},...e.side==="right"&&{right:4,top:"50%",transform:"translateY(-50%)"}})),Cge=it.div(e=>({position:"absolute",backgroundColor:e.color,zIndex:1,...e.orient==="v"&&{width:1,left:"50%"},...e.orient==="h"&&{height:1,top:"50%"},...e.side==="top"&&{top:18,height:10},...e.side==="bottom"&&{bottom:18,height:10},...e.side==="left"&&{left:30,width:20},...e.side==="right"&&{right:30,width:20}})),mj=it.div(e=>({position:"relative",backgroundColor:e.isErr?Ne.errBg:Ne.borderBoxBg,border:`1px solid ${e.isErr?Ne.err:Ne.borderBoxStroke}`,borderRadius:6,padding:0})),hj=it.div({display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 10px",fontSize:11,color:Ne.text}),xj=it.span({fontWeight:500,fontSize:11}),Tge=it.span({color:Ne.dash}),yj=it.div(e=>({position:"relative",backgroundColor:e.isErr?Ne.errBg:Ne.paddingBg,border:`1px solid ${e.isErr?Ne.err:Ne.paddingStroke}`,margin:"0 8px 8px",padding:"18px 28px"})),bj=it.span({position:"absolute",top:3,left:8,fontSize:10,fontWeight:500,color:Ne.text,fontStyle:"italic"}),Kc=it.span(e=>({position:"absolute",fontSize:11,fontFamily:"monospace",color:e.isErr?Ne.err:Ne.text,fontWeight:e.isErr?700:400,...e.side==="top"&&{top:3,left:"50%",transform:"translateX(-50%)"},...e.side==="bottom"&&{bottom:3,left:"50%",transform:"translateX(-50%)"},...e.side==="left"&&{left:8,top:"50%",transform:"translateY(-50%)"},...e.side==="right"&&{right:8,top:"50%",transform:"translateY(-50%)"}})),Sj=it.div(e=>({backgroundColor:e.isErr?Ne.errBg:"#fff",border:`1.5px dashed ${e.isErr?Ne.err:Ne.contentStroke}`,display:"flex",alignItems:"center",justifyContent:"center",padding:"10px 20px",fontSize:11,fontFamily:"monospace",color:e.isErr?Ne.err:Ne.text,fontWeight:e.isErr?600:400})),wj=it.span({position:"absolute",bottom:4,right:8,fontSize:9,color:Ne.dim,fontFamily:"monospace"}),vj=it.div({display:"flex",alignItems:"center",gap:4,fontSize:10,fontWeight:600,color:Ne.ok,padding:"4px 8px 6px"}),Ige=it.div({fontSize:11,fontWeight:600,color:Ne.text,padding:"4px 12px 2px",display:"flex",alignItems:"center",gap:6}),Fge=it.span({fontSize:12,color:Ne.dim}),kj=it.img({maxWidth:"100%",maxHeight:40,objectFit:"contain",borderRadius:2}),Cj=it.div({fontSize:9,color:Ne.dim,marginTop:2}),Tj=({property:e,currentValue:t,expectedValue:n,figmaContext:r,elementName:o})=>{let i=e.toLowerCase(),s=i.includes("padding"),a=i.includes("border")||i.includes("stroke")||i.includes("box-shadow"),u=i.includes("width")||i.includes("height")||i==="dimensions",c=i.includes("radius"),{figmaImageUrl:l}=ce(),d=r||{},p=!(!!r&&Object.keys(r).length>0)&&s?Bj(n):null,f=d.padding||p||{top:0,right:0,bottom:0,left:0},k=d.strokeWeight??(a?ts(n)??0:0),T=d.width??(u?Dj(n)??"\u2014":"\u2014"),E=d.height??(u?Rj(n)??"\u2014":"\u2014");return Pe.createElement(Pe.Fragment,null,Pe.createElement(fj,null,Pe.createElement(mj,{isErr:a},Pe.createElement(hj,null,Pe.createElement(xj,null,"Border"),Pe.createElement("span",{style:{fontSize:11,fontFamily:"monospace",color:a?Ne.err:Ne.dim}},k)),Pe.createElement(yj,{isErr:s},Pe.createElement(bj,null,"Padding"),Pe.createElement(Kc,{side:"top",isErr:s},f.top),Pe.createElement(Kc,{side:"right",isErr:s},f.right),Pe.createElement(Kc,{side:"bottom",isErr:s},f.bottom),Pe.createElement(Kc,{side:"left",isErr:s},f.left),Pe.createElement(Sj,{isErr:u,style:{flexDirection:"column",gap:4}},l&&Pe.createElement(kj,{src:l,alt:"Figma element"}),Pe.createElement(Cj,null,T," \xD7 ",E)))),Pe.createElement(wj,null,"border-box")),Pe.createElement(vj,null,"\u2192 ",n))},wI=it.div({backgroundColor:Ne.outerBg,padding:"24px 16px 16px",display:"flex",flexDirection:"column",alignItems:"center",gap:8}),Ij=it.div({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"12px 20px"}),kx=it.span(e=>({fontSize:e.fSize||"42px",fontWeight:e.fWeight||"600",color:Ne.text,lineHeight:1,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif',position:"relative",zIndex:1})),Fj=it.div({position:"absolute",border:`1.5px dashed ${Ne.err}`,pointerEvents:"none",zIndex:0}),Ej=it.div({position:"absolute",border:`1.5px dashed ${Ne.blue}`,pointerEvents:"none",zIndex:0}),vI=it.div(e=>({position:"absolute",backgroundColor:e.color,color:"#fff",fontSize:10,fontWeight:600,fontFamily:"monospace",padding:"2px 6px",borderRadius:3,zIndex:2,whiteSpace:"nowrap",...e.side==="left"&&{left:-4,top:"50%",transform:"translate(-100%, -50%)"},...e.side==="right"&&{right:-4,top:"50%",transform:"translate(100%, -50%)"}})),Ege=it.div({fontSize:12,color:Ne.text,fontWeight:500,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif'}),Aj=it.div({display:"flex",alignItems:"center",gap:6,fontSize:10,fontFamily:"monospace"}),kI=it.span(e=>({padding:"1px 6px",borderRadius:3,fontWeight:600,fontSize:10,color:"#fff",backgroundColor:e.variant==="err"?Ne.err:Ne.ok})),Pj=it.div({display:"flex",alignItems:"flex-end",justifyContent:"center",gap:16,padding:"4px 0"}),CI=it.div({display:"flex",flexDirection:"column",alignItems:"center",gap:4}),TI=it.div(e=>({fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.3px",color:e.variant==="err"?Ne.err:Ne.ok})),II=it.div(e=>({fontSize:10,fontFamily:"monospace",fontWeight:600,color:e.variant==="err"?Ne.err:Ne.ok,textDecoration:e.variant==="err"?"line-through":"none"})),Lj=it.span({fontSize:16,color:Ne.dim,paddingBottom:20}),FI=it.div(e=>({fontSize:9,color:e.color,fontFamily:"monospace",textAlign:"center",marginTop:2}));function EI(e){return e>=800?"ExtraBold":e>=700?"Bold":e>=600?"Semibold":e>=500?"Medium":e>=400?"Regular":e>=300?"Light":"Thin"}var Mj=({property:e,currentValue:t,expectedValue:n,figmaContext:r})=>{let o=r||{},i=e.toLowerCase(),s=i.includes("size"),a=i.includes("weight"),u=i.includes("lineheight")||i.includes("line-height"),c=i.includes("text")||i.includes("content"),l=i.includes("family"),d=s||u,g=o.fontSize??(s?ts(n):14),p=o.fontWeight??(a?ts(n):600),k=(o.lineHeight??(u?ts(n):null))||Math.round((g||14)*1.43),T=`${Math.min(Math.max(g||14,24),48)}px`;if(d)return Pe.createElement(Pe.Fragment,null,Pe.createElement(wI,null,Pe.createElement(Ij,null,Pe.createElement(Ej,{style:{top:-6,left:0,right:0,bottom:-6}}),Pe.createElement(Fj,{style:{top:2,left:8,right:8,bottom:2}}),Pe.createElement(vI,{color:s?Ne.err:"#7b3030",side:"left"},s?t:`${g}px`),Pe.createElement(vI,{color:u?Ne.err:"#7b3030",side:"right"},u?t:`${k}px`),Pe.createElement(kx,{fSize:T,fWeight:String(p||600)},"Ag")),Pe.createElement("div",{style:{display:"flex",gap:16,justifyContent:"center"}},Pe.createElement(FI,{color:Ne.err},"\u2508\u2508 font-size",s?" \u2717":""),Pe.createElement(FI,{color:Ne.blue},"\u2508\u2508 line-height",u?" \u2717":"")),Pe.createElement(Aj,null,Pe.createElement(kI,{variant:"err"},t),Pe.createElement("span",{style:{color:Ne.dim}},"\u2192"),Pe.createElement(kI,{variant:"ok"},n))));let E=a?t:String(p||600),I=a?n:E,D=ts(t),R=ts(n);return Pe.createElement(Pe.Fragment,null,Pe.createElement(wI,null,Pe.createElement(Pj,null,Pe.createElement(CI,null,Pe.createElement(TI,{variant:"err"},"Current"),Pe.createElement(kx,{fSize:T,fWeight:a?E:String(p||600),style:{color:Ne.err}},c?t:"Ag"),Pe.createElement(II,{variant:"err"},a&&D?`${t} (${EI(D)})`:t)),Pe.createElement(Lj,null,"\u2192"),Pe.createElement(CI,null,Pe.createElement(TI,{variant:"ok"},"Figma"),Pe.createElement(kx,{fSize:T,fWeight:a?I:String(p||600),style:{color:Ne.ok}},c?n:"Ag"),Pe.createElement(II,{variant:"ok"},a&&R?`${n} (${EI(R)})`:n)))))};function Bj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/g);if(!t)return null;let n=t.map(r=>parseFloat(r));return n.length===1?{top:n[0],right:n[0],bottom:n[0],left:n[0]}:n.length===2?{top:n[0],right:n[1],bottom:n[0],left:n[1]}:n.length===3?{top:n[0],right:n[1],bottom:n[2],left:n[1]}:n.length>=4?{top:n[0],right:n[1],bottom:n[2],left:n[3]}:null}function ts(e){let t=e.match(/(\d+(?:\.\d+)?)\s*(?:px)?/);return t?parseFloat(t[1]):null}function Dj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):null}function Rj(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[2]):null}var AI=new Set(["fontSize","font-size","fontWeight","font-weight","lineHeight","line-height","letterSpacing","letter-spacing","fontFamily","font-family","textContent","text-content"]);function zj(e){if(AI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return AI.has(t)}var PI=e=>{let t=!!e.figmaContext&&Object.keys(e.figmaContext).length>0,n=zj(e.property);return Pe.createElement(dj,null,Pe.createElement(gj,null,"\u25BE Layer properties",t?"":" (from review)"),n?Pe.createElement(Mj,{...e}):Pe.createElement(Tj,{...e}))};import Wr from"react";import{styled as Vr}from"storybook/theming";var Nj={color:{text:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)",border:"rgba(59, 130, 246, 0.25)"},border:{text:"#10b981",bg:"rgba(16, 185, 129, 0.1)",border:"rgba(16, 185, 129, 0.25)"},spacing:{text:"#f97316",bg:"rgba(249, 115, 22, 0.1)",border:"rgba(249, 115, 22, 0.25)"},layout:{text:"#14b8a6",bg:"rgba(20, 184, 166, 0.1)",border:"rgba(20, 184, 166, 0.25)"},sizing:{text:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)",border:"rgba(139, 92, 246, 0.25)"},typography:{text:"#ec4899",bg:"rgba(236, 72, 153, 0.1)",border:"rgba(236, 72, 153, 0.25)"}},Oj=Vr.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"12px"}),_j=Vr.div(({theme:e,category:t})=>{let n=Nj[t||""]||{text:e.textMutedColor,bg:"rgba(148, 163, 184, 0.1)",border:"rgba(148, 163, 184, 0.2)"};return{fontSize:"11px",fontWeight:500,color:n.text,backgroundColor:n.bg,padding:"2px 8px",borderRadius:"4px",border:`1px solid ${n.border}`}}),$j=Vr.div(({status:e})=>{let n=(()=>{switch(e){case"pending":return{bg:"rgba(148, 163, 184, 0.15)",text:"#64748b",dot:"#94a3b8"};case"applied":return{bg:"rgba(245, 158, 11, 0.1)",text:"#d97706",dot:"#f59e0b"};case"verified":return{bg:"rgba(16, 185, 129, 0.1)",text:"#059669",dot:"#10b981"};case"failed":return{bg:"rgba(239, 68, 68, 0.1)",text:"#dc2626",dot:"#ef4444"};default:return{bg:"rgba(148, 163, 184, 0.15)",text:"#64748b",dot:"#94a3b8"}}})();return{fontSize:"11px",fontWeight:500,color:n.text,backgroundColor:n.bg,padding:"2px 8px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"5px","&::before":{content:'""',display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:n.dot}}}),Uj=Vr.div({fontSize:"11px",fontWeight:500,color:"#059669",backgroundColor:"rgba(16, 185, 129, 0.1)",padding:"2px 8px",borderRadius:"4px",border:"1px solid rgba(16, 185, 129, 0.2)",display:"flex",alignItems:"center",gap:"5px","&::before":{content:'""',display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#10b981"}}),jj=Vr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginLeft:"12px",paddingLeft:"12px",borderLeft:`1px solid ${e.appBorderColor}`})),Hj=Vr.div({fontSize:"10px",fontWeight:600,color:"#0891b2",backgroundColor:"#ecfeff",padding:"2px 8px",borderRadius:"10px",border:"1px solid #0891b2",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u{1F9E0}"',fontSize:"9px"}}),Wj=Vr.div({fontSize:"10px",fontWeight:600,color:"#7c3aed",backgroundColor:"#ede9fe",padding:"2px 8px",borderRadius:"10px",border:"1px solid #7c3aed",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u{1F50D}"',fontSize:"9px"}}),Vj=Vr.div({fontSize:"10px",fontWeight:600,color:"#d97706",backgroundColor:"#fef3c7",padding:"2px 8px",borderRadius:"10px",border:"1px solid #d97706",display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u26A0\uFE0F"',fontSize:"9px"}}),Gj=Vr.div(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",fontWeight:600,color:e.color.negative,backgroundColor:e.background.negative,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${e.color.negative}`})),qj=Vr.span(({theme:e})=>({fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.textMutedColor,marginLeft:"auto"})),Yj=e=>{if(!e)return{};let t={};if(e.includes("+")){let n=e.split("+");for(let r of n)r.startsWith("programmatic-")?t.programmatic=r.replace("programmatic-","").replace("-detection",""):r==="ai"||r==="ai-review"?t.ai="AI Review":r==="ai-validation"&&(t.ai="AI Validation");return t}return e.startsWith("programmatic-")?t.programmatic=e.replace("programmatic-","").replace("-detection",""):e==="ai-review"?t.ai="AI Review":e==="ai-validation"&&(t.ai="AI Validation"),t},LI=({issue:e,modelDisplayName:t,showModel:n=!1,showDetection:r=!1,dominantDetector:o,showFilePath:i=!0,enableFilePath:s=!1,unreliable:a=!1,validationErrorMessage:u})=>{let c=Yj(e.detectedBy),l=o&&c.ai===o,d=r&&!l&&(c.ai||c.programmatic),g=e.generatedFix?.filePath||e.file;return Wr.createElement(Oj,null,Wr.createElement(_j,{category:e.type},e.type),e.status!=="pending"&&Wr.createElement($j,{status:e.status},e.status),n&&t&&Wr.createElement(Uj,null,t),d&&Wr.createElement(jj,null,c.ai&&!l&&Wr.createElement(Hj,null,c.ai),c.programmatic&&Wr.createElement(Wj,null,"Pre-filter: ",c.programmatic)),a&&Wr.createElement(Vj,{title:u},"Unreliable"),e.dismissed&&Wr.createElement(Gj,null,"Dismissed"),i&&s&&g&&Wr.createElement(qj,null,g))};import Vn from"react";import{styled as Ho}from"storybook/theming";var Kj=e=>{if(!e)return null;let n=(typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):String(e)).match(/#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/);return n?n[0]:null},Xj=e=>e?typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):String(e):"",Qj=Ho.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"2px",fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"8px",padding:"8px 10px",backgroundColor:e.background.app,borderRadius:"4px"})),Cx=Ho.div({display:"flex",gap:"8px",alignItems:"baseline"}),Tx=Ho.span(({theme:e})=>({color:e.textMutedColor,fontWeight:500,width:"60px",flexShrink:0,fontSize:"11px"})),Ix=Ho.span(({theme:e})=>({color:e.color.defaultText,fontFamily:"inherit",fontSize:"11px",fontWeight:500})),Jj=Ho(Ix)(({theme:e})=>({color:e.color.negative,textDecoration:"line-through",opacity:.7})),Zj=Ho(Ix)(({theme:e})=>({color:e.color.positive,fontWeight:600})),eH=Ho.span(({color:e})=>({display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundImage:`
|
|
94
94
|
linear-gradient(${e}, ${e}),
|
|
95
95
|
linear-gradient(45deg, rgba(0,0,0,0.08) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.08) 75%),
|
|
96
96
|
linear-gradient(45deg, rgba(0,0,0,0.08) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.08) 75%)
|
|
97
|
-
`,backgroundSize:"100% 100%, 6px 6px, 6px 6px",backgroundPosition:"0 0, 0 0, 3px 3px",border:"1px solid rgba(0, 0, 0, 0.15)",marginRight:"6px",verticalAlign:"middle",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.15)"})),Qj=Ho.span({display:"flex",alignItems:"center"}),EI=({value:e,isStrikethrough:t=!1})=>{let n=Vj(e),r=Gj(e),o=t?Yj:Kj;return n?Vn.createElement(Qj,null,Vn.createElement(Xj,{color:n,title:`Color: ${n}`}),Vn.createElement(o,null,r)):Vn.createElement(o,null,r)},AI=({property:e,currentValue:t,suggestedValue:n})=>Vn.createElement(qj,null,Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Property"),Vn.createElement(Ix,{style:{fontWeight:600}},e)),t!=null&&t!==""&&Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Current"),Vn.createElement(EI,{value:t,isStrikethrough:!0})),n!=null&&n!==""&&Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Expected"),Vn.createElement(EI,{value:n,isStrikethrough:!1})));Ce();var LI=new Set(["dimensions","width","height","minWidth","minHeight","maxWidth","maxHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","padding-top","padding-right","padding-bottom","padding-left","border","borderWidth","border-width","border / box-shadow","borderRadius","border-radius","gap","rowGap","columnGap"]);function eH(e){if(LI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return LI.has(t)}var tH=Le.div(({theme:e,dismissed:t,fixApplied:n})=>({padding:"14px 16px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:t?e.background.negative:n?e.background.positive:"transparent",opacity:t?.7:n?.6:1,position:"relative",transition:"background-color 0.15s","&:hover":{backgroundColor:t||n?void 0:e.base==="dark"?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)"},"&:first-of-type":{borderTop:"none"}})),$fe=Le.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),nH=Le.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),rH=Le.p(({theme:e})=>({flex:1,minWidth:0,margin:0,fontSize:"14px",fontWeight:400,lineHeight:"1.5",color:e.color.defaultText})),oH=Le.input(({theme:e})=>({appearance:"none",WebkitAppearance:"none",marginTop:"2px",width:"14px",height:"14px",cursor:"pointer",flexShrink:0,border:`1.5px solid ${e.color.mediumdark||"#cbd5e1"}`,borderRadius:"3px",backgroundColor:e.background.content,position:"relative",transition:"all 0.15s","&:hover":{borderColor:se},"&:checked":{backgroundColor:se,borderColor:se},"&:checked::after":{content:'""',position:"absolute",left:"3px",top:"0px",width:"4px",height:"8px",border:"solid #fff",borderWidth:"0 2px 2px 0",transform:"rotate(45deg)"},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),iH=Le.span(({theme:e,severity:t})=>({flexShrink:0,marginTop:"2px",display:"flex",alignItems:"center",color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.color.mediumdark,"& svg":{width:"16px",height:"16px"}})),sH=Le.span(({theme:e,severity:t})=>({flexShrink:0,fontSize:"10px",fontWeight:e.typography.weight.bold,textTransform:"uppercase",letterSpacing:"0.04em",color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.color.mediumdark})),Ufe=Le.div({flex:1,minWidth:0}),jfe=Le.div({display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px",marginBottom:"6px"}),aH=Le.div({display:"flex",alignItems:"center",gap:"12px",flexShrink:0}),Ex=Le.button(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"0",fontSize:"11px",fontWeight:400,color:e.textMutedColor,backgroundColor:"transparent",border:"none",cursor:"pointer",transition:"color 0.15s","&:hover":{color:e.color.defaultText},"& svg":{width:"11px",height:"11px"}})),lH=Le(Ex)(({theme:e})=>({"&:hover":{color:e.color.negative}})),Hfe=Le.div(({theme:e})=>({fontSize:"14px",fontWeight:500,color:e.color.defaultText,marginBottom:"4px",lineHeight:"1.5"})),Wfe=Le.div({display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap"}),cH=Le.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,lineHeight:"1.5",marginBottom:"10px"})),Vfe=Le.pre(({theme:e})=>({fontSize:"13px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',backgroundColor:e.base==="dark"?"#1e293b":"#f8fafc",color:e.base==="dark"?"#e2e8f0":"#1e293b",padding:"12px",borderRadius:"4px",overflowX:"auto",margin:"8px 0 0 0",lineHeight:"1.5"})),Gfe=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"4px"})),uH=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginTop:"6px",fontStyle:"italic",display:"flex",alignItems:"baseline",gap:"4px","& strong":{fontStyle:"normal",fontWeight:600,color:"#7c3aed",fontSize:"10px"}})),pH=Le.div(({theme:e})=>({marginTop:"8px",padding:"10px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${se}`})),dH=Le.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:se,marginBottom:"8px",display:"flex",alignItems:"center",gap:"6px"})),fH=Le.div(({theme:e})=>({display:"grid",gridTemplateColumns:"1fr auto auto",gap:"8px",alignItems:"center",padding:"4px 0",fontSize:"11px",borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),gH=Le.span(({theme:e})=>({fontFamily:"monospace",fontWeight:600,color:e.color.defaultText})),MI=Le.span(({theme:e,type:t})=>({fontFamily:"monospace",fontSize:"10px",padding:"2px 6px",borderRadius:"3px",backgroundColor:t==="current"?e.background.negative:e.background.positive,color:t==="current"?e.color.negative:e.color.positive,textDecoration:t==="current"?"line-through":"none"})),qfe=Le.div({position:"absolute",top:"10px",right:"10px",display:"flex",alignItems:"center",gap:"2px"}),mH=Le(Cn)({width:"24px",height:"24px",padding:0,fontSize:"12px"}),Yfe=Le(mH)(({theme:e})=>({"&:hover":{backgroundColor:e.background.negative,color:e.color.negative}})),hH=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontStyle:"italic",marginTop:"8px",padding:"8px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${e.color.negative}`})),BI=Le.div(({theme:e})=>({fontSize:"11px",color:e.color.negative,backgroundColor:e.background.negative,padding:"10px",borderRadius:"4px",marginTop:"10px",borderLeft:`3px solid ${e.color.negative}`,fontFamily:"monospace",lineHeight:"1.5"})),xH=Le.div(({theme:e,compact:t})=>({marginTop:"12px",padding:t?"8px 12px":"12px",backgroundColor:e.background.positive,borderRadius:"6px",border:`1px solid ${e.color.positive}`})),yH=Le.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}),bH=Le.div(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,display:"flex",alignItems:"center",gap:"6px","&::before":{content:'"\u{1F916}"',fontSize:"14px"}})),SH=Le.span(({theme:e,confidence:t})=>({padding:"4px 8px",borderRadius:"4px",fontSize:"11px",fontWeight:600,backgroundColor:t>=.8?e.background.positive:t>=.6?e.background.warning:e.background.negative,color:t>=.8?e.color.positive:t>=.6?e.color.warning:e.color.negative})),DI=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginBottom:"8px"})),RI=Le.details({marginBottom:"8px"}),zI=Le.summary(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,cursor:"pointer",userSelect:"none",marginBottom:"8px","&:hover":{opacity:.8}})),wH=Le.pre(({theme:e})=>({fontSize:"11px",fontFamily:"monospace",backgroundColor:e.base==="dark"?"#1e293b":"#f8fafc",color:e.base==="dark"?"#e2e8f0":"#1e293b",padding:"10px",borderRadius:"4px",overflowX:"auto",margin:0,lineHeight:"1.5",maxHeight:"300px",overflowY:"auto"})),vH=Le.div({display:"flex",gap:"8px",marginTop:"8px"}),kH=Le(kn)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),CH=Le(Rr)({padding:"6px 12px",fontSize:"12px"}),Kfe=Le(Yt)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"90px",...t?{backgroundColor:e.color.positive}:{}})),Xfe=Le.div({display:"flex",flexDirection:"column",gap:"10px",padding:"8px 0"}),TH=Le.div({display:"flex",alignItems:"center",gap:"12px"}),IH=Le.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"spin 0.8s linear infinite","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),FH=Le.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"})),Qfe=Le.div(({theme:e,width:t="100%"})=>({height:"10px",backgroundColor:e.background.app,borderRadius:"4px",width:t,animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:1},"50%":{opacity:.5}}})),EH=Le.div(({theme:e})=>({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",overflow:"hidden",fontSize:"11px",fontFamily:"monospace",lineHeight:"1.5",marginTop:"8px"})),NI=Le.div(({theme:e,side:t})=>({backgroundColor:t==="old"?e.background.negative:e.background.positive,borderRight:t==="old"?`1px solid ${e.appBorderColor}`:"none",minWidth:0,overflow:"hidden"})),OI=Le.div(({theme:e,side:t})=>({padding:"6px 8px",fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:t==="old"?e.background.negative:e.background.positive,color:t==="old"?e.color.negative:e.color.positive,borderBottom:`1px solid ${e.appBorderColor}`})),_I=Le.div({display:"flex",flexDirection:"column",overflowX:"auto",maxHeight:"300px",overflowY:"auto"}),$I=Le.div(({theme:e,type:t})=>{let n="transparent",r=e.color.defaultText;return t==="removed"?(n=e.background.negative,r=e.color.negative):t==="added"?(n=e.background.positive,r=e.color.positive):t==="empty"&&(n=e.background.app,r=e.textMutedColor),{padding:"2px 8px",backgroundColor:n,color:r,whiteSpace:"pre",minHeight:"20px",borderBottom:"1px solid rgba(0, 0, 0, 0.05)"}}),UI=Le.div(({theme:e,status:t})=>({fontSize:"12px",color:e.color.positive,fontStyle:t==="applying"?"italic":"normal",fontWeight:t==="applied"?600:400})),jI=e=>{let t=e.split(`
|
|
98
|
-
`),n=[];for(let r=0;r<t.length;r++){let o=t[r];if(!o.startsWith("@@"))if(o.startsWith("-"))n.push({oldLine:{type:"removed",content:o.substring(1)},newLine:{type:"empty",content:""}});else if(o.startsWith("+"))n.push({oldLine:{type:"empty",content:""},newLine:{type:"added",content:o.substring(1)}});else{let i=o.startsWith(" ")?o.substring(1):o;n.push({oldLine:{type:"context",content:i},newLine:{type:"context",content:i}})}}return n},
|
|
97
|
+
`,backgroundSize:"100% 100%, 6px 6px, 6px 6px",backgroundPosition:"0 0, 0 0, 3px 3px",border:"1px solid rgba(0, 0, 0, 0.15)",marginRight:"6px",verticalAlign:"middle",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.15)"})),tH=Ho.span({display:"flex",alignItems:"center"}),MI=({value:e,isStrikethrough:t=!1})=>{let n=Kj(e),r=Xj(e),o=t?Jj:Zj;return n?Vn.createElement(tH,null,Vn.createElement(eH,{color:n,title:`Color: ${n}`}),Vn.createElement(o,null,r)):Vn.createElement(o,null,r)},BI=({property:e,currentValue:t,suggestedValue:n})=>Vn.createElement(Qj,null,Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Property"),Vn.createElement(Ix,{style:{fontWeight:600}},e)),t!=null&&t!==""&&Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Current"),Vn.createElement(MI,{value:t,isStrikethrough:!0})),n!=null&&n!==""&&Vn.createElement(Cx,null,Vn.createElement(Tx,null,"Expected"),Vn.createElement(MI,{value:n,isStrikethrough:!1})));Ce();var RI=new Set(["dimensions","width","height","minWidth","minHeight","maxWidth","maxHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","padding-top","padding-right","padding-bottom","padding-left","border","borderWidth","border-width","border / box-shadow","borderRadius","border-radius","gap","rowGap","columnGap"]);function oH(e){if(RI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return RI.has(t)}var iH=Le.div(({theme:e,dismissed:t,fixApplied:n})=>({padding:"14px 16px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:t?e.background.negative:n?e.background.positive:"transparent",opacity:t?.7:n?.6:1,position:"relative",transition:"background-color 0.15s","&:hover":{backgroundColor:t||n?void 0:e.base==="dark"?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)"},"&:first-of-type":{borderTop:"none"}})),Wge=Le.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),sH=Le.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),aH=Le.p(({theme:e})=>({flex:1,minWidth:0,margin:0,fontSize:"14px",fontWeight:400,lineHeight:"1.5",color:e.color.defaultText})),lH=Le.input(({theme:e})=>({appearance:"none",WebkitAppearance:"none",marginTop:"2px",width:"14px",height:"14px",cursor:"pointer",flexShrink:0,border:`1.5px solid ${e.color.mediumdark||"#cbd5e1"}`,borderRadius:"3px",backgroundColor:e.background.content,position:"relative",transition:"all 0.15s","&:hover":{borderColor:se},"&:checked":{backgroundColor:se,borderColor:se},"&:checked::after":{content:'""',position:"absolute",left:"3px",top:"0px",width:"4px",height:"8px",border:"solid #fff",borderWidth:"0 2px 2px 0",transform:"rotate(45deg)"},"&:disabled":{opacity:.4,cursor:"not-allowed"}})),cH=Le.span(({theme:e,severity:t})=>({flexShrink:0,marginTop:"2px",display:"flex",alignItems:"center",color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.color.mediumdark,"& svg":{width:"16px",height:"16px"}})),uH=Le.span(({theme:e,severity:t})=>({flexShrink:0,fontSize:"10px",fontWeight:e.typography.weight.bold,textTransform:"uppercase",letterSpacing:"0.04em",color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.color.mediumdark})),Vge=Le.div({flex:1,minWidth:0}),Gge=Le.div({display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px",marginBottom:"6px"}),pH=Le.div({display:"flex",alignItems:"center",gap:"12px",flexShrink:0}),Ex=Le.button(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"0",fontSize:"11px",fontWeight:400,color:e.textMutedColor,backgroundColor:"transparent",border:"none",cursor:"pointer",transition:"color 0.15s","&:hover":{color:e.color.defaultText},"& svg":{width:"11px",height:"11px"}})),dH=Le(Ex)(({theme:e})=>({"&:hover":{color:e.color.negative}})),qge=Le.div(({theme:e})=>({fontSize:"14px",fontWeight:500,color:e.color.defaultText,marginBottom:"4px",lineHeight:"1.5"})),Yge=Le.div({display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap"}),gH=Le.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,lineHeight:"1.5",marginBottom:"10px"})),Kge=Le.pre(({theme:e})=>({fontSize:"13px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',backgroundColor:e.base==="dark"?"#1e293b":"#f8fafc",color:e.base==="dark"?"#e2e8f0":"#1e293b",padding:"12px",borderRadius:"4px",overflowX:"auto",margin:"8px 0 0 0",lineHeight:"1.5"})),Xge=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"4px"})),fH=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginTop:"6px",fontStyle:"italic",display:"flex",alignItems:"baseline",gap:"4px","& strong":{fontStyle:"normal",fontWeight:600,color:"#7c3aed",fontSize:"10px"}})),mH=Le.div(({theme:e})=>({marginTop:"8px",padding:"10px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${se}`})),hH=Le.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:se,marginBottom:"8px",display:"flex",alignItems:"center",gap:"6px"})),xH=Le.div(({theme:e})=>({display:"grid",gridTemplateColumns:"1fr auto auto",gap:"8px",alignItems:"center",padding:"4px 0",fontSize:"11px",borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),yH=Le.span(({theme:e})=>({fontFamily:"monospace",fontWeight:600,color:e.color.defaultText})),zI=Le.span(({theme:e,type:t})=>({fontFamily:"monospace",fontSize:"10px",padding:"2px 6px",borderRadius:"3px",backgroundColor:t==="current"?e.background.negative:e.background.positive,color:t==="current"?e.color.negative:e.color.positive,textDecoration:t==="current"?"line-through":"none"})),Qge=Le.div({position:"absolute",top:"10px",right:"10px",display:"flex",alignItems:"center",gap:"2px"}),bH=Le(Cn)({width:"24px",height:"24px",padding:0,fontSize:"12px"}),Jge=Le(bH)(({theme:e})=>({"&:hover":{backgroundColor:e.background.negative,color:e.color.negative}})),SH=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontStyle:"italic",marginTop:"8px",padding:"8px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${e.color.negative}`})),NI=Le.div(({theme:e})=>({fontSize:"11px",color:e.color.negative,backgroundColor:e.background.negative,padding:"10px",borderRadius:"4px",marginTop:"10px",borderLeft:`3px solid ${e.color.negative}`,fontFamily:"monospace",lineHeight:"1.5"})),wH=Le.div(({theme:e,compact:t})=>({marginTop:"12px",padding:t?"8px 12px":"12px",backgroundColor:e.background.positive,borderRadius:"6px",border:`1px solid ${e.color.positive}`})),vH=Le.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}),kH=Le.div(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,display:"flex",alignItems:"center",gap:"6px","&::before":{content:'"\u{1F916}"',fontSize:"14px"}})),CH=Le.span(({theme:e,confidence:t})=>({padding:"4px 8px",borderRadius:"4px",fontSize:"11px",fontWeight:600,backgroundColor:t>=.8?e.background.positive:t>=.6?e.background.warning:e.background.negative,color:t>=.8?e.color.positive:t>=.6?e.color.warning:e.color.negative})),OI=Le.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginBottom:"8px"})),_I=Le.details({marginBottom:"8px"}),$I=Le.summary(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,cursor:"pointer",userSelect:"none",marginBottom:"8px","&:hover":{opacity:.8}})),TH=Le.pre(({theme:e})=>({fontSize:"11px",fontFamily:"monospace",backgroundColor:e.base==="dark"?"#1e293b":"#f8fafc",color:e.base==="dark"?"#e2e8f0":"#1e293b",padding:"10px",borderRadius:"4px",overflowX:"auto",margin:0,lineHeight:"1.5",maxHeight:"300px",overflowY:"auto"})),IH=Le.div({display:"flex",gap:"8px",marginTop:"8px"}),FH=Le(kn)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),EH=Le(Rr)({padding:"6px 12px",fontSize:"12px"}),Zge=Le(Yt)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"90px",...t?{backgroundColor:e.color.positive}:{}})),efe=Le.div({display:"flex",flexDirection:"column",gap:"10px",padding:"8px 0"}),AH=Le.div({display:"flex",alignItems:"center",gap:"12px"}),PH=Le.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:se,borderRadius:"50%",animation:"spin 0.8s linear infinite","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),LH=Le.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"})),tfe=Le.div(({theme:e,width:t="100%"})=>({height:"10px",backgroundColor:e.background.app,borderRadius:"4px",width:t,animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:1},"50%":{opacity:.5}}})),MH=Le.div(({theme:e})=>({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",overflow:"hidden",fontSize:"11px",fontFamily:"monospace",lineHeight:"1.5",marginTop:"8px"})),UI=Le.div(({theme:e,side:t})=>({backgroundColor:t==="old"?e.background.negative:e.background.positive,borderRight:t==="old"?`1px solid ${e.appBorderColor}`:"none",minWidth:0,overflow:"hidden"})),jI=Le.div(({theme:e,side:t})=>({padding:"6px 8px",fontWeight:600,fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:t==="old"?e.background.negative:e.background.positive,color:t==="old"?e.color.negative:e.color.positive,borderBottom:`1px solid ${e.appBorderColor}`})),HI=Le.div({display:"flex",flexDirection:"column",overflowX:"auto",maxHeight:"300px",overflowY:"auto"}),WI=Le.div(({theme:e,type:t})=>{let n="transparent",r=e.color.defaultText;return t==="removed"?(n=e.background.negative,r=e.color.negative):t==="added"?(n=e.background.positive,r=e.color.positive):t==="empty"&&(n=e.background.app,r=e.textMutedColor),{padding:"2px 8px",backgroundColor:n,color:r,whiteSpace:"pre",minHeight:"20px",borderBottom:"1px solid rgba(0, 0, 0, 0.05)"}}),VI=Le.div(({theme:e,status:t})=>({fontSize:"12px",color:e.color.positive,fontStyle:t==="applying"?"italic":"normal",fontWeight:t==="applied"?600:400})),GI=e=>{let t=e.split(`
|
|
98
|
+
`),n=[];for(let r=0;r<t.length;r++){let o=t[r];if(!o.startsWith("@@"))if(o.startsWith("-"))n.push({oldLine:{type:"removed",content:o.substring(1)},newLine:{type:"empty",content:""}});else if(o.startsWith("+"))n.push({oldLine:{type:"empty",content:""},newLine:{type:"added",content:o.substring(1)}});else{let i=o.startsWith(" ")?o.substring(1):o;n.push({oldLine:{type:"context",content:i},newLine:{type:"context",content:i}})}}return n},BH=e=>{switch(e){case"post-ai-validation":return"Pre-filter (programmatic)";case"ai-validation":return"Haiku AI";case"user":return"Manual";default:return"Unknown"}},DH=e=>({"claude-sonnet-4-6":"Sonnet 4.6","claude-sonnet-4-20250514":"Sonnet 4","claude-sonnet-3-5-20240620":"Sonnet 3.5","claude-3-opus-20240229":"Opus 3","gpt-5":"GPT-5","gpt-5-mini":"GPT-5 Mini","gpt-5.2-chat-latest":"GPT-5.2 Instant","gpt-4o":"GPT-4o"})[e]||e,qI=rH(({issue:e,modelId:t,dominantDetector:n,showFilePath:r=!0,onToggleSelection:o,onDismiss:i,onUndismiss:s,onApplyFix:a,onRegenerateFix:u})=>{let{featureFlags:c,userRole:l,setHoveredIssueId:d}=ce(),[g,p]=Fx(!1),[f,k]=Fx(!1),[T,E]=Fx(!1),I=nH(null),D=DI(()=>{I.current&&clearTimeout(I.current),I.current=setTimeout(()=>{d(e.id),E(!0)},100)},[e.id,d]),R=DI(()=>{I.current&&clearTimeout(I.current),I.current=null,d(null),E(!1)},[d]),$=()=>{e.dismissed?s(e.id):p(!0)},P=w=>{i(e.id,w),p(!1)},z=async()=>{let w=[`**${e.title}**`,`Type: ${e.type} | Severity: ${e.severity} | Status: ${e.status}`,e.description];if(e.property&&w.push(`Property: ${e.property}`),e.currentValue&&w.push(`Current: ${e.currentValue}`),e.suggestedValue&&w.push(`Expected: ${e.suggestedValue}`),e.file&&w.push(`File: ${e.file}${e.lineNumber!==void 0?`:${e.lineNumber}`:""}`),e.relatedTo&&e.relatedTo.length>0&&w.push(`Caused by: ${e.relatedTo.join(", ")}`),e.suggestedCode&&w.push(`
|
|
99
99
|
Suggested code:
|
|
100
100
|
\`\`\`
|
|
101
101
|
${e.suggestedCode}
|
|
@@ -109,25 +109,25 @@ Diff:
|
|
|
109
109
|
\`\`\`diff
|
|
110
110
|
${C.diffPreview}
|
|
111
111
|
\`\`\``),C.error&&w.push(`Error: ${C.error}`)}let v=w.filter(Boolean).join(`
|
|
112
|
-
`);try{await navigator.clipboard.writeText(v),k(!0),setTimeout(()=>k(!1),2e3)}catch(C){console.error("Failed to copy:",C)}},x=e.generatedFix?.status==="applied";return Z.createElement(Z.Fragment,null,Z.createElement(
|
|
112
|
+
`);try{await navigator.clipboard.writeText(v),k(!0),setTimeout(()=>k(!1),2e3)}catch(C){console.error("Failed to copy:",C)}},x=e.generatedFix?.status==="applied";return Z.createElement(Z.Fragment,null,Z.createElement(iH,{dismissed:!!e.dismissed,fixApplied:x,onMouseEnter:D,onMouseLeave:R},Z.createElement(sH,null,Z.createElement(lH,{type:"checkbox",checked:e.selectedForFix,onChange:()=>o(e.id),disabled:e.dismissed||e.generatedFix?.status==="failed"}),Z.createElement(cH,{severity:e.severity},e.severity==="critical"?Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("circle",{cx:"12",cy:"12",r:"10"}),Z.createElement("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),Z.createElement("line",{x1:"9",y1:"9",x2:"15",y2:"15"})):e.severity==="major"?Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),Z.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),Z.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})):Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("circle",{cx:"12",cy:"12",r:"10"}),Z.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),Z.createElement("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"}))),Z.createElement(uH,{severity:e.severity},e.severity),Z.createElement(aH,null,e.title),Z.createElement(pH,null,Z.createElement(Ex,{onClick:z,title:"Copy issue details"},f?Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("polyline",{points:"20 6 9 17 4 12"})):Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),Z.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})),"Copy"),e.dismissed?Z.createElement(Ex,{onClick:$,title:"Restore issue"},Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("polyline",{points:"1 4 1 10 7 10"}),Z.createElement("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})),"Restore"):Z.createElement(dH,{onClick:$,title:"Dismiss issue"},Z.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),"Dismiss"))),Z.createElement(LI,{issue:e,modelDisplayName:DH(t),showModel:c.enableModelSelection,showDetection:l==="admin",dominantDetector:n,showFilePath:r,enableFilePath:c.enableFixGeneration,unreliable:e._unreliable,validationErrorMessage:e._validationError?.message}),e.description&&e.description!==e.title&&Z.createElement(gH,null,e.description),e.property&&Z.createElement(BI,{property:e.property,currentValue:e.currentValue,suggestedValue:e.suggestedValue}),l==="admin"&&T&&e.property&&e.currentValue&&e.suggestedValue&&oH(e.property)&&Z.createElement(PI,{property:e.property,currentValue:e.currentValue,expectedValue:e.suggestedValue,figmaContext:e.figmaContext}),e.relatedTo&&e.relatedTo.length>0&&Z.createElement(fH,null,Z.createElement("strong",null,"Caused by:")," ",e.relatedTo.join(", ")),e.relatedProperties&&e.relatedProperties.length>0&&Z.createElement(mH,null,Z.createElement(hH,null,"Affected Properties (",e.relatedProperties.length,")"),e.relatedProperties.map((w,v)=>Z.createElement(xH,{key:`${w.property}-${v}`},Z.createElement(yH,null,w.property),Z.createElement(zI,{type:"current"},w.currentValue),Z.createElement(zI,{type:"suggested"},w.suggestedValue)))),e.dismissed&&Z.createElement(SH,null,Z.createElement("strong",null,"Filtered by:")," ",BH(e.dismissedBy),e.dismissReason&&Z.createElement(Z.Fragment,null,Z.createElement("br",null),"Reason: ",e.dismissReason)),e.status==="failed"&&e.error&&Z.createElement(NI,null,Z.createElement("strong",null,"Error:")," ",e.error),e.generatedFix&&Z.createElement(wH,{compact:e.generatedFix.status==="generating"},e.generatedFix.status==="generating"?Z.createElement(AH,{style:{margin:0}},Z.createElement(PH,null),Z.createElement(LH,{style:{margin:0}},"Generating fix...")):Z.createElement(Z.Fragment,null,Z.createElement(vH,null,Z.createElement(kH,null,"AI-Generated Fix"),Z.createElement(CH,{confidence:e.generatedFix.confidence},Math.round(e.generatedFix.confidence>1?e.generatedFix.confidence:e.generatedFix.confidence*100),"% confidence")),e.generatedFix.strategy&&Z.createElement(OI,null,"Strategy: ",e.generatedFix.strategy),e.generatedFix.noChangesExplanation&&Z.createElement(OI,{style:{fontStyle:"italic"}},"Reason: ",e.generatedFix.noChangesExplanation),e.generatedFix.diffPreview?Z.createElement(_I,null,Z.createElement($I,null,"View Diff"),Z.createElement(MH,null,Z.createElement(UI,{side:"old"},Z.createElement(jI,{side:"old"},"Old"),Z.createElement(HI,null,GI(e.generatedFix.diffPreview).map((w,v)=>Z.createElement(WI,{key:`old-${v}`,type:w.oldLine.type},w.oldLine.content||"\xA0")))),Z.createElement(UI,{side:"new"},Z.createElement(jI,{side:"new"},"New"),Z.createElement(HI,null,GI(e.generatedFix.diffPreview).map((w,v)=>Z.createElement(WI,{key:`new-${v}`,type:w.newLine.type},w.newLine.content||"\xA0")))))):e.generatedFix.code&&Z.createElement(_I,null,Z.createElement($I,null,"View Generated Code"),Z.createElement(TH,null,e.generatedFix.code)),e.generatedFix.status==="failed"&&e.generatedFix.error&&Z.createElement(NI,null,Z.createElement("strong",null,"Fix generation failed:")," ",e.generatedFix.error),e.generatedFix.status==="ready"&&c.enableFixApply&&a&&Z.createElement(IH,null,Z.createElement(FH,{onClick:()=>a(e.id)},"Apply Fix"),u&&Z.createElement(EH,{onClick:()=>u(e.id)},"Regenerate")),e.generatedFix.status==="applying"&&Z.createElement(VI,{status:"applying"},"Applying fix..."),e.generatedFix.status==="applied"&&Z.createElement(VI,{status:"applied"},"\u2713 Fix applied successfully")))),Z.createElement(SI,{isOpen:g,issueTitle:e.title,onConfirm:P,onCancel:()=>p(!1)}))});import Ax from"react";import{styled as Px,keyframes as RH}from"storybook/theming";var zH=RH`
|
|
113
113
|
0% { transform: rotate(0deg); }
|
|
114
114
|
100% { transform: rotate(360deg); }
|
|
115
|
-
`,
|
|
115
|
+
`,NH=Px.div({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px",gap:"12px"}),OH=Px.div(({theme:e})=>({width:"24px",height:"24px",border:`3px solid ${e.appBorderColor}`,borderTopColor:"#7c3aed",borderRadius:"50%",animation:`${zH} 0.8s linear infinite`})),_H=Px.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Xc=({label:e="Loading..."})=>Ax.createElement(NH,null,Ax.createElement(OH,null),Ax.createElement(_H,null,e));Ce();import mt,{useState as $H,useEffect as UH,useRef as jH}from"react";import{styled as mn,keyframes as Ea}from"storybook/theming";var ns="#8b6cc1",HH="rgba(139, 108, 193, 0.2)",XI="rgba(139, 108, 193, 0.15)",WH="rgba(139, 108, 193, 0.1)",VH="rgba(139, 108, 193, 0.5)",QI=Ea`
|
|
116
116
|
from { transform: rotate(0deg); }
|
|
117
117
|
to { transform: rotate(360deg); }
|
|
118
|
-
`,
|
|
118
|
+
`,GH=Ea`
|
|
119
119
|
from { transform: rotate(0deg); }
|
|
120
120
|
to { transform: rotate(-360deg); }
|
|
121
|
-
`,
|
|
121
|
+
`,qH=Ea`
|
|
122
122
|
0%, 100% { opacity: 1; transform: scale(1); }
|
|
123
123
|
50% { opacity: 0.6; transform: scale(1.05); }
|
|
124
|
-
`,
|
|
124
|
+
`,YH=Ea`
|
|
125
125
|
from { opacity: 0; transform: translateY(8px); }
|
|
126
126
|
to { opacity: 1; transform: translateY(0); }
|
|
127
|
-
`,
|
|
127
|
+
`,KH=Ea`
|
|
128
128
|
0%, 100% { opacity: 1; }
|
|
129
129
|
50% { opacity: 0.4; }
|
|
130
|
-
`,
|
|
130
|
+
`,XH=mn.div({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"60px 20px",textAlign:"center",animation:`${YH} 0.4s ease-out`}),QH=mn.div({position:"relative",width:"80px",height:"80px",marginBottom:"32px"}),JH=mn.div({position:"absolute",inset:0,borderRadius:"50%",background:`radial-gradient(circle, ${XI} 0%, transparent 70%)`,animation:`${qH} 2s ease-in-out infinite`}),ZH=mn.div({position:"absolute",inset:0,borderRadius:"50%",border:`2px solid ${HH}`}),e8=mn.div({position:"absolute",inset:0,borderRadius:"50%",border:"2px solid transparent",borderTopColor:ns,borderRightColor:ns,animation:`${QI} 1.2s linear infinite`}),t8=mn.div({position:"absolute",inset:"12px",borderRadius:"50%",border:`1px solid ${XI}`}),n8=mn.div({position:"absolute",inset:"12px",borderRadius:"50%",border:"1px solid transparent",borderBottomColor:VH,animation:`${GH} 1.8s linear infinite`}),r8=mn.div({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}),o8=mn.div({position:"absolute",inset:0,animation:`${QI} 3s linear infinite`}),i8=mn.div({position:"absolute",top:0,left:"50%",transform:"translate(-50%, -50%)",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:ns}),s8=()=>mt.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:ns,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},mt.createElement("path",{d:"M12 3l1.912 5.813a2 2 0 0 0 1.275 1.275L21 12l-5.813 1.912a2 2 0 0 0-1.275 1.275L12 21l-1.912-5.813a2 2 0 0 0-1.275-1.275L3 12l5.813-1.912a2 2 0 0 0 1.275-1.275L12 3z"}),mt.createElement("path",{d:"M5 3v4"}),mt.createElement("path",{d:"M3 5h4"}),mt.createElement("path",{d:"M19 17v4"}),mt.createElement("path",{d:"M17 19h4"})),a8=mn.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,letterSpacing:"-0.01em"})),l8=mn.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.textMutedColor,marginTop:"6px",maxWidth:"220px"})),c8=mn.div({display:"flex",alignItems:"center",gap:"8px",marginTop:"24px"}),Lx=mn.div(({theme:e,variant:t})=>({display:"flex",alignItems:"center",gap:"6px",padding:"4px 10px",borderRadius:"999px",fontSize:"11px",fontWeight:500,...t==="done"&&{backgroundColor:e.color.positive?`${e.color.positive}1a`:"rgba(16, 185, 129, 0.1)",color:e.color.positive||"#10b981"},...t==="active"&&{backgroundColor:WH,color:ns},...t==="pending"&&{backgroundColor:e.background.hoverable||"#f3f4f6",color:e.textMutedColor}})),YI=mn.div(({theme:e})=>({width:"16px",height:"1px",backgroundColor:e.appBorderColor})),KI=mn.div({width:"6px",height:"6px",borderRadius:"50%",backgroundColor:ns,animation:`${KH} 1.5s ease-in-out infinite`}),u8=mn.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"16px"})),p8=()=>mt.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},mt.createElement("polyline",{points:"20 6 9 17 4 12"})),JI=()=>{let{streamingProgress:e}=ce(),t=(e||0)>25,[n,r]=$H(0),o=jH();return UH(()=>(o.current=setInterval(()=>r(i=>i+1),1e3),()=>clearInterval(o.current)),[]),mt.createElement(XH,null,mt.createElement(QH,null,mt.createElement(JH,null),mt.createElement(ZH,null),mt.createElement(e8,null),mt.createElement(t8,null),mt.createElement(n8,null),mt.createElement(r8,null,mt.createElement(s8,null)),mt.createElement(o8,null,mt.createElement(i8,null))),mt.createElement(a8,null,"Analyzing designs"),mt.createElement(l8,null,"AI is comparing screenshots and detecting issues"),mt.createElement(c8,null,mt.createElement(Lx,{variant:t?"done":"active"},t?mt.createElement(p8,null):mt.createElement(KI,null),"Screenshots"),mt.createElement(YI,null),mt.createElement(Lx,{variant:t?"active":"pending"},t?mt.createElement(KI,null):null,"Analysis"),mt.createElement(YI,null),mt.createElement(Lx,{variant:"pending"},"Report")),mt.createElement(u8,null,n,"s \xB7 Esc to stop"))};Ce();var bfe=st.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:e.textMutedColor,cursor:"pointer",padding:"4px 8px",borderRadius:"4px",backgroundColor:e.background.app,"&:hover":{backgroundColor:e.background.hoverable}})),Sfe=st.input(({theme:e})=>({width:"14px",height:"14px",cursor:"pointer",accentColor:se})),h8=st.div({display:"flex",flexDirection:"column",gap:"12px",padding:"12px"}),x8=st.div({display:"flex",gap:"8px"}),ZI=st(hn)({flex:1}),y8=st.div(({theme:e,isOpen:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderRadius:t?"8px 8px 0 0":"8px",border:`1px solid ${e.appBorderColor}`,borderBottom:t?"none":`1px solid ${e.appBorderColor}`,cursor:"pointer",transition:"background-color 0.15s ease","&:hover":{backgroundColor:e.background.hoverable}})),b8=st.div({display:"flex",alignItems:"center",gap:"10px",fontSize:"12px"}),S8=st.span(({theme:e,isOpen:t})=>({display:"flex",alignItems:"center",color:e.textMutedColor,transition:"transform 0.15s ease",transform:t?"rotate(0deg)":"rotate(-90deg)","& svg":{width:"14px",height:"14px"}})),w8=st.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderTop:"none",borderRadius:"0 0 8px 8px",display:"flex",flexDirection:"column"})),v8=st.div({display:"flex",alignItems:"center",gap:"2px"}),Qc=st(Cn)({padding:"4px 8px",fontSize:"11px",fontWeight:500}),Mx=st.span(({theme:e,variant:t})=>({fontSize:"11px",fontWeight:500,color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.textMutedColor})),k8=st.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),wfe=st.div(({theme:e})=>({display:"flex",gap:"12px",alignItems:"center",fontSize:"12px",color:e.textMutedColor})),Wo=st.div(({theme:e,variant:t})=>{let r=(()=>{switch(t){case"total":return{bg:e.background.app,text:e.color.defaultText};case"critical":return{bg:e.background.negative,text:e.color.negative};case"major":return{bg:e.background.warning,text:e.color.warning};case"minor":return{bg:e.color.tertiary,text:se};case"selected":return{bg:e.color.tertiary,text:se};case"score":return{bg:e.background.positive,text:e.color.positive};case"cost":return{bg:e.background.warning,text:e.color.warning};case"timing":return{bg:e.color.tertiary,text:se};case"tokens":return{bg:e.background.app,text:e.color.mediumdark};case"model":return{bg:e.background.app,text:e.color.mediumdark}}})();return{padding:"3px 8px",borderRadius:"10px",backgroundColor:r.bg,color:r.text,fontWeight:600,fontSize:"11px",whiteSpace:"nowrap"}}),C8=st.div({display:"flex",flexDirection:"column"}),T8=st.span(({theme:e})=>({fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.textMutedColor,marginLeft:"4px"})),eF=st.div(({theme:e})=>({textAlign:"center",padding:"40px 20px",color:e.textMutedColor})),tF=st.div({fontSize:"36px",marginBottom:"12px"}),nF=st.div(({theme:e})=>({fontSize:"14px",fontWeight:600,marginBottom:"6px",color:e.textMutedColor})),rF=st.div({fontSize:"12px"}),I8=m8`
|
|
131
131
|
0% {
|
|
132
132
|
transform: translateY(0) rotate(0deg) scale(1);
|
|
133
133
|
opacity: 1;
|
|
@@ -139,7 +139,7 @@ ${C.diffPreview}
|
|
|
139
139
|
transform: translateY(120px) rotate(720deg) scale(0.3);
|
|
140
140
|
opacity: 0;
|
|
141
141
|
}
|
|
142
|
-
`;var
|
|
142
|
+
`;var vfe=st.div({position:"relative",width:"100%",height:"60px",marginBottom:"10px",overflow:"visible"}),kfe=st.span(({delay:e,left:t,color:n,size:r})=>({position:"absolute",top:"0",left:`${t}%`,width:`${r}px`,height:`${r}px`,backgroundColor:n,borderRadius:r>8?"50%":"2px",animation:`${I8} 3s ease-out ${e}s forwards`,pointerEvents:"none"}));var F8=st.div(({theme:e,variant:t})=>({display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderRadius:"6px",fontSize:"13px",fontWeight:600,backgroundColor:t==="success"?e.background.positive:e.background.warning,color:t==="success"?e.color.positive:e.color.warning,border:`2px solid ${t==="success"?e.color.positive:e.color.warning}`,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",animation:"slideIn 0.3s ease-out","@keyframes slideIn":{"0%":{transform:"translateY(-10px)",opacity:0},"100%":{transform:"translateY(0)",opacity:1}}})),E8=st(Cn)(({theme:e})=>({marginLeft:"auto",padding:"2px 6px",fontSize:"10px",backgroundColor:e.background.hoverable,color:e.color.defaultText})),oF=st.div({display:"flex",gap:"8px",alignItems:"center",justifyContent:"flex-end"}),iF=st(kn)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),sF=st(Yt)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"120px",...t?{backgroundColor:e.color.positive}:{}})),aF=st(Yt)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),A8=st.div(({theme:e,confidence:t})=>{let n=t>=90?"#16a34a":t>=70?"#ca8a04":"#dc2626";return{padding:"10px 14px",borderRadius:"8px",border:`1px solid ${n}30`,backgroundColor:`${n}08`,marginTop:"8px",fontSize:"12px",lineHeight:1.5}}),P8=st.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"}),L8=st.span(({confidence:e,theme:t})=>{let n=e>=90?"#16a34a":e>=70?"#ca8a04":"#dc2626";return{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"10px",backgroundColor:t.base==="dark"?e>=90?"rgba(22, 163, 74, 0.18)":e>=70?"rgba(202, 138, 4, 0.18)":"rgba(220, 38, 38, 0.18)":e>=90?"#dcfce7":e>=70?"#fef9c3":"#fee2e2",color:n,fontSize:"11px",fontWeight:700}}),M8=st.span(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px"})),B8=st.div(({theme:e})=>({color:e.color.defaultText,fontSize:"12px","& ul":{margin:"4px 0",paddingLeft:"16px"},"& li":{marginBottom:"2px"}})),Jc=st.div(({theme:e})=>({marginTop:"6px","&:first-of-type":{marginTop:0}})),Zc=st.span(({theme:e})=>({fontWeight:600,color:e.textMutedColor,fontSize:"11px"})),D8=e=>{if(["layout","content"].includes(e.type))return!0;if(e.type==="typography"){let n=(e.description||"").toLowerCase(),r=(e.property||"").toLowerCase();if(n.includes("text content")||n.includes("text differs")||r.includes("content")||r.includes("innerhtml")||r.includes("textcontent"))return!0}return!1},lF=({issues:e,modelId:t,complianceScore:n,visualSimilarity:r,costUsd:o,reviewDurationMs:i,inputTokens:s,outputTokens:a,cacheCreationTokens:u,cacheReadTokens:c,onToggleSelection:l,onSelectAll:d,onSelectNone:g,onSelectAllFixes:p,onApplyFixes:f,onApplyFix:k,onCopyAllFixes:T,onGenerateFixes:E,onDismiss:I,onUndismiss:D,isGenerating:R=!1,isApplying:$=!1,isCopying:P=!1,applyFixesResult:z,onDismissResult:x,generationTiming:w,generationUsage:v,generationProgress:C,autoApplySupported:m=!0,hasReviewBeenRun:F=!1,isLoadingReview:S=!1,isReviewing:b=!1,selfReview:A})=>{let[L,B]=q.useState("all"),[N,h]=q.useState("all"),[j,W]=q.useState(!1),[M,K]=q.useState(!0),{includeComponentIssues:ee,setIncludeComponentIssues:ge,featureFlags:xe}=ce(),ae=q.useRef(null),[Ke,be]=g8(0);f8(()=>{if(!R){be(0);return}let oe=setInterval(()=>be(Y=>Y+1),1e3);return()=>clearInterval(oe)},[R]);let Te=async()=>{let oe=te.map(H=>{let Be=[`[${H.severity.toUpperCase()}] ${H.title||H.description}`,`Status: ${H.status}`,H.description&&H.description!==H.title?`Description: ${H.description}`:"",H.property?`Property: ${H.property}`:"",H.currentValue?`Current: ${H.currentValue}`:"",H.suggestedValue?`Expected: ${H.suggestedValue}`:"",H.file?`File: ${H.file}${H.lineNumber!==void 0?`:${H.lineNumber}`:""}`:"",H.suggestedCode?`Suggested code: ${H.suggestedCode}`:""];if(H.generatedFix){let _e=H.generatedFix;if(Be.push(""),Be.push("--- AI-Generated Fix ---"),Be.push(`Fix Status: ${_e.status}`),_e.confidence!==void 0){let bt=_e.confidence>1?_e.confidence:Math.round(_e.confidence*100);Be.push(`Confidence: ${bt}%`)}_e.strategy&&Be.push(`Strategy: ${_e.strategy}`),_e.filePath&&Be.push(`Target file: ${_e.filePath}`),_e.code&&Be.push(`Generated code:
|
|
143
143
|
${_e.code}`),_e.diffPreview&&Be.push(`Diff:
|
|
144
144
|
${_e.diffPreview}`),_e.error&&Be.push(`Error: ${_e.error}`)}return Be.push(""),Be.filter(Boolean).join(`
|
|
145
145
|
`)}).join(`
|
|
@@ -147,15 +147,15 @@ ${_e.diffPreview}`),_e.error&&Be.push(`Error: ${_e.error}`)}return Be.push(""),B
|
|
|
147
147
|
|
|
148
148
|
`),Y=te.filter(H=>H.generatedFix?.status==="applied").length,me=te.filter(H=>H.generatedFix?.status==="ready").length,ie=Y>0||me>0?` | Fixes: ${Y} applied, ${me} ready`:"",O=r!==void 0?` | Similarity: ${r}%`:"",U=`Score: ${n}/100${O} | ${te.length} issues${ie}
|
|
149
149
|
|
|
150
|
-
`;try{await navigator.clipboard.writeText(U+oe),W(!0),setTimeout(()=>W(!1),2e3)}catch(H){console.error("Failed to copy:",H)}};q.useEffect(()=>{z&&ae.current&&ae.current.scrollIntoView({behavior:"smooth",block:"start"})},[z]);let te=l8(()=>e.filter(oe=>{let Y=L==="all"||oe.severity===L,me=N==="all"||oe.status===N,ie=ee||!P8(oe);return Y&&me&&ie}),[e,L,N,ee]),Me=()=>{te.forEach(oe=>{oe.selectedForFix||l(oe.id)})},Ae=()=>{te.forEach(oe=>{oe.selectedForFix&&l(oe.id)})},pe=()=>{te.forEach(oe=>{oe.generatedFix&&oe.generatedFix.status==="ready"&&!oe.selectedForFix&&l(oe.id)})},Pt=te.filter(oe=>oe.selectedForFix).length,nn=te.filter(oe=>oe.severity==="critical").length,Mr=te.filter(oe=>oe.severity==="major").length,ge=te.filter(oe=>oe.severity==="minor").length,tt=te.filter(oe=>oe.generatedFix&&oe.generatedFix.status==="ready").length,he=te.filter(oe=>oe.selectedForFix&&oe.generatedFix&&oe.generatedFix.status==="ready").length;return e.length===0?S?q.createElement(Xc,{label:"Loading review..."}):b?q.createElement(YI,null):q.createElement(XI,null,q.createElement(QI,null,F?"\u2728":"\u{1F441}\uFE0F"),q.createElement(JI,null,F?"No issues found":"No review yet"),q.createElement(ZI,null,F?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):q.createElement(d8,{"data-testid":"issues-panel"},q.createElement(f8,null,q.createElement(KI,{value:L,onChange:oe=>B(oe.target.value)},q.createElement("option",{value:"all"},"All Severities"),q.createElement("option",{value:"critical"},"Critical Only"),q.createElement("option",{value:"major"},"Major Only"),q.createElement("option",{value:"minor"},"Minor Only")),q.createElement(KI,{value:N,onChange:oe=>h(oe.target.value)},q.createElement("option",{value:"all"},"All Statuses"),q.createElement("option",{value:"pending"},"Pending"),q.createElement("option",{value:"applied"},"Applied"),q.createElement("option",{value:"verified"},"Verified"),q.createElement("option",{value:"failed"},"Failed"))),q.createElement("div",null,q.createElement(g8,{isOpen:M,onClick:()=>K(!M)},q.createElement(m8,null,q.createElement(h8,{isOpen:M},q.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("polyline",{points:"6 9 12 15 18 9"}))),q.createElement(b8,null,te.length," issues"),(()=>{if(te.length===0)return null;let oe=te.map(ie=>ie.generatedFix?.filePath||ie.file).filter(Boolean);if(oe.length===0)return null;let Y=oe[0];return oe.every(ie=>ie===Y)?q.createElement(w8,null,"in ",Y):null})(),q.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},nn>0&&q.createElement(Mx,{variant:"critical"},nn," critical"),Mr>0&&q.createElement(Mx,{variant:"major"},Mr," major"),ge>0&&q.createElement(Mx,{variant:"minor"},ge," minor"))),q.createElement(y8,{onClick:oe=>oe.stopPropagation()},q.createElement(Qc,{onClick:Me},"All"),q.createElement(Qc,{onClick:Ae},"None"),q.createElement(Qc,{onClick:Te},j?"\u2713":"\u2398"," Copy"),tt>0&&q.createElement(Qc,{onClick:pe},"Fixes (",tt,")"))),z&&q.createElement(k8,{ref:ae,variant:z.error||z.failed>0?"warning":"success"},z.error?q.createElement(q.Fragment,null,z.error):z.failed>0?q.createElement(q.Fragment,null,"Applied ",z.succeeded,"/",z.total," ","fixes. ",z.failed," failed. Run a new review to verify."):q.createElement(q.Fragment,null,"Applied ",z.total," fix",z.total!==1?"es":"","! Run a new review to verify changes."),x&&q.createElement(C8,{onClick:x},"\u2715")),Pt>0&&q.createElement(eF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(rF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&g&&q.createElement(tF,{disabled:R||$||he===0,onClick:g},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(nF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")),A&&!R&&q.createElement(T8,{confidence:A.overallConfidence},q.createElement(I8,null,q.createElement(E8,null,"AI Self-Review"),q.createElement(F8,{confidence:A.overallConfidence},A.wouldReachPerfect?"\u2713":"\u25B3"," ",A.overallConfidence,"% confidence")),q.createElement(A8,null,A.variantSafety&&q.createElement(Jc,null,q.createElement(Zc,null,"Variant safety:"," "),A.variantSafety),A.gaps.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Gaps: "),q.createElement("ul",null,A.gaps.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),!A.wouldReachPerfect&&A.reasonsNotPerfect.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Why not 100%:"," "),q.createElement("ul",null,A.reasonsNotPerfect.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),A.suggestions&&A.suggestions.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Suggestions: "),q.createElement("ul",null,A.suggestions.map((oe,Y)=>q.createElement("li",{key:Y},oe)))))),M&&q.createElement(x8,null,te.length===0?q.createElement(XI,null,q.createElement(QI,null,"\u{1F50D}"),q.createElement(JI,null,"No issues match current filters"),q.createElement(ZI,null,"Try adjusting your severity or status filters")):q.createElement(S8,null,(()=>{let oe={};te.forEach(U=>{let H=U.detectedBy;H&&(oe[H]=(oe[H]||0)+1)});let Y=Object.entries(oe).sort((U,H)=>H[1]-U[1])[0],me=Y&&Y[1]>te.length/2?Y[0]:void 0,ie=te.map(U=>U.generatedFix?.filePath||U.file).filter(Boolean),O=ie.length>0&&ie.every(U=>U===ie[0]);return te.map(U=>q.createElement(HI,{key:U.id,issue:U,modelId:t,dominantDetector:me,showFilePath:!O,onToggleSelection:l,onDismiss:I,onUndismiss:D,onApplyFix:k}))})()))),Pt>0&&q.createElement(eF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(rF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&g&&q.createElement(tF,{disabled:R||$||he===0,onClick:g},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(nF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")))};Oe();var L8=Ct.div({display:"flex",flexDirection:"column"}),M8=Ct.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),B8=Ct.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),Bx=Ct.span(({theme:e,variant:t})=>{let n={resolved:{bg:e.background.positive,text:e.color.positive},remaining:{bg:e.background.warning,text:e.color.warning},new:{bg:e.color.tertiary,text:se}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),D8=Ct.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),Pge=Ct.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),Lge=Ct.div({fontSize:"48px",marginBottom:"16px"}),Mge=Ct.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),Bge=Ct.div({fontSize:"14px",opacity:.8}),R8=Ct.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),z8=Ct.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),N8=Ct(Cn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),O8=Ct(Rr)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),_8=Ct.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),$8=Ct.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),U8=Ct.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),j8=Ct.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}),H8=Ct.button(({theme:e})=>({background:"none",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"2px 8px",fontSize:"11px",color:e.color.mediumdark,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.secondary}})),W8=Ct.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),V8=Ct.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),G8=Ct.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",padding:"12px 0 8px 0",marginTop:"8px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"8px","&:first-of-type":{marginTop:0}})),q8=Ct.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),Y8=e=>{if(!e)return"Other";let t=e.toLowerCase();return t.includes("hug")||t.includes("fill")||t.includes("content-driven")?"HUG/FILL Sizing":t.includes("sub-pixel")||t.includes("negligible")?"Sub-pixel Differences":t.includes("values match")||t.includes("values already match")||t.includes("identical")?"Values Match":t.includes("no fix needed")||t.includes("no changes needed")?"No Fix Needed":"Other"},iF=e=>{if(!e)return"";let t=e.replace(/^Auto-dismissed:\s*/i,"").replace(/^Programmatic:\s*/i,"").replace(/^Two-Pass:\s*/i,"");return t=t.replace(/Sub-pixel difference \([\d.]+px\) - within [\d.]+px tolerance/i,"Sub-pixel difference").replace(/Dimension issue with HUG\/FILL sizing - width is content-driven, not fixed/i,"Width is content-driven").replace(/Height issue with HUG sizing - dimension is content-driven, not actionable/i,"Height is content-driven").replace(/Width issue with HUG sizing - dimension is content-driven, not actionable/i,"Width is content-driven").replace(/no-changes-needed - values already match/i,"Values already match").replace(/Values are the same - no difference/i,"Values match"),t},K8=Ct.span(({theme:e,phase:t})=>{let n={"post-ai-validation":{bg:"#4b5563",text:"#ffffff"},"ai-validation":{bg:"#7c3aed",text:"#ffffff"},user:{bg:"#7c3aed",text:"#ffffff"}},{bg:r,text:o}=n[t]||n.user;return{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontWeight:600,color:o,backgroundColor:r,padding:"3px 10px",borderRadius:"10px",marginBottom:"8px"}}),X8=Ct.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"8px",marginLeft:"8px",fontSize:"11px",color:e.textMutedColor,"& > span":{display:"inline-flex",alignItems:"center",gap:"3px"}})),Rx=e=>{if(!e)return;let t=e.toLowerCase();if(t.includes("no-changes-needed")||t.includes("values already match")||t.includes("sub-pixel")||t.includes("negligible")||t.includes("hug")||t.includes("fill")||t.includes("content-driven")||t.includes("equivalent")||t.includes("layout mechanism"))return"post-ai-validation"},Q8=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},sF=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Haiku";case"user":return"Manual";default:return"Auto"}},J8=Ct.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),Z8=Ct.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),eW=Ct.pre(({theme:e})=>({fontSize:"12px",color:e.color.negative,backgroundColor:e.background.app,padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"200px",fontFamily:"monospace",lineHeight:"1.5"})),tW=Ct(ay)({marginTop:"12px"}),Dx=class extends We.Component{constructor(n){super(n);this.handleReset=()=>{this.setState({hasError:!1,error:null})};this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){y.error("[IssuesPanel ErrorBoundary] Caught error:",n,r)}render(){return this.state.hasError?We.createElement(J8,null,We.createElement(Z8,null,"\u26A0\uFE0F Issues Panel Error"),We.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),We.createElement(eW,null,this.state.error?.message||"Unknown error",`
|
|
150
|
+
`;try{await navigator.clipboard.writeText(U+oe),W(!0),setTimeout(()=>W(!1),2e3)}catch(H){console.error("Failed to copy:",H)}};q.useEffect(()=>{z&&ae.current&&ae.current.scrollIntoView({behavior:"smooth",block:"start"})},[z]);let te=d8(()=>e.filter(oe=>{let Y=L==="all"||oe.severity===L,me=N==="all"||oe.status===N,ie=ee||!D8(oe);return Y&&me&&ie}),[e,L,N,ee]),Me=()=>{te.forEach(oe=>{oe.selectedForFix||l(oe.id)})},Ae=()=>{te.forEach(oe=>{oe.selectedForFix&&l(oe.id)})},pe=()=>{te.forEach(oe=>{oe.generatedFix&&oe.generatedFix.status==="ready"&&!oe.selectedForFix&&l(oe.id)})},Pt=te.filter(oe=>oe.selectedForFix).length,nn=te.filter(oe=>oe.severity==="critical").length,Mr=te.filter(oe=>oe.severity==="major").length,fe=te.filter(oe=>oe.severity==="minor").length,tt=te.filter(oe=>oe.generatedFix&&oe.generatedFix.status==="ready").length,he=te.filter(oe=>oe.selectedForFix&&oe.generatedFix&&oe.generatedFix.status==="ready").length;return e.length===0?S?q.createElement(Xc,{label:"Loading review..."}):b?q.createElement(JI,null):q.createElement(eF,null,q.createElement(tF,null,F?"\u2728":"\u{1F441}\uFE0F"),q.createElement(nF,null,F?"No issues found":"No review yet"),q.createElement(rF,null,F?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):q.createElement(h8,{"data-testid":"issues-panel"},q.createElement(x8,null,q.createElement(ZI,{value:L,onChange:oe=>B(oe.target.value)},q.createElement("option",{value:"all"},"All Severities"),q.createElement("option",{value:"critical"},"Critical Only"),q.createElement("option",{value:"major"},"Major Only"),q.createElement("option",{value:"minor"},"Minor Only")),q.createElement(ZI,{value:N,onChange:oe=>h(oe.target.value)},q.createElement("option",{value:"all"},"All Statuses"),q.createElement("option",{value:"pending"},"Pending"),q.createElement("option",{value:"applied"},"Applied"),q.createElement("option",{value:"verified"},"Verified"),q.createElement("option",{value:"failed"},"Failed"))),q.createElement("div",null,q.createElement(y8,{isOpen:M,onClick:()=>K(!M)},q.createElement(b8,null,q.createElement(S8,{isOpen:M},q.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("polyline",{points:"6 9 12 15 18 9"}))),q.createElement(k8,null,te.length," issues"),(()=>{if(te.length===0)return null;let oe=te.map(ie=>ie.generatedFix?.filePath||ie.file).filter(Boolean);if(oe.length===0)return null;let Y=oe[0];return oe.every(ie=>ie===Y)?q.createElement(T8,null,"in ",Y):null})(),q.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},nn>0&&q.createElement(Mx,{variant:"critical"},nn," critical"),Mr>0&&q.createElement(Mx,{variant:"major"},Mr," major"),fe>0&&q.createElement(Mx,{variant:"minor"},fe," minor"))),q.createElement(v8,{onClick:oe=>oe.stopPropagation()},q.createElement(Qc,{onClick:Me},"All"),q.createElement(Qc,{onClick:Ae},"None"),q.createElement(Qc,{onClick:Te},j?"\u2713":"\u2398"," Copy"),tt>0&&q.createElement(Qc,{onClick:pe},"Fixes (",tt,")"))),z&&q.createElement(F8,{ref:ae,variant:z.error||z.failed>0?"warning":"success"},z.error?q.createElement(q.Fragment,null,z.error):z.failed>0?q.createElement(q.Fragment,null,"Applied ",z.succeeded,"/",z.total," ","fixes. ",z.failed," failed. Run a new review to verify."):q.createElement(q.Fragment,null,"Applied ",z.total," fix",z.total!==1?"es":"","! Run a new review to verify changes."),x&&q.createElement(E8,{onClick:x},"\u2715")),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")),A&&!R&&q.createElement(A8,{confidence:A.overallConfidence},q.createElement(P8,null,q.createElement(M8,null,"AI Self-Review"),q.createElement(L8,{confidence:A.overallConfidence},A.wouldReachPerfect?"\u2713":"\u25B3"," ",A.overallConfidence,"% confidence")),q.createElement(B8,null,A.variantSafety&&q.createElement(Jc,null,q.createElement(Zc,null,"Variant safety:"," "),A.variantSafety),A.gaps.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Gaps: "),q.createElement("ul",null,A.gaps.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),!A.wouldReachPerfect&&A.reasonsNotPerfect.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Why not 100%:"," "),q.createElement("ul",null,A.reasonsNotPerfect.map((oe,Y)=>q.createElement("li",{key:Y},oe)))),A.suggestions&&A.suggestions.length>0&&q.createElement(Jc,null,q.createElement(Zc,null,"Suggestions: "),q.createElement("ul",null,A.suggestions.map((oe,Y)=>q.createElement("li",{key:Y},oe)))))),M&&q.createElement(w8,null,te.length===0?q.createElement(eF,null,q.createElement(tF,null,"\u{1F50D}"),q.createElement(nF,null,"No issues match current filters"),q.createElement(rF,null,"Try adjusting your severity or status filters")):q.createElement(C8,null,(()=>{let oe={};te.forEach(U=>{let H=U.detectedBy;H&&(oe[H]=(oe[H]||0)+1)});let Y=Object.entries(oe).sort((U,H)=>H[1]-U[1])[0],me=Y&&Y[1]>te.length/2?Y[0]:void 0,ie=te.map(U=>U.generatedFix?.filePath||U.file).filter(Boolean),O=ie.length>0&&ie.every(U=>U===ie[0]);return te.map(U=>q.createElement(qI,{key:U.id,issue:U,modelId:t,dominantDetector:me,showFilePath:!O,onToggleSelection:l,onDismiss:I,onUndismiss:D,onApplyFix:k}))})()))),Pt>0&&q.createElement(oF,null,w&&q.createElement(Wo,{variant:"timing"},w.durationSec,"s (",w.issueCount," ","fixes)"),v&&q.createElement(q.Fragment,null,q.createElement(Wo,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),q.createElement(Wo,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"#"," ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),q.createElement(Wo,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),xe.enableFixGeneration&&E&&q.createElement(aF,{disabled:R||$||P,onClick:E},q.createElement("span",null,"\u{1F916}"),R&&C?`Generating ${C.completed}/${C.total}... (${Ke}s)`:R?`Generating... (${Ke}s)`:`Generate Fixes for ${Pt} Issue${Pt>1?"s":""}`),xe.enableFixApply&&m&&f&&q.createElement(iF,{disabled:R||$||he===0,onClick:f},$?"Applying...":R?"Generating...":he>0?`Apply ${he} Ready Fix${he>1?"es":""}`:"Apply Fixes (generate first)"),xe.enableFixApply&&!m&&T&&q.createElement(sF,{disabled:R||P||he===0,copied:P,onClick:T},P?"Copied!":he>0?`Copy ${he} Fix${he>1?"es":""}`:"Copy Fixes (generate first)")))};Oe();var R8=Ct.div({display:"flex",flexDirection:"column"}),z8=Ct.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),N8=Ct.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),Bx=Ct.span(({theme:e,variant:t})=>{let n={resolved:{bg:e.background.positive,text:e.color.positive},remaining:{bg:e.background.warning,text:e.color.warning},new:{bg:e.color.tertiary,text:se}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),O8=Ct.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),Dfe=Ct.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),Rfe=Ct.div({fontSize:"48px",marginBottom:"16px"}),zfe=Ct.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),Nfe=Ct.div({fontSize:"14px",opacity:.8}),_8=Ct.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),$8=Ct.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),U8=Ct(Cn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),j8=Ct(Rr)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),H8=Ct.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),W8=Ct.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),V8=Ct.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),G8=Ct.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}),q8=Ct.button(({theme:e})=>({background:"none",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"2px 8px",fontSize:"11px",color:e.color.mediumdark,cursor:"pointer","&:hover":{backgroundColor:e.background.hoverable,color:e.color.defaultText,borderColor:e.color.secondary}})),Y8=Ct.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),K8=Ct.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),X8=Ct.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",padding:"12px 0 8px 0",marginTop:"8px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"8px","&:first-of-type":{marginTop:0}})),Q8=Ct.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),J8=e=>{if(!e)return"Other";let t=e.toLowerCase();return t.includes("hug")||t.includes("fill")||t.includes("content-driven")?"HUG/FILL Sizing":t.includes("sub-pixel")||t.includes("negligible")?"Sub-pixel Differences":t.includes("values match")||t.includes("values already match")||t.includes("identical")?"Values Match":t.includes("no fix needed")||t.includes("no changes needed")?"No Fix Needed":"Other"},cF=e=>{if(!e)return"";let t=e.replace(/^Auto-dismissed:\s*/i,"").replace(/^Programmatic:\s*/i,"").replace(/^Two-Pass:\s*/i,"");return t=t.replace(/Sub-pixel difference \([\d.]+px\) - within [\d.]+px tolerance/i,"Sub-pixel difference").replace(/Dimension issue with HUG\/FILL sizing - width is content-driven, not fixed/i,"Width is content-driven").replace(/Height issue with HUG sizing - dimension is content-driven, not actionable/i,"Height is content-driven").replace(/Width issue with HUG sizing - dimension is content-driven, not actionable/i,"Width is content-driven").replace(/no-changes-needed - values already match/i,"Values already match").replace(/Values are the same - no difference/i,"Values match"),t},Z8=Ct.span(({theme:e,phase:t})=>{let n={"post-ai-validation":{bg:"#4b5563",text:"#ffffff"},"ai-validation":{bg:"#7c3aed",text:"#ffffff"},user:{bg:"#7c3aed",text:"#ffffff"}},{bg:r,text:o}=n[t]||n.user;return{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",fontWeight:600,color:o,backgroundColor:r,padding:"3px 10px",borderRadius:"10px",marginBottom:"8px"}}),eW=Ct.span(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:"8px",marginLeft:"8px",fontSize:"11px",color:e.textMutedColor,"& > span":{display:"inline-flex",alignItems:"center",gap:"3px"}})),Rx=e=>{if(!e)return;let t=e.toLowerCase();if(t.includes("no-changes-needed")||t.includes("values already match")||t.includes("sub-pixel")||t.includes("negligible")||t.includes("hug")||t.includes("fill")||t.includes("content-driven")||t.includes("equivalent")||t.includes("layout mechanism"))return"post-ai-validation"},tW=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},uF=(e,t)=>{switch(e||Rx(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Haiku";case"user":return"Manual";default:return"Auto"}},nW=Ct.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),rW=Ct.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),oW=Ct.pre(({theme:e})=>({fontSize:"12px",color:e.color.negative,backgroundColor:e.background.app,padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"200px",fontFamily:"monospace",lineHeight:"1.5"})),iW=Ct(ly)({marginTop:"12px"}),Dx=class extends We.Component{constructor(n){super(n);this.handleReset=()=>{this.setState({hasError:!1,error:null})};this.state={hasError:!1,error:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){y.error("[IssuesPanel ErrorBoundary] Caught error:",n,r)}render(){return this.state.hasError?We.createElement(nW,null,We.createElement(rW,null,"\u26A0\uFE0F Issues Panel Error"),We.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),We.createElement(oW,null,this.state.error?.message||"Unknown error",`
|
|
151
151
|
|
|
152
|
-
`,this.state.error?.stack),We.createElement(
|
|
152
|
+
`,this.state.error?.stack),We.createElement(iW,{onClick:this.handleReset},"Try Again")):this.props.children}},pF=()=>{let{currentStoryId:e}=nt(),{currentReviewId:t,isReviewing:n,reviewHistory:r,toggleIssueSelection:o,applyFixesResult:i,setApplyFixesResult:s}=ce(),{dismissAndSync:a,undismissAndSync:u}=bI(),{loadingMapping:c}=nt(),l=!!e&&!t&&!n&&c,[d,g]=We.useState(!1),[p,f]=We.useState(!1),[k,T]=We.useState(!1),{isSupported:E,isDetecting:I}=vm(),{refreshStorybookOnly:D}=ei(),{generateBatchFixes:R,isGenerating:$,error:P,timing:z,progress:x,usage:w,selfReview:v,lastStorybookRoot:C}=ym(),{applyFixes:m,isApplying:F}=xm({onComplete:D,storybookRoot:C}),S=r.find(Y=>Y.id===t),b=S?.issues||[],A=We.useMemo(()=>b.filter(Y=>!Y.dismissed),[b]),L=We.useMemo(()=>b.filter(Y=>Y.dismissed),[b]),B=We.useMemo(()=>{let Y={postAiValidation:0,aiValidation:0,user:0};for(let me of L)switch(me.dismissedBy){case"post-ai-validation":Y.postAiValidation++;break;case"ai-validation":Y.aiValidation++;break;default:Y.user++;break}return Y},[L]),N=A,h=S?.modelId||"unknown",j=A.filter(Y=>Y.severity==="critical").length,W=A.filter(Y=>Y.severity==="major").length,M=A.filter(Y=>Y.severity==="minor").length,K=S?To(j,W,M):void 0,ee=S?.visualSimilarity,ge=S?.costUsd,xe=S?.reviewDurationMs,ae=S?.inputTokens,Ke=S?.outputTokens,be=S?.cacheCreationTokens,Te=S?.cacheReadTokens,te=S?.parentReviewId?r.find(Y=>Y.id===S.parentReviewId):null,Me=We.useMemo(()=>{if(!te||!S)return null;let Y=new Set(te.issues.map(H=>`${H.type}:${H.property||""}:${H.description}`)),me=new Set(N.map(H=>`${H.type}:${H.property||""}:${H.description}`)),ie=te.issues.filter(H=>!me.has(`${H.type}:${H.property||""}:${H.description}`)).length,O=N.filter(H=>Y.has(`${H.type}:${H.property||""}:${H.description}`)).length,U=N.filter(H=>!Y.has(`${H.type}:${H.property||""}:${H.description}`)).length;return{resolved:ie,remaining:O,newIssues:U}},[te,S,N]),Ae=()=>{N.forEach(Y=>{Y.selectedForFix||o(Y.id)})},pe=()=>{N.forEach(Y=>{Y.selectedForFix&&o(Y.id)})},Pt=()=>{N.forEach(Y=>{Y.generatedFix&&Y.generatedFix.status==="ready"&&!Y.selectedForFix&&o(Y.id)})},{featureFlags:nn}=ce(),Mr=()=>{if(!nn.enableFixGeneration){y.warn("[IssuesPanel] Fix generation is disabled by feature flag");return}let Y=N.filter(me=>me.selectedForFix);if(Y.length===0){y.warn("[IssuesPanel] No issues selected for fix generation");return}y.debug(`[IssuesPanel] Generating fixes for ${Y.length} issue(s)`,Y),R(Y)},fe=()=>{if(!nn.enableFixApply){y.warn("[IssuesPanel] Fix apply is disabled by feature flag");return}let Y=N.filter(ie=>ie.selectedForFix&&ie.generatedFix&&ie.generatedFix.status==="ready"&&ie.generatedFix.code&&ie.generatedFix.filePath);if(Y.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let me=Y.map(ie=>({id:ie.id,reviewId:ie.reviewId,type:ie.type,severity:ie.severity,title:ie.title,description:ie.description,generatedFix:ie.generatedFix,storyId:S?.storyId||""}));y.debug(`[IssuesPanel] Applying AI-generated fixes for ${me.length} issue(s)`,me),m(me)},tt=Y=>{let me=N.find(O=>O.id===Y);if(!me){y.warn("[IssuesPanel] Issue not found:",Y);return}if(!me.generatedFix||me.generatedFix.status!=="ready"||!me.generatedFix.code||!me.generatedFix.filePath){y.warn("[IssuesPanel] Issue does not have a ready AI-generated fix:",Y);return}let ie={id:me.id,reviewId:me.reviewId,type:me.type,severity:me.severity,title:me.title,description:me.description,generatedFix:me.generatedFix,storyId:S?.storyId||""};y.debug("[IssuesPanel] Applying single AI-generated fix for issue:",ie),m([ie])},he=async()=>{let Y=N.filter(ie=>ie.selectedForFix&&ie.generatedFix&&ie.generatedFix.status==="ready"&&ie.generatedFix.code&&ie.generatedFix.filePath);if(Y.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let me=Y.map(ie=>{let O=ie.generatedFix,U=[];return U.push(`// File: ${O.filePath}`),U.push(`// Issue: ${ie.title||ie.description}`),ie.currentValue&&U.push(`// Actual: ${ie.currentValue}`),ie.suggestedValue&&U.push(`// Expected (Figma): ${ie.suggestedValue}`),O.diffPreview&&(U.push("//"),U.push("// Diff:"),O.diffPreview.split(`
|
|
153
153
|
`).forEach(H=>{U.push(`// ${H}`)})),U.push("//"),U.push("// Full Fixed Code:"),U.push(O.code),U.join(`
|
|
154
154
|
`)}).join(`
|
|
155
155
|
|
|
156
156
|
`+"=".repeat(60)+`
|
|
157
157
|
|
|
158
|
-
`);
|
|
158
|
+
`);f(!0);try{await km(me)?y.debug(`[IssuesPanel] Copied ${Y.length} fix(es) to clipboard`):y.error("[IssuesPanel] Failed to copy fixes to clipboard"),setTimeout(()=>f(!1),1500)}catch(ie){y.error("[IssuesPanel] Error copying fixes:",ie),f(!1)}},oe=async Y=>{Y.stopPropagation();let me=L.map(O=>[`[${O.severity.toUpperCase()}] ${O.title||O.description}`,`Phase: ${uF(O.dismissedBy,O.dismissReason)}`,O.dismissReason?`Reason: ${cF(O.dismissReason)}`:"",O.property?`Property: ${O.property}`:"",O.currentValue?`Current: ${O.currentValue}`:"",O.suggestedValue?`Expected: ${O.suggestedValue}`:""].filter(Boolean).join(`
|
|
159
159
|
`)).join(`
|
|
160
160
|
|
|
161
161
|
---
|
|
@@ -163,11 +163,11 @@ ${_e.diffPreview}`),_e.error&&Be.push(`Error: ${_e.error}`)}return Be.push(""),B
|
|
|
163
163
|
`),ie=`Filtered Issues (${L.length})
|
|
164
164
|
${"=".repeat(40)}
|
|
165
165
|
|
|
166
|
-
`;try{await navigator.clipboard.writeText(ie+me),T(!0),setTimeout(()=>T(!1),2e3)}catch(O){y.error("Failed to copy dismissed issues:",O)}};return We.createElement(L8,null,Me&&We.createElement(M8,null,We.createElement(B8,null,"\u{1F4CA} Progress:"),We.createElement(Bx,{variant:"resolved"},"\u2705 ",Me.resolved," resolved"),We.createElement(Bx,{variant:"remaining"},"\u23F3 ",Me.remaining," remaining"),Me.newIssues>0&&We.createElement(Bx,{variant:"new"},"\u{1F195} ",Me.newIssues," new"),We.createElement(D8,null,"Iteration ",S?.iterationNumber||1)),We.createElement(Dx,null,We.createElement(oF,{issues:N,modelId:h,complianceScore:K,visualSimilarity:ee,costUsd:fe,reviewDurationMs:xe,inputTokens:ae,outputTokens:Ke,cacheCreationTokens:be,cacheReadTokens:Te,onToggleSelection:o,onSelectAll:Ae,onSelectNone:pe,onSelectAllFixes:Pt,onGenerateFixes:Mr,onApplyFixes:ge,onApplyFix:tt,onCopyAllFixes:he,onDismiss:a,onUndismiss:u,isGenerating:$,isApplying:F,isCopying:p,applyFixesResult:i,onDismissResult:()=>s(null),generationTiming:z,generationUsage:w,hasReviewBeenRun:!!S,isLoadingReview:l,isReviewing:n,generationProgress:x,autoApplySupported:E,selfReview:v})),L.length>0&&We.createElement(R8,null,We.createElement(z8,null,We.createElement(N8,{onClick:()=>f(!d)},We.createElement("span",null,d?"\u25BC":"\u25B6"),We.createElement("span",null,"Filtered out"),We.createElement(_8,null,L.length),We.createElement(X8,null,B.postAiValidation>0&&We.createElement("span",null,"\u2699\uFE0F ",B.postAiValidation),B.aiValidation>0&&We.createElement("span",null,"\u2726 ",B.aiValidation),B.user>0&&We.createElement("span",null,"\u{1F464} ",B.user))),We.createElement(O8,{onClick:oe},k?"\u2713 Copied!":"Copy")),d&&We.createElement($8,null,(()=>{let Y=L.reduce((O,U)=>{let H=Y8(U.dismissReason);return O[H]||(O[H]=[]),O[H].push(U),O},{}),me=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(Y).sort((O,U)=>me.indexOf(O)-me.indexOf(U)).map(O=>We.createElement(We.Fragment,{key:O},We.createElement(G8,null,O,We.createElement(q8,null,Y[O].length)),Y[O].map(U=>We.createElement(U8,{key:U.id},We.createElement(j8,null,We.createElement(K8,{phase:U.dismissedBy||Rx(U.dismissReason)||"post-ai-validation"},Q8(U.dismissedBy,U.dismissReason)," ",sF(U.dismissedBy,U.dismissReason)),We.createElement(H8,{onClick:()=>u(U.id),title:"Restore to active issues"},"\u21A9 Restore")),We.createElement(W8,null,"[",U.severity.toUpperCase(),"] ",U.title||U.description),U.dismissReason&&We.createElement(V8,null,iF(U.dismissReason))))))})())))};var rW=Ea.div({marginTop:"20px"}),oW=Ea.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),iW=Ea.div({display:"flex",alignItems:"center"}),zx=Ea(yo)({padding:"10px 16px"}),sW=Ea.div({minHeight:"200px"}),Nx=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r,userRole:o,roleOverride:i}=ce(),a=(i??o)==="admin",u=r.length>1||n&&Object.keys(n.byModel).length>1;return nW(()=>{!a&&(e==="chat"||e==="prompt")&&t("issues")},[a,e,t]),Lr.createElement(rW,null,Lr.createElement(oW,null,Lr.createElement(iW,null,a&&Lr.createElement(zx,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),a&&Lr.createElement(zx,{active:e==="chat",onClick:()=>t("chat")},u?"Models":"Chat"),Lr.createElement(zx,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),Lr.createElement(sW,null,a&&e==="chat"&&(u?Lr.createElement(gI,null):Lr.createElement(wx,null)),e==="issues"&&Lr.createElement(aF,null),a&&e==="prompt"&&Lr.createElement(Sx,null)))};Ce();import G,{useState as fo,useRef as jx,useEffect as uW,useMemo as pW}from"react";import{styled as vt,useTheme as dW}from"storybook/theming";je();Oe();var eu={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},Aa="uicopilot_feature_flags";function Ox(){try{let e=localStorage.getItem(Aa);if(e){let t=JSON.parse(e);return{...eu,...t}}}catch(e){y.warn("[FeatureFlags] Failed to load from localStorage:",e)}return eu}function aW(e,t){try{let r={...Ox(),[e]:t},o={};for(let i in r){let s=i;r[s]!==eu[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(Aa,JSON.stringify(o)):localStorage.removeItem(Aa),y.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){y.error("[FeatureFlags] Failed to set flag:",n)}}function lW(){try{localStorage.removeItem(Aa),y.debug("[FeatureFlags] Reset to defaults")}catch(e){y.error("[FeatureFlags] Failed to reset:",e)}}function _x(e){return Ox()[e]}function cW(){let e=Object.keys(eu).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(Aa,JSON.stringify(e)),y.debug("[FeatureFlags] All features enabled! Reload to apply.")}catch(t){y.error("[FeatureFlags] Failed to enable all features:",t)}}typeof window<"u"&&(window.uicopilot={...window.uicopilot,featureFlags:{get:Ox,set:aW,reset:lW,enableAll:cW,isEnabled:_x}});Oe();ct();import At from"react";var lF=()=>At.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"},At.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),At.createElement("circle",{cx:"12",cy:"12",r:"3"}));var Pa={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"},tu=()=>At.createElement("svg",{...Pa},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),cF=()=>At.createElement("svg",{...Pa},At.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),At.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),At.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),At.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),At.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),At.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),uF=()=>At.createElement("svg",{...Pa},At.createElement("polyline",{points:"23 4 23 10 17 10"}),At.createElement("polyline",{points:"1 20 1 14 7 14"}),At.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"})),$x=()=>At.createElement("svg",{...Pa},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"})),Ux=()=>At.createElement("svg",{...Pa},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"}));var La=vt.div({marginTop:"20px"}),Hx=vt.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Wx=vt.div({display:"flex",alignItems:"center",gap:"12px"}),Ma=vt.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),ome=vt.div({display:"flex",gap:"8px"}),ime=vt.button(({active:e,theme:t})=>({padding:"4px 12px",backgroundColor:e?t.color.secondary:"transparent",color:e?"#fff":t.color.mediumdark,border:`1px solid ${e?t.color.secondary:t.appBorderColor}`,borderRadius:"4px",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.2s","&:hover":{opacity:.9}})),pF=vt.div(({theme:e,layout:t})=>({display:t==="side-by-side"?"grid":"flex",gridTemplateColumns:t==="side-by-side"?"minmax(0, 1fr) minmax(0, 1fr)":void 0,gap:t==="side-by-side"?`${e.layoutMargin}px`:0,position:"relative",width:"100%",justifyContent:t==="overlay"?"center":void 0})),nu=vt.div(({theme:e,zoomed:t})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,overflow:"hidden",backgroundColor:e.background.app,minHeight:"60px",maxHeight:t?"400px":"150px",display:"flex",alignItems:"center",justifyContent:"center",transition:"max-height 0.2s ease, box-shadow 0.2s ease",boxShadow:t?"0 8px 30px rgba(0, 0, 0, 0.15)":"none","& img":t?{maxWidth:"100%",maxHeight:"400px"}:void 0})),ru=vt.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.92)":"rgba(0, 0, 0, 0.7)",color:e.base==="dark"?"#0a0a0f":e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),ou=vt.div({position:"absolute",top:"6px",right:"6px",display:"flex",gap:"4px",zIndex:10}),fi=vt.button(({theme:e,accent:t})=>({width:"24px",height:"24px",padding:"0",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.12)":"rgba(255, 255, 255, 0.92)",border:`1px solid ${t}55`,borderRadius:e.appBorderRadius,color:t,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",backdropFilter:"blur(4px)","&:hover:not(:disabled)":{backgroundColor:t,color:"#ffffff",borderColor:t},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),fW=vt.img(({opacity:e=1})=>({maxWidth:"150px",maxHeight:"150px",height:"auto",display:"block",objectFit:"contain",opacity:e})),gW=vt.img({display:"block",objectFit:"contain",maxHeight:"150px",maxWidth:"150px"}),mW=vt.div({position:"relative",display:"inline-block",maxHeight:"150px",overflow:"hidden"}),sme=vt.svg(({isVisible:e})=>({position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",opacity:e?1:0,transition:"opacity 150ms ease-in",...!e&&{transition:"opacity 100ms ease-out"}})),hW=vt.div({position:"relative",display:"inline-block"}),ame=vt.div(({width:e,height:t,theme:n})=>({position:"relative",width:e?`${e}px`:"auto",height:t?`${t}px`:"auto",border:`1px solid ${n.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:n.background.app})),xW=vt.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),yW=vt.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),bW=vt.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),SW=vt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),wW=vt.input({flex:1}),Vx=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),lme=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),dF=vt.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),ns=vt.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center","&::before":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:e.base==="dark"?"linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent)":"linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent)",animation:"shimmer 1.5s ease-in-out infinite",pointerEvents:"none"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),rs=vt.div({textAlign:"center",zIndex:1}),os=vt.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTop:`3px solid ${e.color.secondary}`,borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"12px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),is=vt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Gx=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let r=dW(),{currentMapping:o,loadingMapping:i}=nt(),{figmaImageUrl:s,storybookImageUrl:a,figmaDimensions:u,setFigmaImageUrl:c,hoveredIssueId:l,reviewHistory:d,currentReviewId:f}=ce(),{selectedProjectId:p}=Je(),{sessionToken:g}=we(),{openComponentBrowser:k}=Hs(),{hasMapping:T,deleteMapping:E,setCurrentMapping:I}=ni(),D=_x("enableHoverHighlight"),[R,$]=fo("side-by-side"),[P,z]=fo(.5),[x,w]=fo(!1),[v,C]=fo(!1),[m,F]=fo(!1),[S,b]=fo(!1),[A,L]=fo(!1),B=async()=>{F(!1);try{let be=o?.id;be&&await E(be),I(null)}catch(be){y.error("[ScreenshotComparison] Failed to unlink:",be)}};uW(()=>{C(!1)},[s]);let[N,h]=fo(null),[j,W]=fo(null),M=jx(null),K=jx(null),ee=jx(null),fe=pW(()=>{if(!D||!l||!f)return null;let be=d.find(Te=>Te.id===f);return be?.issues&&be.issues.find(Te=>Te.id===l)||null},[l,f,d]),xe=be=>{let Te=be.currentTarget;C(!0),!ft.getState().figmaDimensions&&Te.naturalWidth&&Te.naturalHeight&&ft.getState().setFigmaDimensions({width:Te.naturalWidth,height:Te.naturalHeight}),requestAnimationFrame(()=>{if(K.current){let{clientWidth:Me,clientHeight:Ae}=K.current;Me&&Ae&&W({width:Me,height:Ae})}})},ae=()=>{requestAnimationFrame(()=>{if(M.current){let{clientWidth:be,clientHeight:Te}=M.current;be&&Te&&h({width:be,height:Te})}})},Ke=async()=>{if(!(!p||!g)){w(!0);try{let be=V();await ne(`${be}/api/figma/frames/invalidate?projectId=${p}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},credentials:"include"}),c(null),y.debug("Figma cache cleared, image will reload on next review")}catch(be){y.error("Failed to refresh Figma:",be)}finally{w(!1)}}};return e?G.createElement(La,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ma,null,"Screenshot Comparison"))),G.createElement(dF,null,G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,"Loading Figma..."))),G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,"Loading Storybook..."))))):!s&&!a&&!o?i?G.createElement(La,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ma,null,"Screenshot Comparison"))),G.createElement(dF,null,G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,"Loading..."))))):G.createElement(La,null,G.createElement(Ma,null,"Screenshot Comparison"),G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(fi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"20px 16px",lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u2728 This story isn't linked to a Figma frame yet"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the \u{1F50D} above to browse your Figma file and pick a matching frame. Once linked, run a Review to compare your code with the design.")))):!s&&!a?G.createElement(La,null,G.createElement(Ma,null,"Screenshot Comparison"),G.createElement(Vx,{style:{lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u{1F440} Ready to compare"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the ",G.createElement("strong",null,"Review")," button above to capture both the Figma frame and your Storybook component, then check for differences."))):G.createElement(La,{ref:ee},G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ma,null,"Screenshot Comparison"))),R==="side-by-side"?G.createElement(pF,{layout:"side-by-side"},o&&s&&!t?G.createElement(nu,{zoomed:S},G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(fi,{accent:r.color.secondary,onClick:()=>b(be=>!be),title:S?"Shrink preview":"Enlarge preview","aria-label":S?"Shrink preview":"Enlarge preview"},S?G.createElement(Ux,null):G.createElement($x,null)),T&&G.createElement(fi,{accent:r.color.secondary,onClick:k,title:"Browse Figma \u2014 change mapping","aria-label":"Browse Figma"},G.createElement(tu,null)),G.createElement(fi,{accent:r.color.positive,onClick:Ke,disabled:x,title:"Refresh Figma cache and reload image","aria-label":"Refresh Figma cache"},G.createElement(uF,null)),T&&G.createElement(fi,{accent:r.color.negative,onClick:()=>F(!0),title:"Unlink Figma mapping","aria-label":"Unlink Figma mapping"},G.createElement(cF,null))),G.createElement(mW,null,G.createElement(gW,{ref:K,src:s,alt:"Figma design",onLoad:xe,style:{opacity:v?1:0,transition:"opacity 150ms ease-in"}}))):!o&&!i?G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(fi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"16px"}},"No Figma mapping.")):G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,t?"Refreshing Figma...":"Loading Figma..."))),a&&!n?G.createElement(nu,{zoomed:A},G.createElement(ru,null,"Storybook Component"),G.createElement(ou,null,G.createElement(fi,{accent:r.color.secondary,onClick:()=>L(be=>!be),title:A?"Shrink preview":"Enlarge preview","aria-label":A?"Shrink preview":"Enlarge preview"},A?G.createElement(Ux,null):G.createElement($x,null))),G.createElement(fW,{ref:M,src:a,alt:"Storybook component",onLoad:ae})):G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,n?"Refreshing Storybook...":"Loading Storybook...")))):G.createElement(G.Fragment,null,G.createElement(pF,{layout:"overlay"},G.createElement(hW,null,s&&a?G.createElement(G.Fragment,null,G.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},G.createElement(xW,{ref:M,src:a,alt:"Storybook component",onLoad:ae,style:{maxHeight:"150px"}}),N&&G.createElement(yW,{src:s,alt:"Figma design overlay",style:{opacity:P,width:N.width,height:N.height,objectFit:"fill"}})),G.createElement("div",{style:{fontSize:"10px",color:r.color.mediumdark,marginTop:"8px",textAlign:"center"}},G.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",G.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),N&&` \u2022 ${N.width}\xD7${N.height}px`)):G.createElement(ns,null,G.createElement(rs,null,G.createElement(os,null),G.createElement(is,null,"Loading Images..."))))),a&&s&&G.createElement(bW,null,G.createElement(SW,null,"Figma Opacity:"),G.createElement(wW,{type:"range",min:"0",max:"1",step:"0.01",value:P,onChange:be=>z(parseFloat(be.target.value))}),G.createElement("span",null,Math.round(P*100),"%"))),G.createElement(_r,{isOpen:m,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:B,onCancel:()=>F(!1)}))};Ce();ct();var vW=ss.div({height:"100%"}),qx=ss.div({marginBottom:"20px"}),fF=ss.div(({theme:e})=>({padding:"12px",backgroundColor:e.background.negative||"#fee2e2",border:`1px solid ${e.color.negative||"#fca5a5"}`,borderRadius:"6px",color:e.color.negative||"#991b1b",fontSize:"13px",marginBottom:"16px",display:"flex",alignItems:"flex-start",gap:"8px"})),gF=ss.span({fontSize:"16px",flexShrink:0}),kW=ss.div(({theme:e})=>({padding:"10px 12px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}`,borderRadius:"6px",color:e.color.warning,fontSize:e.typography.size.s2,marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px",lineHeight:1.4})),mF=ss.div({flex:1}),Yx=()=>{let{reviewError:e,getCurrentReview:t}=ce(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Hs(),{selectedProjectId:s}=no(),{setCurrentMapping:a}=ni(),{currentStoryId:u,currentStoryName:c}=nt(),{isLoadingScreenshots:l,isLoadingFigma:d,isLoadingStorybook:f,screenshotError:p,setFigmaImageDirect:g}=ei(),k=async T=>{y.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",T),y.debug("[ReviewPanel] frame.id:",T?.id);let E=ft.getState(),I=E.selectedProjectId,D=E.currentStoryId,R=E.currentStoryName,$=E.figmaFileUrl;y.debug("[ReviewPanel] selectedProjectId (from store):",I),y.debug("[ReviewPanel] currentStoryId (from store):",D),y.debug("[ReviewPanel] currentStoryName (from store):",R),T.thumbnail&&D&&(y.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),g(D,T.id,T.thumbnail));try{let P=V(),z=localStorage.getItem("uicopilot_session_token");if(y.debug("[ReviewPanel] sessionToken exists:",!!z),y.debug("[ReviewPanel] dashboardUrl:",P),!z||!I||!D){y.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!z,selectedProjectId:I,currentStoryId:D});return}let x=$?.match(/\/file\/([^\/]+)/)?.[1]||void 0;y.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x});let w=await ne(`${P}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x})});if(w.ok){let v=await w.json();v.mapping&&(a(v.mapping),T.thumbnail||(y.debug("[ReviewPanel] No thumbnail available, triggering fetch"),ft.getState().triggerScreenshotRefresh()),y.debug("[ReviewPanel] Mapping saved successfully:",v.mapping))}else{let v=await w.text();y.error("[ReviewPanel] Failed to save mapping:",v)}}catch(P){y.error("[ReviewPanel] Error saving mapping:",P)}};return Qt.createElement(vW,null,Qt.createElement(qx,null,Qt.createElement(yh,null)),e&&Qt.createElement(fF,null,Qt.createElement(gF,null,"\u26A0\uFE0F"),Qt.createElement(mF,null,e)),p&&Qt.createElement(fF,null,Qt.createElement(gF,null,"\u26A0\uFE0F"),Qt.createElement(mF,null,"Screenshot loading error: ",p)),n?.variantMismatch&&Qt.createElement(kW,null,Qt.createElement("span",{style:{fontSize:16,flexShrink:0}},"\u26A0"),Qt.createElement("span",null,Qt.createElement("strong",null,"Variant mismatch:")," Storybook is showing ",Qt.createElement("strong",null,n.storybookVariant)," but Figma frame is ",Qt.createElement("strong",null,n.figmaVariant),". Some differences may be expected.")),Qt.createElement(qx,null,Qt.createElement(Gx,{isLoading:l,isLoadingFigma:d,isLoadingStorybook:f})),Qt.createElement(qx,null,Qt.createElement(Nx,null)),Qt.createElement(ji,{isOpen:r,onClose:o,onSelect:k,figmaFileUrl:i||"",projectId:s||void 0}))};Ce();Oe();je();ct();import{useEffect as hF,useState as CW,useRef as Kx,useCallback as TW}from"react";var IW=V(),FW=2e3;function xF(){let{sessionToken:e,usageData:t,setUsageData:n}=we(),[r,o]=CW(null),i=Kx(null),s=Kx(!1),a=Kx(0);hF(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=TW(()=>{o(null)},[]);return hF(()=>{if(!e)return;let c=async()=>{let d=Date.now();if(s.current||d-a.current<FW){y.debug("[useBalanceRefresh] Skipping refresh (debounced or in progress)");return}s.current=!0,a.current=d;try{y.debug("[useBalanceRefresh] Refreshing balance...");let f=await ne(`${IW}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(f.ok){let p=await f.json(),g=p.creditBalance,k=i.current;if(k!==null&&g>k){let T=g-k;o({message:`Credits added! +${Math.floor(T)} credit(s)`,previousBalance:k,newBalance:g}),y.debug("[useBalanceRefresh] Credits added:",T)}i.current=g,n(p),y.debug("[useBalanceRefresh] Balance updated:",g)}}catch(f){y.error("[useBalanceRefresh] Failed to refresh:",f)}finally{s.current=!1}},l=()=>{document.visibilityState==="visible"&&c()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l)}},[e,n]),{notification:r,dismissNotification:u}}Ce();Ce();je();Oe();ct();Lg();import{useEffect as EW,useRef as AW}from"react";var PW=300*1e3,yF="uicopilot_feature_flags_fetched_at";function LW(){if(typeof localStorage>"u")return!1;try{let e=localStorage.getItem(yF);if(!e)return!1;let t=parseInt(e,10);return Number.isNaN(t)?!1:Date.now()-t<PW}catch{return!1}}var Xx=null,MW={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}};function bF(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=ce(),{sessionToken:r,resetAuth:o}=we(),i=AW(null);EW(()=>{if(!r||r===i.current)return;if(i.current=r,LW()){y.debug("[useFeatureFlags] Cache fresh, skipping fetch");return}if(Xx){y.debug("[useFeatureFlags] Reusing in-flight fetch");return}let s=`${V()}/api/addon/flags`;Xx=ne(s,{headers:{Authorization:`Bearer ${r}`}}).then(a=>{if(a.status===401||a.status===403)throw y.debug("[useFeatureFlags] Token rejected, resetting auth"),o(),new Error("session token invalid");if(!a.ok)throw new Error(`flags endpoint returned ${a.status}`);return a.json()}).then(a=>{y.debug("[useFeatureFlags] Received flags:",a);let u={enableFixGeneration:!!a.enableFixGeneration,enableFixApply:!!a.enableFixApply,enableAutoMap:!!a.enableAutoMap,enableReviewBadges:!!a.enableReviewBadges,showCosts:!!a.showCosts,enableParallelReview:!!a.enableParallelReview,enableModelSelection:!!a.enableModelSelection};a.role&&(t(a.role),a.role==="beta"&&xw());let c=a.role==="admin"&&n?MW[n]:u;e(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c)),a.role&&localStorage.setItem("uicopilot_user_role",a.role),localStorage.setItem(yF,Date.now().toString())}catch{}}).catch(a=>{y.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",a.message)}).finally(()=>{Xx=null})},[r,e,t])}Ce();je();Rn();var RW={success:"linear-gradient(135deg, #10b981 0%, #059669 100%)",warning:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",error:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)"},zW=xr.div`
|
|
166
|
+
`;try{await navigator.clipboard.writeText(ie+me),T(!0),setTimeout(()=>T(!1),2e3)}catch(O){y.error("Failed to copy dismissed issues:",O)}};return We.createElement(R8,null,Me&&We.createElement(z8,null,We.createElement(N8,null,"\u{1F4CA} Progress:"),We.createElement(Bx,{variant:"resolved"},"\u2705 ",Me.resolved," resolved"),We.createElement(Bx,{variant:"remaining"},"\u23F3 ",Me.remaining," remaining"),Me.newIssues>0&&We.createElement(Bx,{variant:"new"},"\u{1F195} ",Me.newIssues," new"),We.createElement(O8,null,"Iteration ",S?.iterationNumber||1)),We.createElement(Dx,null,We.createElement(lF,{issues:N,modelId:h,complianceScore:K,visualSimilarity:ee,costUsd:ge,reviewDurationMs:xe,inputTokens:ae,outputTokens:Ke,cacheCreationTokens:be,cacheReadTokens:Te,onToggleSelection:o,onSelectAll:Ae,onSelectNone:pe,onSelectAllFixes:Pt,onGenerateFixes:Mr,onApplyFixes:fe,onApplyFix:tt,onCopyAllFixes:he,onDismiss:a,onUndismiss:u,isGenerating:$,isApplying:F,isCopying:p,applyFixesResult:i,onDismissResult:()=>s(null),generationTiming:z,generationUsage:w,hasReviewBeenRun:!!S,isLoadingReview:l,isReviewing:n,generationProgress:x,autoApplySupported:E,selfReview:v})),L.length>0&&We.createElement(_8,null,We.createElement($8,null,We.createElement(U8,{onClick:()=>g(!d)},We.createElement("span",null,d?"\u25BC":"\u25B6"),We.createElement("span",null,"Filtered out"),We.createElement(H8,null,L.length),We.createElement(eW,null,B.postAiValidation>0&&We.createElement("span",null,"\u2699\uFE0F ",B.postAiValidation),B.aiValidation>0&&We.createElement("span",null,"\u2726 ",B.aiValidation),B.user>0&&We.createElement("span",null,"\u{1F464} ",B.user))),We.createElement(j8,{onClick:oe},k?"\u2713 Copied!":"Copy")),d&&We.createElement(W8,null,(()=>{let Y=L.reduce((O,U)=>{let H=J8(U.dismissReason);return O[H]||(O[H]=[]),O[H].push(U),O},{}),me=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(Y).sort((O,U)=>me.indexOf(O)-me.indexOf(U)).map(O=>We.createElement(We.Fragment,{key:O},We.createElement(X8,null,O,We.createElement(Q8,null,Y[O].length)),Y[O].map(U=>We.createElement(V8,{key:U.id},We.createElement(G8,null,We.createElement(Z8,{phase:U.dismissedBy||Rx(U.dismissReason)||"post-ai-validation"},tW(U.dismissedBy,U.dismissReason)," ",uF(U.dismissedBy,U.dismissReason)),We.createElement(q8,{onClick:()=>u(U.id),title:"Restore to active issues"},"\u21A9 Restore")),We.createElement(Y8,null,"[",U.severity.toUpperCase(),"] ",U.title||U.description),U.dismissReason&&We.createElement(K8,null,cF(U.dismissReason))))))})())))};var aW=Aa.div({marginTop:"20px"}),lW=Aa.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),cW=Aa.div({display:"flex",alignItems:"center"}),zx=Aa(yo)({padding:"10px 16px"}),uW=Aa.div({minHeight:"200px"}),Nx=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r,userRole:o,roleOverride:i}=ce(),a=(i??o)==="admin",u=r.length>1||n&&Object.keys(n.byModel).length>1;return sW(()=>{!a&&(e==="chat"||e==="prompt")&&t("issues")},[a,e,t]),Lr.createElement(aW,null,Lr.createElement(lW,null,Lr.createElement(cW,null,a&&Lr.createElement(zx,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),a&&Lr.createElement(zx,{active:e==="chat",onClick:()=>t("chat")},u?"Models":"Chat"),Lr.createElement(zx,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),Lr.createElement(uW,null,a&&e==="chat"&&(u?Lr.createElement(yI,null):Lr.createElement(wx,null)),e==="issues"&&Lr.createElement(pF,null),a&&e==="prompt"&&Lr.createElement(Sx,null)))};Ce();import G,{useState as go,useRef as jx,useEffect as fW,useMemo as mW}from"react";import{styled as vt,useTheme as hW}from"storybook/theming";je();Oe();var eu={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},Pa="uicopilot_feature_flags";function Ox(){try{let e=localStorage.getItem(Pa);if(e){let t=JSON.parse(e);return{...eu,...t}}}catch(e){y.warn("[FeatureFlags] Failed to load from localStorage:",e)}return eu}function pW(e,t){try{let r={...Ox(),[e]:t},o={};for(let i in r){let s=i;r[s]!==eu[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(Pa,JSON.stringify(o)):localStorage.removeItem(Pa),y.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){y.error("[FeatureFlags] Failed to set flag:",n)}}function dW(){try{localStorage.removeItem(Pa),y.debug("[FeatureFlags] Reset to defaults")}catch(e){y.error("[FeatureFlags] Failed to reset:",e)}}function _x(e){return Ox()[e]}function gW(){let e=Object.keys(eu).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(Pa,JSON.stringify(e)),y.debug("[FeatureFlags] All features enabled! Reload to apply.")}catch(t){y.error("[FeatureFlags] Failed to enable all features:",t)}}typeof window<"u"&&(window.uicopilot={...window.uicopilot,featureFlags:{get:Ox,set:pW,reset:dW,enableAll:gW,isEnabled:_x}});Oe();ct();import At from"react";var dF=()=>At.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"},At.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),At.createElement("circle",{cx:"12",cy:"12",r:"3"}));var La={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"},tu=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),gF=()=>At.createElement("svg",{...La},At.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),At.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),At.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),At.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),At.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),At.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),fF=()=>At.createElement("svg",{...La},At.createElement("polyline",{points:"23 4 23 10 17 10"}),At.createElement("polyline",{points:"1 20 1 14 7 14"}),At.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"})),$x=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"})),Ux=()=>At.createElement("svg",{...La},At.createElement("circle",{cx:"11",cy:"11",r:"8"}),At.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),At.createElement("line",{x1:"8",y1:"11",x2:"14",y2:"11"}));var Ma=vt.div({marginTop:"20px"}),Hx=vt.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Wx=vt.div({display:"flex",alignItems:"center",gap:"12px"}),Ba=vt.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),lme=vt.div({display:"flex",gap:"8px"}),cme=vt.button(({active:e,theme:t})=>({padding:"4px 12px",backgroundColor:e?t.color.secondary:"transparent",color:e?"#fff":t.color.mediumdark,border:`1px solid ${e?t.color.secondary:t.appBorderColor}`,borderRadius:"4px",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.2s","&:hover":{opacity:.9}})),mF=vt.div(({theme:e,layout:t})=>({display:t==="side-by-side"?"grid":"flex",gridTemplateColumns:t==="side-by-side"?"minmax(0, 1fr) minmax(0, 1fr)":void 0,gap:t==="side-by-side"?`${e.layoutMargin}px`:0,position:"relative",width:"100%",justifyContent:t==="overlay"?"center":void 0})),nu=vt.div(({theme:e,zoomed:t})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:e.appBorderRadius,overflow:"hidden",backgroundColor:e.background.app,minHeight:"60px",maxHeight:t?"400px":"150px",display:"flex",alignItems:"center",justifyContent:"center",transition:"max-height 0.2s ease, box-shadow 0.2s ease",boxShadow:t?"0 8px 30px rgba(0, 0, 0, 0.15)":"none","& img":t?{maxWidth:"100%",maxHeight:"400px"}:void 0})),ru=vt.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.92)":"rgba(0, 0, 0, 0.7)",color:e.base==="dark"?"#0a0a0f":e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),ou=vt.div({position:"absolute",top:"6px",right:"6px",display:"flex",gap:"4px",zIndex:10}),gi=vt.button(({theme:e,accent:t})=>({width:"24px",height:"24px",padding:"0",backgroundColor:e.base==="dark"?"rgba(255, 255, 255, 0.12)":"rgba(255, 255, 255, 0.92)",border:`1px solid ${t}55`,borderRadius:e.appBorderRadius,color:t,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s",backdropFilter:"blur(4px)","&:hover:not(:disabled)":{backgroundColor:t,color:"#ffffff",borderColor:t},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),xW=vt.img(({opacity:e=1})=>({maxWidth:"150px",maxHeight:"150px",height:"auto",display:"block",objectFit:"contain",opacity:e})),yW=vt.img({display:"block",objectFit:"contain",maxHeight:"150px",maxWidth:"150px"}),bW=vt.div({position:"relative",display:"inline-block",maxHeight:"150px",overflow:"hidden"}),ume=vt.svg(({isVisible:e})=>({position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",opacity:e?1:0,transition:"opacity 150ms ease-in",...!e&&{transition:"opacity 100ms ease-out"}})),SW=vt.div({position:"relative",display:"inline-block"}),pme=vt.div(({width:e,height:t,theme:n})=>({position:"relative",width:e?`${e}px`:"auto",height:t?`${t}px`:"auto",border:`1px solid ${n.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:n.background.app})),wW=vt.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),vW=vt.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),kW=vt.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),CW=vt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),TW=vt.input({flex:1}),Vx=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),dme=vt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),hF=vt.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),rs=vt.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center","&::before":{content:'""',position:"absolute",top:0,left:"-100%",width:"100%",height:"100%",background:e.base==="dark"?"linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent)":"linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent)",animation:"shimmer 1.5s ease-in-out infinite",pointerEvents:"none"},"@keyframes shimmer":{"0%":{left:"-100%"},"100%":{left:"100%"}}})),os=vt.div({textAlign:"center",zIndex:1}),is=vt.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTop:`3px solid ${e.color.secondary}`,borderRadius:"50%",animation:"spin 1s linear infinite",marginBottom:"12px","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),ss=vt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Gx=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let r=hW(),{currentMapping:o,loadingMapping:i}=nt(),{figmaImageUrl:s,storybookImageUrl:a,figmaDimensions:u,setFigmaImageUrl:c,hoveredIssueId:l,reviewHistory:d,currentReviewId:g}=ce(),{selectedProjectId:p}=Je(),{sessionToken:f}=we(),{openComponentBrowser:k}=Ws(),{hasMapping:T,deleteMapping:E,setCurrentMapping:I}=ni(),D=_x("enableHoverHighlight"),[R,$]=go("side-by-side"),[P,z]=go(.5),[x,w]=go(!1),[v,C]=go(!1),[m,F]=go(!1),[S,b]=go(!1),[A,L]=go(!1),B=async()=>{F(!1);try{let be=o?.id;be&&await E(be),I(null)}catch(be){y.error("[ScreenshotComparison] Failed to unlink:",be)}};fW(()=>{C(!1)},[s]);let[N,h]=go(null),[j,W]=go(null),M=jx(null),K=jx(null),ee=jx(null),ge=mW(()=>{if(!D||!l||!g)return null;let be=d.find(Te=>Te.id===g);return be?.issues&&be.issues.find(Te=>Te.id===l)||null},[l,g,d]),xe=be=>{let Te=be.currentTarget;C(!0),!gt.getState().figmaDimensions&&Te.naturalWidth&&Te.naturalHeight&>.getState().setFigmaDimensions({width:Te.naturalWidth,height:Te.naturalHeight}),requestAnimationFrame(()=>{if(K.current){let{clientWidth:Me,clientHeight:Ae}=K.current;Me&&Ae&&W({width:Me,height:Ae})}})},ae=()=>{requestAnimationFrame(()=>{if(M.current){let{clientWidth:be,clientHeight:Te}=M.current;be&&Te&&h({width:be,height:Te})}})},Ke=async()=>{if(!(!p||!f)){w(!0);try{let be=V();await ne(`${be}/api/figma/frames/invalidate?projectId=${p}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},credentials:"include"}),c(null),y.debug("Figma cache cleared, image will reload on next review")}catch(be){y.error("Failed to refresh Figma:",be)}finally{w(!1)}}};return e?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Figma..."))),G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Storybook..."))))):!s&&!a&&!o?i?G.createElement(Ma,null,G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),G.createElement(hF,null,G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading..."))))):G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"20px 16px",lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u2728 This story isn't linked to a Figma frame yet"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the \u{1F50D} above to browse your Figma file and pick a matching frame. Once linked, run a Review to compare your code with the design.")))):!s&&!a?G.createElement(Ma,null,G.createElement(Ba,null,"Screenshot Comparison"),G.createElement(Vx,{style:{lineHeight:"1.6"}},G.createElement("div",{style:{fontSize:"14px",marginBottom:"6px"}},"\u{1F440} Ready to compare"),G.createElement("div",{style:{fontSize:"12px",opacity:.75}},"Click the ",G.createElement("strong",null,"Review")," button above to capture both the Figma frame and your Storybook component, then check for differences."))):G.createElement(Ma,{ref:ee},G.createElement(Hx,null,G.createElement(Wx,null,G.createElement(Ba,null,"Screenshot Comparison"))),R==="side-by-side"?G.createElement(mF,{layout:"side-by-side"},o&&s&&!t?G.createElement(nu,{zoomed:S},G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>b(be=>!be),title:S?"Shrink preview":"Enlarge preview","aria-label":S?"Shrink preview":"Enlarge preview"},S?G.createElement(Ux,null):G.createElement($x,null)),T&&G.createElement(gi,{accent:r.color.secondary,onClick:k,title:"Browse Figma \u2014 change mapping","aria-label":"Browse Figma"},G.createElement(tu,null)),G.createElement(gi,{accent:r.color.positive,onClick:Ke,disabled:x,title:"Refresh Figma cache and reload image","aria-label":"Refresh Figma cache"},G.createElement(fF,null)),T&&G.createElement(gi,{accent:r.color.negative,onClick:()=>F(!0),title:"Unlink Figma mapping","aria-label":"Unlink Figma mapping"},G.createElement(gF,null))),G.createElement(bW,null,G.createElement(yW,{ref:K,src:s,alt:"Figma design",onLoad:xe,style:{opacity:v?1:0,transition:"opacity 150ms ease-in"}}))):!o&&!i?G.createElement(nu,null,G.createElement(ru,null,"Figma Design"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:k,disabled:!p,title:"Browse Figma to map this component","aria-label":"Browse Figma to map this component"},G.createElement(tu,null))),G.createElement(Vx,{style:{border:"none",padding:"16px"}},"No Figma mapping.")):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,t?"Refreshing Figma...":"Loading Figma..."))),a&&!n?G.createElement(nu,{zoomed:A},G.createElement(ru,null,"Storybook Component"),G.createElement(ou,null,G.createElement(gi,{accent:r.color.secondary,onClick:()=>L(be=>!be),title:A?"Shrink preview":"Enlarge preview","aria-label":A?"Shrink preview":"Enlarge preview"},A?G.createElement(Ux,null):G.createElement($x,null))),G.createElement(xW,{ref:M,src:a,alt:"Storybook component",onLoad:ae})):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,n?"Refreshing Storybook...":"Loading Storybook...")))):G.createElement(G.Fragment,null,G.createElement(mF,{layout:"overlay"},G.createElement(SW,null,s&&a?G.createElement(G.Fragment,null,G.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},G.createElement(wW,{ref:M,src:a,alt:"Storybook component",onLoad:ae,style:{maxHeight:"150px"}}),N&&G.createElement(vW,{src:s,alt:"Figma design overlay",style:{opacity:P,width:N.width,height:N.height,objectFit:"fill"}})),G.createElement("div",{style:{fontSize:"10px",color:r.color.mediumdark,marginTop:"8px",textAlign:"center"}},G.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",G.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),N&&` \u2022 ${N.width}\xD7${N.height}px`)):G.createElement(rs,null,G.createElement(os,null,G.createElement(is,null),G.createElement(ss,null,"Loading Images..."))))),a&&s&&G.createElement(kW,null,G.createElement(CW,null,"Figma Opacity:"),G.createElement(TW,{type:"range",min:"0",max:"1",step:"0.01",value:P,onChange:be=>z(parseFloat(be.target.value))}),G.createElement("span",null,Math.round(P*100),"%"))),G.createElement(_r,{isOpen:m,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:B,onCancel:()=>F(!1)}))};Ce();ct();var IW=as.div({height:"100%"}),qx=as.div({marginBottom:"20px"}),xF=as.div(({theme:e})=>({padding:"12px",backgroundColor:e.background.negative||"#fee2e2",border:`1px solid ${e.color.negative||"#fca5a5"}`,borderRadius:"6px",color:e.color.negative||"#991b1b",fontSize:"13px",marginBottom:"16px",display:"flex",alignItems:"flex-start",gap:"8px"})),yF=as.span({fontSize:"16px",flexShrink:0}),FW=as.div(({theme:e})=>({padding:"10px 12px",backgroundColor:`${e.color.warning}1a`,border:`1px solid ${e.color.warning}`,borderRadius:"6px",color:e.color.warning,fontSize:e.typography.size.s2,marginBottom:"16px",display:"flex",alignItems:"center",gap:"8px",lineHeight:1.4})),bF=as.div({flex:1}),Yx=()=>{let{reviewError:e,getCurrentReview:t}=ce(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Ws(),{selectedProjectId:s}=no(),{setCurrentMapping:a}=ni(),{currentStoryId:u,currentStoryName:c}=nt(),{isLoadingScreenshots:l,isLoadingFigma:d,isLoadingStorybook:g,screenshotError:p,setFigmaImageDirect:f}=ei(),k=async T=>{y.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",T),y.debug("[ReviewPanel] frame.id:",T?.id);let E=gt.getState(),I=E.selectedProjectId,D=E.currentStoryId,R=E.currentStoryName,$=E.figmaFileUrl;y.debug("[ReviewPanel] selectedProjectId (from store):",I),y.debug("[ReviewPanel] currentStoryId (from store):",D),y.debug("[ReviewPanel] currentStoryName (from store):",R),T.thumbnail&&D&&(y.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),f(D,T.id,T.thumbnail));try{let P=V(),z=localStorage.getItem("uicopilot_session_token");if(y.debug("[ReviewPanel] sessionToken exists:",!!z),y.debug("[ReviewPanel] dashboardUrl:",P),!z||!I||!D){y.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!z,selectedProjectId:I,currentStoryId:D});return}let x=$?.match(/\/file\/([^\/]+)/)?.[1]||void 0;y.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x});let w=await ne(`${P}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({projectId:I,storyId:D,name:R,figmaNodeId:T.id,figmaFileKey:x})});if(w.ok){let v=await w.json();v.mapping&&(a(v.mapping),T.thumbnail||(y.debug("[ReviewPanel] No thumbnail available, triggering fetch"),gt.getState().triggerScreenshotRefresh()),y.debug("[ReviewPanel] Mapping saved successfully:",v.mapping))}else{let v=await w.text();y.error("[ReviewPanel] Failed to save mapping:",v)}}catch(P){y.error("[ReviewPanel] Error saving mapping:",P)}};return Qt.createElement(IW,null,Qt.createElement(qx,null,Qt.createElement(yh,null)),e&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,e)),p&&Qt.createElement(xF,null,Qt.createElement(yF,null,"\u26A0\uFE0F"),Qt.createElement(bF,null,"Screenshot loading error: ",p)),n?.variantMismatch&&Qt.createElement(FW,null,Qt.createElement("span",{style:{fontSize:16,flexShrink:0}},"\u26A0"),Qt.createElement("span",null,Qt.createElement("strong",null,"Variant mismatch:")," Storybook is showing ",Qt.createElement("strong",null,n.storybookVariant)," but Figma frame is ",Qt.createElement("strong",null,n.figmaVariant),". Some differences may be expected.")),Qt.createElement(qx,null,Qt.createElement(Gx,{isLoading:l,isLoadingFigma:d,isLoadingStorybook:g})),Qt.createElement(qx,null,Qt.createElement(Nx,null)),Qt.createElement(Hi,{isOpen:r,onClose:o,onSelect:k,figmaFileUrl:i||"",projectId:s||void 0}))};Ce();Oe();je();ct();import{useEffect as SF,useState as EW,useRef as Kx,useCallback as AW}from"react";var PW=V(),LW=2e3;function wF(){let{sessionToken:e,usageData:t,setUsageData:n}=we(),[r,o]=EW(null),i=Kx(null),s=Kx(!1),a=Kx(0);SF(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=AW(()=>{o(null)},[]);return SF(()=>{if(!e)return;let c=async()=>{let d=Date.now();if(s.current||d-a.current<LW){y.debug("[useBalanceRefresh] Skipping refresh (debounced or in progress)");return}s.current=!0,a.current=d;try{y.debug("[useBalanceRefresh] Refreshing balance...");let g=await ne(`${PW}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(g.ok){let p=await g.json(),f=p.creditBalance,k=i.current;if(k!==null&&f>k){let T=f-k;o({message:`Credits added! +${Math.floor(T)} credit(s)`,previousBalance:k,newBalance:f}),y.debug("[useBalanceRefresh] Credits added:",T)}i.current=f,n(p),y.debug("[useBalanceRefresh] Balance updated:",f)}}catch(g){y.error("[useBalanceRefresh] Failed to refresh:",g)}finally{s.current=!1}},l=()=>{document.visibilityState==="visible"&&c()};return document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l)}},[e,n]),{notification:r,dismissNotification:u}}Ce();Ce();je();Oe();ct();Lf();import{useEffect as MW,useRef as BW}from"react";var DW=300*1e3,vF="uicopilot_feature_flags_fetched_at";function RW(){if(typeof localStorage>"u")return!1;try{let e=localStorage.getItem(vF);if(!e)return!1;let t=parseInt(e,10);return Number.isNaN(t)?!1:Date.now()-t<DW}catch{return!1}}var Xx=null,zW={admin:{enableFixGeneration:!0,enableFixApply:!0,enableAutoMap:!0,enableReviewBadges:!0,showCosts:!0,enableParallelReview:!0,enableModelSelection:!0},beta:{enableFixGeneration:!0,enableFixApply:!1,enableAutoMap:!0,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1}};function kF(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=ce(),{sessionToken:r,resetAuth:o}=we(),i=BW(null);MW(()=>{if(!r||r===i.current)return;if(i.current=r,RW()){y.debug("[useFeatureFlags] Cache fresh, skipping fetch");return}if(Xx){y.debug("[useFeatureFlags] Reusing in-flight fetch");return}let s=`${V()}/api/addon/flags`;Xx=ne(s,{headers:{Authorization:`Bearer ${r}`}}).then(a=>{if(a.status===401||a.status===403)throw y.debug("[useFeatureFlags] Token rejected, resetting auth"),o(),new Error("session token invalid");if(!a.ok)throw new Error(`flags endpoint returned ${a.status}`);return a.json()}).then(a=>{y.debug("[useFeatureFlags] Received flags:",a);let u={enableFixGeneration:!!a.enableFixGeneration,enableFixApply:!!a.enableFixApply,enableAutoMap:!!a.enableAutoMap,enableReviewBadges:!!a.enableReviewBadges,showCosts:!!a.showCosts,enableParallelReview:!!a.enableParallelReview,enableModelSelection:!!a.enableModelSelection};a.role&&(t(a.role),a.role==="beta"&&yw());let c=a.role==="admin"&&n?zW[n]:u;e(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c)),a.role&&localStorage.setItem("uicopilot_user_role",a.role),localStorage.setItem(vF,Date.now().toString())}catch{}}).catch(a=>{y.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",a.message)}).finally(()=>{Xx=null})},[r,e,t])}Ce();je();Rn();var _W={success:"linear-gradient(135deg, #10b981 0%, #059669 100%)",warning:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",error:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)"},$W=xr.div`
|
|
167
167
|
position: fixed;
|
|
168
168
|
top: 16px;
|
|
169
169
|
right: 16px;
|
|
170
|
-
background: ${({variant:e})=>
|
|
170
|
+
background: ${({variant:e})=>_W[e||"success"]};
|
|
171
171
|
color: white;
|
|
172
172
|
padding: 12px 20px;
|
|
173
173
|
border-radius: 8px;
|
|
@@ -187,12 +187,12 @@ ${"=".repeat(40)}
|
|
|
187
187
|
opacity: 1;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
`,
|
|
190
|
+
`,UW=xr.span`
|
|
191
191
|
font-size: 20px;
|
|
192
|
-
`,
|
|
192
|
+
`,jW=xr.span`
|
|
193
193
|
font-weight: 500;
|
|
194
194
|
font-size: 14px;
|
|
195
|
-
`,
|
|
195
|
+
`,HW=xr.button`
|
|
196
196
|
background: rgba(255, 255, 255, 0.2);
|
|
197
197
|
border: none;
|
|
198
198
|
color: white;
|
|
@@ -208,15 +208,15 @@ ${"=".repeat(40)}
|
|
|
208
208
|
&:hover {
|
|
209
209
|
background: rgba(255, 255, 255, 0.3);
|
|
210
210
|
}
|
|
211
|
-
|
|
211
|
+
`,WW=xr.div`
|
|
212
212
|
padding: 8px 16px;
|
|
213
213
|
border-top: 1px solid ${({theme:e})=>e.appBorderColor};
|
|
214
214
|
font-size: 11px;
|
|
215
215
|
color: ${({theme:e})=>e.color.mediumdark};
|
|
216
216
|
text-align: center;
|
|
217
217
|
opacity: 0.7;
|
|
218
|
-
`,
|
|
219
|
-
`);r=p.pop()||"";for(let g of p)if(g.startsWith("data: "))try{let k=JSON.parse(g.slice(6));if(k.type==="complete"){o=k.complianceScore??k.validation?.complianceScore??null;let E=(k.issues||[]).filter(I=>!I.dismissed);i=E.filter(I=>I.severity==="critical").length,s=E.filter(I=>I.severity==="major").length,a=E.filter(I=>I.severity==="minor").length,u=k.costUsd||0,c=k.inputTokens||0,l=k.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:s,minorCount:a,costUsd:u,inputTokens:c,outputTokens:l}}function iu(e,t,n,r,o){e&&e.set([{value:n,typeId:QW,storyId:t,title:r,description:o}])}async function eV(e){let t=window.location.origin;try{let n=await fetch(`${t}/__uicopilot/capture?storyId=${encodeURIComponent(e)}`);if(n.ok){let r=await n.json();return{screenshot:r.screenshot||void 0,computedStyles:r.computedStyles||void 0,domTree:r.domTree||void 0}}}catch{}try{let n=await fetch(`${t}/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(n.ok)return{screenshot:(await n.json()).screenshot||void 0}}catch{}return{}}async function FF(e,t,n,r,o,i){iu(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{console.warn(`[reviewAll] Capturing for: ${e.storyName} (${e.storyId})`);let s=await eV(e.storyId);console.warn(`[reviewAll] Captured: screenshot=${!!s.screenshot} domTree=${!!s.domTree} styles=${!!s.computedStyles} for: ${e.storyName}`);let a=await JW(`${XW}/api/review/stream`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:n,storyId:e.storyId,storyName:e.storyName,storybookScreenshot:s.screenshot,computedStyles:s.computedStyles,domTree:s.domTree,aiModels:[r]})});if(console.warn(`[reviewAll] API response for ${e.storyName}: HTTP ${a.status}`),!a.ok)throw new Error(`HTTP ${a.status}`);let u=a.body?.getReader();if(!u)throw new Error("No response body");let c=await ZW(u,i),{score:l,criticalCount:d,majorCount:f,minorCount:p,costUsd:g,inputTokens:k,outputTokens:T}=c;if(l!==null){let E=d>0||l<70?"status-value:error":f>0||l<90?"status-value:warning":"status-value:success",I=[`Score: ${l}`];d>0&&I.push(`${d} critical`),f>0&&I.push(`${f} major`),p>0&&I.push(`${p} minor`);let D=l>=90?`\u2713 Score ${l}`:l>=70?`\u26A0 Score ${l}`:`\u2717 Score ${l}`;return iu(o,e.storyId,E,D,I.join(" \xB7 ")),{passed:l>=70,score:l,costUsd:g,inputTokens:k,outputTokens:T}}return iu(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}catch(s){y.error(`[reviewAll] Failed to review ${e.storyName}:`,s);let a=s instanceof Error?s.message:"Unknown error";return iu(o,e.storyId,"status-value:error","Review Failed",a),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var nV=V(),Ba="uireview/badge";function EF(){let e=!1,t=!1;try{let n=tV.getChannel();n.on(Jx,async()=>{if(!t){t=!0,e=!1;try{await iV(n,()=>e)}finally{t=!1}}}),n.on(Zx,()=>{e=!0})}catch{}}async function Qx(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let n=await fetch(`${nV}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)return[];let i=((await n.json()).mappings||[]).filter(s=>s.figmaNodeId).map(s=>{let a=s;return{storyId:a.storyId,storyName:a.name||a.storyId,figmaNodeId:a.figmaNodeId}});return rV(i),i}catch(e){return y.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function rV(e){try{if(typeof su!="function")return;let t=su(Ba);if(!t)return;let n=t.getAll?.()||{},r=new Set(e.map(s=>s.storyId)),o=Object.keys(n).filter(s=>n[s]?.[Ba]&&!r.has(s));o.length>0&&t.unset(o);let i=e.filter(s=>{let a=n[s.storyId]?.[Ba];return!(a?.value==="status-value:success"||a?.value==="status-value:warning"||a?.value==="status-value:error")}).map(s=>({value:"status-value:pending",typeId:Ba,storyId:s.storyId,title:"Mapped to Figma",description:"Ready for UI review \u2014 click Run to start"}));i.length>0&&t.set(i)}catch{}}function oV(){try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3}async function iV(e,t){let n=await Qx();if(n.length===0){e.emit(Ra,{total:0,passed:0,failed:0});return}let r=localStorage.getItem("uicopilot_session_token"),o=localStorage.getItem("uicopilot_selected_project_id");if(!r||!o)return;let i="claude-sonnet-4-6";try{let k=localStorage.getItem("uicopilot_selected_models");if(k){let T=JSON.parse(k);Array.isArray(T)&&T.length>0&&(i=T[0])}}catch{}let s=null;try{typeof su=="function"&&(s=su(Ba))}catch{}let a=oV(),u=0,c=0,l=0,d=0,f=0,p=0;e.emit(Da,{total:n.length,completed:0,currentStoryName:n[0]?.storyName||""});let g=n.map(k=>()=>FF(k,r,o,i,s,t));await IF(g,a,(k,T)=>{if(T&&typeof T=="object"&&"score"in T){let E=T;E.score!==null&&E.score>=90?u++:E.score!==null&&E.score>=70?c++:l++,d+=E.costUsd||0,f+=E.inputTokens||0,p+=E.outputTokens||0}else l++;console.warn(`[reviewAll] Story ${k+1}/${n.length} done:`,n[k].storyName,T),e.emit(Da,{total:n.length,completed:u+c+l,currentStoryName:n[k].storyName})},t),e.emit(Ra,{total:n.length,passed:u,failed:l,warnCount:c,costUsd:d,inputTokens:f,outputTokens:p})}var aV=go.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),lV=go.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),cV=go.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),PF=go.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),LF=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}})),uV=go.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),pV=go.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),MF=go.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),as=go.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),Jx="uireview/review-all-start",Zx="uireview/review-all-cancel",Da="uireview/review-all-progress",Ra="uireview/review-all-complete";function BF(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableParallelReview:!1}catch{return!1}}var DF=()=>{let[e,t]=za(!1),[n,r]=za(null),[o,i]=za(null),[s,a]=za(null),[u,c]=za(BF);ey(()=>{let g=()=>c(BF()),k=setInterval(g,2e3);return window.addEventListener("storage",g),()=>{clearInterval(k),window.removeEventListener("storage",g)}},[]),ey(()=>{let g=()=>{Qx().then(I=>{a(I.length)}).catch(()=>{})},k=setTimeout(g,3e3),T=null;try{T=au.getChannel(),T.on("storyChanged",g),T.on("uireview/mappings-changed",g)}catch{}let E=setInterval(g,6e4);return()=>{clearTimeout(k),clearInterval(E),T&&(T.off("storyChanged",g),T.off("uireview/mappings-changed",g))}},[]),ey(()=>{let g;try{g=au.getChannel()}catch{return}let k=E=>{r(E),t(!0)},T=E=>{t(!1),r(null),i({total:E.total,passed:E.passed,failed:E.failed,warned:E.warnCount||0,costUsd:E.costUsd||0})};return g.on(Da,k),g.on(Ra,T),()=>{g.off(Da,k),g.off(Ra,T)}},[]);let l=AF(()=>{try{au.getChannel().emit(Jx),t(!0),i(null)}catch{}},[]),d=AF(()=>{try{au.getChannel().emit(Zx)}catch{}t(!1),r(null)},[]),f=n?Math.round(n.completed/n.total*100):0,p=sV();return u?Gt.createElement(aV,null,Gt.createElement(lV,null,Gt.createElement(cV,null,"UI Review"),e?Gt.createElement(LF,{running:!0,onClick:d},"Cancel"):Gt.createElement(LF,{onClick:l,disabled:!s||s===0},"Run",s?` (${s})`:"")),!e&&o?Gt.createElement(Gt.Fragment,null,Gt.createElement(MF,null,Gt.createElement(as,{dotColor:p.color.positive},"Pass (",o.passed,")"),Gt.createElement(as,{dotColor:p.color.warning},"Warn (",o.warned,")"),Gt.createElement(as,{dotColor:p.color.negative},"Fail (",o.failed,")")),o.costUsd>0&&Gt.createElement(PF,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:Gt.createElement(MF,null,Gt.createElement(as,{dotColor:p.color.positive},"Pass"),Gt.createElement(as,{dotColor:p.color.warning},"Warn"),Gt.createElement(as,{dotColor:p.color.negative},"Fail")),e&&n&&Gt.createElement(Gt.Fragment,null,Gt.createElement(uV,null,Gt.createElement(pV,{percent:f})),Gt.createElement(PF,null,"Reviewing ",Math.min(n.completed+1,n.total),"/",n.total," \u2014 ",n.currentStoryName))):null};import*as zF from"@sentry/react";var dV="https://015e961f5f626bad5315430e02940616@o138219.ingest.us.sentry.io/4511134750539776",RF=!1;function fV(){if(typeof window>"u")return"production";let e=window.location.hostname;return/^(localhost|127\.0\.0\.1|0\.0\.0\.0)$/i.test(e)?"localhost":"production"}function NF(){if(!RF){RF=!0;try{zF.init({dsn:dV,environment:fV(),release:`uicopilot-addon@${process.env.npm_package_version||"unknown"}`,tracesSampleRate:0,enabled:!0,beforeSend(e){return e.tags={...e.tags,component:"storybook-addon"},e}})}catch{}}}NF();var cu="uireview",mV=`${cu}/panel`,hV=`${cu}/tool`,_F=`${cu}/test-provider`;lu.register(cu,()=>{if(console.log("[UI Review] Registering addon, checking for StatusStore API..."),typeof OF=="function"){console.log("[UI Review] StatusStore API available, initializing badges");let t=OF("uireview/badge");Dv(t),console.log("[UI Review] Badge listener initialized")}else console.warn("[UI Review] experimental_getStatusStore not available \u2014 badges disabled");lu.add(hV,{type:ty.TOOL,title:"UI Review",match:({viewMode:t})=>t==="story",render:()=>Na.createElement(TF,null)}),EF(),(()=>{try{let t=localStorage.getItem("uicopilot_feature_flags");return t?!!JSON.parse(t).enableParallelReview:!1}catch{return!1}})()&&lu.add(_F,{type:ty.experimental_TEST_PROVIDER,id:_F,render:()=>Na.createElement(DF,null)}),lu.add(mV,{type:ty.PANEL,title:"UI Review",match:({viewMode:t})=>t==="story",render:({active:t})=>Na.createElement(gV,{active:t||!1},Na.createElement(zg,null,Na.createElement(kF,null)))})});
|
|
218
|
+
`,VW=xr.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),GW=xr.div({fontSize:"32px"}),qW=xr.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),YW=xr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),CF=xr.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})),TF=xr.span({flex:1}),IF=xr.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`}})),FF=()=>{let{selectedProjectId:e,projects:t,loadingProjects:n}=Je(),{isConnected:r,sessionToken:o,authError:i}=we(),{currentStoryId:s}=nt(),{currentReviewId:a,userRole:u,roleOverride:c,setRoleOverride:l,setFeatureFlags:d}=ce(),[g,p]=NW(!1),f=()=>{l(null),o&&fetch(`${V()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(P=>P.json()).then(P=>{d({enableFixGeneration:!!P.enableFixGeneration,enableFixApply:!!P.enableFixApply,enableAutoMap:!!P.enableAutoMap,enableReviewBadges:!!P.enableReviewBadges,showCosts:!!P.showCosts,enableParallelReview:!!P.enableParallelReview,enableModelSelection:!!P.enableModelSelection})}).catch(()=>{})};mm(),Mm(),kF(),Cm(),wm();let{notification:k,dismissNotification:T}=wF();OW(()=>{if(k){let P=setTimeout(T,5e3);return()=>clearTimeout(P)}},[k,T]);let E=t.find(P=>P.id===e),I=r&&!!e&&!!E,D=!!o&&!!e&&(n||t.length===0),{loadingMapping:R}=nt(),$=I&&!!s&&!a&&R;return Dt.createElement(gu,{header:Dt.createElement(fu,{toolbar:Dt.createElement(_f,{onOpenSettings:()=>p(!0)})}),footer:Dt.createElement(WW,null,Ft.NAME," v","0.5.16")},k&&Dt.createElement($W,{variant:k.variant||"success"},Dt.createElement(UW,null,k.variant==="error"?"!":k.variant==="warning"?"\u26A0":"+"),Dt.createElement(jW,null,k.message),Dt.createElement(HW,{onClick:T},"x")),i&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u26A0"),Dt.createElement(TF,null,i),Dt.createElement(IF,{onClick:()=>p(!0)},"Reconnect")),u==="admin"&&c&&Dt.createElement(CF,null,Dt.createElement("span",null,"\u{1F441}"),Dt.createElement(TF,null,"Previewing as ",c),Dt.createElement(IF,{onClick:f},"Exit preview")),D||$?Dt.createElement(Xc,{label:D?"Loading...":"Loading review..."}):I?Dt.createElement(Yx,null):Dt.createElement(VW,null,Dt.createElement(GW,null,"\u2699"),Dt.createElement(qW,null,i?"Connection issue":`Set up ${Ft.NAME}`),Dt.createElement(YW,null,i?"Session expired or dashboard unreachable. Please reconnect.":"Connect your account and select a project to start reviewing your components against Figma designs."),Dt.createElement(Yt,{onClick:()=>p(!0)},i?"Reconnect":"Open Settings")),g&&Dt.createElement(JC,{onClose:()=>p(!1)}))};import EF,{useCallback as KW}from"react";import{useStorybookApi as XW}from"storybook/manager-api";import{IconButton as QW}from"storybook/internal/components";var JW="uireview",ZW=`${JW}/panel`,AF=()=>{let e=XW(),t=KW(()=>{e.togglePanel(!0),e.setSelectedPanel(ZW)},[e]);return EF.createElement(QW,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:t},EF.createElement(dF,null))};Ce();import Gt,{useState as Na,useCallback as BF,useEffect as ey}from"react";import{styled as fo,useTheme as uV}from"storybook/theming";import{addons as au}from"storybook/manager-api";je();Oe();import{addons as iV,experimental_getStatusStore as su}from"storybook/manager-api";async function PF(e,t,n,r){let o=new Array(e.length),i=0;async function s(){for(;i<e.length&&!r();){let a=i++;try{let u=await e[a]();o[a]=u,r()||n(a,u)}catch(u){o[a]=u,r()||n(a,u)}}}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>s())),o}je();Oe();var eV=V(),tV="uireview/badge";async function nV(e,t,n=3){for(let r=0;r<=n;r++){let o=await fetch(e,t);if(o.status!==429||r===n)return o;let i=Math.pow(2,r)*1e3;y.warn(`[reviewAll] Rate limited, retrying in ${i}ms`),await new Promise(s=>setTimeout(s,i))}throw new Error("Max retries exceeded")}async function rV(e,t){let n=new TextDecoder,r="",o=null,i=0,s=0,a=0,u=0,c=0,l=0;for(;;){let{done:d,value:g}=await e.read();if(d)break;if(t()){e.cancel();break}r+=n.decode(g,{stream:!0});let p=r.split(`
|
|
219
|
+
`);r=p.pop()||"";for(let f of p)if(f.startsWith("data: "))try{let k=JSON.parse(f.slice(6));if(k.type==="complete"){o=k.complianceScore??k.validation?.complianceScore??null;let E=(k.issues||[]).filter(I=>!I.dismissed);i=E.filter(I=>I.severity==="critical").length,s=E.filter(I=>I.severity==="major").length,a=E.filter(I=>I.severity==="minor").length,u=k.costUsd||0,c=k.inputTokens||0,l=k.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:s,minorCount:a,costUsd:u,inputTokens:c,outputTokens:l}}function iu(e,t,n,r,o){e&&e.set([{value:n,typeId:tV,storyId:t,title:r,description:o}])}async function oV(e){let t=window.location.origin;try{let n=await fetch(`${t}/__uicopilot/capture?storyId=${encodeURIComponent(e)}`);if(n.ok){let r=await n.json();return{screenshot:r.screenshot||void 0,computedStyles:r.computedStyles||void 0,domTree:r.domTree||void 0}}}catch{}try{let n=await fetch(`${t}/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(n.ok)return{screenshot:(await n.json()).screenshot||void 0}}catch{}return{}}async function LF(e,t,n,r,o,i){iu(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{console.warn(`[reviewAll] Capturing for: ${e.storyName} (${e.storyId})`);let s=await oV(e.storyId);console.warn(`[reviewAll] Captured: screenshot=${!!s.screenshot} domTree=${!!s.domTree} styles=${!!s.computedStyles} for: ${e.storyName}`);let a=await nV(`${eV}/api/review/stream`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({projectId:n,storyId:e.storyId,storyName:e.storyName,storybookScreenshot:s.screenshot,computedStyles:s.computedStyles,domTree:s.domTree,aiModels:[r]})});if(console.warn(`[reviewAll] API response for ${e.storyName}: HTTP ${a.status}`),!a.ok)throw new Error(`HTTP ${a.status}`);let u=a.body?.getReader();if(!u)throw new Error("No response body");let c=await rV(u,i),{score:l,criticalCount:d,majorCount:g,minorCount:p,costUsd:f,inputTokens:k,outputTokens:T}=c;if(l!==null){let E=d>0||l<70?"status-value:error":g>0||l<90?"status-value:warning":"status-value:success",I=[`Score: ${l}`];d>0&&I.push(`${d} critical`),g>0&&I.push(`${g} major`),p>0&&I.push(`${p} minor`);let D=l>=90?`\u2713 Score ${l}`:l>=70?`\u26A0 Score ${l}`:`\u2717 Score ${l}`;return iu(o,e.storyId,E,D,I.join(" \xB7 ")),{passed:l>=70,score:l,costUsd:f,inputTokens:k,outputTokens:T}}return iu(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}catch(s){y.error(`[reviewAll] Failed to review ${e.storyName}:`,s);let a=s instanceof Error?s.message:"Unknown error";return iu(o,e.storyId,"status-value:error","Review Failed",a),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var sV=V(),Da="uireview/badge";function MF(){let e=!1,t=!1;try{let n=iV.getChannel();n.on(Jx,async()=>{if(!t){t=!0,e=!1;try{await cV(n,()=>e)}finally{t=!1}}}),n.on(Zx,()=>{e=!0})}catch{}}async function Qx(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let n=await fetch(`${sV}/api/mappings?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)return[];let i=((await n.json()).mappings||[]).filter(s=>s.figmaNodeId).map(s=>{let a=s;return{storyId:a.storyId,storyName:a.name||a.storyId,figmaNodeId:a.figmaNodeId}});return aV(i),i}catch(e){return y.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function aV(e){try{if(typeof su!="function")return;let t=su(Da);if(!t)return;let n=t.getAll?.()||{},r=new Set(e.map(s=>s.storyId)),o=Object.keys(n).filter(s=>n[s]?.[Da]&&!r.has(s));o.length>0&&t.unset(o);let i=e.filter(s=>{let a=n[s.storyId]?.[Da];return!(a?.value==="status-value:success"||a?.value==="status-value:warning"||a?.value==="status-value:error")}).map(s=>({value:"status-value:pending",typeId:Da,storyId:s.storyId,title:"Mapped to Figma",description:"Ready for UI review \u2014 click Run to start"}));i.length>0&&t.set(i)}catch{}}function lV(){try{let e=localStorage.getItem("uicopilot_review_all_concurrency");if(e)return Math.max(1,Math.min(5,parseInt(e,10)))}catch{}return 3}async function cV(e,t){let n=await Qx();if(n.length===0){e.emit(za,{total:0,passed:0,failed:0});return}let r=localStorage.getItem("uicopilot_session_token"),o=localStorage.getItem("uicopilot_selected_project_id");if(!r||!o)return;let i="claude-sonnet-4-6";try{let k=localStorage.getItem("uicopilot_selected_models");if(k){let T=JSON.parse(k);Array.isArray(T)&&T.length>0&&(i=T[0])}}catch{}let s=null;try{typeof su=="function"&&(s=su(Da))}catch{}let a=lV(),u=0,c=0,l=0,d=0,g=0,p=0;e.emit(Ra,{total:n.length,completed:0,currentStoryName:n[0]?.storyName||""});let f=n.map(k=>()=>LF(k,r,o,i,s,t));await PF(f,a,(k,T)=>{if(T&&typeof T=="object"&&"score"in T){let E=T;E.score!==null&&E.score>=90?u++:E.score!==null&&E.score>=70?c++:l++,d+=E.costUsd||0,g+=E.inputTokens||0,p+=E.outputTokens||0}else l++;console.warn(`[reviewAll] Story ${k+1}/${n.length} done:`,n[k].storyName,T),e.emit(Ra,{total:n.length,completed:u+c+l,currentStoryName:n[k].storyName})},t),e.emit(za,{total:n.length,passed:u,failed:l,warnCount:c,costUsd:d,inputTokens:g,outputTokens:p})}var pV=fo.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),dV=fo.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),gV=fo.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),DF=fo.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),RF=fo.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}})),fV=fo.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),mV=fo.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),zF=fo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),ls=fo.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),Jx="uireview/review-all-start",Zx="uireview/review-all-cancel",Ra="uireview/review-all-progress",za="uireview/review-all-complete";function NF(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableParallelReview:!1}catch{return!1}}var OF=()=>{let[e,t]=Na(!1),[n,r]=Na(null),[o,i]=Na(null),[s,a]=Na(null),[u,c]=Na(NF);ey(()=>{let f=()=>c(NF()),k=setInterval(f,2e3);return window.addEventListener("storage",f),()=>{clearInterval(k),window.removeEventListener("storage",f)}},[]),ey(()=>{let f=()=>{Qx().then(I=>{a(I.length)}).catch(()=>{})},k=setTimeout(f,3e3),T=null;try{T=au.getChannel(),T.on("storyChanged",f),T.on("uireview/mappings-changed",f)}catch{}let E=setInterval(f,6e4);return()=>{clearTimeout(k),clearInterval(E),T&&(T.off("storyChanged",f),T.off("uireview/mappings-changed",f))}},[]),ey(()=>{let f;try{f=au.getChannel()}catch{return}let k=E=>{r(E),t(!0)},T=E=>{t(!1),r(null),i({total:E.total,passed:E.passed,failed:E.failed,warned:E.warnCount||0,costUsd:E.costUsd||0})};return f.on(Ra,k),f.on(za,T),()=>{f.off(Ra,k),f.off(za,T)}},[]);let l=BF(()=>{try{au.getChannel().emit(Jx),t(!0),i(null)}catch{}},[]),d=BF(()=>{try{au.getChannel().emit(Zx)}catch{}t(!1),r(null)},[]),g=n?Math.round(n.completed/n.total*100):0,p=uV();return u?Gt.createElement(pV,null,Gt.createElement(dV,null,Gt.createElement(gV,null,"UI Review"),e?Gt.createElement(RF,{running:!0,onClick:d},"Cancel"):Gt.createElement(RF,{onClick:l,disabled:!s||s===0},"Run",s?` (${s})`:"")),!e&&o?Gt.createElement(Gt.Fragment,null,Gt.createElement(zF,null,Gt.createElement(ls,{dotColor:p.color.positive},"Pass (",o.passed,")"),Gt.createElement(ls,{dotColor:p.color.warning},"Warn (",o.warned,")"),Gt.createElement(ls,{dotColor:p.color.negative},"Fail (",o.failed,")")),o.costUsd>0&&Gt.createElement(DF,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:Gt.createElement(zF,null,Gt.createElement(ls,{dotColor:p.color.positive},"Pass"),Gt.createElement(ls,{dotColor:p.color.warning},"Warn"),Gt.createElement(ls,{dotColor:p.color.negative},"Fail")),e&&n&&Gt.createElement(Gt.Fragment,null,Gt.createElement(fV,null,Gt.createElement(mV,{percent:g})),Gt.createElement(DF,null,"Reviewing ",Math.min(n.completed+1,n.total),"/",n.total," \u2014 ",n.currentStoryName))):null};import*as $F from"@sentry/react";var hV="https://015e961f5f626bad5315430e02940616@o138219.ingest.us.sentry.io/4511134750539776",_F=!1;function xV(){if(typeof window>"u")return"production";let e=window.location.hostname;return/^(localhost|127\.0\.0\.1|0\.0\.0\.0)$/i.test(e)?"localhost":"production"}function UF(){if(!_F){_F=!0;try{$F.init({dsn:hV,environment:xV(),release:`uicopilot-addon@${process.env.npm_package_version||"unknown"}`,tracesSampleRate:0,enabled:!0,beforeSend(e){return e.tags={...e.tags,component:"storybook-addon"},e}})}catch{}}}UF();var cu="uireview",bV=`${cu}/panel`,SV=`${cu}/tool`,jF=`${cu}/test-provider`;lu.register(cu,()=>{if(console.log("[UI Review] Registering addon, checking for StatusStore API..."),typeof ny=="function"){console.log("[UI Review] StatusStore API available, initializing badges");let t=ny("uireview/badge");Rv(t);let n=ny("uireview/mapped");Ov(n),console.log("[UI Review] Badge listener initialized")}else console.warn("[UI Review] experimental_getStatusStore not available \u2014 badges disabled");lu.add(SV,{type:ty.TOOL,title:"UI Review",match:({viewMode:t})=>t==="story",render:()=>Oa.createElement(AF,null)}),MF(),(()=>{try{let t=localStorage.getItem("uicopilot_feature_flags");return t?!!JSON.parse(t).enableParallelReview:!1}catch{return!1}})()&&lu.add(jF,{type:ty.experimental_TEST_PROVIDER,id:jF,render:()=>Oa.createElement(OF,null)}),lu.add(bV,{type:ty.PANEL,title:"UI Review",match:({viewMode:t})=>t==="story",render:({active:t})=>Oa.createElement(yV,{active:t||!1},Oa.createElement(zf,null,Oa.createElement(FF,null)))})});
|
|
220
220
|
/*! Bundled license information:
|
|
221
221
|
|
|
222
222
|
@noble/hashes/utils.js:
|