@uicopilot/storybook-addon 0.5.0 → 0.5.3
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 +87 -65
- package/package.json +10 -4
package/dist/manager.mjs
CHANGED
|
@@ -1,36 +1,47 @@
|
|
|
1
|
-
var o1=Object.create;var fa=Object.defineProperty;var i1=Object.getOwnPropertyDescriptor;var s1=Object.getOwnPropertyNames;var a1=Object.getPrototypeOf,l1=Object.prototype.hasOwnProperty;var c1=(e,t,n)=>t in e?fa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var on=(e,t)=>()=>(e&&(t=e(e=0)),t);var Un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{for(var n in t)fa(e,n,{get:t[n],enumerable:!0})},u1=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s1(t))!l1.call(e,o)&&o!==n&&fa(e,o,{get:()=>t[o],enumerable:!(r=i1(t,o))||r.enumerable});return e};var ga=(e,t,n)=>(n=e!=null?o1(a1(e)):{},u1(t||!e||!e.__esModule?fa(n,"default",{value:e,enumerable:!0}):n,e));var jn=(e,t,n)=>c1(e,typeof t!="symbol"?t+"":t,n);function lh(){try{return typeof window<"u"&&localStorage.getItem(g1)==="true"}catch{return!1}}var g1,b,Me=on(()=>{"use strict";g1="uicopilot:debug";b={debug:(...e)=>{lh()&&console.log(...e)},info:(...e)=>{lh()&&console.info(...e)},warn:(...e)=>console.warn(...e),error:(...e)=>console.error(...e)}});import m1,{createContext as h1,useContext as x1,useReducer as y1,useMemo as ch}from"react";function b1(e,t){switch(t.type){case"SET_STATE":return{...e,...t.payload};case"RESET_AUTH":return typeof localStorage<"u"&&(localStorage.removeItem("uicopilot_session_token"),localStorage.removeItem("uicopilot_api_key")),b.debug("[AuthContext] resetAuth: Cleared localStorage"),{...e,isConnected:!1,sessionToken:null,apiKey:"",authMethod:"oauth",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null};default:return e}}function Lc({children:e}){let[t,n]=y1(b1,k1),r=ch(()=>({setIsConnected:i=>n({type:"SET_STATE",payload:{isConnected:i}}),setSessionToken:i=>{b.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}})},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=ch(()=>({...t,...r}),[t,r]);return m1.createElement(ph.Provider,{value:o},e)}function Ie(){let e=x1(ph);if(!e)throw new Error("useAuthStore must be used within an AuthProvider");return e}var S1,w1,v1,uh,k1,ph,Mc=on(()=>{"use strict";Me();S1=()=>{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"))};S1();w1=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_session_token"),v1=()=>typeof localStorage>"u"?"":localStorage.getItem("uicopilot_api_key")||"",uh=w1(),k1={isConnected:!!uh,sessionToken:uh,apiKey:v1(),authMethod:"oauth",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null},ph=h1(null)});import C1,{createContext as T1,useContext as I1,useReducer as F1,useMemo as dh,useRef as E1,useEffect as A1}from"react";function P1(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 Bc({children:e}){let[t,n]=F1(P1,M1),r=E1(t);A1(()=>{r.current=t},[t]);let o=dh(()=>({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=dh(()=>({...t,...o}),[t,o]);return C1.createElement(fh.Provider,{value:i},e)}function Qe(){let e=I1(fh);if(!e)throw new Error("useProjectStore must be used within a ProjectProvider");return e}var L1,M1,fh,Dc=on(()=>{"use strict";L1=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_selected_project_id"),M1={projects:[],selectedProjectId:L1(),loadingProjects:!1,currentStorybookPath:null},fh=T1(null)});import B1,{createContext as D1,useContext as R1,useReducer as z1,useMemo as gh}from"react";function N1(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>mh)for(let o of r.slice(0,r.length-mh))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 Rc({children:e}){let[t,n]=z1(N1,O1),r=gh(()=>({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}})},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=gh(()=>({...t,...r}),[t,r]);return B1.createElement(hh.Provider,{value:o},e)}function Ye(){let e=R1(hh);if(!e)throw new Error("useFigmaStore must be used within a FigmaProvider");return e}var mh,O1,hh,zc=on(()=>{"use strict";mh=200;O1={showComponentBrowser:!1,figmaFileUrl:"",currentStoryId:null,currentStoryName:"",currentMapping:null,mappingsRefreshKey:0,reviewFigmaUrl:"",mappingSource:null,loadingMapping:!1,showFigmaQuality:!1,framesCache:null,isLoadingFrames:!1,variantThumbnailsCache:{}},hh=D1(null)});function Vn(e){try{let t=JSON.stringify(e,_1);sessionStorage.setItem(Nc,t)}catch(t){b.error("[SessionStorage] Failed to save review history:",t)}}function xh(){try{let e=sessionStorage.getItem(Nc);if(!e)return[];let t=JSON.parse(e,$1);return Array.isArray(t)?t:[]}catch(e){return b.error("[SessionStorage] Failed to load review history:",e),[]}}function yh(){try{sessionStorage.removeItem(Nc),b.debug("[SessionStorage] Review history cleared")}catch(e){b.error("[SessionStorage] Failed to clear review history:",e)}}function _1(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function $1(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var Nc,bh=on(()=>{"use strict";Me();Nc="uicopilot_review_history"});import U1,{createContext as j1,useContext as H1,useReducer as W1,useMemo as Sh,useRef as V1,useEffect as G1}from"react";function q1(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={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:e.fullPrompt||void 0,aiResponse:e.fullResponse||void 0,costUsd:t.payload.costUsd,inputTokens:t.payload.inputTokens,outputTokens:t.payload.outputTokens},r=e.reviewHistory.findIndex(i=>i.id===t.payload.id),o;return r>=0?o=e.reviewHistory.map((i,s)=>s===r?n:i):o=[...e.reviewHistory,n],Vn(o),{...e,reviewResults:t.payload,reviewHistory:o,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=[...e.reviewHistory,...r];return Vn(o),{...e,reviewHistory:o}}case"ADD_REVIEW":{let n=[...e.reviewHistory,t.payload];return Vn(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 Vn(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 Vn(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 Vn(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 Vn(r),{...e,reviewHistory:r}}case"DISMISS_ISSUE":{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,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:o)});return Vn(n),{...e,reviewHistory:n}}case"UNDISMISS_ISSUE":{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,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:o)});return Vn(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(l=>!l.dismissed),i=o.filter(l=>l.severity==="critical").length,s=o.filter(l=>l.severity==="major").length,u=o.filter(l=>l.severity==="minor").length*1+s*5+i*25,c=Math.max(0,100-u);return b.debug(`[recalculateScore] Active: ${o.length}, score: ${c}`),{...r,complianceScore:c,issuesCount:o.length}});return Vn(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 Vn(n),{...e,reviewHistory:n}}case"CLEAR_ALL_REVIEWS":return yh(),{...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 Oc({children:e}){let[t,n]=W1(q1,X1),r=V1(t);G1(()=>{r.current=t},[t]);let o=Sh(()=>({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=Sh(()=>({...t,...o}),[t,o]);return U1.createElement(wh.Provider,{value:i},e)}function se(){let e=H1(wh);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var Y1,K1,X1,wh,_c=on(()=>{"use strict";bh();Me();Y1=()=>{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},K1=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},X1={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:xh(),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:"beta",roleOverride:K1(),featureFlags:{enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},reviewAllConcurrency:Y1(),hoveredIssueId:null},wh=j1(null)});import qi,{useMemo as Q1}from"react";function Uc({children:e}){return qi.createElement(Lc,null,qi.createElement(Bc,null,qi.createElement(Rc,null,qi.createElement(Oc,null,qi.createElement(J1,null),e))))}function vh(e){let t=Ie(),n=Qe(),r=Ye(),o=se(),i=Q1(()=>({...t,...n,...r,...o}),[t,n,r,o]);return e?e(i):i}function J1(){return $c=vh(),null}var $c,at,kh=on(()=>{"use strict";Mc();Dc();zc();_c();$c=null,at=Object.assign(vh,{getState:()=>{if(!$c)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return $c}})});var ke=on(()=>{"use strict";kh();Mc();Dc();zc();_c()});function G(){return(process.env.STORYBOOK_UICOPILOT_URL||Z1).replace(/\/$/,"")}var Z1,Ch,Re=on(()=>{"use strict";Z1="https://uicopilot-dashboard.vercel.app",Ch=3.6});async function ne(e,t,n=1e4){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 nt=on(()=>{"use strict"});import{useEffect as Ji,useState as ba,useRef as MT,useCallback as Hc}from"react";import{addons as Wc}from"storybook/manager-api";function BT(e,t,n){try{sessionStorage.setItem(`${Sa}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:n,timestamp:Date.now()}))}catch{}}function DT(e,t){try{let n=sessionStorage.getItem(`${Sa}${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(`${Sa}${e}`)}catch{}return null}function RT(e){try{let t=sessionStorage.getItem(`${Sa}${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 Dh,Rh,zh,Oh,Zo,Nh,Gn,Vc,Sa,_h,Eo,Zi=on(()=>{"use strict";ke();Gc();Me();Re();nt();Dh="storyArgsUpdated",Rh="storyRendered",zh="forceRemount",Oh=null,Zo=()=>Oh,Nh=G(),Gn=new Map,Vc=null,Sa="uicopilot-figma-image-";_h=(e,t,n)=>{Vc=t;let r=Gn.get(e);r?r.figmaImageUrl=n:Gn.set(e,{storybookImageUrl:null,figmaImageUrl:n}),b.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:n.substring(0,50)+"..."})},Eo=()=>{let[e,t]=ba(!1),[n,r]=ba(!1),[o,i]=ba(!1),[s,a]=ba(null),u=MT(null),{screenshotRefreshKey:c,triggerScreenshotRefresh:l}=se(),p=Hc(()=>{let R=at.getState().currentStoryId;R&&(b.debug("[useReviewScreenshots] Refreshing screenshots for story:",R),Gn.delete(R),u.current=null,i(!0),l())},[l]),f=Hc(()=>{let R=at.getState().currentStoryId;if(R){b.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",R);let O=Gn.get(R);O&&(O.storybookImageUrl=null),u.current=null,i(!0),l()}},[l]),{sessionToken:d}=Ie(),{selectedProjectId:m}=Qe(),{currentStoryId:S,currentMapping:T}=Ye(),{setStorybookImageUrl:F,setFigmaImageUrl:k}=se();Ji(()=>{if(!S||at.getState().figmaImageUrl)return;let O=RT(S);O&&(b.debug("[useReviewScreenshots] Quick-restored Figma image for:",S),k(O))},[S,k]),Ji(()=>{(async()=>{if(!d||!m||!S){b.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}let O=at.getState();if(O.storybookImageUrl&&O.figmaImageUrl){b.debug("[useReviewScreenshots] Screenshots already loaded from persisted review, skipping capture"),u.current=S;return}let E=T?.figmaNodeId??null;if(E!==Vc){b.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",S);let I=Gn.get(S);I&&(I.figmaImageUrl=null),Vc=E,u.current=null}let D=T?.figmaNodeId;if(D&&!Gn.get(S)?.figmaImageUrl){let I=DT(S,D);if(I){b.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",S),k(I);let y=Gn.get(S);y?y.figmaImageUrl=I:Gn.set(S,{storybookImageUrl:null,figmaImageUrl:I})}}let g=Gn.get(S),w=g&&g.storybookImageUrl&&g.figmaImageUrl,v=g&&g.storybookImageUrl&&!g.figmaImageUrl,A=g&&!g.storybookImageUrl&&g.figmaImageUrl;if(w){b.debug("[useReviewScreenshots] Using fully cached screenshots for story:",S),F(g.storybookImageUrl),k(g.figmaImageUrl),u.current=S;return}let h=v&&T?.figmaNodeId;h&&(b.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",S),F(g.storybookImageUrl));let C=A;if(C&&(b.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",S),k(g.figmaImageUrl)),u.current===S&&T?.figmaNodeId){b.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{a(null),h?r(!0):(C||(t(!0),r(!0)),i(!0)),u.current=S;let I=C?g.figmaImageUrl:null,y;if(C)b.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),r(!1);else if(D){b.debug("[useReviewScreenshots] Found Figma node ID from mapping:",D);let L=null;try{b.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let B=await ne(`${Nh}/api/figma/image?projectId=${m}&nodeId=${D}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`}});if(B.ok){let N=await B.json();L=N.imageUrl||null;let x=N.cached?"(cached)":"(fresh)";b.debug(`[useReviewScreenshots] Figma image fetched ${x}:`,L?"success":"not found")}}catch(B){b.warn("[useReviewScreenshots] Failed to fetch Figma image:",B)}if(L)if(L.includes(".blob.vercel-storage.com")){b.debug("[useReviewScreenshots] Using cached Vercel Blob URL directly (fast)"),I=L,k(L);let N=new Image;N.crossOrigin="anonymous",await new Promise(x=>{N.onload=()=>{y={width:N.naturalWidth,height:N.naturalHeight},b.debug("[useReviewScreenshots] Figma dimensions:",y),x()},N.onerror=()=>x(),N.src=L})}else try{b.debug("[useReviewScreenshots] Converting Figma S3 URL to data URL via proxy...");let N=`${Nh}/api/proxy/image?url=${encodeURIComponent(L)}`,x=await ne(N);if(x.ok){let U=await x.blob(),H=new FileReader,M=await new Promise((ee,J)=>{H.onloadend=()=>ee(H.result),H.onerror=J,H.readAsDataURL(U)});I=M,k(M),b.debug("[useReviewScreenshots] Figma thumbnail converted to data URL");let Q=new Image;await new Promise(ee=>{Q.onload=()=>{y={width:Q.naturalWidth,height:Q.naturalHeight},b.debug("[useReviewScreenshots] Figma dimensions:",y),ee()},Q.onerror=()=>ee(),Q.src=M})}else I=L,k(L),b.debug("[useReviewScreenshots] Figma thumbnail loaded (external URL)")}catch(N){b.warn("[useReviewScreenshots] Failed to convert to data URL, using external URL:",N),I=L,k(L)}else b.warn("[useReviewScreenshots] No thumbnail found for node:",D),k(null);I&&D&&BT(S,D,I),r(!1)}else b.debug("[useReviewScreenshots] No Figma mapping exists for this component"),k(null),r(!1);let P=g?.storybookImageUrl||null;if(P)b.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{b.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",S);let L=await wa({storyId:S,sessionToken:d||void 0,...y&&{figmaWidth:y.width,figmaHeight:y.height}});L?(P=L,F(L),b.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",y||"natural")):b.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}Gn.set(S,{storybookImageUrl:P,figmaImageUrl:I}),b.debug("[useReviewScreenshots] Screenshots cached for story:",S)}catch(I){b.error("[useReviewScreenshots] Error loading screenshots:",I),a(I instanceof Error?I.message:"Failed to load screenshots"),u.current=null,r(!1),i(!1)}finally{t(!1)}})()},[d,m,S,T?.figmaNodeId,c]),Ji(()=>{let R=Wc.getChannel(),O=null,E=D=>{Oh=D.args,b.debug("[useReviewScreenshots] Args updated for story:",D.storyId,"args:",D.args),O&&clearTimeout(O),O=setTimeout(()=>{b.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),p()},500)};return R.on(Dh,E),()=>{R.off(Dh,E),O&&clearTimeout(O)}},[p]),Ji(()=>{let R=Wc.getChannel(),O=!1,E=null,D=()=>{b.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),O=!0,i(!0)},g=()=>{O&&(b.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),E&&clearTimeout(E),E=setTimeout(()=>{O=!1,b.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),f()},500))};return R.on(zh,D),R.on(Rh,g),()=>{R.off(zh,D),R.off(Rh,g),E&&clearTimeout(E)}},[f]),Ji(()=>{let R=Wc.getChannel(),O=async E=>{if(!E?.snapshot?.html){b.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}b.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let D=at.getState().currentStoryId,g=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...E.snapshot,storyId:D})});if(g.ok){let w=await g.json();if(w.screenshot){F(w.screenshot);let v=at.getState().currentStoryId;if(v){let A=Gn.get(v);A?A.storybookImageUrl=w.screenshot:Gn.set(v,{storybookImageUrl:w.screenshot,figmaImageUrl:null})}}}else b.error("[useReviewScreenshots] Snapshot screenshot failed:",await g.text())}catch(D){b.error("[useReviewScreenshots] Snapshot screenshot error:",D)}finally{i(!1)}};return R.on("UICOPILOT/STORY_DOM_MUTATED",O),()=>{R.off("UICOPILOT/STORY_DOM_MUTATED",O)}},[]);let z=Hc((R,O,E)=>{b.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),_h(R,O,E),k(E),r(!1),u.current=R},[k]);return{isLoadingScreenshots:e,isLoadingFigma:n,isLoadingStorybook:o,screenshotError:s,refreshScreenshots:p,refreshStorybookOnly:f,setFigmaImageDirect:z}}});function NT(){return!G().startsWith("http://localhost")}function OT(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 $h(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=OT(o,t,n);return r.set(o,i),i})}async function _T(){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=$h(c,o,r))});let a=Array.from(o.styleSheets);s.querySelectorAll('link[rel="stylesheet"]').forEach(u=>{let c=u.href,l=a.find(p=>p.href===c);if(l)try{let p="";for(let f of Array.from(l.cssRules))p+=f.cssText+`
|
|
2
|
-
`;if(/(?:color|oklch|oklab|lab|lch)\(/.test(p)){let f=s.createElement("style");f.textContent=$h(p,o,r),u.replaceWith(f)}}catch{}})}})).toDataURL("image/png")}function $T(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 UT(e,t){b.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(`${zT}/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 jT(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 HT(e){let t=new URLSearchParams(window.location.search),n=e;if(n||(n=(t.get("path")||"").replace("/story/","").replace("/docs/",""),b.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=Zo();if(!s||Object.keys(s).length===0){let a=t.get("args");a&&(s=jT(a),b.debug("[Screenshot] Parsed args from URL:",s))}if(s&&Object.keys(s).length>0){let a=$T(s);i+=`&args=${a}`,b.debug("[Screenshot] Using URL with current args:",i)}else b.debug("[Screenshot] No current args, using default URL:",i);return i}async function WT(e){try{let t=await fetch(`/__uicopilot/screenshot?storyId=${encodeURIComponent(e)}`);if(t.status===501)return b.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 b.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 wa(e){try{let t=e?.storyId||VT();if(t){let n=await WT(t);if(n)return n}if(!NT()){let n=HT(e?.storyId);return await UT(n,{...e,selector:"#storybook-root > *"})}return b.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await _T()}catch(t){throw b.error("Error capturing screenshot:",t),new Error(`Failed to capture screenshot: ${t instanceof Error?t.message:"Unknown error"}`)}}function VT(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var zT,Gc=on(()=>{"use strict";Re();Zi();Me();nt();zT=G()});function mn(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 vn(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 es(e){return e.split(",").map(n=>n.trim().replace(/['"]/g,""))[0]||e}function Uh(e){let t=e.ownerDocument,r=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let T=r.fontSize||"16px",F=r.fontWeight||"400";if(r.fontFamily.includes("Roboto")){let k=t.fonts.check(`${F} ${T} Roboto`);if(b.debug("[computedStyles] Roboto check:",{cssFamily:r.fontFamily,robotoLoaded:k,fontWeight:F,fontSize:T,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(z=>({family:z.family,status:z.status}))}),k)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,"")),p=["Arial","Helvetica","Helvetica Neue","Times New Roman","Georgia","Courier New","Verdana","Tahoma","Trebuchet MS","sans-serif","serif","monospace"],f=[...new Set([...l,...p])];s.font=`${c} ${u} ${a} monospace`;let d=s.measureText(o).width,m="unknown",S=new Map;for(let T of f){s.font=`${c} ${u} ${a} "${T}", monospace`;let F=s.measureText(o).width;if(S.set(T,F),F!==d){s.font=`${c} ${u} ${a} "${T}"`;let k=s.measureText(o).width;s.font=`${c} ${u} ${a} ${r.fontFamily}`;let z=s.measureText(o).width;if(Math.abs(k-z)<.1){m=T;break}}}return b.debug("[computedStyles] Font detection:",{declared:r.fontFamily,detected:m,declaredFonts:l,fontWidths:Array.from(S.entries()),isIframe:t!==document}),m}var ts=on(()=>{"use strict";Me()});function ei(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 qc(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e);return b.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:mn(n.color),backgroundColor:mn(n.backgroundColor),borderColor:mn(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:Uh(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 Yc(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){b.error("Error extracting declared styles:",r)}return n}var va=on(()=>{"use strict";Me();ts()});function GT(e){let t=[],n=new Set,r=jh.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(jh.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;n.has(i)||t.unshift(e)}return t}function qT(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:ei(r,i),tagName:r,className:i,styles:{fontSize:n.fontSize,fontFamily:es(n.fontFamily),fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:mn(n.color),textAlign:n.textAlign,textTransform:n.textTransform}}}function YT(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 p=`${c.tagName}.${o(c)}`;r.has(p)||(r.add(p),n.push(c),i(c,a+1))}}return i(e,0),n}function KT(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,p=n.borderStyle,f=mn(n.borderColor),d=s?`${l} ${p} ${f}`:"none";return{selector:ei(r,i),className:i,border:d,borderRadius:n.borderRadius,backgroundColor:mn(n.backgroundColor),gap:n.gap}}function ns(){b.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=YT(r,2),i=o.map(KT).filter(a=>a!==null);b.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=GT(r);s=a.map(qT),b.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){b.error("[computedStyles] Error extracting text elements:",a)}return{computed:qc(r),declared:Yc(r,t),markup:r.outerHTML,textElementStyles:s,nestedElementStyles:i}}catch(e){return b.error("Error extracting computed styles:",e),null}}var jh,Hh=on(()=>{"use strict";Me();ts();va();jh=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function Kc(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 QT(e,t,n){if(!(e==="0px"||t==="none"))return`${e} ${t} ${n}`}function JT(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r={},o=mn(n.backgroundColor);vn("backgroundColor",o)||(r.backgroundColor=o);let i=QT(n.borderWidth,n.borderStyle,mn(n.borderColor));i&&(r.border=i),vn("borderRadius",n.borderRadius)||(r.borderRadius=n.borderRadius),vn("boxShadow",n.boxShadow)||(r.boxShadow=n.boxShadow),vn("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 F=e.attributes[T];if(["class","style","id","xmlns","xmlns:xlink"].includes(F.name))continue;let k=F.name.replace(/-([a-z])/g,(R,O)=>O.toUpperCase()),z=F.value.startsWith("rgb")?mn(F.value):F.value;k==="d"&&z.length>100?r[k]=z.substring(0,100)+"...":r[k]=z}let d=n.getPropertyValue("fill"),m=n.getPropertyValue("stroke");if(d&&d!=="none"&&(r.fill=d.startsWith("rgb")?mn(d):d),m&&m!=="none"&&(r.stroke=m.startsWith("rgb")?mn(m):m),["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=XT.includes(e.tagName.toLowerCase());(c||l)&&(r.fontSize=n.fontSize,r.fontFamily=es(n.fontFamily),r.fontWeight=n.fontWeight,r.lineHeight=n.lineHeight,r.color=mn(n.color),vn("letterSpacing",n.letterSpacing)||(r.letterSpacing=n.letterSpacing),vn("textAlign",n.textAlign)||(r.textAlign=n.textAlign)),r.display=n.display;let p=Kc(n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft);vn("padding",p)||(r.padding=p);let f=Kc(n.marginTop,n.marginRight,n.marginBottom,n.marginLeft);return vn("margin",f)||(r.margin=f),vn("gap",n.gap)||(r.gap=n.gap),(n.display==="flex"||n.display==="inline-flex")&&(vn("flexDirection",n.flexDirection)||(r.flexDirection=n.flexDirection),vn("justifyContent",n.justifyContent)||(r.justifyContent=n.justifyContent),vn("alignItems",n.alignItems)||(r.alignItems=n.alignItems)),r.width||(r.width=n.width),r.height||(r.height=n.height),r}function Wh(e){let t=1;for(let n of e.children)t+=Wh(n);return t}function Vh(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,p;for(let S of Array.from(o.childNodes))if(S.nodeType===Node.TEXT_NODE){let T=S.textContent?.trim();if(T){p=T.length>50?T.substring(0,50)+"...":T;break}}let f=s;c?f=`${s}#${c}`:u&&(f=ei(s,u));let d=JT(o),m=[];if(i<t){let S=Array.from(o.children);for(let T of S){let F=T.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(F))continue;let z=(T.ownerDocument.defaultView||window).getComputedStyle(T);z.display==="none"||z.visibility==="hidden"||m.push(n(T,i+1))}}return{selector:f,tagName:s,className:u,id:c,role:l,textContent:p,styles:d,children:m}}b.debug("[computedStyles] Extracting DOM tree with maxDepth:",t);let r=n(e,0);return b.debug("[computedStyles] DOM tree extracted:",{rootSelector:r.selector,childrenCount:r.children.length,totalNodes:Wh(r)}),r}function Xc(e=4){b.debug("[extractStoryDOMTree] Starting DOM tree extraction...");try{let t=document.getElementById("storybook-preview-iframe");if(b.debug("[extractStoryDOMTree] iframe found:",!!t),!t)throw new Error("Storybook preview iframe not found");if(b.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(b.debug("[extractStoryDOMTree] storyRoot found:",!!n),!n)throw new Error("Story root element not found");let r=n.firstElementChild;if(b.debug("[extractStoryDOMTree] componentElement found:",!!r,r?.tagName),!r)throw new Error("Component element not found in story root");let o=Vh(r,e);return b.debug("[extractStoryDOMTree] DOM tree extracted successfully:",{selector:o.selector,childrenCount:o.children.length}),o}catch(t){return b.error("[extractStoryDOMTree] Error extracting DOM tree:",t),null}}var XT,Gh=on(()=>{"use strict";Me();ts();va();XT=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var Qc=on(()=>{"use strict";ts();va();Hh();Gh()});var yx=Un((aW,xx)=>{"use strict";xx.exports={compareTwoStrings:hx,findBestMatch:kI};function hx(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 kI(e,t){if(!CI(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=hx(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 CI(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(n){return typeof n!="string"}))}});var Mx=Un(hu=>{"use strict";var Lx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");hu.encode=function(e){if(0<=e&&e<Lx.length)return Lx[e];throw new TypeError("Must be between 0 and 63: "+e)};hu.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 Nx=Un(yu=>{"use strict";var Bx=Mx(),xu=5,Dx=1<<xu,Rx=Dx-1,zx=Dx;function NI(e){return e<0?(-e<<1)+1:(e<<1)+0}function OI(e){var t=(e&1)===1,n=e>>1;return t?-n:n}yu.encode=function(t){var n="",r,o=NI(t);do r=o&Rx,o>>>=xu,o>0&&(r|=zx),n+=Bx.encode(r);while(o>0);return n};yu.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=Bx.decode(t.charCodeAt(n++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(n-1));a=!!(u&zx),u&=Rx,i=i+(u<<s),s+=xu}while(a);r.value=OI(i),r.rest=n}});var ja=Un(Xt=>{"use strict";function _I(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}Xt.getArg=_I;var Ox=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,$I=/^data:.+\,.+$/;function ps(e){var t=e.match(Ox);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}Xt.urlParse=ps;function ai(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}Xt.urlGenerate=ai;var UI=32;function jI(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>UI&&t.pop(),i}}var bu=jI(function(t){var n=t,r=ps(t);if(r){if(!r.path)return t;n=r.path}for(var o=Xt.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,ai(r)):n});Xt.normalize=bu;function _x(e,t){e===""&&(e="."),t===""&&(t=".");var n=ps(t),r=ps(e);if(r&&(e=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),ai(n);if(n||t.match($I))return t;if(r&&!r.host&&!r.path)return r.host=t,ai(r);var o=t.charAt(0)==="/"?t:bu(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=o,ai(r)):o}Xt.join=_x;Xt.isAbsolute=function(e){return e.charAt(0)==="/"||Ox.test(e)};function HI(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)}Xt.relative=HI;var $x=(function(){var e=Object.create(null);return!("__proto__"in e)})();function Ux(e){return e}function WI(e){return jx(e)?"$"+e:e}Xt.toSetString=$x?Ux:WI;function VI(e){return jx(e)?e.slice(1):e}Xt.fromSetString=$x?Ux:VI;function jx(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 GI(e,t,n){var r=Rr(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:Rr(e.name,t.name)}Xt.compareByOriginalPositions=GI;function qI(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:Rr(e.name,t.name)}Xt.compareByOriginalPositionsNoSource=qI;function YI(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=Rr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Rr(e.name,t.name)}Xt.compareByGeneratedPositionsDeflated=YI;function KI(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=Rr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:Rr(e.name,t.name)}Xt.compareByGeneratedPositionsDeflatedNoLine=KI;function Rr(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function XI(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=Rr(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:Rr(e.name,t.name)}Xt.compareByGeneratedPositionsInflated=XI;function QI(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}Xt.parseSourceMapInput=QI;function JI(e,t,n){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),n){var r=ps(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=_x(ai(r),t)}return bu(t)}Xt.computeSourceURL=JI});var Wx=Un(Hx=>{"use strict";var Su=ja(),wu=Object.prototype.hasOwnProperty,Bo=typeof Map<"u";function zr(){this._array=[],this._set=Bo?new Map:Object.create(null)}zr.fromArray=function(t,n){for(var r=new zr,o=0,i=t.length;o<i;o++)r.add(t[o],n);return r};zr.prototype.size=function(){return Bo?this._set.size:Object.getOwnPropertyNames(this._set).length};zr.prototype.add=function(t,n){var r=Bo?t:Su.toSetString(t),o=Bo?this.has(t):wu.call(this._set,r),i=this._array.length;(!o||n)&&this._array.push(t),o||(Bo?this._set.set(t,i):this._set[r]=i)};zr.prototype.has=function(t){if(Bo)return this._set.has(t);var n=Su.toSetString(t);return wu.call(this._set,n)};zr.prototype.indexOf=function(t){if(Bo){var n=this._set.get(t);if(n>=0)return n}else{var r=Su.toSetString(t);if(wu.call(this._set,r))return this._set[r]}throw new Error('"'+t+'" is not in the set.')};zr.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};zr.prototype.toArray=function(){return this._array.slice()};Hx.ArraySet=zr});var qx=Un(Gx=>{"use strict";var Vx=ja();function ZI(e,t){var n=e.generatedLine,r=t.generatedLine,o=e.generatedColumn,i=t.generatedColumn;return r>n||r==n&&i>=o||Vx.compareByGeneratedPositionsInflated(e,t)<=0}function Ha(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}Ha.prototype.unsortedForEach=function(t,n){this._array.forEach(t,n)};Ha.prototype.add=function(t){ZI(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};Ha.prototype.toArray=function(){return this._sorted||(this._array.sort(Vx.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Gx.MappingList=Ha});var Kx=Un(Yx=>{"use strict";var ds=Nx(),Bt=ja(),Wa=Wx().ArraySet,eF=qx().MappingList;function Qn(e){e||(e={}),this._file=Bt.getArg(e,"file",null),this._sourceRoot=Bt.getArg(e,"sourceRoot",null),this._skipValidation=Bt.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=Bt.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Wa,this._names=new Wa,this._mappings=new eF,this._sourcesContents=null}Qn.prototype._version=3;Qn.fromSourceMap=function(t,n){var r=t.sourceRoot,o=new Qn(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=Bt.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=Bt.relative(r,i)),o._sources.has(s)||o._sources.add(s);var a=t.sourceContentFor(i);a!=null&&o.setSourceContent(i,a)}),o};Qn.prototype.addMapping=function(t){var n=Bt.getArg(t,"generated"),r=Bt.getArg(t,"original",null),o=Bt.getArg(t,"source",null),i=Bt.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}))};Qn.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot!=null&&(r=Bt.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Bt.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[Bt.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};Qn.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=Bt.relative(i,o));var s=new Wa,a=new Wa;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=Bt.join(r,u.source)),i!=null&&(u.source=Bt.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 p=u.name;p!=null&&!a.has(p)&&a.add(p)},this),this._sources=s,this._names=a,t.sources.forEach(function(u){var c=t.sourceContentFor(u);c!=null&&(r!=null&&(u=Bt.join(r,u)),i!=null&&(u=Bt.relative(i,u)),this.setSourceContent(u,c))},this)};Qn.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)}};Qn.prototype._serializeMappings=function(){for(var t=0,n=1,r=0,o=0,i=0,s=0,a="",u,c,l,p,f=this._mappings.toArray(),d=0,m=f.length;d<m;d++){if(c=f[d],u="",c.generatedLine!==n)for(t=0;c.generatedLine!==n;)u+=";",n++;else if(d>0){if(!Bt.compareByGeneratedPositionsInflated(c,f[d-1]))continue;u+=","}u+=ds.encode(c.generatedColumn-t),t=c.generatedColumn,c.source!=null&&(p=this._sources.indexOf(c.source),u+=ds.encode(p-s),s=p,u+=ds.encode(c.originalLine-1-o),o=c.originalLine-1,u+=ds.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(l=this._names.indexOf(c.name),u+=ds.encode(l-i),i=l)),a+=u}return a};Qn.prototype._generateSourcesContent=function(t,n){return t.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=Bt.relative(n,r));var o=Bt.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};Qn.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};Qn.prototype.toString=function(){return JSON.stringify(this.toJSON())};Yx.SourceMapGenerator=Qn});var qw=Un((zee,Gw)=>{"use strict";var jw=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,rO=/\n/g,oO=/^\s*/,iO=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,sO=/^:\s*/,aO=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,lO=/^[;\s]*/,cO=/^\s+|\s+$/g,uO=`
|
|
3
|
-
`,Hw="/",Ww="*",Wo="",pO="comment",dO="declaration";function fO(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(m){var S=m.match(rO);S&&(n+=S.length);var T=m.lastIndexOf(uO);r=~T?m.length-T:r+m.length}function i(){var m={line:n,column:r};return function(S){return S.position=new s(m),c(),S}}function s(m){this.start=m,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(m){var S=new Error(t.source+":"+n+":"+r+": "+m);if(S.reason=m,S.filename=t.source,S.line=n,S.column=r,S.source=e,!t.silent)throw S}function u(m){var S=m.exec(e);if(S){var T=S[0];return o(T),e=e.slice(T.length),S}}function c(){u(oO)}function l(m){var S;for(m=m||[];S=p();)S!==!1&&m.push(S);return m}function p(){var m=i();if(!(Hw!=e.charAt(0)||Ww!=e.charAt(1))){for(var S=2;Wo!=e.charAt(S)&&(Ww!=e.charAt(S)||Hw!=e.charAt(S+1));)++S;if(S+=2,Wo===e.charAt(S-1))return a("End of comment missing");var T=e.slice(2,S-2);return r+=2,o(T),e=e.slice(S),r+=2,m({type:pO,comment:T})}}function f(){var m=i(),S=u(iO);if(S){if(p(),!u(sO))return a("property missing ':'");var T=u(aO),F=m({type:dO,property:Vw(S[0].replace(jw,Wo)),value:T?Vw(T[0].replace(jw,Wo)):Wo});return u(lO),F}}function d(){var m=[];l(m);for(var S;S=f();)S!==!1&&(m.push(S),l(m));return m}return c(),d()}function Vw(e){return e?e.replace(cO,Wo):Wo}Gw.exports=fO});var Yw=Un(Ws=>{"use strict";var gO=Ws&&Ws.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.default=hO;var mO=gO(qw());function hO(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,mO.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 Xw=Un(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.camelCase=void 0;var xO=/^--[a-zA-Z0-9_-]+$/,yO=/-([a-z])/g,bO=/^[^-]+$/,SO=/^-(webkit|moz|ms|o|khtml)-/,wO=/^-(ms)-/,vO=function(e){return!e||bO.test(e)||xO.test(e)},kO=function(e,t){return t.toUpperCase()},Kw=function(e,t){return"".concat(t,"-")},CO=function(e,t){return t===void 0&&(t={}),vO(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(wO,Kw):e=e.replace(SO,Kw),e.replace(yO,kO))};Ul.camelCase=CO});var Jw=Un((Lg,Qw)=>{"use strict";var TO=Lg&&Lg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},IO=TO(Yw()),FO=Xw();function Pg(e,t){var n={};return!e||typeof e!="string"||(0,IO.default)(e,function(r,o){r&&o&&(n[(0,FO.camelCase)(r,t)]=o)}),n}Pg.default=Pg;Qw.exports=Pg});var Tk=Un((pse,Ck)=>{"use strict";var uc=Object.prototype.hasOwnProperty,kk=Object.prototype.toString,xk=Object.defineProperty,yk=Object.getOwnPropertyDescriptor,bk=function(t){return typeof Array.isArray=="function"?Array.isArray(t):kk.call(t)==="[object Array]"},Sk=function(t){if(!t||kk.call(t)!=="[object Object]")return!1;var n=uc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&uc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||uc.call(t,o)},wk=function(t,n){xk&&n.name==="__proto__"?xk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},vk=function(t,n){if(n==="__proto__")if(uc.call(t,n)){if(yk)return yk(t,n).value}else return;return t[n]};Ck.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=vk(a,n),o=vk(t,n),a!==o&&(l&&o&&(Sk(o)||(i=bk(o)))?(i?(i=!1,s=r&&bk(r)?r:[]):s=r&&Sk(r)?r:{},wk(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&wk(a,{name:n,newValue:o}));return a}});import pa from"react";import{addons as Cc,types as Zm,experimental_getStatusStore as n1}from"storybook/manager-api";import{AddonPanel as hj}from"storybook/internal/components";import Ft,{useState as N6,useEffect as O6}from"react";import{styled as rr}from"storybook/theming";import ah from"react";import{styled as Ct}from"storybook/theming";var ae="#ea580c",Ic="#c2410c",ma="#ff6b35";var th=Ct.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),nh=Ct.div({flex:1,overflow:"auto",padding:"20px"}),To=Ct.div({marginBottom:"20px"}),Io=Ct.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})),Fo=Ct.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`}})),wn=Ct.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"}})),rh=Ct(wn)(({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"}}),Hn=Ct.button(({theme:e})=>({...ha(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),_t=Ct.button(({theme:e})=>({...ha(e),backgroundColor:ae,color:e.color.inverseText,boxShadow:`0 2px 4px ${ae}4d`,"&:hover:not(:disabled)":{backgroundColor:Ic,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${ae}66`}})),Wn=Ct.button(({theme:e})=>({...ha(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),oh=Ct.button(({theme:e})=>({...ha(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),fn=Ct.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"}})),Fc=Ct.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"}})),Xr=Ct.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}})),Qr=Ct(Fo)(({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"})),Cj=Ct.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),ih=Ct.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})),Tj=Ct.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})),Ec=Ct.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})),Ij=Ct.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%)"}}})),sh=Ct.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}}),Fj=Ct.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),Ej=Ct.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),Aj=Ct.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var Ac=({header:e,children:t,footer:n})=>ah.createElement(th,null,e,ah.createElement(nh,null,t),n);import p1 from"react";import{styled as d1}from"storybook/theming";var f1=d1.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})),Pc=({toolbar:e})=>p1.createElement(f1,null,e);import _j from"react";import{styled as xa}from"storybook/theming";var jj=xa.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})),Hj=xa.div({display:"flex",flex:1}),Wj=xa(Xr)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),Vj=xa.div({display:"flex",gap:"8px",alignItems:"center"});import gn,{useState as Ph,useCallback as Lh,useEffect as Mh}from"react";import{styled as Jr}from"storybook/theming";import ut,{useEffect as Th}from"react";import{styled as $t}from"storybook/theming";ke();Re();Me();nt();var eT=$t.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),tT=$t.div(({theme:e})=>({position:"absolute",top:"100%",right:0,marginTop:"8px",backgroundColor:e.background.content,borderRadius:"8px",width:"360px",maxWidth:"90vw",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3)",overflow:"hidden",zIndex:10001})),nT=$t.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),rT=$t.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),oT=$t.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:ae,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),iT=$t.div({display:"flex",gap:"8px"}),Ih=$t(fn)({fontSize:"18px"}),sT=$t.div({padding:"20px 16px"}),aT=$t.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),lT=$t.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),cT=$t.div({fontSize:"28px",fontWeight:700}),uT=$t.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),pT=$t.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),dT=$t.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),fT=$t.div({display:"flex",alignItems:"center",gap:"8px"}),gT=$t.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),mT=$t.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:ae,color:e.color.inverseText})),hT=$t.button(({theme:e})=>({background:"none",border:"none",color:ae,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),xT=$t.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),yT=$t.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"?ae:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),bT=30*1e3,Fh=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=Ie(),{featureFlags:s}=se(),a=s.showCosts,u=r,c=!r&&t,l=async(m=!1)=>{if(!t)return;let S=o&&Date.now()-o<bT;if(!(!m&&S&&r))try{let T=G(),F=await ne(`${T}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(F.ok){let k=await F.json();i(k)}}catch(T){b.error("Failed to fetch usage:",T)}};Th(()=>{l()},[t]),Th(()=>{let m=()=>{document.visibilityState==="visible"&&(b.debug("[TokenUsageModal] Tab visible, refreshing balance..."),l(!0))};return document.addEventListener("visibilitychange",m),()=>document.removeEventListener("visibilitychange",m)},[t]);let p=()=>{n(),e()},f=()=>{let m=G();window.open(`${m}/pricing`,"_blank")},d=()=>{let m=G();window.open(`${m}/pricing#add-credits`,"_blank")};return ut.createElement(ut.Fragment,null,ut.createElement(eT,{onClick:e}),ut.createElement(tT,{onClick:m=>m.stopPropagation()},ut.createElement(nT,null,ut.createElement(rT,null,ut.createElement(oT,null,u?.email?u.email[0].toUpperCase():"U"),ut.createElement("span",null,u?.email||"Loading...")),ut.createElement(iT,null,ut.createElement(Ih,{onClick:p,title:"Sign out"},"\u2192"),ut.createElement(Ih,{onClick:e,title:"Close"},"\xD7"))),ut.createElement(sT,null,c?ut.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?a?ut.createElement(ut.Fragment,null,ut.createElement(aT,null,ut.createElement(lT,null,"Credit Balance"),ut.createElement(cT,null,"$",(u?.creditBalance??0).toFixed(2)),ut.createElement(uT,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),ut.createElement(pT,null,ut.createElement(dT,null,ut.createElement(fT,null,ut.createElement(gT,null,"Current Plan"),ut.createElement(mT,null,u?.plan||"Free")),ut.createElement(hT,{onClick:f},"View detail >")),ut.createElement(xT,null,"~$0.02-0.05 per review depending on complexity"),ut.createElement(yT,{onClick:d,style:{marginTop:"16px"}},"Add Credits"))):ut.createElement("div",{style:{textAlign:"center",padding:"20px",color:"#6b7280",fontSize:"13px"}},"Signed in as ",u?.email||"user"):ut.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};ke();import Qo from"react";import{styled as Eh}from"storybook/theming";Re();ke();nt();Me();var ST=Eh.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),wT=Eh.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),vT={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}},Ah=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=se(),{sessionToken:o}=Ie();return e!=="admin"?null:Qo.createElement(ST,null,Qo.createElement(wT,null,"View as:"),Qo.createElement(rh,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&ne(`${G()}/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=>b.warn("[RoleSwitcher] Failed to re-fetch flags:",c.message));else{n(u);let c=vT[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},Qo.createElement("option",{value:"admin"},"Admin"),Qo.createElement("option",{value:"beta"},"Beta Tester")),t&&Qo.createElement(sh,{variant:"warning"},"Previewing as ",t))};ke();Re();nt();var kT=Jr.div({display:"flex",alignItems:"center"}),Yi=Jr.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),CT=Jr.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),TT=Jr.div({position:"relative"}),IT=Jr.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`}})),FT=Jr.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)"}})),ET=Jr.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)"}}}),AT=Jr.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}})),PT=30*1e3,jc=({onOpenSettings:e})=>{let[t,n]=Ph(!1),[r,o]=Ph(!1),{usageData:i,usageLastFetched:s,setUsageData:a,sessionToken:u}=Ie(),{userRole:c,roleOverride:l,featureFlags:p}=se(),f=l??c;Mh(()=>{(async()=>{if(!(!u||s&&Date.now()-s<PT&&i)){o(!0);try{let z=G(),R=await ne(`${z}/api/addon/account`,{headers:{Authorization:`Bearer ${u}`}});if(R.ok){let O=await R.json();a(O)}}catch(z){console.error("Failed to fetch balance:",z)}finally{o(!1)}}})()},[u,s,i,a]),Mh(()=>{let F=()=>{document.visibilityState==="visible"&&t&&n(!1)},k=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",F),window.addEventListener("focus",k),()=>{document.removeEventListener("visibilitychange",F),window.removeEventListener("focus",k)}},[t]);let d=Lh(()=>{n(!0)},[]),m=Lh(()=>{n(!1)},[]),S=i?.creditBalance??0,T=S<2&&!r;return gn.createElement(kT,null,e&&gn.createElement(Yi,null,gn.createElement(AT,{onClick:e,title:"Settings"},gn.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),u&&c==="admin"&&f==="admin"&&gn.createElement(Yi,null,gn.createElement(Ah,null)),gn.createElement(Yi,null,gn.createElement(CT,null,"v","0.4.1")),u&&p.showCosts&&gn.createElement(Yi,null,gn.createElement(FT,{onClick:d,isLow:T,title:r?"Loading...":i?T?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},r?gn.createElement(ET,null):i?`$${S.toFixed(2)}`:"...")),gn.createElement(Yi,null,gn.createElement(TT,null,gn.createElement(IT,{title:"Account & Usage",onClick:d},i?.email?i.email[0].toUpperCase():"?"),t&&gn.createElement(Fh,{onClose:m}))))};import jr from"react";import{styled as Ai}from"storybook/theming";import It from"react";ke();Me();Re();nt();import{useCallback as Jo,useRef as Bh,useEffect as LT}from"react";var Zr=G();b.debug("[useAuth] Module loaded, APP_URL:",Zr);var Ki=()=>{let e=Bh(null),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setSessionToken:c,setApiKey:l,setAuthMethod:p,setDeviceCode:f,setUserCode:d,setVerificationUri:m,setPollingInterval:S,setAuthError:T,resetAuth:F}=Ie(),k=Bh(null),z=Jo(async()=>{try{b.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let w;try{w=await ne(`${Zr}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(P){let B=P instanceof Error&&P.message.includes("timed out")?`Cannot reach UI Copilot server at ${Zr}. Is the dashboard running?`:`Connection failed: ${Zr} is not responding.`;T(B),b.error("[useAuth]",B);return}if(!w.ok)throw new Error("Failed to create poll code");let{poll_code:v}=await w.json();b.debug("[useAuth] Got poll_code:",v.substring(0,15)+"...");let A=600,h=700,C=window.screenX+(window.outerWidth-A)/2,I=window.screenY+(window.outerHeight-h)/2;window.open(`${Zr}/addon/auth?poll_code=${v}`,"figma-auth",`width=${A},height=${h},left=${C},top=${I}`),b.debug("[useAuth] Starting OAuth poll for token..."),k.current&&clearInterval(k.current);let y=async()=>{try{let L=await(await fetch(`${Zr}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:v})})).json();L.status==="authorized"&&L.session_token?(b.debug("[useAuth] \u2705 OAuth poll successful! Got token."),k.current&&(clearInterval(k.current),k.current=null),localStorage.setItem("uicopilot_session_token",L.session_token),c(L.session_token)):L.status==="expired"&&(b.debug("[useAuth] OAuth poll_code expired"),k.current&&(clearInterval(k.current),k.current=null))}catch(P){b.error("[useAuth] OAuth poll error:",P)}};k.current=setInterval(y,2e3),setTimeout(y,1e3)}catch(w){b.error("[useAuth] OAuth flow error:",w)}},[c]),R=Jo(async()=>{try{let w=await fetch(`${Zr}/api/addon/auth/device`,{method:"POST"});if(!w.ok)throw new Error("Failed to start device code flow");let v=await w.json();f(v.device_code),d(v.user_code),m(v.verification_uri),window.open(v.verification_uri,"_blank"),O(v.device_code,v.interval*1e3)}catch(w){throw b.error("[useAuth] Device code flow error:",w),w}},[f,d,m]),O=Jo((w,v)=>{b.debug("[useAuth] Starting polling. Device code:",w,"Interval:",v),e.current&&clearInterval(e.current);let A=async()=>{try{let C=await(await fetch(`${Zr}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:w})})).json();C.status==="authorized"?(b.debug("[useAuth] Device code authorization successful!"),e.current&&(clearInterval(e.current),e.current=null),f(null),d(null),m(null),localStorage.setItem("uicopilot_session_token",C.session_token),c(C.session_token)):(C.status==="expired"||C.status==="denied")&&(b.debug("[useAuth] Device code expired or denied"),e.current&&(clearInterval(e.current),e.current=null),f(null),d(null),m(null))}catch(h){b.error("[useAuth] Polling error:",h)}};e.current=setInterval(A,v),S(v)},[f,d,m,c,S]),E=Jo(()=>{e.current&&(clearInterval(e.current),e.current=null),f(null),d(null),m(null),S(null)},[f,d,m,S]),D=Jo(w=>{l(w),localStorage.setItem("uicopilot_api_key",w)},[l]),g=Jo(()=>{F(),e.current&&(clearInterval(e.current),e.current=null)},[F]);return LT(()=>()=>{e.current&&clearInterval(e.current),k.current&&clearInterval(k.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setAuthMethod:p,startOAuth:z,startDeviceCode:R,cancelDeviceCode:E,saveApiKey:D,logout:g}};ke();Me();Re();nt();import{useCallback as ya}from"react";var Xi=G(),ir=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Qe(),{sessionToken:a}=Ie(),u=ya(async()=>{if(!a){b.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),b.debug("[useProjects] Fetching from:",`${Xi}/api/projects`);let f=await ne(`${Xi}/api/projects`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`}});if(f.ok){let d=await f.json();b.debug("[useProjects] Projects:",d.projects),r(d.projects||[])}else b.error("[useProjects] Failed to fetch projects:",f.status,f.statusText)}catch(f){b.error("[useProjects] Error fetching projects:",f)}finally{i(!1)}},[a,r,i]),c=ya(async f=>{if(!a)throw new Error("Not authenticated");let d=await ne(`${Xi}/api/projects`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(f)});if(!d.ok)throw new Error("Failed to create project");let m=await d.json();return await u(),m.project},[a,u]),l=ya(async(f,d)=>{if(!a)throw new Error("Not authenticated");let m={};if(d.name!==void 0&&(m.name=d.name),d.description!==void 0&&(m.description=d.description),d.figmaFileUrl!==void 0&&(m.figmaFileId=d.figmaFileUrl||void 0),!(await ne(`${Xi}/api/projects/${f}`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(m)})).ok)throw new Error("Failed to update project");await u()},[a,u]),p=ya(async f=>{if(!a)throw new Error("Not authenticated");if(!(await ne(`${Xi}/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:p}};ke();var Qi=()=>{let{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:p}=Ye();return{showComponentBrowser:e,figmaFileUrl:t,currentMapping:n,mappingSource:r,loadingMapping:o,showFigmaQuality:i,setShowComponentBrowser:s,setFigmaFileUrl:a,setCurrentMapping:u,setMappingSource:c,setLoadingMapping:l,setShowFigmaQuality:p,openComponentBrowser:()=>s(!0),closeComponentBrowser:()=>s(!1)}};ke();Gc();Qc();import{useCallback as Ms,useRef as pf}from"react";Me();function ka(){return new Promise(e=>{let t=document.getElementById("storybook-preview-iframe");if(!t||!t.contentWindow){b.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();b.debug("[iframeReload] Triggering cache-busted reload:",o);let i=setTimeout(()=>{b.warn("[iframeReload] Iframe reload timed out after 5s"),t.removeEventListener("load",s),e()},5e3),s=()=>{clearTimeout(i),t.removeEventListener("load",s),b.debug("[iframeReload] Iframe loaded, waiting for HMR and styles to settle..."),setTimeout(()=>{b.debug("[iframeReload] Iframe reloaded and styles should be fresh"),e()},2e3)};t.addEventListener("load",s),t.contentWindow.location.href=o})}var Ca=BigInt(4294967295),qh=BigInt(32);function ZT(e,t=!1){return t?{h:Number(e&Ca),l:Number(e>>qh&Ca)}:{h:Number(e>>qh&Ca)|0,l:Number(e&Ca)|0}}function Yh(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}=ZT(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var Kh=(e,t,n)=>e<<n|t>>>32-n,Xh=(e,t,n)=>t<<n|e>>>32-n,Qh=(e,t,n)=>t<<n-32|e>>>64-n,Jh=(e,t,n)=>e<<n-32|t>>>64-n;function eI(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Jc(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Ta(e,t,n=""){let r=eI(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 Zc(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 Zh(e,t){Ta(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 ex(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function eu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var tI=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function nI(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function rI(e){for(let t=0;t<e.length;t++)e[t]=nI(e[t]);return e}var tu=tI?e=>e:rI;function tx(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 nx=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var oI=BigInt(0),rs=BigInt(1),iI=BigInt(2),sI=BigInt(7),aI=BigInt(256),lI=BigInt(113),ix=[],sx=[],ax=[];for(let e=0,t=rs,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ix.push(2*(5*r+n)),sx.push((e+1)*(e+2)/2%64);let o=oI;for(let i=0;i<7;i++)t=(t<<rs^(t>>sI)*lI)%aI,t&iI&&(o^=rs<<(rs<<BigInt(i))-rs);ax.push(o)}var lx=Yh(ax,!0),cI=lx[0],uI=lx[1],rx=(e,t,n)=>n>32?Qh(e,t,n):Kh(e,t,n),ox=(e,t,n)=>n>32?Jh(e,t,n):Xh(e,t,n);function pI(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],p=rx(c,l,1)^n[a],f=ox(c,l,1)^n[a+1];for(let d=0;d<50;d+=10)e[s+d]^=p,e[s+d+1]^=f}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=sx[s],u=rx(o,i,a),c=ox(o,i,a),l=ix[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]^=cI[r],e[1]^=uI[r]}eu(n)}var nu=class e{constructor(t,n,r,o=!1,i=24){jn(this,"state");jn(this,"pos",0);jn(this,"posOut",0);jn(this,"finished",!1);jn(this,"state32");jn(this,"destroyed",!1);jn(this,"blockLen");jn(this,"suffix");jn(this,"outputLen");jn(this,"enableXOF",!1);jn(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Jc(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ex(this.state)}clone(){return this._cloneInto()}keccak(){tu(this.state32),pI(this.state32,this.rounds),tu(this.state32),this.posOut=0,this.pos=0}update(t){Zc(this),Ta(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){Zc(this,!1),Ta(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 Jc(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Zh(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,eu(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}},dI=(e,t,n,r={})=>tx(()=>new nu(t,e,n),r);var cx=dI(6,72,64,nx(10));var fI=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ru=Math.ceil,Yn=Math.floor,kn="[BigNumber Error] ",ux=kn+"Number primitive has more than 15 significant digits: ",sr=1e14,ze=14,ou=9007199254740991,iu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],eo=1e7,Yt=1e9;function px(e){var t,n,r,o=k.prototype={constructor:k,toString:null,valueOf:null},i=new k(1),s=20,a=4,u=-7,c=21,l=-1e7,p=1e7,f=!1,d=1,m=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},T="0123456789abcdefghijklmnopqrstuvwxyz",F=!0;function k(g,w){var v,A,h,C,I,y,P,L,B=this;if(!(B instanceof k))return new k(g,w);if(w==null){if(g&&g._isBigNumber===!0){B.s=g.s,!g.c||g.e>p?B.c=B.e=null:g.e<l?B.c=[B.e=0]:(B.e=g.e,B.c=g.c.slice());return}if((y=typeof g=="number")&&g*0==0){if(B.s=1/g<0?(g=-g,-1):1,g===~~g){for(C=0,I=g;I>=10;I/=10,C++);C>p?B.c=B.e=null:(B.e=C,B.c=[g]);return}L=String(g)}else{if(!fI.test(L=String(g)))return r(B,L,y);B.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(C=L.indexOf("."))>-1&&(L=L.replace(".","")),(I=L.search(/e/i))>0?(C<0&&(C=I),C+=+L.slice(I+1),L=L.substring(0,I)):C<0&&(C=L.length)}else{if(Et(w,2,T.length,"Base"),w==10&&F)return B=new k(g),E(B,s+B.e+1,a);if(L=String(g),y=typeof g=="number"){if(g*0!=0)return r(B,L,y,w);if(B.s=1/g<0?(L=L.slice(1),-1):1,k.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(ux+g)}else B.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(v=T.slice(0,w),C=I=0,P=L.length;I<P;I++)if(v.indexOf(A=L.charAt(I))<0){if(A=="."){if(I>C){C=P;continue}}else if(!h&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){h=!0,I=-1,C=0;continue}return r(B,String(g),y,w)}y=!1,L=n(L,w,10,B.s),(C=L.indexOf("."))>-1?L=L.replace(".",""):C=L.length}for(I=0;L.charCodeAt(I)===48;I++);for(P=L.length;L.charCodeAt(--P)===48;);if(L=L.slice(I,++P)){if(P-=I,y&&k.DEBUG&&P>15&&(g>ou||g!==Yn(g)))throw Error(ux+B.s*g);if((C=C-I-1)>p)B.c=B.e=null;else if(C<l)B.c=[B.e=0];else{if(B.e=C,B.c=[],I=(C+1)%ze,C<0&&(I+=ze),I<P){for(I&&B.c.push(+L.slice(0,I)),P-=ze;I<P;)B.c.push(+L.slice(I,I+=ze));I=ze-(L=L.slice(I)).length}else I-=P;for(;I--;L+="0");B.c.push(+L)}}else B.c=[B.e=0]}k.clone=px,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(g){var w,v;if(g!=null)if(typeof g=="object"){if(g.hasOwnProperty(w="DECIMAL_PLACES")&&(v=g[w],Et(v,0,Yt,w),s=v),g.hasOwnProperty(w="ROUNDING_MODE")&&(v=g[w],Et(v,0,8,w),a=v),g.hasOwnProperty(w="EXPONENTIAL_AT")&&(v=g[w],v&&v.pop?(Et(v[0],-Yt,0,w),Et(v[1],0,Yt,w),u=v[0],c=v[1]):(Et(v,-Yt,Yt,w),u=-(c=v<0?-v:v))),g.hasOwnProperty(w="RANGE"))if(v=g[w],v&&v.pop)Et(v[0],-Yt,-1,w),Et(v[1],1,Yt,w),l=v[0],p=v[1];else if(Et(v,-Yt,Yt,w),v)l=-(p=v<0?-v:v);else throw Error(kn+w+" cannot be zero: "+v);if(g.hasOwnProperty(w="CRYPTO"))if(v=g[w],v===!!v)if(v)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=v;else throw f=!v,Error(kn+"crypto unavailable");else f=v;else throw Error(kn+w+" not true or false: "+v);if(g.hasOwnProperty(w="MODULO_MODE")&&(v=g[w],Et(v,0,9,w),d=v),g.hasOwnProperty(w="POW_PRECISION")&&(v=g[w],Et(v,0,Yt,w),m=v),g.hasOwnProperty(w="FORMAT"))if(v=g[w],typeof v=="object")S=v;else throw Error(kn+w+" not an object: "+v);if(g.hasOwnProperty(w="ALPHABET"))if(v=g[w],typeof v=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(v))F=v.slice(0,10)=="0123456789",T=v;else throw Error(kn+w+" invalid: "+v)}else throw Error(kn+"Object expected: "+g);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,p],CRYPTO:f,MODULO_MODE:d,POW_PRECISION:m,FORMAT:S,ALPHABET:T}},k.isBigNumber=function(g){if(!g||g._isBigNumber!==!0)return!1;if(!k.DEBUG)return!0;var w,v,A=g.c,h=g.e,C=g.s;e:if({}.toString.call(A)=="[object Array]"){if((C===1||C===-1)&&h>=-Yt&&h<=Yt&&h===Yn(h)){if(A[0]===0){if(h===0&&A.length===1)return!0;break e}if(w=(h+1)%ze,w<1&&(w+=ze),String(A[0]).length==w){for(w=0;w<A.length;w++)if(v=A[w],v<0||v>=sr||v!==Yn(v))break e;if(v!==0)return!0}}}else if(A===null&&h===null&&(C===null||C===1||C===-1))return!0;throw Error(kn+"Invalid BigNumber: "+g)},k.maximum=k.max=function(){return R(arguments,-1)},k.minimum=k.min=function(){return R(arguments,1)},k.random=(function(){var g=9007199254740992,w=Math.random()*g&2097151?function(){return Yn(Math.random()*g)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(v){var A,h,C,I,y,P=0,L=[],B=new k(i);if(v==null?v=s:Et(v,0,Yt),I=ru(v/ze),f)if(crypto.getRandomValues){for(A=crypto.getRandomValues(new Uint32Array(I*=2));P<I;)y=A[P]*131072+(A[P+1]>>>11),y>=9e15?(h=crypto.getRandomValues(new Uint32Array(2)),A[P]=h[0],A[P+1]=h[1]):(L.push(y%1e14),P+=2);P=I/2}else if(crypto.randomBytes){for(A=crypto.randomBytes(I*=7);P<I;)y=(A[P]&31)*281474976710656+A[P+1]*1099511627776+A[P+2]*4294967296+A[P+3]*16777216+(A[P+4]<<16)+(A[P+5]<<8)+A[P+6],y>=9e15?crypto.randomBytes(7).copy(A,P):(L.push(y%1e14),P+=7);P=I/7}else throw f=!1,Error(kn+"crypto unavailable");if(!f)for(;P<I;)y=w(),y<9e15&&(L[P++]=y%1e14);for(I=L[--P],v%=ze,I&&v&&(y=iu[ze-v],L[P]=Yn(I/y)*y);L[P]===0;L.pop(),P--);if(P<0)L=[C=0];else{for(C=-1;L[0]===0;L.splice(0,1),C-=ze);for(P=1,y=L[0];y>=10;y/=10,P++);P<ze&&(C-=ze-P)}return B.e=C,B.c=L,B}})(),k.sum=function(){for(var g=1,w=arguments,v=new k(w[0]);g<w.length;)v=v.plus(w[g++]);return v},n=(function(){var g="0123456789";function w(v,A,h,C){for(var I,y=[0],P,L=0,B=v.length;L<B;){for(P=y.length;P--;y[P]*=A);for(y[0]+=C.indexOf(v.charAt(L++)),I=0;I<y.length;I++)y[I]>h-1&&(y[I+1]==null&&(y[I+1]=0),y[I+1]+=y[I]/h|0,y[I]%=h)}return y.reverse()}return function(v,A,h,C,I){var y,P,L,B,N,x,U,H,M=v.indexOf("."),Q=s,ee=a;for(M>=0&&(B=m,m=0,v=v.replace(".",""),H=new k(A),x=H.pow(v.length-M),m=B,H.c=w(Lr(qn(x.c),x.e,"0"),10,h,g),H.e=H.c.length),U=w(v,A,h,I?(y=T,g):(y=g,T)),L=B=U.length;U[--B]==0;U.pop());if(!U[0])return y.charAt(0);if(M<0?--L:(x.c=U,x.e=L,x.s=C,x=t(x,H,Q,ee,h),U=x.c,N=x.r,L=x.e),P=L+Q+1,M=U[P],B=h/2,N=N||P<0||U[P+1]!=null,N=ee<4?(M!=null||N)&&(ee==0||ee==(x.s<0?3:2)):M>B||M==B&&(ee==4||N||ee==6&&U[P-1]&1||ee==(x.s<0?8:7)),P<1||!U[0])v=N?Lr(y.charAt(1),-Q,y.charAt(0)):y.charAt(0);else{if(U.length=P,N)for(--h;++U[--P]>h;)U[P]=0,P||(++L,U=[1].concat(U));for(B=U.length;!U[--B];);for(M=0,v="";M<=B;v+=y.charAt(U[M++]));v=Lr(v,L,y.charAt(0))}return v}})(),t=(function(){function g(A,h,C){var I,y,P,L,B=0,N=A.length,x=h%eo,U=h/eo|0;for(A=A.slice();N--;)P=A[N]%eo,L=A[N]/eo|0,I=U*P+L*x,y=x*P+I%eo*eo+B,B=(y/C|0)+(I/eo|0)+U*L,A[N]=y%C;return B&&(A=[B].concat(A)),A}function w(A,h,C,I){var y,P;if(C!=I)P=C>I?1:-1;else for(y=P=0;y<C;y++)if(A[y]!=h[y]){P=A[y]>h[y]?1:-1;break}return P}function v(A,h,C,I){for(var y=0;C--;)A[C]-=y,y=A[C]<h[C]?1:0,A[C]=y*I+A[C]-h[C];for(;!A[0]&&A.length>1;A.splice(0,1));}return function(A,h,C,I,y){var P,L,B,N,x,U,H,M,Q,ee,J,Le,Ee,We,st,te,Y,ce=A.s==h.s?1:-1,ie=A.c,ue=h.c;if(!ie||!ie[0]||!ue||!ue[0])return new k(!A.s||!h.s||(ie?ue&&ie[0]==ue[0]:!ue)?NaN:ie&&ie[0]==0||!ue?ce*0:ce/0);for(M=new k(ce),Q=M.c=[],L=A.e-h.e,ce=C+L+1,y||(y=sr,L=Kn(A.e/ze)-Kn(h.e/ze),ce=ce/ze|0),B=0;ue[B]==(ie[B]||0);B++);if(ue[B]>(ie[B]||0)&&L--,ce<0)Q.push(1),N=!0;else{for(We=ie.length,te=ue.length,B=0,ce+=2,x=Yn(y/(ue[0]+1)),x>1&&(ue=g(ue,x,y),ie=g(ie,x,y),te=ue.length,We=ie.length),Ee=te,ee=ie.slice(0,te),J=ee.length;J<te;ee[J++]=0);Y=ue.slice(),Y=[0].concat(Y),st=ue[0],ue[1]>=y/2&&st++;do{if(x=0,P=w(ue,ee,te,J),P<0){if(Le=ee[0],te!=J&&(Le=Le*y+(ee[1]||0)),x=Yn(Le/st),x>1)for(x>=y&&(x=y-1),U=g(ue,x,y),H=U.length,J=ee.length;w(U,ee,H,J)==1;)x--,v(U,te<H?Y:ue,H,y),H=U.length,P=1;else x==0&&(P=x=1),U=ue.slice(),H=U.length;if(H<J&&(U=[0].concat(U)),v(ee,U,J,y),J=ee.length,P==-1)for(;w(ue,ee,te,J)<1;)x++,v(ee,te<J?Y:ue,J,y),J=ee.length}else P===0&&(x++,ee=[0]);Q[B++]=x,ee[0]?ee[J++]=ie[Ee]||0:(ee=[ie[Ee]],J=1)}while((Ee++<We||ee[0]!=null)&&ce--);N=ee[0]!=null,Q[0]||Q.splice(0,1)}if(y==sr){for(B=1,ce=Q[0];ce>=10;ce/=10,B++);E(M,C+(M.e=B+L*ze-1)+1,I,N)}else M.e=L,M.r=+N;return M}})();function z(g,w,v,A){var h,C,I,y,P;if(v==null?v=a:Et(v,0,8),!g.c)return g.toString();if(h=g.c[0],I=g.e,w==null)P=qn(g.c),P=A==1||A==2&&(I<=u||I>=c)?Fa(P,I):Lr(P,I,"0");else if(g=E(new k(g),w,v),C=g.e,P=qn(g.c),y=P.length,A==1||A==2&&(w<=C||C<=u)){for(;y<w;P+="0",y++);P=Fa(P,C)}else if(w-=I+(A===2&&C>I),P=Lr(P,C,"0"),C+1>y){if(--w>0)for(P+=".";w--;P+="0");}else if(w+=C-y,w>0)for(C+1==y&&(P+=".");w--;P+="0");return g.s<0&&h?"-"+P:P}function R(g,w){for(var v,A,h=1,C=new k(g[0]);h<g.length;h++)A=new k(g[h]),(!A.s||(v=Ao(C,A))===w||v===0&&C.s===w)&&(C=A);return C}function O(g,w,v){for(var A=1,h=w.length;!w[--h];w.pop());for(h=w[0];h>=10;h/=10,A++);return(v=A+v*ze-1)>p?g.c=g.e=null:v<l?g.c=[g.e=0]:(g.e=v,g.c=w),g}r=(function(){var g=/^(-?)0([xbo])(?=\w[\w.]*$)/i,w=/^([^.]+)\.$/,v=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(C,I,y,P){var L,B=y?I:I.replace(h,"");if(A.test(B))C.s=isNaN(B)?null:B<0?-1:1;else{if(!y&&(B=B.replace(g,function(N,x,U){return L=(U=U.toLowerCase())=="x"?16:U=="b"?2:8,!P||P==L?x:N}),P&&(L=P,B=B.replace(w,"$1").replace(v,"0.$1")),I!=B))return new k(B,L);if(k.DEBUG)throw Error(kn+"Not a"+(P?" base "+P:"")+" number: "+I);C.s=null}C.c=C.e=null}})();function E(g,w,v,A){var h,C,I,y,P,L,B,N=g.c,x=iu;if(N){e:{for(h=1,y=N[0];y>=10;y/=10,h++);if(C=w-h,C<0)C+=ze,I=w,P=N[L=0],B=Yn(P/x[h-I-1]%10);else if(L=ru((C+1)/ze),L>=N.length)if(A){for(;N.length<=L;N.push(0));P=B=0,h=1,C%=ze,I=C-ze+1}else break e;else{for(P=y=N[L],h=1;y>=10;y/=10,h++);C%=ze,I=C-ze+h,B=I<0?0:Yn(P/x[h-I-1]%10)}if(A=A||w<0||N[L+1]!=null||(I<0?P:P%x[h-I-1]),A=v<4?(B||A)&&(v==0||v==(g.s<0?3:2)):B>5||B==5&&(v==4||A||v==6&&(C>0?I>0?P/x[h-I]:0:N[L-1])%10&1||v==(g.s<0?8:7)),w<1||!N[0])return N.length=0,A?(w-=g.e+1,N[0]=x[(ze-w%ze)%ze],g.e=-w||0):N[0]=g.e=0,g;if(C==0?(N.length=L,y=1,L--):(N.length=L+1,y=x[ze-C],N[L]=I>0?Yn(P/x[h-I]%x[I])*y:0),A)for(;;)if(L==0){for(C=1,I=N[0];I>=10;I/=10,C++);for(I=N[0]+=y,y=1;I>=10;I/=10,y++);C!=y&&(g.e++,N[0]==sr&&(N[0]=1));break}else{if(N[L]+=y,N[L]!=sr)break;N[L--]=0,y=1}for(C=N.length;N[--C]===0;N.pop());}g.e>p?g.c=g.e=null:g.e<l&&(g.c=[g.e=0])}return g}function D(g){var w,v=g.e;return v===null?g.toString():(w=qn(g.c),w=v<=u||v>=c?Fa(w,v):Lr(w,v,"0"),g.s<0?"-"+w:w)}return o.absoluteValue=o.abs=function(){var g=new k(this);return g.s<0&&(g.s=1),g},o.comparedTo=function(g,w){return Ao(this,new k(g,w))},o.decimalPlaces=o.dp=function(g,w){var v,A,h,C=this;if(g!=null)return Et(g,0,Yt),w==null?w=a:Et(w,0,8),E(new k(C),g+C.e+1,w);if(!(v=C.c))return null;if(A=((h=v.length-1)-Kn(this.e/ze))*ze,h=v[h])for(;h%10==0;h/=10,A--);return A<0&&(A=0),A},o.dividedBy=o.div=function(g,w){return t(this,new k(g,w),s,a)},o.dividedToIntegerBy=o.idiv=function(g,w){return t(this,new k(g,w),0,1)},o.exponentiatedBy=o.pow=function(g,w){var v,A,h,C,I,y,P,L,B,N=this;if(g=new k(g),g.c&&!g.isInteger())throw Error(kn+"Exponent not an integer: "+D(g));if(w!=null&&(w=new k(w)),y=g.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!g.c||!g.c[0])return B=new k(Math.pow(+D(N),y?g.s*(2-Ia(g)):+D(g))),w?B.mod(w):B;if(P=g.s<0,w){if(w.c?!w.c[0]:!w.s)return new k(NaN);A=!P&&N.isInteger()&&w.isInteger(),A&&(N=N.mod(w))}else{if(g.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||y&&N.c[1]>=24e7:N.c[0]<8e13||y&&N.c[0]<=9999975e7)))return C=N.s<0&&Ia(g)?-0:0,N.e>-1&&(C=1/C),new k(P?1/C:C);m&&(C=ru(m/ze+2))}for(y?(v=new k(.5),P&&(g.s=1),L=Ia(g)):(h=Math.abs(+D(g)),L=h%2),B=new k(i);;){if(L){if(B=B.times(N),!B.c)break;C?B.c.length>C&&(B.c.length=C):A&&(B=B.mod(w))}if(h){if(h=Yn(h/2),h===0)break;L=h%2}else if(g=g.times(v),E(g,g.e+1,1),g.e>14)L=Ia(g);else{if(h=+D(g),h===0)break;L=h%2}N=N.times(N),C?N.c&&N.c.length>C&&(N.c.length=C):A&&(N=N.mod(w))}return A?B:(P&&(B=i.div(B)),w?B.mod(w):C?E(B,m,a,I):B)},o.integerValue=function(g){var w=new k(this);return g==null?g=a:Et(g,0,8),E(w,w.e+1,g)},o.isEqualTo=o.eq=function(g,w){return Ao(this,new k(g,w))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(g,w){return Ao(this,new k(g,w))>0},o.isGreaterThanOrEqualTo=o.gte=function(g,w){return(w=Ao(this,new k(g,w)))===1||w===0},o.isInteger=function(){return!!this.c&&Kn(this.e/ze)>this.c.length-2},o.isLessThan=o.lt=function(g,w){return Ao(this,new k(g,w))<0},o.isLessThanOrEqualTo=o.lte=function(g,w){return(w=Ao(this,new k(g,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(g,w){var v,A,h,C,I=this,y=I.s;if(g=new k(g,w),w=g.s,!y||!w)return new k(NaN);if(y!=w)return g.s=-w,I.plus(g);var P=I.e/ze,L=g.e/ze,B=I.c,N=g.c;if(!P||!L){if(!B||!N)return B?(g.s=-w,g):new k(N?I:NaN);if(!B[0]||!N[0])return N[0]?(g.s=-w,g):new k(B[0]?I:a==3?-0:0)}if(P=Kn(P),L=Kn(L),B=B.slice(),y=P-L){for((C=y<0)?(y=-y,h=B):(L=P,h=N),h.reverse(),w=y;w--;h.push(0));h.reverse()}else for(A=(C=(y=B.length)<(w=N.length))?y:w,y=w=0;w<A;w++)if(B[w]!=N[w]){C=B[w]<N[w];break}if(C&&(h=B,B=N,N=h,g.s=-g.s),w=(A=N.length)-(v=B.length),w>0)for(;w--;B[v++]=0);for(w=sr-1;A>y;){if(B[--A]<N[A]){for(v=A;v&&!B[--v];B[v]=w);--B[v],B[A]+=sr}B[A]-=N[A]}for(;B[0]==0;B.splice(0,1),--L);return B[0]?O(g,B,L):(g.s=a==3?-1:1,g.c=[g.e=0],g)},o.modulo=o.mod=function(g,w){var v,A,h=this;return g=new k(g,w),!h.c||!g.s||g.c&&!g.c[0]?new k(NaN):!g.c||h.c&&!h.c[0]?new k(h):(d==9?(A=g.s,g.s=1,v=t(h,g,0,3),g.s=A,v.s*=A):v=t(h,g,0,d),g=h.minus(v.times(g)),!g.c[0]&&d==1&&(g.s=h.s),g)},o.multipliedBy=o.times=function(g,w){var v,A,h,C,I,y,P,L,B,N,x,U,H,M,Q,ee=this,J=ee.c,Le=(g=new k(g,w)).c;if(!J||!Le||!J[0]||!Le[0])return!ee.s||!g.s||J&&!J[0]&&!Le||Le&&!Le[0]&&!J?g.c=g.e=g.s=null:(g.s*=ee.s,!J||!Le?g.c=g.e=null:(g.c=[0],g.e=0)),g;for(A=Kn(ee.e/ze)+Kn(g.e/ze),g.s*=ee.s,P=J.length,N=Le.length,P<N&&(H=J,J=Le,Le=H,h=P,P=N,N=h),h=P+N,H=[];h--;H.push(0));for(M=sr,Q=eo,h=N;--h>=0;){for(v=0,x=Le[h]%Q,U=Le[h]/Q|0,I=P,C=h+I;C>h;)L=J[--I]%Q,B=J[I]/Q|0,y=U*L+B*x,L=x*L+y%Q*Q+H[C]+v,v=(L/M|0)+(y/Q|0)+U*B,H[C--]=L%M;H[C]=v}return v?++A:H.splice(0,1),O(g,H,A)},o.negated=function(){var g=new k(this);return g.s=-g.s||null,g},o.plus=function(g,w){var v,A=this,h=A.s;if(g=new k(g,w),w=g.s,!h||!w)return new k(NaN);if(h!=w)return g.s=-w,A.minus(g);var C=A.e/ze,I=g.e/ze,y=A.c,P=g.c;if(!C||!I){if(!y||!P)return new k(h/0);if(!y[0]||!P[0])return P[0]?g:new k(y[0]?A:h*0)}if(C=Kn(C),I=Kn(I),y=y.slice(),h=C-I){for(h>0?(I=C,v=P):(h=-h,v=y),v.reverse();h--;v.push(0));v.reverse()}for(h=y.length,w=P.length,h-w<0&&(v=P,P=y,y=v,w=h),h=0;w;)h=(y[--w]=y[w]+P[w]+h)/sr|0,y[w]=sr===y[w]?0:y[w]%sr;return h&&(y=[h].concat(y),++I),O(g,y,I)},o.precision=o.sd=function(g,w){var v,A,h,C=this;if(g!=null&&g!==!!g)return Et(g,1,Yt),w==null?w=a:Et(w,0,8),E(new k(C),g,w);if(!(v=C.c))return null;if(h=v.length-1,A=h*ze+1,h=v[h]){for(;h%10==0;h/=10,A--);for(h=v[0];h>=10;h/=10,A++);}return g&&C.e+1>A&&(A=C.e+1),A},o.shiftedBy=function(g){return Et(g,-ou,ou),this.times("1e"+g)},o.squareRoot=o.sqrt=function(){var g,w,v,A,h,C=this,I=C.c,y=C.s,P=C.e,L=s+4,B=new k("0.5");if(y!==1||!I||!I[0])return new k(!y||y<0&&(!I||I[0])?NaN:I?C:1/0);if(y=Math.sqrt(+D(C)),y==0||y==1/0?(w=qn(I),(w.length+P)%2==0&&(w+="0"),y=Math.sqrt(+w),P=Kn((P+1)/2)-(P<0||P%2),y==1/0?w="5e"+P:(w=y.toExponential(),w=w.slice(0,w.indexOf("e")+1)+P),v=new k(w)):v=new k(y+""),v.c[0]){for(P=v.e,y=P+L,y<3&&(y=0);;)if(h=v,v=B.times(h.plus(t(C,h,L,1))),qn(h.c).slice(0,y)===(w=qn(v.c)).slice(0,y))if(v.e<P&&--y,w=w.slice(y-3,y+1),w=="9999"||!A&&w=="4999"){if(!A&&(E(h,h.e+s+2,0),h.times(h).eq(C))){v=h;break}L+=4,y+=4,A=1}else{(!+w||!+w.slice(1)&&w.charAt(0)=="5")&&(E(v,v.e+s+2,1),g=!v.times(v).eq(C));break}}return E(v,v.e+s+1,a,g)},o.toExponential=function(g,w){return g!=null&&(Et(g,0,Yt),g++),z(this,g,w,1)},o.toFixed=function(g,w){return g!=null&&(Et(g,0,Yt),g=g+this.e+1),z(this,g,w)},o.toFormat=function(g,w,v){var A,h=this;if(v==null)g!=null&&w&&typeof w=="object"?(v=w,w=null):g&&typeof g=="object"?(v=g,g=w=null):v=S;else if(typeof v!="object")throw Error(kn+"Argument not an object: "+v);if(A=h.toFixed(g,w),h.c){var C,I=A.split("."),y=+v.groupSize,P=+v.secondaryGroupSize,L=v.groupSeparator||"",B=I[0],N=I[1],x=h.s<0,U=x?B.slice(1):B,H=U.length;if(P&&(C=y,y=P,P=C,H-=C),y>0&&H>0){for(C=H%y||y,B=U.substr(0,C);C<H;C+=y)B+=L+U.substr(C,y);P>0&&(B+=L+U.slice(C)),x&&(B="-"+B)}A=N?B+(v.decimalSeparator||"")+((P=+v.fractionGroupSize)?N.replace(new RegExp("\\d{"+P+"}\\B","g"),"$&"+(v.fractionGroupSeparator||"")):N):B}return(v.prefix||"")+A+(v.suffix||"")},o.toFraction=function(g){var w,v,A,h,C,I,y,P,L,B,N,x,U=this,H=U.c;if(g!=null&&(y=new k(g),!y.isInteger()&&(y.c||y.s!==1)||y.lt(i)))throw Error(kn+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+D(y));if(!H)return new k(U);for(w=new k(i),L=v=new k(i),A=P=new k(i),x=qn(H),C=w.e=x.length-U.e-1,w.c[0]=iu[(I=C%ze)<0?ze+I:I],g=!g||y.comparedTo(w)>0?C>0?w:L:y,I=p,p=1/0,y=new k(x),P.c[0]=0;B=t(y,w,0,1),h=v.plus(B.times(A)),h.comparedTo(g)!=1;)v=A,A=h,L=P.plus(B.times(h=L)),P=h,w=y.minus(B.times(h=w)),y=h;return h=t(g.minus(v),A,0,1),P=P.plus(h.times(L)),v=v.plus(h.times(A)),P.s=L.s=U.s,C=C*2,N=t(L,A,C,a).minus(U).abs().comparedTo(t(P,v,C,a).minus(U).abs())<1?[L,A]:[P,v],p=I,N},o.toNumber=function(){return+D(this)},o.toPrecision=function(g,w){return g!=null&&Et(g,1,Yt),z(this,g,w,2)},o.toString=function(g){var w,v=this,A=v.s,h=v.e;return h===null?A?(w="Infinity",A<0&&(w="-"+w)):w="NaN":(g==null?w=h<=u||h>=c?Fa(qn(v.c),h):Lr(qn(v.c),h,"0"):g===10&&F?(v=E(new k(v),s+h+1,a),w=Lr(qn(v.c),v.e,"0")):(Et(g,2,T.length,"Base"),w=n(Lr(qn(v.c),h,"0"),10,g,A,!0)),A<0&&v.c[0]&&(w="-"+w)),w},o.valueOf=o.toJSON=function(){return D(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&k.set(e),k}function Kn(e){var t=e|0;return e>0||e===t?t:t-1}function qn(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=ze-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function Ao(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 Et(e,t,n,r){if(e<t||e>n||e!==Yn(e))throw Error(kn+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Ia(e){var t=e.c.length-1;return Kn(e.e/ze)==t&&e.c[t]%2!=0}function Fa(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Lr(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 gI=px(),dx=gI;var mI=24,os=32,hI=()=>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,au=hI(),su=(e=4,t=au)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function xI(e){let t=new dx(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var gx=(e="")=>{let t=new TextEncoder;return xI(cx(t.encode(e))).toString(36).slice(1)},fx=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),yI=e=>fx[Math.floor(e()*fx.length)],bI=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=au}={})=>{let n=Object.keys(e).toString(),r=n.length?n+su(os,t):su(os,t);return gx(r).substring(0,os)},SI=e=>()=>e++,wI=476782367,mx=({random:e=au,counter:t=SI(Math.floor(e()*wI)),length:n=mI,fingerprint:r=bI({random:e})}={})=>{if(n>os)throw new Error(`Length must be between 2 and ${os}. Received: ${n}`);return function(){let i=yI(e),s=Date.now().toString(36),a=t().toString(36),u=su(n,e),c=`${s+u+a+r}`;return`${i+gx(c).substring(1,n)}`}},to=vI(mx);function vI(e){let t;return()=>(t||(t=e()),t())}var xM=ga(yx());function Mt(e){return e>=48&&e<=57}function Tn(e){return Mt(e)||e>=65&&e<=70||e>=97&&e<=102}function Aa(e){return e>=65&&e<=90}function TI(e){return e>=97&&e<=122}function II(e){return Aa(e)||TI(e)}function FI(e){return e>=128}function Ea(e){return II(e)||FI(e)||e===95}function Pa(e){return Ea(e)||Mt(e)||e===45}function EI(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function is(e){return e===10||e===13||e===12}function vr(e){return is(e)||e===32||e===9}function Cn(e,t){return!(e!==92||is(t)||t===0)}function ti(e,t,n){return e===45?Ea(t)||t===45||Cn(t,n):Ea(e)?!0:e===92?Cn(e,t):!1}function La(e,t,n){return e===43||e===45?Mt(t)?2:t===46&&Mt(n)?3:0:e===46?Mt(t)?2:0:Mt(e)?1:0}function Ma(e){return e===65279||e===65534?1:0}var lu=new Array(128),AI=128,ss=130,cu=131,Ba=132,uu=133;for(let e=0;e<lu.length;e++)lu[e]=vr(e)&&ss||Mt(e)&&cu||Ea(e)&&Ba||EI(e)&&uu||e||AI;function Da(e){return e<128?lu[e]:Ba}function ni(e,t){return t<e.length?e.charCodeAt(t):0}function Ra(e,t,n){return n===13&&ni(e,t+1)===10?2:1}function Mr(e,t,n){let r=e.charCodeAt(t);return Aa(r)&&(r=r|32),r===n}function Br(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(Aa(s)&&(s=s|32),s!==i)return!1}return!0}function bx(e,t){for(;t>=0&&vr(e.charCodeAt(t));t--);return t+1}function as(e,t){for(;t<e.length&&vr(e.charCodeAt(t));t++);return t}function pu(e,t){for(;t<e.length&&Mt(e.charCodeAt(t));t++);return t}function Dr(e,t){if(t+=2,Tn(ni(e,t-1))){for(let r=Math.min(e.length,t+5);t<r&&Tn(ni(e,t));t++);let n=ni(e,t);vr(n)&&(t+=Ra(e,t,n))}return t}function ls(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!Pa(n)){if(Cn(n,ni(e,t+1))){t=Dr(e,t)-1;continue}break}}return t}function Po(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),Mt(n)&&(t=pu(e,t+1),n=e.charCodeAt(t)),n===46&&Mt(e.charCodeAt(t+1))&&(t+=2,t=pu(e,t)),Mr(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),Mt(n)&&(t=pu(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}Cn(n,ni(e,t+1))&&(t=Dr(e,t))}return t}function Na(e){if(e.length===1&&!Tn(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 ri=["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 oi(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var Sx=10,PI=12,wx=13;function vx(e){let t=e.source,n=t.length,r=t.length>0?Ma(t.charCodeAt(0)):0,o=oi(e.lines,n),i=oi(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===Sx||c===wx||c===PI)&&(c===wx&&u+1<n&&t.charCodeAt(u+1)===Sx&&(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 Oa=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||vx(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,r){return this.computed||vx(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]}}}};var ar=16777215,lr=24,cs=1,$a=2,no=new Uint8Array(32);no[2]=22;no[21]=22;no[19]=20;no[23]=24;var cr=new Uint8Array(32);cr[2]=cs;cr[21]=cs;cr[19]=cs;cr[23]=cs;cr[22]=$a;cr[20]=$a;cr[24]=$a;function kx(e,t,n){return e<t?t:e>n?n:e}var _a=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=oi(this.offsetAndType,t.length+1),i=oi(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,p,f)=>{let d=s++;if(o[d]=l<<lr|f,a===-1&&(a=p),i[d]=c,l===u){let m=i[c];i[c]=d,c=m,u=no[o[m]>>lr]}else this.isBlockOpenerTokenType(l)&&(c=d,u=no[l])}),o[s]=0<<lr|r,i[s]=s;for(let l=0;l<s;l++){let p=i[l];if(p<=l){let f=i[p];f!==l&&(i[l]=f)}else p>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]>>lr:0}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>lr;if(r!==13&&r!==25&&t--===0)return r}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&ar:this.source.length}lookupOffsetNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>lr;if(r!==13&&r!==25&&t--===0)return n-this.tokenIndex}return 0}lookupValue(t,n){return t+=this.tokenIndex,t<this.tokenCount?Br(this.source,this.offsetAndType[t-1]&ar,this.offsetAndType[t]&ar,n):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&ar:this.offsetAndType[this.tokenCount]&ar:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[kx(t,0,this.tokenCount)]&ar}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[kx(t,0,this.tokenCount)]>>lr}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return cr[t]===cs}isBlockCloserTokenType(t){return cr[t]===$a}getBlockTokenPairIndex(t){let n=this.getTokenType(t);if(cr[n]===1){let r=this.balance[t],o=this.getTokenType(r);return no[n]===o?r:-1}else if(cr[n]===2){let r=this.balance[t],o=this.getTokenType(r);return no[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]&ar,n=this.offsetAndType[n],this.tokenType=n>>lr,this.tokenEnd=n&ar):(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>>lr,this.tokenEnd=t&ar):(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]&ar:this.firstCharOffset,n(this.source.charCodeAt(i))){case 1:break e;case 2:r++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[r]>>lr)&&(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&ar,a=i>>lr;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:ri[n],chunk:this.source.substring(r,o),balance:this.balance[i]}}),t}};function ro(e,t){function n(p){return p<a?e.charCodeAt(p):0}function r(){if(c=Po(e,c),ti(n(c),n(c+1),n(c+2))){l=12,c=ls(e,c);return}if(n(c)===37){l=11,c++;return}l=10}function o(){let p=c;if(c=ls(e,c),Br(e,p,c,"url")&&n(c)===40){if(c=as(e,c+1),n(c)===34||n(c)===39){l=2,c=p+4;return}s();return}if(n(c)===40){l=2,c++;return}l=1}function i(p){for(p||(p=n(c++)),l=5;c<e.length;c++){let f=e.charCodeAt(c);switch(Da(f)){case p:c++;return;case ss:if(is(f)){c+=Ra(e,c,f),l=6;return}break;case 92:if(c===e.length-1)break;let d=n(c+1);is(d)?c+=Ra(e,c+1,d):Cn(f,d)&&(c=Dr(e,c)-1);break}}}function s(){for(l=7,c=as(e,c);c<e.length;c++){let p=e.charCodeAt(c);switch(Da(p)){case 41:c++;return;case ss:if(c=as(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 uu:c=za(e,c),l=8;return;case 92:if(Cn(p,n(c+1))){c=Dr(e,c)-1;break}c=za(e,c),l=8;return}}}e=String(e||"");let a=e.length,u=Ma(n(0)),c=u,l;for(;c<a;){let p=e.charCodeAt(c);switch(Da(p)){case ss:l=13,c=as(e,c+1);break;case 34:i();break;case 35:Pa(n(c+1))||Cn(n(c+1),n(c+2))?(l=4,c=ls(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:La(p,n(c+1),n(c+2))?r():(l=9,c++);break;case 44:l=18,c++;break;case 45:La(p,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(l=15,c=c+3):ti(p,n(c+1),n(c+2))?o():(l=9,c++);break;case 46:La(p,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:ti(n(c+1),n(c+2),n(c+3))?(l=3,c=ls(e,c+1)):(l=9,c++);break;case 91:l=19,c++;break;case 92:Cn(p,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 cu:r();break;case Ba:o();break;default:l=9,c++}t(l,u,u=c)}}var ii=null,Rn=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 ii!==null?(r=ii,ii=ii.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=ii,ii=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 Mo(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}
|
|
4
|
-
`)}})}var du=100,Cx=60,Tx=" ";function Ix({source:e,line:t,column:n,baseLine:r,baseColumn:o},i){function s(m,S){return c.slice(m,S).map((T,F)=>String(m+F+1).padStart(f)+" |"+T).join(`
|
|
1
|
+
var yF=Object.create;var Ea=Object.defineProperty;var bF=Object.getOwnPropertyDescriptor;var SF=Object.getOwnPropertyNames;var wF=Object.getPrototypeOf,vF=Object.prototype.hasOwnProperty;var kF=(e,t,n)=>t in e?Ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $=(e,t)=>()=>(e&&(t=e(e=0)),t);var Jn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ye=(e,t)=>{for(var n in t)Ea(e,n,{get:t[n],enumerable:!0})},CF=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of SF(t))!vF.call(e,o)&&o!==n&&Ea(e,o,{get:()=>t[o],enumerable:!(r=bF(t,o))||r.enumerable});return e};var Aa=(e,t,n)=>(n=e!=null?yF(wF(e)):{},CF(t||!e||!e.__esModule?Ea(n,"default",{value:e,enumerable:!0}):n,e));var Zn=(e,t,n)=>kF(e,typeof t!="symbol"?t+"":t,n);function Kx(){try{return typeof window<"u"&&localStorage.getItem(EF)==="true"}catch{return!1}}var EF,y,De=$(()=>{"use strict";EF="uicopilot:debug";y={debug:(...e)=>{Kx()&&console.log(...e)},info:(...e)=>{Kx()&&console.info(...e)},warn:(...e)=>console.warn(...e),error:(...e)=>console.error(...e)}});import AF,{createContext as PF,useContext as LF,useReducer as MF,useMemo as Xx}from"react";function BF(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)),y.debug("[AuthContext] resetAuth: Cleared uicopilot_* localStorage + sessionStorage keys"),{...e,isConnected:!1,sessionToken:null,apiKey:"",authMethod:"oauth",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null};default:return e}}function Zc({children:e}){let[t,n]=MF(BF,NF),r=Xx(()=>({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}})},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=Xx(()=>({...t,...r}),[t,r]);return AF.createElement(Jx.Provider,{value:o},e)}function we(){let e=LF(Jx);if(!e)throw new Error("useAuthStore must be used within an AuthProvider");return e}var DF,RF,zF,Qx,NF,Jx,eu=$(()=>{"use strict";De();DF=()=>{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"))};DF();RF=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_session_token"),zF=()=>typeof localStorage>"u"?"":localStorage.getItem("uicopilot_api_key")||"",Qx=RF(),NF={isConnected:!!Qx,sessionToken:Qx,apiKey:zF(),authMethod:"oauth",deviceCode:null,userCode:null,verificationUri:null,pollingInterval:null,usageData:null,usageLastFetched:null,authError:null},Jx=PF(null)});import OF,{createContext as _F,useContext as $F,useReducer as UF,useMemo as Zx,useRef as jF,useEffect as HF}from"react";function WF(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 tu({children:e}){let[t,n]=UF(WF,GF),r=jF(t);HF(()=>{r.current=t},[t]);let o=Zx(()=>({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=Zx(()=>({...t,...o}),[t,o]);return OF.createElement(ey.Provider,{value:i},e)}function Ze(){let e=$F(ey);if(!e)throw new Error("useProjectStore must be used within a ProjectProvider");return e}var VF,GF,ey,nu=$(()=>{"use strict";VF=()=>typeof localStorage>"u"?null:localStorage.getItem("uicopilot_selected_project_id"),GF={projects:[],selectedProjectId:VF(),loadingProjects:!1,currentStorybookPath:null},ey=_F(null)});import qF,{createContext as YF,useContext as KF,useReducer as XF,useMemo as ty}from"react";function QF(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>ny)for(let o of r.slice(0,r.length-ny))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 ru({children:e}){let[t,n]=XF(QF,JF),r=ty(()=>({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}})},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=ty(()=>({...t,...r}),[t,r]);return qF.createElement(ry.Provider,{value:o},e)}function rt(){let e=KF(ry);if(!e)throw new Error("useFigmaStore must be used within a FigmaProvider");return e}var ny,JF,ry,ou=$(()=>{"use strict";ny=200;JF={showComponentBrowser:!1,figmaFileUrl:"",currentStoryId:null,currentStoryName:"",currentMapping:null,mappingsRefreshKey:0,reviewFigmaUrl:"",mappingSource:null,loadingMapping:!1,showFigmaQuality:!1,framesCache:null,isLoadingFrames:!1,variantThumbnailsCache:{}},ry=YF(null)});var oy=$(()=>{"use strict"});var iu=$(()=>{"use strict"});function _t(e){return e>=48&&e<=57}function Pn(e){return _t(e)||e>=65&&e<=70||e>=97&&e<=102}function Da(e){return e>=65&&e<=90}function eE(e){return e>=97&&e<=122}function tE(e){return Da(e)||eE(e)}function nE(e){return e>=128}function Ba(e){return tE(e)||nE(e)||e===95}function Ra(e){return Ba(e)||_t(e)||e===45}function rE(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function os(e){return e===10||e===13||e===12}function Ar(e){return os(e)||e===32||e===9}function An(e,t){return!(e!==92||os(t)||t===0)}function oi(e,t,n){return e===45?Ba(t)||t===45||An(t,n):Ba(e)?!0:e===92?An(e,t):!1}function za(e,t,n){return e===43||e===45?_t(t)?2:t===46&&_t(n)?3:0:e===46?_t(t)?2:0:_t(e)?1:0}function Na(e){return e===65279||e===65534?1:0}function _a(e){return e<128?su[e]:Oa}var su,oE,is,au,Oa,lu,ss=$(()=>{"use strict";su=new Array(128),oE=128,is=130,au=131,Oa=132,lu=133;for(let e=0;e<su.length;e++)su[e]=Ar(e)&&is||_t(e)&&au||Ba(e)&&Oa||rE(e)&&lu||e||oE});function ii(e,t){return t<e.length?e.charCodeAt(t):0}function $a(e,t,n){return n===13&&ii(e,t+1)===10?2:1}function _r(e,t,n){let r=e.charCodeAt(t);return Da(r)&&(r=r|32),r===n}function $r(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(Da(s)&&(s=s|32),s!==i)return!1}return!0}function iy(e,t){for(;t>=0&&Ar(e.charCodeAt(t));t--);return t+1}function as(e,t){for(;t<e.length&&Ar(e.charCodeAt(t));t++);return t}function cu(e,t){for(;t<e.length&&_t(e.charCodeAt(t));t++);return t}function Ur(e,t){if(t+=2,Pn(ii(e,t-1))){for(let r=Math.min(e.length,t+5);t<r&&Pn(ii(e,t));t++);let n=ii(e,t);Ar(n)&&(t+=$a(e,t,n))}return t}function ls(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!Ra(n)){if(An(n,ii(e,t+1))){t=Ur(e,t)-1;continue}break}}return t}function Do(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),_t(n)&&(t=cu(e,t+1),n=e.charCodeAt(t)),n===46&&_t(e.charCodeAt(t+1))&&(t+=2,t=cu(e,t)),_r(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),_t(n)&&(t=cu(e,t+1+r+1))}return t}function Ua(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n===41){t++;break}An(n,ii(e,t+1))&&(t=Ur(e,t))}return t}function ja(e){if(e.length===1&&!Pn(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 Ha=$(()=>{"use strict";ss()});var si,uu=$(()=>{"use strict";si=["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 ai(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,16384)):e}var pu=$(()=>{"use strict"});function ly(e){let t=e.source,n=t.length,r=t.length>0?Na(t.charCodeAt(0)):0,o=ai(e.lines,n),i=ai(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===sy||c===ay||c===iE)&&(c===ay&&u+1<n&&t.charCodeAt(u+1)===sy&&(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 sy,iE,ay,Wa,cy=$(()=>{"use strict";pu();ss();sy=10,iE=12,ay=13;Wa=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||ly(this),{source:n,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,n,r){return this.computed||ly(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 uy(e,t,n){return e<t?t:e>n?n:e}var gr,mr,cs,Ga,ao,hr,Va,py=$(()=>{"use strict";pu();Ha();uu();gr=16777215,mr=24,cs=1,Ga=2,ao=new Uint8Array(32);ao[2]=22;ao[21]=22;ao[19]=20;ao[23]=24;hr=new Uint8Array(32);hr[2]=cs;hr[21]=cs;hr[19]=cs;hr[23]=cs;hr[22]=Ga;hr[20]=Ga;hr[24]=Ga;Va=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=ai(this.offsetAndType,t.length+1),i=ai(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<<mr|f,a===-1&&(a=d),i[p]=c,l===u){let g=i[c];i[c]=p,c=g,u=ao[o[g]>>mr]}else this.isBlockOpenerTokenType(l)&&(c=p,u=ao[l])}),o[s]=0<<mr|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]>>mr:0}lookupTypeNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>mr;if(r!==13&&r!==25&&t--===0)return r}return 0}lookupOffset(t){return t+=this.tokenIndex,t<this.tokenCount?this.offsetAndType[t-1]&gr:this.source.length}lookupOffsetNonSC(t){for(let n=this.tokenIndex;n<this.tokenCount;n++){let r=this.offsetAndType[n]>>mr;if(r!==13&&r!==25&&t--===0)return n-this.tokenIndex}return 0}lookupValue(t,n){return t+=this.tokenIndex,t<this.tokenCount?$r(this.source,this.offsetAndType[t-1]&gr,this.offsetAndType[t]&gr,n):!1}getTokenStart(t){return t===this.tokenIndex?this.tokenStart:t>0?t<this.tokenCount?this.offsetAndType[t-1]&gr:this.offsetAndType[this.tokenCount]&gr:this.firstCharOffset}getTokenEnd(t){return t===this.tokenIndex?this.tokenEnd:this.offsetAndType[uy(t,0,this.tokenCount)]&gr}getTokenType(t){return t===this.tokenIndex?this.tokenType:this.offsetAndType[uy(t,0,this.tokenCount)]>>mr}substrToCursor(t){return this.source.substring(t,this.tokenStart)}isBlockOpenerTokenType(t){return hr[t]===cs}isBlockCloserTokenType(t){return hr[t]===Ga}getBlockTokenPairIndex(t){let n=this.getTokenType(t);if(hr[n]===1){let r=this.balance[t],o=this.getTokenType(r);return ao[n]===o?r:-1}else if(hr[n]===2){let r=this.balance[t],o=this.getTokenType(r);return ao[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]&gr,n=this.offsetAndType[n],this.tokenType=n>>mr,this.tokenEnd=n&gr):(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>>mr,this.tokenEnd=t&gr):(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]&gr:this.firstCharOffset,n(this.source.charCodeAt(i))){case 1:break e;case 2:r++;break e;default:this.isBlockOpenerTokenType(this.offsetAndType[r]>>mr)&&(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&gr,a=i>>mr;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:si[n],chunk:this.source.substring(r,o),balance:this.balance[i]}}),t}}});function lo(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Do(e,c),oi(n(c),n(c+1),n(c+2))){l=12,c=ls(e,c);return}if(n(c)===37){l=11,c++;return}l=10}function o(){let d=c;if(c=ls(e,c),$r(e,d,c,"url")&&n(c)===40){if(c=as(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(_a(f)){case d:c++;return;case is:if(os(f)){c+=$a(e,c,f),l=6;return}break;case 92:if(c===e.length-1)break;let p=n(c+1);os(p)?c+=$a(e,c+1,p):An(f,p)&&(c=Ur(e,c)-1);break}}}function s(){for(l=7,c=as(e,c);c<e.length;c++){let d=e.charCodeAt(c);switch(_a(d)){case 41:c++;return;case is:if(c=as(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=Ua(e,c),l=8;return;case 34:case 39:case 40:case lu:c=Ua(e,c),l=8;return;case 92:if(An(d,n(c+1))){c=Ur(e,c)-1;break}c=Ua(e,c),l=8;return}}}e=String(e||"");let a=e.length,u=Na(n(0)),c=u,l;for(;c<a;){let d=e.charCodeAt(c);switch(_a(d)){case is:l=13,c=as(e,c+1);break;case 34:i();break;case 35:Ra(n(c+1))||An(n(c+1),n(c+2))?(l=4,c=ls(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:za(d,n(c+1),n(c+2))?r():(l=9,c++);break;case 44:l=18,c++;break;case 45:za(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(l=15,c=c+3):oi(d,n(c+1),n(c+2))?o():(l=9,c++);break;case 46:za(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:oi(n(c+1),n(c+2),n(c+3))?(l=3,c=ls(e,c+1)):(l=9,c++);break;case 91:l=19,c++;break;case 92:An(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 au:r();break;case Oa:o();break;default:l=9,c++}t(l,u,u=c)}}var nr=$(()=>{"use strict";ss();Ha();iu();iu();uu();ss();Ha();cy();py()});var li,Vn,ps=$(()=>{"use strict";li=null,Vn=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 li!==null?(r=li,li=li.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=li,li=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 zo(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 Ya=$(()=>{"use strict"});function gy({source:e,line:t,column:n,baseLine:r,baseColumn:o},i){function s(g,S){return c.slice(g,S).map((C,F)=>String(g+F+1).padStart(f)+" |"+C).join(`
|
|
5
3
|
`)}let a=`
|
|
6
|
-
`.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,
|
|
7
|
-
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function fu(e,t,n,r,o,i=1,s=1){return Object.assign(
|
|
8
|
-
`+Ix({source:t,line:r,column:o,baseLine:i,baseColumn:s},2)}})}function Fx(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 si=()=>{},LI=33,MI=35,gu=59,Ex=123,Ax=0,BI={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}},DI={createList(){return new Rn},createSingleNodeList(e){return new Rn().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}};function RI(e){return function(){return this[e]()}}function mu(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 zI(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:mu(e.atrule),pseudo:mu(e.pseudo),node:mu(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]=RI(r);break}return{config:t,...t,...t.node}}function Px(e){let t="",n="<unknown>",r=!1,o=si,i=!1,s=new Oa,a=Object.assign(new _a,zI(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Fx,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===Ex?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===Ex||l===gu?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===LI||l===gu?1:0},consumeUntilSemicolonIncluded(l){return l===gu?2:0},createList:si,createSingleNodeList:si,getFirstListNode:si,getLastListNode:si,parseWithFallback(l,p){let f=this.tokenIndex;try{return l.call(this)}catch(d){if(i)throw d;this.skip(f-this.tokenIndex);let m=p.call(this);return i=!0,o(d,m),i=!1,m}},lookupNonWSType(l){let p;do if(p=this.lookupType(l++),p!==13&&p!==25)return p;while(p!==Ax);return Ax},charCodeAt(l){return l>=0&&l<t.length?t.charCodeAt(l):0},substring(l,p){return t.substring(l,p)},substrToCursor(l){return this.source.substring(l,this.tokenStart)},cmpChar(l,p){return Mr(t,l,p)},cmpStr(l,p,f){return Br(t,l,p,f)},consume(l){let p=this.tokenStart;return this.eat(l),this.substrToCursor(p)},consumeFunctionName(){let l=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),l},consumeNumber(l){let p=t.substring(this.tokenStart,Po(t,this.tokenStart));return this.eat(l),p},eat(l){if(this.tokenType!==l){let p=ri[l].slice(0,-6).replace(/-/g," ").replace(/^./,m=>m.toUpperCase()),f=`${/[[\](){}]/.test(p)?`"${p}"`:p} is expected`,d=this.tokenStart;switch(l){case 1:this.tokenType===2||this.tokenType===7?(d=this.tokenEnd-1,f="Identifier is expected but function found"):f="Identifier is expected";break;case 4:this.isDelim(MI)&&(this.next(),d++,f="Name is expected");break;case 11:this.tokenType===10&&(d=this.tokenEnd,f="Percent sign is expected");break}this.error(f,d)}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,p){return r?s.getLocationRange(l,p,n):null},getLocationFromList(l){if(r){let p=this.getFirstListNode(l),f=this.getLastListNode(l);return s.getLocationRange(p!==null?p.loc.start.offset-s.startOffset:this.tokenStart,f!==null?f.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(l,p){let f=typeof p<"u"&&p<t.length?s.getLocation(p):this.eof?s.getLocation(bx(t,t.length-1)):s.getLocation(this.tokenStart);throw new fu(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=>ri[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,p)=>a.source.substring(l,p),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,p)=>s.getLocationRange(l,p,n)});return Object.assign(function(l,p){t=l,p=p||{},a.setSource(t,ro),s.setSource(t,p.offset,p.line,p.column),n=p.filename||"<unknown>",r=!!p.positions,o=typeof p.onParseError=="function"?p.onParseError:si,i=!1,a.parseAtrulePrelude="parseAtrulePrelude"in p?!!p.parseAtrulePrelude:!0,a.parseRulePrelude="parseRulePrelude"in p?!!p.parseRulePrelude:!0,a.parseValue="parseValue"in p?!!p.parseValue:!0,a.parseCustomProperty="parseCustomProperty"in p?!!p.parseCustomProperty:!1;let{context:f="default",list:d=!0,onComment:m,onToken:S}=p;if(!(f in a.context))throw new Error("Unknown context `"+f+"`");Object.assign(a,d?DI:BI),Array.isArray(S)?a.forEachToken((F,k,z)=>{S.push({type:F,start:k,end:z})}):typeof S=="function"&&a.forEachToken(S.bind(u())),typeof m=="function"&&a.forEachToken((F,k,z)=>{if(F===25){let R=a.getLocation(k,z),O=Br(t,z-2,z,"*/")?t.slice(k+2,z-2):t.slice(k+2,z);m(O,R)}});let T=a.context[f].call(a,p);return a.eof||a.error(),T},{SyntaxError:fu,config:a.config})}var Qx=ga(Kx(),1),Xx=new Set(["Atrule","Selector","Declaration"]);function Jx(e){let t=new Qx.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&&Xx.has(f.type)){let d=f.loc.start.line,m=f.loc.start.column-1;(r.line!==d||r.column!==m)&&(r.line=d,r.column=m,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&&Xx.has(f.type)&&(o.line=s,o.column=a)};let l=e.emit;e.emit=function(f,d,m){for(let S=0;S<f.length;S++)f.charCodeAt(S)===10?(s++,a=0):a++;l(f,d,m)};let p=e.result;return e.result=function(){return u&&t.addMapping(i),{css:p(),map:t}},e}var Va={};be(Va,{safe:()=>ku,spec:()=>oF});var tF=43,nF=45,vu=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),Zx=[[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],["/","*"]],rF=Zx.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,"-"]]);function ey(e){let t=new Set(e.map(([n,r])=>vu(n)<<16|vu(r)));return function(n,r,o){let i=vu(r,o),s=o.charCodeAt(0),a=s===nF&&r!==1&&r!==2&&r!==15||s===tF?t.has((n&65534)<<16|s<<7):t.has((n&65534)<<16|i);return i|a}}var oF=ey(Zx),ku=ey(rF);var iF=92;function sF(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 ty(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:ku,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)===iF&&this.emit(`
|
|
9
|
-
`,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),f=Math.max(4,String(d).length)+1,p=0;n+=(fy.length-1)*(c[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>du&&(p=n-dy+3,n=dy-2);for(let g=l;g<=d;g++)g>=0&&g<c.length&&(c[g]=c[g].replace(/\t/g,fy),c[g]=(p>0&&c[g].length>p?"\u2026":"")+c[g].substr(p,du-2)+(c[g].length>p+du-1?"\u2026":""));return[s(l,t),new Array(n+f+2).join("-")+"^",s(t,d)].filter(Boolean).join(`
|
|
5
|
+
`).replace(/^(\s+\d+\s+\|\n)+/,"").replace(/\n(\s+\d+\s+\|)+$/,"")}function fu(e,t,n,r,o,i=1,s=1){return Object.assign(zo("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment(u){return gy({source:t,line:r,column:o,baseLine:i,baseColumn:s},isNaN(u)?0:u)},get formattedMessage(){return`Parse error: ${e}
|
|
6
|
+
`+gy({source:t,line:r,column:o,baseLine:i,baseColumn:s},2)}})}var du,dy,fy,my=$(()=>{"use strict";Ya();du=100,dy=60,fy=" "});function hy(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 xy=$(()=>{"use strict"});function uE(e){return function(){return this[e]()}}function mu(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 pE(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:mu(e.atrule),pseudo:mu(e.pseudo),node:mu(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]=uE(r);break}return{config:t,...t,...t.node}}function Sy(e){let t="",n="<unknown>",r=!1,o=ci,i=!1,s=new Wa,a=Object.assign(new Va,pE(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:hy,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(l){return l===yy?1:0},consumeUntilLeftCurlyBracketOrSemicolon(l){return l===yy||l===gu?1:0},consumeUntilExclamationMarkOrSemicolon(l){return l===sE||l===gu?1:0},consumeUntilSemicolonIncluded(l){return l===gu?2:0},createList:ci,createSingleNodeList:ci,getFirstListNode:ci,getLastListNode:ci,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!==by);return by},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 _r(t,l,d)},cmpStr(l,d,f){return $r(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,Do(t,this.tokenStart));return this.eat(l),d},eat(l){if(this.tokenType!==l){let d=si[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(aE)&&(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(iy(t,t.length-1)):s.getLocation(this.tokenStart);throw new fu(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=>si[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,lo),s.setSource(t,d.offset,d.line,d.column),n=d.filename||"<unknown>",r=!!d.positions,o=typeof d.onParseError=="function"?d.onParseError:ci,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:S}=d;if(!(f in a.context))throw new Error("Unknown context `"+f+"`");Object.assign(a,p?cE:lE),Array.isArray(S)?a.forEachToken((F,k,R)=>{S.push({type:F,start:k,end:R})}):typeof S=="function"&&a.forEachToken(S.bind(u())),typeof g=="function"&&a.forEachToken((F,k,R)=>{if(F===25){let z=a.getLocation(k,R),_=$r(t,R-2,R,"*/")?t.slice(k+2,R-2):t.slice(k+2,R);g(_,z)}});let C=a.context[f].call(a,d);return a.eof||a.error(),C},{SyntaxError:fu,config:a.config})}var ci,sE,aE,gu,yy,by,lE,cE,wy=$(()=>{"use strict";ps();my();nr();xy();ci=()=>{},sE=33,aE=35,gu=59,yy=123,by=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}},cE={createList(){return new Vn},createSingleNodeList(e){return new Vn().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}}});var ky=Jn(hu=>{"use strict";var vy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");hu.encode=function(e){if(0<=e&&e<vy.length)return vy[e];throw new TypeError("Must be between 0 and 63: "+e)};hu.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 Ey=Jn(yu=>{"use strict";var Cy=ky(),xu=5,Ty=1<<xu,Iy=Ty-1,Fy=Ty;function dE(e){return e<0?(-e<<1)+1:(e<<1)+0}function fE(e){var t=(e&1)===1,n=e>>1;return t?-n:n}yu.encode=function(t){var n="",r,o=dE(t);do r=o&Iy,o>>>=xu,o>0&&(r|=Fy),n+=Cy.encode(r);while(o>0);return n};yu.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=Cy.decode(t.charCodeAt(n++)),u===-1)throw new Error("Invalid base64 digit: "+t.charAt(n-1));a=!!(u&Fy),u&=Iy,i=i+(u<<s),s+=xu}while(a);r.value=fE(i),r.rest=n}});var Ka=Jn(nn=>{"use strict";function gE(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw new Error('"'+t+'" is a required argument.')}nn.getArg=gE;var Ay=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,mE=/^data:.+\,.+$/;function ds(e){var t=e.match(Ay);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}nn.urlParse=ds;function ui(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}nn.urlGenerate=ui;var hE=32;function xE(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>hE&&t.pop(),i}}var bu=xE(function(t){var n=t,r=ds(t);if(r){if(!r.path)return t;n=r.path}for(var o=nn.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,ui(r)):n});nn.normalize=bu;function Py(e,t){e===""&&(e="."),t===""&&(t=".");var n=ds(t),r=ds(e);if(r&&(e=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),ui(n);if(n||t.match(mE))return t;if(r&&!r.host&&!r.path)return r.host=t,ui(r);var o=t.charAt(0)==="/"?t:bu(e.replace(/\/+$/,"")+"/"+t);return r?(r.path=o,ui(r)):o}nn.join=Py;nn.isAbsolute=function(e){return e.charAt(0)==="/"||Ay.test(e)};function yE(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)}nn.relative=yE;var Ly=(function(){var e=Object.create(null);return!("__proto__"in e)})();function My(e){return e}function bE(e){return By(e)?"$"+e:e}nn.toSetString=Ly?My:bE;function SE(e){return By(e)?e.slice(1):e}nn.fromSetString=Ly?My:SE;function By(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=jr(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:jr(e.name,t.name)}nn.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:jr(e.name,t.name)}nn.compareByOriginalPositionsNoSource=vE;function kE(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=jr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:jr(e.name,t.name)}nn.compareByGeneratedPositionsDeflated=kE;function CE(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=jr(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:jr(e.name,t.name)}nn.compareByGeneratedPositionsDeflatedNoLine=CE;function jr(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function TE(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=jr(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:jr(e.name,t.name)}nn.compareByGeneratedPositionsInflated=TE;function IE(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}nn.parseSourceMapInput=IE;function FE(e,t,n){if(t=t||"",e&&(e[e.length-1]!=="/"&&t[0]!=="/"&&(e+="/"),t=e+t),n){var r=ds(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=Py(ui(r),t)}return bu(t)}nn.computeSourceURL=FE});var Ry=Jn(Dy=>{"use strict";var Su=Ka(),wu=Object.prototype.hasOwnProperty,No=typeof Map<"u";function Hr(){this._array=[],this._set=No?new Map:Object.create(null)}Hr.fromArray=function(t,n){for(var r=new Hr,o=0,i=t.length;o<i;o++)r.add(t[o],n);return r};Hr.prototype.size=function(){return No?this._set.size:Object.getOwnPropertyNames(this._set).length};Hr.prototype.add=function(t,n){var r=No?t:Su.toSetString(t),o=No?this.has(t):wu.call(this._set,r),i=this._array.length;(!o||n)&&this._array.push(t),o||(No?this._set.set(t,i):this._set[r]=i)};Hr.prototype.has=function(t){if(No)return this._set.has(t);var n=Su.toSetString(t);return wu.call(this._set,n)};Hr.prototype.indexOf=function(t){if(No){var n=this._set.get(t);if(n>=0)return n}else{var r=Su.toSetString(t);if(wu.call(this._set,r))return this._set[r]}throw new Error('"'+t+'" is not in the set.')};Hr.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)};Hr.prototype.toArray=function(){return this._array.slice()};Dy.ArraySet=Hr});var Oy=Jn(Ny=>{"use strict";var zy=Ka();function EE(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 Xa(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}Xa.prototype.unsortedForEach=function(t,n){this._array.forEach(t,n)};Xa.prototype.add=function(t){EE(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))};Xa.prototype.toArray=function(){return this._sorted||(this._array.sort(zy.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};Ny.MappingList=Xa});var $y=Jn(_y=>{"use strict";var fs=Ey(),$t=Ka(),Qa=Ry().ArraySet,AE=Oy().MappingList;function rr(e){e||(e={}),this._file=$t.getArg(e,"file",null),this._sourceRoot=$t.getArg(e,"sourceRoot",null),this._skipValidation=$t.getArg(e,"skipValidation",!1),this._ignoreInvalidMapping=$t.getArg(e,"ignoreInvalidMapping",!1),this._sources=new Qa,this._names=new Qa,this._mappings=new AE,this._sourcesContents=null}rr.prototype._version=3;rr.fromSourceMap=function(t,n){var r=t.sourceRoot,o=new rr(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=$t.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=$t.relative(r,i)),o._sources.has(s)||o._sources.add(s);var a=t.sourceContentFor(i);a!=null&&o.setSourceContent(i,a)}),o};rr.prototype.addMapping=function(t){var n=$t.getArg(t,"generated"),r=$t.getArg(t,"original",null),o=$t.getArg(t,"source",null),i=$t.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}))};rr.prototype.setSourceContent=function(t,n){var r=t;this._sourceRoot!=null&&(r=$t.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[$t.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[$t.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};rr.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=$t.relative(i,o));var s=new Qa,a=new Qa;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=$t.join(r,u.source)),i!=null&&(u.source=$t.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=$t.join(r,u)),i!=null&&(u=$t.relative(i,u)),this.setSourceContent(u,c))},this)};rr.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)}};rr.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(!$t.compareByGeneratedPositionsInflated(c,f[p-1]))continue;u+=","}u+=fs.encode(c.generatedColumn-t),t=c.generatedColumn,c.source!=null&&(d=this._sources.indexOf(c.source),u+=fs.encode(d-s),s=d,u+=fs.encode(c.originalLine-1-o),o=c.originalLine-1,u+=fs.encode(c.originalColumn-r),r=c.originalColumn,c.name!=null&&(l=this._names.indexOf(c.name),u+=fs.encode(l-i),i=l)),a+=u}return a};rr.prototype._generateSourcesContent=function(t,n){return t.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=$t.relative(n,r));var o=$t.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};rr.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};rr.prototype.toString=function(){return JSON.stringify(this.toJSON())};_y.SourceMapGenerator=rr});function Hy(e){let t=new jy.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&&Uy.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&&Uy.has(f.type)&&(o.line=s,o.column=a)};let l=e.emit;e.emit=function(f,p,g){for(let S=0;S<f.length;S++)f.charCodeAt(S)===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 jy,Uy,Wy=$(()=>{"use strict";jy=Aa($y(),1),Uy=new Set(["Atrule","Selector","Declaration"])});var Ja={};ye(Ja,{safe:()=>ku,spec:()=>BE});function Gy(e){let t=new Set(e.map(([n,r])=>vu(n)<<16|vu(r)));return function(n,r,o){let i=vu(r,o),s=o.charCodeAt(0),a=s===LE&&r!==1&&r!==2&&r!==15||s===PE?t.has((n&65534)<<16|s<<7):t.has((n&65534)<<16|i);return i|a}}var PE,LE,vu,Vy,ME,BE,ku,qy=$(()=>{"use strict";PE=43,LE=45,vu=(e,t)=>(e===9&&(e=t),typeof e=="string"&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),Vy=[[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],["/","*"]],ME=Vy.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,"-"]]);BE=Gy(Vy),ku=Gy(ME)});function RE(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 Yy(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:ku,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)===DE&&this.emit(`
|
|
7
|
+
`,13,!0)},emit(u){o+=u},result(){return o}};r&&(typeof r.decorator=="function"&&(s=r.decorator(s)),r.sourceMap&&(s=Hy(s)),r.mode in Ja&&(s.tokenBefore=Ja[r.mode]));let a={node:u=>s.node(u),children:RE,token:(u,c)=>s.token(u,c),tokenize:u=>lo(u,(c,l,d)=>{s.token(c,u.slice(l,d),l!==0)})};return s.node(n),s.result()}}var DE,Ky=$(()=>{"use strict";nr();Wy();qy();DE=92});function Xy(e){return{fromPlainObject(t){return e(t,{enter(n){n.children&&!(n.children instanceof Vn)&&(n.children=new Vn().fromArray(n.children))}}),t},toPlainObject(t){return e(t,{leave(n){n.children&&n.children instanceof Vn&&(n.children=n.children.toArray())}}),t}}}var Qy=$(()=>{"use strict";ps()});function Jy(e){return typeof e=="function"?e:gs}function Zy(e,t){return function(n,r,o){n.type===t&&e.call(this,n,r,o)}}function zE(e,t){let n=t.structure,r=[];for(let o in n){if(Cu.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 NE(e){let t={};for(let n in e.node)if(Cu.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]=zE(n,r)}return t}function eb(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 tb({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 nb(e){let t=NE(e),n={},r={},o=Symbol("break-walk"),i=Symbol("skip-node");for(let c in t)Cu.call(t,c)&&t[c]!==null&&(n[c]=eb(t[c],!1),r[c]=eb(t[c],!0));let s=tb(n),a=tb(r),u=function(c,l){function d(F,k,R){let z=f.call(C,F,k,R);return z===o?!0:z===i?!1:!!(g.hasOwnProperty(F.type)&&g[F.type](F,C,d,S)||p.call(C,F,k,R)===o)}let f=gs,p=gs,g=n,S=(F,k,R,z)=>F||d(k,R,z),C={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")f=l;else if(l&&(f=Jy(l.enter),p=Jy(l.leave),l.reverse&&(g=r),l.visit)){if(s.hasOwnProperty(l.visit))g=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(", ")+")");f=Zy(f,l.visit),p=Zy(p,l.visit)}if(f===gs&&p===gs)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(f,p,g){if(l.call(this,f,p,g))return d=f,o}),d},u.findLast=function(c,l){let d=null;return u(c,{reverse:!0,enter(f,p,g){if(l.call(this,f,p,g))return d=f,o}}),d},u.findAll=function(c,l){let d=[];return u(c,function(f,p,g){l.call(this,f,p,g)&&d.push(f)}),d},u}var Cu,gs,rb=$(()=>{"use strict";({hasOwnProperty:Cu}=Object.prototype),gs=function(){}});function OE(e){return e}function _E(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 $E(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 UE(e,t,n,r){let o=e.combinator===" "||r?e.combinator:" "+e.combinator+" ",i=e.terms.map(s=>Za(s,t,n,r)).join(o);return e.explicit||n?(r||i[0]===","?"[":"[ ")+i+(r?"]":" ]"):i}function Za(e,t,n,r){let o;switch(e.type){case"Group":o=UE(e,t,n,r)+(e.disallowEmpty?"!":"");break;case"Multiplier":return Za(e.term,t,n,r)+t(_E(e),e);case"Boolean":o="<boolean-expr["+Za(e.term,t,n,r)+"]>";break;case"Type":o="<"+e.name+(e.opts?t($E(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 pi(e,t){let n=OE,r=!1,o=!1;return typeof t=="function"?n=t:t&&(r=!!t.forceBraces,o=!!t.compact,typeof t.decorate=="function"&&(n=t.decorate)),Za(e,n,r,o)}var Tu=$(()=>{"use strict"});function jE(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 f=0;f<n.length;f++){let p=n[f].value;f===r&&(a=p.length,s=c.length),i!==null&&n[f].node===i&&(f<=r?u++:u=0),c+=p}return r===n.length||u>1?(l=el(i||t,"end")||ms(ob,c),d=ms(l)):(l=el(i,"start")||ms(el(t,"start")||ob,c.slice(0,s)),d=el(i,"end")||ms(l,c.substr(s,a))),{css:c,mismatchOffset:s,mismatchLength:a,start:l,end:d}}function el(e,t){let n=e&&e.loc&&e.loc[t];return n?"line"in n?ms(n):n:null}function ms({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 ob,di,ib,sb=$(()=>{"use strict";Ya();Tu();ob={offset:0,line:1,column:1};di=function(e,t){let n=zo("SyntaxReferenceError",e+(t?" `"+t+"`":""));return n.reference=t,n},ib=function(e,t,n,r){let o=zo("SyntaxMatchError",e),{css:i,mismatchOffset:s,mismatchLength:a,start:u,end:c}=jE(r,n);return o.rawMessage=e,o.syntax=t?pi(t):"<generic>",o.css=i,o.mismatchOffset=s,o.mismatchLength=a,o.message=e+`
|
|
10
8
|
syntax: `+o.syntax+`
|
|
11
9
|
value: `+(i||"<empty string>")+`
|
|
12
|
-
--------`+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};
|
|
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 ol(e,t){return t=t||0,e.length-t>=2&&e.charCodeAt(t)===nl&&e.charCodeAt(t+1)===nl}function ab(e,t){if(t=t||0,e.length-t>=3&&e.charCodeAt(t)===nl&&e.charCodeAt(t+1)!==nl){let n=e.indexOf("-",t+2);if(n!==-1)return e.substring(t,n+1)}return""}function HE(e){if(tl.has(e))return tl.get(e);let t=e.toLowerCase(),n=tl.get(t);if(n===void 0){let r=ol(t,0),o=r?"":ab(t,0);n=Object.freeze({basename:t.substr(o.length),name:t,prefix:o,vendor:o,custom:r})}return tl.set(e,n),n}function WE(e){if(fi.has(e))return fi.get(e);let t=e,n=e[0];n==="/"?n=e[1]==="/"?"//":"/":n!=="_"&&n!=="*"&&n!=="$"&&n!=="#"&&n!=="+"&&n!=="&"&&(n="");let r=ol(t,n.length);if(!r&&(t=t.toLowerCase(),fi.has(t))){let a=fi.get(t);return fi.set(e,a),a}let o=r?"":ab(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 fi.set(e,s),s}var tl,fi,nl,rl,Iu,il=$(()=>{"use strict";tl=new Map,fi=new Map,nl=45,rl=HE,Iu=WE});var gi,sl=$(()=>{"use strict";gi=["initial","inherit","unset","revert","revert-layer"]});function Au(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function hs(e,t,n){for(;e!==null&&(e.type===13||e.type===25);)e=n(++t);return t}function co(e,t,n,r){if(!e)return 0;let o=e.value.charCodeAt(t);if(o===xs||o===Pr){if(n)return 0;t++}for(;t<e.value.length;t++)if(!_t(e.value.charCodeAt(t)))return 0;return r+1}function Eu(e,t,n){let r=!1,o=hs(e,t,n);if(e=n(o),e===null)return t;if(e.type!==10)if(Au(e,xs)||Au(e,Pr)){if(r=!0,o=hs(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!==xs&&i!==Pr)return 0}return co(e,r?0:1,r,o)}function Pu(e,t){let n=0;if(!e)return 0;if(e.type===10)return co(e,0,GE,n);if(e.type===1&&e.value.charCodeAt(0)===Pr){if(!_r(e.value,1,Fu))return 0;switch(e.value.length){case 2:return Eu(t(++n),n,t);case 3:return e.value.charCodeAt(2)!==Pr?0:(n=hs(t(++n),n,t),e=t(n),co(e,0,mi,n));default:return e.value.charCodeAt(2)!==Pr?0:co(e,3,mi,n)}}else if(e.type===1||Au(e,xs)&&t(n+1).type===1){if(e.type!==1&&(e=t(++n)),e===null||!_r(e.value,0,Fu))return 0;switch(e.value.length){case 1:return Eu(t(++n),n,t);case 2:return e.value.charCodeAt(1)!==Pr?0:(n=hs(t(++n),n,t),e=t(n),co(e,0,mi,n));default:return e.value.charCodeAt(1)!==Pr?0:co(e,2,mi,n)}}else if(e.type===12){let r=e.value.charCodeAt(0),o=r===xs||r===Pr?1:0,i=o;for(;i<e.value.length&&_t(e.value.charCodeAt(i));i++);return i===o||!_r(e.value,i,Fu)?0:i+1===e.value.length?Eu(t(++n),n,t):e.value.charCodeAt(i+1)!==Pr?0:i+2===e.value.length?(n=hs(t(++n),n,t),e=t(n),co(e,0,mi,n)):co(e,i+2,mi,n)}return 0}var xs,Pr,Fu,mi,GE,lb=$(()=>{"use strict";nr();xs=43,Pr=45,Fu=110,mi=!0,GE=!1});function Lu(e,t){return e!==null&&e.type===9&&e.value.charCodeAt(0)===t}function KE(e,t){return e.value.charCodeAt(0)===t}function ys(e,t,n){let r=0;for(let o=t;o<e.value.length;o++){let i=e.value.charCodeAt(o);if(i===cb&&n&&r!==0)return ys(e,t+r+1,!1),6;if(!Pn(i)||++r>6)return 0}return r}function al(e,t,n){if(!e)return 0;for(;Lu(n(t),ub);){if(++e>6)return 0;t++}return t}function Mu(e,t){let n=0;if(e===null||e.type!==1||!_r(e.value,0,YE)||(e=t(++n),e===null))return 0;if(Lu(e,qE))return e=t(++n),e===null?0:e.type===1?al(ys(e,0,!0),++n,t):Lu(e,ub)?al(1,++n,t):0;if(e.type===10){let r=ys(e,1,!0);return r===0?0:(e=t(++n),e===null?n:e.type===12||e.type===10?!KE(e,cb)||!ys(e,1,!1)?0:n+1:al(r,n,t))}return e.type===12?al(ys(e,1,!0),++n,t):0}var qE,cb,ub,YE,pb=$(()=>{"use strict";nr();qE=43,cb=45,ub=63,YE=117});function yr(e,t){return t<e.length?e.charCodeAt(t):0}function fb(e,t){return $r(e,0,e.length,t)}function gb(e,t){for(let n=0;n<t.length;n++)if(fb(e,t[n]))return!0;return!1}function mb(e,t){return t!==e.length-2?!1:yr(e,t)===92&&_t(yr(e,t+1))}function ll(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 eA(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=Ou.get(e.type);break}o++}while(e=t(o));return o}function or(e,t){return function(n,r,o){return n===null?0:n.type===2&&gb(n.value,t)?eA(n,r):e(n,r,o)}}function Ft(e){return function(t){return t===null||t.type!==e?0:1}}function tA(e){if(e===null||e.type!==1)return 0;let t=e.value.toLowerCase();return gb(t,gi)||fb(t,"default")?0:1}function hb(e){return e===null||e.type!==1||yr(e.value,0)!==45||yr(e.value,1)!==45?0:1}function nA(e){return!hb(e)||e.value==="--"?0:1}function rA(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(!Pn(yr(e.value,n)))return 0;return 1}function oA(e){return e===null||e.type!==4||!oi(yr(e.value,1),yr(e.value,2),yr(e.value,3))?0:1}function iA(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=Ou.get(e.type);break}o++}while(e=t(o));return o}function sA(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=Ou.get(e.type);break}o++}while(e=t(o));return o}function Vr(e){return e&&(e=new Set(e)),function(t,n,r){if(t===null||t.type!==12)return 0;let o=Do(t.value,0);if(e!==null){let i=t.value.indexOf("\\",o),s=i===-1||!mb(t.value,i)?t.value.substr(o):t.value.substring(o,i);if(e.has(s.toLowerCase())===!1)return 0}return ll(r,t.value,o)?0:1}}function aA(e,t,n){return e===null||e.type!==11||ll(n,e.value,e.value.length-1)?0:1}function xb(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 lA(e,t,n){if(e===null)return 0;let r=Do(e.value,0);return!(r===e.value.length)&&!mb(e.value,r)||ll(n,e.value,r)?0:1}function cA(e,t,n){if(e===null||e.type!==10)return 0;let r=yr(e.value,0)===43||yr(e.value,0)===45?1:0;for(;r<e.value.length;r++)if(!_t(yr(e.value,r)))return 0;return ll(n,e.value,r)?0:1}function fA(e){let{angle:t,decibel:n,frequency:r,flex:o,length:i,resolution:s,semitones:a,time:u}=e||{};return{dimension:or(Vr(null),Wr),angle:or(Vr(t),Wr),decibel:or(Vr(n),Wr),frequency:or(Vr(r),Wr),flex:or(Vr(o),Wr),length:or(xb(Vr(i)),Wr),resolution:or(Vr(s),Wr),semitones:or(Vr(a),Wr),time:or(Vr(u),Wr)}}function gA(e){let t=new Set;for(let n of dA)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 yb(e){return{...uA,...pA,...fA(e),"attr-unit":gA(e)}}var Bu,Du,Ru,XE,QE,JE,zu,Nu,db,ZE,Wr,Ou,uA,pA,dA,bb=$(()=>{"use strict";sl();lb();pb();nr();Bu=["calc(","-moz-calc(","-webkit-calc("],Du=["min(","max(","clamp("],Ru=["round(","mod(","rem("],XE=["sin(","cos(","tan("],QE=["asin(","acos(","atan(","atan2("],JE=["pow(","sqrt(","log(","exp(","sign("],zu=["hypot("],Nu=["abs("],db=[...Bu,...Du,...Ru,...XE,...JE,...zu,...Nu],ZE=[...Bu,...Du,...Ru,...zu,...Nu],Wr=[...Bu,...Du,...Ru,...QE,...zu,...Nu],Ou=new Map([[2,22],[21,22],[19,20],[23,24]]);uA={"ident-token":Ft(1),"function-token":Ft(2),"at-keyword-token":Ft(3),"hash-token":Ft(4),"string-token":Ft(5),"bad-string-token":Ft(6),"url-token":Ft(7),"bad-url-token":Ft(8),"delim-token":Ft(9),"number-token":Ft(10),"percentage-token":Ft(11),"dimension-token":Ft(12),"whitespace-token":Ft(13),"CDO-token":Ft(14),"CDC-token":Ft(15),"colon-token":Ft(16),"semicolon-token":Ft(17),"comma-token":Ft(18),"[-token":Ft(19),"]-token":Ft(20),"(-token":Ft(21),")-token":Ft(22),"{-token":Ft(23),"}-token":Ft(24)},pA={string:Ft(5),ident:Ft(1),percentage:or(aA,ZE),zero:xb(),number:or(lA,db),integer:or(cA,db),"custom-ident":tA,"dashed-ident":hb,"custom-property-name":nA,"hex-color":rA,"id-selector":oA,"an-plus-b":Pu,urange:Mu,"declaration-value":iA,"any-value":sA},dA=["length","angle","time","frequency","resolution","flex","decibel","semitones"]});var cl={};ye(cl,{angle:()=>hA,decibel:()=>wA,flex:()=>SA,frequency:()=>yA,length:()=>mA,resolution:()=>bA,semitones:()=>vA,time:()=>xA});var mA,hA,xA,yA,bA,SA,wA,vA,Sb=$(()=>{"use strict";mA=["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"],hA=["deg","grad","rad","turn"],xA=["s","ms"],yA=["hz","khz"],bA=["dpi","dpcm","dppx","x"],SA=["fr"],wA=["db"],vA=["st"]});function wb(e,t,n){return Object.assign(zo("SyntaxError",e),{input:t,offset:n,rawMessage:e,message:e+`
|
|
13
11
|
`+t+`
|
|
14
|
-
--`+new Array((n||t.length)+1).join("-")+"^"})}var YF=9,KF=10,XF=12,QF=13,JF=32,wy=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),tl=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&&wy[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!==QF&&n!==KF&&n!==XF&&n!==JF&&n!==YF)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 Sy(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||wy[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)}};var ZF=9,eE=10,tE=12,nE=13,rE=32,Ey=33,Uu=35,vy=38,nl=39,Ay=40,Py=41,Ly=42,ju=43,Hu=44,ky=45,Wu=60,_u=62,rl=63,oE=64,ys=91,fi=93,ol=123,Cy=124,$u=125,Ty=8734,Iy={" ":1,"&&":2,"||":3,"|":4};function Fy(e){let t=null,n=null;return e.eat(ol),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===Hu?(e.pos++,e.skipWs(),e.charCode()!==$u&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat($u),{min:Number(t),max:n?Number(n):0}}function iE(e){let t=null,n=!1;switch(e.charCode()){case Ly:e.pos++,t={min:0,max:0};break;case ju:e.pos++,t={min:1,max:0};break;case rl:e.pos++,t={min:0,max:1};break;case Uu:e.pos++,n=!0,e.charCode()===ol?t=Fy(e):e.charCode()===rl?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case ol:t=Fy(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function _r(e,t){let n=iE(e);return n!==null?(n.term=t,e.charCode()===Uu&&e.charCodeAt(e.pos-1)===ju||e.charCode()===rl&&e.charCodeAt(e.pos-1)===$u?_r(e,n):n):t}function Ou(e){let t=e.peek();return t===""?null:_r(e,{type:"Token",value:t})}function sE(e){let t;return e.eat(Wu),e.eat(nl),t=e.scanWord(),e.eat(nl),e.eat(_u),_r(e,{type:"Property",name:t})}function aE(e){let t=null,n=null,r=1;return e.eat(ys),e.charCode()===ky&&(e.peek(),r=-1),r==-1&&e.charCode()===Ty?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(Hu),e.skipWs(),e.charCode()===Ty?e.peek():(r=1,e.charCode()===ky&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(fi),{type:"Range",min:t,max:n}}function lE(e){let t,n=null;if(e.eat(Wu),t=e.scanWord(),t==="boolean-expr"){e.eat(ys);let r=il(e,fi);return e.eat(fi),e.eat(_u),_r(e,{type:"Boolean",term:r.terms.length===1?r.terms[0]:r})}return e.charCode()===Ay&&e.nextCharCode()===Py&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===ys&&(e.skipWs(),n=aE(e)),e.eat(_u),_r(e,{type:"Type",name:t,opts:n})}function cE(e){let t=e.scanWord();return e.charCode()===Ay?(e.pos++,{type:"Function",name:t}):_r(e,{type:"Keyword",name:t})}function uE(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)=>Iy[o]-Iy[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,Py):dE(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:uE(r,n)||" ",disallowEmpty:!1,explicit:!1}}function pE(e){let t;return e.eat(ys),t=il(e,fi),e.eat(fi),t.explicit=!0,e.charCode()===Ey&&(e.pos++,t.disallowEmpty=!0),t}function dE(e){let t=e.charCode();switch(t){case fi:break;case ys:return _r(e,pE(e));case Wu:return e.nextCharCode()===nl?sE(e):lE(e);case Cy:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===Cy?2:1))};case vy:return e.pos++,e.eat(vy),{type:"Combinator",value:"&&"};case Hu:return e.pos++,{type:"Comma"};case nl:return _r(e,{type:"String",value:e.scanString()});case rE:case ZF:case eE:case nE:case tE:return{type:"Spaces",value:e.scanSpaces()};case oE:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):Ou(e);case Ly:case ju:case rl:case Uu:case Ey:break;case ol:if(t=e.nextCharCode(),t<48||t>57)return Ou(e);break;default:return e.isNameCharCode(t)?cE(e):Ou(e)}}function bs(e){let t=new tl(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 Ss=function(){};function My(e){return typeof e=="function"?e:Ss}function Vu(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=Ss,i=Ss;if(typeof t=="function"?o=t:t&&(o=My(t.enter),i=My(t.leave)),o===Ss&&i===Ss)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var gE={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 mE(e){let t=[];return ro(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function By(e,t){return typeof e=="string"?mE(e):t.generate(e,gE)}var ot={type:"Match"},pt={type:"Mismatch"},sl={type:"DisallowEmpty"},hE=40,xE=41;function un(e,t,n){return t===ot&&n===pt||e===ot&&t===ot&&n===ot?e:(e.type==="If"&&e.else===pt&&t===ot&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function Ry(e){return e.length>2&&e.charCodeAt(e.length-2)===hE&&e.charCodeAt(e.length-1)===xE}function Dy(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&Ry(e.name)}function io(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function ws(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=ws(e.match,t,n),e.then=ws(e.then,t,n),e.else=ws(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function Gu(e,t,n){switch(e){case" ":{let r=ot;for(let o=t.length-1;o>=0;o--){let i=t[o];r=un(i,r,pt)}return r}case"|":{let r=pt,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(Dy(s)&&(o===null&&i>0&&Dy(t[i-1])&&(o=Object.create(null),r=un({type:"Enum",map:o},ot,r)),o!==null)){let a=(Ry(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=un(s,ot,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=pt;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=Gu(e,t.filter(function(a){return a!==i}),!1):s=ot,r=un(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?ot:pt;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=Gu(e,t.filter(function(a){return a!==i}),!0):s=ot,r=un(i,s,r)}return r}}}function yE(e){let t=ot,n=gi(e.term);if(e.max===0)n=un(n,sl,pt),t=un(n,null,pt),t.then=un(ot,ot,t),e.comma&&(t.then.else=un({type:"Comma",syntax:e},t,pt));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==ot&&(t=un({type:"Comma",syntax:e},t,pt)),t=un(n,un(ot,ot,t),pt);if(e.min===0)t=un(ot,ot,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==ot&&(t=un({type:"Comma",syntax:e},t,pt)),t=un(n,t,pt);return t}function gi(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=Gu(e.combinator,e.terms.map(gi),!1);return e.disallowEmpty&&(t=un(t,sl,pt)),t}case"Multiplier":return yE(e);case"Boolean":{let t=gi(e.term),n=gi(io([io([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),io([{type:"Type",name:"!boolean-group"},io([{type:"Multiplier",comma:!1,min:0,max:0,term:io([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:io([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),r=gi(io([{type:"Type",name:"!term"},io([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return ws(r,{"!term":t,"!self":n}),ws(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 vs(e,t){return typeof e=="string"&&(e=bs(e)),{type:"MatchGraph",match:gi(e),syntax:t||null,source:e}}var{hasOwnProperty:zy}=Object.prototype,bE=0,SE=1,Yu=2,Uy=3,Ny="Match",wE="Mismatch",vE="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",Oy=15e3,kE=0;function CE(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function qu(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 TE(e){return e.type!==9?!1:e.value!=="?"}function _y(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||TE(e)}function $y(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function IE(e,t,n){function r(){do k++,F=k<e.length?e[k]:null;while(F!==null&&(F.type===13||F.type===25))}function o(O){let E=k+O;return E<e.length?e[E]:null}function i(O,E){return{nextState:O,matchStack:R,syntaxStack:p,thenStack:f,tokenIndex:k,prev:E}}function s(O){f={nextState:O,matchStack:R,syntaxStack:p,prev:f}}function a(O){d=i(O,d)}function u(){R={type:SE,syntax:t.syntax,token:F,prev:R},r(),m=null,k>z&&(z=k)}function c(){p={syntax:t.syntax,opts:t.syntax.opts||p!==null&&p.opts||null,prev:p},R={type:Yu,syntax:t.syntax,token:R.token,prev:R}}function l(){R.type===Yu?R=R.prev:R={type:Uy,syntax:p.syntax,token:R.token,prev:R},p=p.prev}let p=null,f=null,d=null,m=null,S=0,T=null,F=null,k=-1,z=0,R={type:bE,syntax:null,token:null,prev:null};for(r();T===null&&++S<Oy;)switch(t.type){case"Match":if(f===null){if(F!==null&&(k!==e.length-1||F.value!=="\\0"&&F.value!=="\\9")){t=pt;break}T=Ny;break}if(t=f.nextState,t===sl)if(f.matchStack===R){t=pt;break}else t=ot;for(;f.syntaxStack!==p;)l();f=f.prev;break;case"Mismatch":if(m!==null&&m!==!1)(d===null||k>d.tokenIndex)&&(d=m,m=!1);else if(d===null){T=wE;break}t=d.nextState,f=d.thenStack,p=d.syntaxStack,R=d.matchStack,k=d.tokenIndex,F=k<e.length?e[k]:null,d=d.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==pt&&a(t.else),t.then!==ot&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let D=t.syntax.terms;if(t.index===D.length){if(t.mask===0||t.syntax.all){t=pt;break}t=ot;break}if(t.mask===(1<<D.length)-1){t=ot;break}for(;t.index<D.length;t.index++){let g=1<<t.index;if((t.mask&g)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|g}),t=D[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(F!==null){let D=F.value.toLowerCase();if(D.indexOf("\\")!==-1&&(D=D.replace(/\\[09].*$/,"")),zy.call(t.map,D)){t=t.map[D];break}}t=pt;break;case"Generic":{let D=p!==null?p.opts:null,g=k+Math.floor(t.fn(F,o,D));if(!isNaN(g)&&g>k){for(;k<g;)u();t=ot}else t=pt;break}case"Type":case"Property":{let D=t.type==="Type"?"types":"properties",g=zy.call(n,D)?n[D][t.name]:null;if(!g||!g.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(m!==!1&&F!==null&&t.type==="Type"&&(t.name==="custom-ident"&&F.type===1||t.name==="length"&&F.value==="0")){m===null&&(m=i(t,d)),t=pt;break}c(),t=g.matchRef||g.match;break}case"Keyword":{let D=t.name;if(F!==null){let g=F.value;if(g.indexOf("\\")!==-1&&(g=g.replace(/\\[09].*$/,"")),qu(g,D)){u(),t=ot;break}}t=pt;break}case"AtKeyword":case"Function":if(F!==null&&qu(F.value,t.name)){u(),t=ot;break}t=pt;break;case"Token":if(F!==null&&F.value===t.value){u(),t=ot;break}t=pt;break;case"Comma":F!==null&&F.type===18?_y(R.token)?t=pt:(u(),t=$y(F)?pt:ot):t=_y(R.token)||$y(F)?ot:pt;break;case"String":let O="",E=k;for(;E<e.length&&O.length<t.value.length;E++)O+=e[E].value;if(qu(O,t.value)){for(;k<E;)u();t=ot}else t=pt;break;default:throw new Error("Unknown node type: "+t.type)}switch(kE+=S,T){case null:console.warn("[csstree-match] BREAK after "+Oy+" iterations"),T=vE,R=null;break;case Ny:for(;p!==null;)l();break;default:R=null}return{tokens:e,reason:T,iterations:S,match:R,longestMatch:z}}function Ku(e,t,n){let r=IE(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=CE(o).prev;o!==null;){switch(o.type){case Yu:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case Uy: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 Qu={};be(Qu,{getTrace:()=>jy,isKeyword:()=>AE,isProperty:()=>EE,isType:()=>FE});function jy(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 FE(e,t){return Xu(this,e,n=>n.type==="Type"&&n.name===t)}function EE(e,t){return Xu(this,e,n=>n.type==="Property"&&n.name===t)}function AE(e){return Xu(this,e,t=>t.type==="Keyword")}function Xu(e,t,n){let r=jy.call(e,t);return r===null?!1:r.some(n)}function Hy(e){return"node"in e?e.node:Hy(e.match[0])}function Wy(e){return"node"in e?e.node:Wy(e.match[e.match.length-1])}function Ju(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){let u=Hy(a),c=Wy(a);e.syntax.walk(t,function(l,p,f){if(l===u){let d=new Rn;do{if(d.appendData(p.data),p.data===c)break;p=p.next}while(p!==null);s.push({parent:f,nodes:d})}})}Array.isArray(a.match)&&a.match.forEach(i)}let s=[];return n.matched!==null&&i(n.matched),s}var{hasOwnProperty:ks}=Object.prototype;function Zu(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function Vy(e){return!!e&&Zu(e.offset)&&Zu(e.line)&&Zu(e.column)}function PE(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(ks.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(!Vy(r.loc.start))i+=".start";else if(!Vy(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 Rn)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(let i in t)ks.call(t,i)&&ks.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function Gy(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<"+(Gy(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return n.join(" | ")}function LE(e,t){let n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in n){if(ks.call(n,i)===!1)continue;let s=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];o[i]=Gy(s,e+"."+i)}return{docs:o,check:PE(e,r)}}function qy(e){let t={};if(e.node){for(let n in e.node)if(ks.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=LE(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}function ep(e,t,n){let r={};for(let o in e)e[o].syntax&&(r[o]=n?e[o].syntax:li(e[o].syntax,{compact:t}));return r}function ME(e,t,n){let r={};for(let[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:li(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&ep(i.descriptors,t,n)};return r}function BE(e){for(let t=0;t<e.length;t++)if(e[t].value.toLowerCase()==="var(")return!0;return!1}function DE(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function dr(e,t,n){return{matched:e,iterations:n,error:t,...Qu}}function mi(e,t,n,r){let o=By(n,e.syntax),i;return BE(o)?dr(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=Ku(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=Ku(o,t.match,e),!i.match)?dr(null,new cy(i.reason,t.syntax,n,i),i.iterations):dr(i.match,null,i.iterations))}var Cs=class{constructor(t,n,r){if(this.cssWideKeywords=pi,this.syntax=n,this.generic=!1,this.units={...el},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=r||qy(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(el))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(by(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=vs(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=vs(t,i):(typeof t=="string"?Object.defineProperty(s,"syntax",{get(){return Object.defineProperty(s,"syntax",{value:bs(t)}),s.syntax}}):s.syntax=t,Object.defineProperty(s,"match",{get(){return Object.defineProperty(s,"match",{value:vs(s.syntax,i)}),s.match}}),n==="Property"&&Object.defineProperty(s,"matchRef",{get(){let a=s.syntax,u=DE(a)?vs({...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 ci("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&&!mi(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=Xa(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 ci("Unknown at-rule descriptor",n)}checkPropertyName(t){if(!this.getProperty(t))return new ci("Unknown property",t)}matchAtrulePrelude(t,n){let r=this.checkAtrulePrelude(t,n);if(r)return dr(null,r);let o=this.getAtrule(t);return o.prelude?mi(this,o.prelude,n||"",!1):dr(null,null)}matchAtruleDescriptor(t,n,r){let o=this.checkAtruleDescriptorName(t,n);if(o)return dr(null,o);let i=this.getAtrule(t),s=Xa(n);return mi(this,i.descriptors[s.name]||i.descriptors[s.basename],r,!1)}matchDeclaration(t){return t.type!=="Declaration"?dr(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,n){if(Tu(t).custom)return dr(null,new Error("Lexer matching doesn't applicable for custom properties"));let r=this.checkPropertyName(t);return r?dr(null,r):mi(this,this.getProperty(t),n,!0)}matchType(t,n){let r=this.getType(t);return r?mi(this,r,n,!1):dr(null,new ci("Unknown type",t))}match(t,n){return typeof t!="string"&&(!t||!t.type)?dr(null,new ci("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),mi(this,t,n,!1))}findValueFragments(t,n,r,o){return Ju(this,n,this.matchProperty(t,n),r,o)}findDeclarationValueFragments(t,n,r){return Ju(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=Xa(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=Tu(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,p){if(l.has(c))return l.get(c);l.set(c,!1),p.syntax!==null&&Vu(p.syntax,function(f){if(f.type!=="Type"&&f.type!=="Property")return;let d=f.type==="Type"?u.types:u.properties,m=f.type==="Type"?o:i;hasOwnProperty.call(d,f.name)?n(u,f.name,m,d[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:ep(this.types,!n,t),properties:ep(this.properties,!n,t),atrules:ME(this.atrules,!n,t)}}toString(){return JSON.stringify(this.dump())}};function tp(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function RE(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function np(e,t,n){let r={...e};for(let[o,i]of Object.entries(t))r[o]={...r[o],...n?RE(i,n):i};return r}function Ts(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?tp(u.prelude,s.prelude):u.prelude||null;for(let[c,l]of Object.entries(s.descriptors||{}))u.descriptors[c]=l?tp(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]=tp(n[r][i],s);break;case"parseContext":n[r]={...e[r],...o};break;case"scope":case"features":n[r]=np(e[r],o);break;case"atrule":case"pseudo":n[r]=np(e[r],o,["parse"]);break;case"node":n[r]=np(e[r],o,["name","structure","parse","generate","walkContext"]);break}return n}function Yy(e){let t=Px(e),n=ay(e),r=ty(e),{fromPlainObject:o,toPlainObject:i}=ny(n),s={lexer:null,createLexer:a=>new Cs(a,s,s.lexer.structure),tokenize:ro,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){let u=Ts({},e);return Yy(typeof a=="function"?a(u):Ts(u,a))}};return s.lexer=new Cs({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var Ky=e=>Yy(Ts({},e));var Xy={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 Fs={};be(Fs,{AnPlusB:()=>ip,Atrule:()=>ap,AtrulePrelude:()=>cp,AttributeSelector:()=>dp,Block:()=>gp,Brackets:()=>hp,CDC:()=>yp,CDO:()=>Sp,ClassSelector:()=>vp,Combinator:()=>Cp,Comment:()=>Ip,Condition:()=>Ep,Declaration:()=>Pp,DeclarationList:()=>Bp,Dimension:()=>Rp,Feature:()=>Np,FeatureFunction:()=>_p,FeatureRange:()=>jp,Function:()=>Wp,GeneralEnclosed:()=>Gp,Hash:()=>Yp,IdSelector:()=>Jp,Identifier:()=>Xp,Layer:()=>ed,LayerList:()=>nd,MediaQuery:()=>od,MediaQueryList:()=>sd,NestingSelector:()=>ld,Nth:()=>ud,Number:()=>dd,Operator:()=>gd,Parentheses:()=>hd,Percentage:()=>yd,PseudoClassSelector:()=>Sd,PseudoElementSelector:()=>vd,Ratio:()=>Cd,Raw:()=>Id,Rule:()=>Ed,Scope:()=>Pd,Selector:()=>Md,SelectorList:()=>Dd,String:()=>Nd,StyleSheet:()=>_d,SupportsDeclaration:()=>Ud,TypeSelector:()=>Wd,UnicodeRange:()=>qd,Url:()=>Xd,Value:()=>Jd,WhiteSpace:()=>ef});var ip={};be(ip,{generate:()=>_E,name:()=>NE,parse:()=>op,structure:()=>OE});var Cr=43,zn=45,al=110,Do=!0,zE=!1;function ll(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Cr||r===zn)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)Mt(this.charCodeAt(n))||this.error("Integer is expected",n)}function hi(e){return ll.call(this,0,e)}function so(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case al:n="N is expected";break;case zn:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function rp(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim(Cr,e)||this.isDelim(zn,e)){t=this.isDelim(Cr,e)?Cr:zn;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),hi.call(this,Do))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==Cr&&n!==zn&&this.error("Number sign is expected")),hi.call(this,t!==0),t===zn?"-"+this.consume(10):this.consume(10)}var NE="AnPlusB",OE={a:[String,null],b:[String,null]};function op(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)hi.call(this,zE),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,zn))switch(t="-1",so.call(this,1,al),this.tokenEnd-this.tokenStart){case 2:this.next(),n=rp.call(this);break;case 3:so.call(this,2,zn),this.next(),this.skipSC(),hi.call(this,Do),n="-"+this.consume(10);break;default:so.call(this,2,zn),ll.call(this,3,Do),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(Cr)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim(Cr)&&(r=1,this.next()),so.call(this,0,al),this.tokenEnd-this.tokenStart){case 1:this.next(),n=rp.call(this);break;case 2:so.call(this,1,zn),this.next(),this.skipSC(),hi.call(this,Do),n="-"+this.consume(10);break;default:so.call(this,1,zn),ll.call(this,2,Do),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),o=r===Cr||r===zn,i=this.tokenStart+o;for(;i<this.tokenEnd&&Mt(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),so.call(this,i-this.tokenStart,al),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=rp.call(this)):(so.call(this,i-this.tokenStart+1,zn),i+2===this.tokenEnd?(this.next(),this.skipSC(),hi.call(this,Do),n="-"+this.consume(10)):(ll.call(this,i-this.tokenStart+2,Do),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===Cr&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===Cr&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function _E(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 ap={};be(ap,{generate:()=>WE,name:()=>UE,parse:()=>sp,structure:()=>HE,walkContext:()=>jE});function Qy(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function $E(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}var UE="Atrule",jE="atrule",HE={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]};function sp(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),Qy):o=Qy.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($E.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:o,block:i}}function WE(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var cp={};be(cp,{generate:()=>YE,name:()=>VE,parse:()=>lp,structure:()=>qE,walkContext:()=>GE});var VE="AtrulePrelude",GE="atrulePrelude",qE={children:[[]]};function lp(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 YE(e){this.children(e)}var dp={};be(dp,{generate:()=>nA,name:()=>eA,parse:()=>pp,structure:()=>tA});var KE=36,Jy=42,cl=61,XE=94,up=124,QE=126;function JE(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(Jy)?(t=!0,this.next()):this.isDelim(up)||this.eat(1),this.isDelim(up)?this.charCodeAt(this.tokenStart+1)!==cl?(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 ZE(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==cl&&t!==QE&&t!==XE&&t!==KE&&t!==Jy&&t!==up&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==cl&&(this.isDelim(cl)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}var eA="AttributeSelector",tA={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]};function pp(){let e=this.tokenStart,t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=JE.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=ZE.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 nA(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 gp={};be(gp,{generate:()=>lA,name:()=>iA,parse:()=>fp,structure:()=>aA,walkContext:()=>sA});var rA=38;function tb(){return this.Raw(null,!0)}function Zy(){return this.parseWithFallback(this.Rule,tb)}function eb(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function oA(){if(this.tokenType===17)return eb.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,eb);return this.tokenType===17&&this.next(),e}var iA="Block",sA="block",aA={children:[["Atrule","Rule","Declaration"]]};function fp(e){let t=e?oA:Zy,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),tb));break;default:e&&this.isDelim(rA)?r.push(Zy.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function lA(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var hp={};be(hp,{generate:()=>pA,name:()=>cA,parse:()=>mp,structure:()=>uA});var cA="Brackets",uA={children:[[]]};function mp(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 pA(e){this.token(9,"["),this.children(e),this.token(9,"]")}var yp={};be(yp,{generate:()=>gA,name:()=>dA,parse:()=>xp,structure:()=>fA});var dA="CDC",fA=[];function xp(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function gA(){this.token(15,"-->")}var Sp={};be(Sp,{generate:()=>xA,name:()=>mA,parse:()=>bp,structure:()=>hA});var mA="CDO",hA=[];function bp(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function xA(){this.token(14,"<!--")}var vp={};be(vp,{generate:()=>wA,name:()=>bA,parse:()=>wp,structure:()=>SA});var yA=46,bA="ClassSelector",SA={name:String};function wp(){return this.eatDelim(yA),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function wA(e){this.token(9,"."),this.token(1,e.name)}var Cp={};be(Cp,{generate:()=>FA,name:()=>TA,parse:()=>kp,structure:()=>IA});var vA=43,nb=47,kA=62,CA=126,TA="Combinator",IA={name:String};function kp(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case kA:case vA:case CA:this.next();break;case nb:this.next(),this.eatIdent("deep"),this.eatDelim(nb);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e);break}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function FA(e){this.tokenize(e.name)}var Ip={};be(Ip,{generate:()=>MA,name:()=>PA,parse:()=>Tp,structure:()=>LA});var EA=42,AA=47,PA="Comment",LA={value:String};function Tp(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===EA&&this.charCodeAt(t-1)===AA&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function MA(e){this.token(25,"/*"+e.value+"*/")}var Ep={};be(Ep,{generate:()=>NA,name:()=>DA,parse:()=>Fp,structure:()=>RA});var BA=new Set([16,22,0]),DA="Condition",RA={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};function rb(e){return this.lookupTypeNonSC(1)===1&&BA.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}var zA={media:rb,container:rb,supports(){return this.SupportsDeclaration()}};function Fp(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(()=>zA[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 NA(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var Pp={};be(Pp,{generate:()=>KA,name:()=>GA,parse:()=>Ap,structure:()=>YA,walkContext:()=>qA});var ib=33,OA=35,_A=36,$A=38,UA=42,jA=43,ob=47;function HA(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function WA(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function VA(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(ib)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}var GA="Declaration",qA="declaration",YA={important:[Boolean,String],property:String,value:["Value","Raw"]};function Ap(){let e=this.tokenStart,t=this.tokenIndex,n=XA.call(this),r=Qa(n),o=r?this.parseCustomProperty:this.parseValue,i=r?WA:HA,s=!1,a;this.skipSC(),this.eat(16);let u=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(VA,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(ib)&&(s=QA.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 KA(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 XA(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case UA:case _A:case jA:case OA:case $A:this.next();break;case ob:this.next(),this.isDelim(ob)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function QA(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var Bp={};be(Bp,{generate:()=>tP,name:()=>ZA,parse:()=>Mp,structure:()=>eP});var JA=38;function Lp(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}var ZA="DeclarationList",eP={children:[["Declaration","Atrule","Rule"]]};function Mp(){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),Lp));break;default:this.isDelim(JA)?e.push(this.parseWithFallback(this.Rule,Lp)):e.push(this.parseWithFallback(this.Declaration,Lp))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function tP(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var Rp={};be(Rp,{generate:()=>oP,name:()=>nP,parse:()=>Dp,structure:()=>rP});var nP="Dimension",rP={value:String,unit:String};function Dp(){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 oP(e){this.token(12,e.value+e.unit)}var Np={};be(Np,{generate:()=>lP,name:()=>sP,parse:()=>zp,structure:()=>aP});var iP=47,sP="Feature",aP={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]};function zp(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(iP)&&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 lP(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var _p={};be(_p,{generate:()=>dP,name:()=>cP,parse:()=>Op,structure:()=>uP});var cP="FeatureFunction",uP={kind:String,feature:String,value:["Declaration","Selector"]};function pP(e,t){let r=(this.features[e]||{})[t];return typeof r!="function"&&this.error(`Unknown feature ${t}()`),r}function Op(e="unknown"){let t=this.tokenStart,n=this.consumeFunctionName(),r=pP.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 dP(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var jp={};be(jp,{generate:()=>xP,name:()=>mP,parse:()=>Up,structure:()=>hP});var sb=47,fP=60,ab=61,gP=62,mP="FeatureRange",hP={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]};function $p(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(sb,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(sb)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function lb(e){if(this.skipSC(),this.isDelim(fP)||this.isDelim(gP)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(ab)?(this.next(),t+"="):t}if(this.isDelim(ab))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function Up(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=$p.call(this),r=lb.call(this,n.type==="Identifier"),o=$p.call(this),i=null,s=null;return this.lookupNonWSType(0)!==22&&(i=lb.call(this),s=$p.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 xP(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 Wp={};be(Wp,{generate:()=>wP,name:()=>yP,parse:()=>Hp,structure:()=>SP,walkContext:()=>bP});var yP="Function",bP="function",SP={name:String,children:[[]]};function Hp(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 wP(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var Gp={};be(Gp,{generate:()=>CP,name:()=>vP,parse:()=>Vp,structure:()=>kP});var vP="GeneralEnclosed",kP={kind:String,function:[String,null],children:[[]]};function Vp(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 CP(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var Yp={};be(Yp,{generate:()=>EP,name:()=>IP,parse:()=>qp,structure:()=>FP,xxx:()=>TP});var TP="XXX",IP="Hash",FP={value:String};function qp(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function EP(e){this.token(4,"#"+e.value)}var Xp={};be(Xp,{generate:()=>LP,name:()=>AP,parse:()=>Kp,structure:()=>PP});var AP="Identifier",PP={name:String};function Kp(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function LP(e){this.token(1,e.name)}var Jp={};be(Jp,{generate:()=>DP,name:()=>MP,parse:()=>Qp,structure:()=>BP});var MP="IdSelector",BP={name:String};function Qp(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function DP(e){this.token(9,"#"+e.name)}var ed={};be(ed,{generate:()=>OP,name:()=>zP,parse:()=>Zp,structure:()=>NP});var RP=46,zP="Layer",NP={name:String};function Zp(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(RP);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function OP(e){this.tokenize(e.name)}var nd={};be(nd,{generate:()=>UP,name:()=>_P,parse:()=>td,structure:()=>$P});var _P="LayerList",$P={children:[["Layer"]]};function td(){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 UP(e){this.children(e,()=>this.token(18,","))}var od={};be(od,{generate:()=>WP,name:()=>jP,parse:()=>rd,structure:()=>HP});var jP="MediaQuery",HP={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]};function rd(){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 WP(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 sd={};be(sd,{generate:()=>qP,name:()=>VP,parse:()=>id,structure:()=>GP});var VP="MediaQueryList",GP={children:[["MediaQuery"]]};function id(){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 qP(e){this.children(e,()=>this.token(18,","))}var ld={};be(ld,{generate:()=>QP,name:()=>KP,parse:()=>ad,structure:()=>XP});var YP=38,KP="NestingSelector",XP={};function ad(){let e=this.tokenStart;return this.eatDelim(YP),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function QP(){this.token(9,"&")}var ud={};be(ud,{generate:()=>e2,name:()=>JP,parse:()=>cd,structure:()=>ZP});var JP="Nth",ZP={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]};function cd(){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 e2(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var dd={};be(dd,{generate:()=>r2,name:()=>t2,parse:()=>pd,structure:()=>n2});var t2="Number",n2={value:String};function pd(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function r2(e){this.token(10,e.value)}var gd={};be(gd,{generate:()=>s2,name:()=>o2,parse:()=>fd,structure:()=>i2});var o2="Operator",i2={value:String};function fd(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function s2(e){this.tokenize(e.value)}var hd={};be(hd,{generate:()=>c2,name:()=>a2,parse:()=>md,structure:()=>l2});var a2="Parentheses",l2={children:[[]]};function md(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 c2(e){this.token(21,"("),this.children(e),this.token(22,")")}var yd={};be(yd,{generate:()=>d2,name:()=>u2,parse:()=>xd,structure:()=>p2});var u2="Percentage",p2={value:String};function xd(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function d2(e){this.token(11,e.value+"%")}var Sd={};be(Sd,{generate:()=>h2,name:()=>f2,parse:()=>bd,structure:()=>m2,walkContext:()=>g2});var f2="PseudoClassSelector",g2="function",m2={name:String,children:[["Raw"],null]};function bd(){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 h2(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var vd={};be(vd,{generate:()=>S2,name:()=>x2,parse:()=>wd,structure:()=>b2,walkContext:()=>y2});var x2="PseudoElementSelector",y2="function",b2={name:String,children:[["Raw"],null]};function wd(){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 S2(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 Cd={};be(Cd,{generate:()=>k2,name:()=>w2,parse:()=>kd,structure:()=>v2});var cb=47;function ub(){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")}}var w2="Ratio",v2={left:["Number","Function"],right:["Number","Function",null]};function kd(){let e=this.tokenStart,t=ub.call(this),n=null;return this.skipSC(),this.isDelim(cb)&&(this.eatDelim(cb),n=ub.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function k2(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var Id={};be(Id,{generate:()=>F2,name:()=>T2,parse:()=>Td,structure:()=>I2});function C2(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}var T2="Raw",I2={value:String};function Td(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?r=C2.call(this):r=this.tokenStart,{type:"Raw",loc:this.getLocation(n,r),value:this.substring(n,r)}}function F2(e){this.tokenize(e.value)}var Ed={};be(Ed,{generate:()=>M2,name:()=>A2,parse:()=>Fd,structure:()=>L2,walkContext:()=>P2});function pb(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function E2(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}var A2="Rule",P2="rule",L2={prelude:["SelectorList","Raw"],block:["Block"]};function Fd(){let e=this.tokenIndex,t=this.tokenStart,n,r;return this.parseRulePrelude?n=this.parseWithFallback(E2,pb):n=pb.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function M2(e){this.node(e.prelude),this.node(e.block)}var Pd={};be(Pd,{generate:()=>R2,name:()=>B2,parse:()=>Ad,structure:()=>D2});var B2="Scope",D2={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]};function Ad(){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 R2(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 Md={};be(Md,{generate:()=>O2,name:()=>z2,parse:()=>Ld,structure:()=>N2});var z2="Selector",N2={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]};function Ld(){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 O2(e){this.children(e)}var Dd={};be(Dd,{generate:()=>j2,name:()=>_2,parse:()=>Bd,structure:()=>U2,walkContext:()=>$2});var _2="SelectorList",$2="selector",U2={children:[["Selector","Raw"]]};function Bd(){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 j2(e){this.children(e,()=>this.token(18,","))}var Nd={};be(Nd,{generate:()=>V2,name:()=>H2,parse:()=>zd,structure:()=>W2});var Rd=92,db=34,fb=39;function ul(e){let t=e.length,n=e.charCodeAt(0),r=n===db||n===fb?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===Rd){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),Cn(Rd,a)){let u=s-1,c=Dr(e,u);s=c-1,i+=Na(e.substring(u+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function gb(e,t){let n=t?"'":'"',r=t?fb:db,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===Rd?(o+="\\"+e.charAt(s),i=!1):(i&&(Tn(a)||vr(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var H2="String",W2={value:String};function zd(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:ul(this.consume(5))}}function V2(e){this.token(5,gb(e.value))}var _d={};be(_d,{generate:()=>X2,name:()=>q2,parse:()=>Od,structure:()=>K2,walkContext:()=>Y2});var G2=33;function hb(){return this.Raw(null,!1)}var q2="StyleSheet",Y2="stylesheet",K2={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]};function Od(){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)!==G2){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,hb);break;default:n=this.parseWithFallback(this.Rule,hb)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function X2(e){this.children(e)}var Ud={};be(Ud,{generate:()=>Z2,name:()=>Q2,parse:()=>$d,structure:()=>J2});var Q2="SupportsDeclaration",J2={declaration:"Declaration"};function $d(){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 Z2(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var Wd={};be(Wd,{generate:()=>rL,name:()=>tL,parse:()=>Hd,structure:()=>nL});var eL=42,xb=124;function jd(){this.tokenType!==1&&this.isDelim(eL)===!1&&this.error("Identifier or asterisk is expected"),this.next()}var tL="TypeSelector",nL={name:String};function Hd(){let e=this.tokenStart;return this.isDelim(xb)?(this.next(),jd.call(this)):(jd.call(this),this.isDelim(xb)&&(this.next(),jd.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function rL(e){this.tokenize(e.name)}var qd={};be(qd,{generate:()=>lL,name:()=>sL,parse:()=>Gd,structure:()=>aL});var yb=43,bb=45,Vd=63;function Is(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let o=this.charCodeAt(r);if(o===bb&&t&&n!==0)return Is.call(this,e+n+1,!1),-1;Tn(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 pl(e){let t=0;for(;this.isDelim(Vd);)++t>e&&this.error("Too many question marks"),this.next()}function oL(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===yb?"Plus sign":"Hyphen minus")+" is expected")}function iL(){let e=0;switch(this.tokenType){case 10:if(e=Is.call(this,1,!0),this.isDelim(Vd)){pl.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){oL.call(this,bb),Is.call(this,1,!1);break}break;case 12:e=Is.call(this,1,!0),e>0&&pl.call(this,6-e);break;default:if(this.eatDelim(yb),this.tokenType===1){e=Is.call(this,0,!0),e>0&&pl.call(this,6-e);break}if(this.isDelim(Vd)){this.next(),pl.call(this,5);break}this.error("Hex digit or question mark is expected")}}var sL="UnicodeRange",aL={value:String};function Gd(){let e=this.tokenStart;return this.eatIdent("u"),iL.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function lL(e){this.tokenize(e.value)}var Xd={};be(Xd,{generate:()=>mL,name:()=>fL,parse:()=>Kd,structure:()=>gL});var cL=32,Yd=92,uL=34,pL=39,dL=40,Sb=41;function wb(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===Sb?t-2:t-1,o="";for(;n<r&&vr(e.charCodeAt(n));)n++;for(;n<r&&vr(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===Yd){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),Cn(Yd,s)){let a=i-1,u=Dr(e,a);i=u-1,o+=Na(e.substring(a+1,u))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function vb(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===cL||o===Yd||o===uL||o===pL||o===dL||o===Sb?(t+="\\"+e.charAt(r),n=!1):(n&&Tn(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var fL="Url",gL={value:String};function Kd(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=wb(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=ul(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 mL(e){this.token(7,vb(e.value))}var Jd={};be(Jd,{generate:()=>yL,name:()=>hL,parse:()=>Qd,structure:()=>xL});var hL="Value",xL={children:[[]]};function Qd(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function yL(e){this.children(e)}var ef={};be(ef,{generate:()=>vL,name:()=>SL,parse:()=>Zd,structure:()=>wL});var bL=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),SL="WhiteSpace",wL={value:String};function Zd(){return this.eat(13),bL}function vL(e){this.token(13,e.value)}var Cb={generic:!0,cssWideKeywords:pi,...Xy,node:Fs};var tf={};be(tf,{AtrulePrelude:()=>Ib,Selector:()=>Eb,Value:()=>Mb});var kL=35,CL=42,Tb=43,TL=45,IL=47,FL=117;function Es(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,FL)&&this.cmpChar(this.tokenStart+1,Tb)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===IL||t===CL||t===Tb||t===TL)return this.Operator();t===kL&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var Ib={getNode:Es};var EL=35,AL=38,PL=42,LL=43,ML=47,Fb=46,BL=62,DL=124,RL=126;function zL(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function NL(){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)===Fb&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case LL:case BL:case RL:case ML:return this.Combinator();case Fb:return this.ClassSelector();case PL:case DL:return this.TypeSelector();case EL:return this.IdSelector();case AL:return this.NestingSelector()}break}}}var Eb={onWhiteSpace:zL,getNode:NL};function Ab(){return this.createSingleNodeList(this.Raw(null,!1))}function Pb(){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}function Lb(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var Mb={getNode:Es,onWhiteSpace(e,t){Lb(e)&&(e.value=" "+e.value),Lb(t.last)&&(t.last.value+=" ")},expression:Ab,var:Pb};var OL=new Set(["none","and","not","or"]),Bb={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);OL.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}};var Db={parse:{prelude:null,block(){return this.Block(!0)}}};function nf(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 Rb={layer(){this.skipSC();let e=this.createList(),t=nf.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=nf.call(this,this.Declaration,()=>nf.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},zb={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,Rb)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,Rb)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}};var Nb={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}};var Ob={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}};var _b={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}};var $b={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}};var Ub={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}};var jb={parse:{prelude:null,block(e=!1){return this.Block(e)}}};var Hb={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}};var Wb={container:Bb,"font-face":Db,import:zb,layer:Nb,media:Ob,nest:_b,page:$b,scope:Ub,"starting-style":jb,supports:Hb};function Vb(){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 Ro={parse(){return this.createSingleNodeList(this.SelectorList())}},rf={parse(){return this.createSingleNodeList(this.Selector())}},_L={parse(){return this.createSingleNodeList(this.Identifier())}},$L={parse:Vb},dl={parse(){return this.createSingleNodeList(this.Nth())}},Gb={dir:_L,has:Ro,lang:$L,matches:Ro,is:Ro,"-moz-any":Ro,"-webkit-any":Ro,where:Ro,not:Ro,"nth-child":dl,"nth-last-child":dl,"nth-last-of-type":dl,"nth-of-type":dl,slotted:rf,host:rf,"host-context":rf};var of={};be(of,{AnPlusB:()=>op,Atrule:()=>sp,AtrulePrelude:()=>lp,AttributeSelector:()=>pp,Block:()=>fp,Brackets:()=>mp,CDC:()=>xp,CDO:()=>bp,ClassSelector:()=>wp,Combinator:()=>kp,Comment:()=>Tp,Condition:()=>Fp,Declaration:()=>Ap,DeclarationList:()=>Mp,Dimension:()=>Dp,Feature:()=>zp,FeatureFunction:()=>Op,FeatureRange:()=>Up,Function:()=>Hp,GeneralEnclosed:()=>Vp,Hash:()=>qp,IdSelector:()=>Qp,Identifier:()=>Kp,Layer:()=>Zp,LayerList:()=>td,MediaQuery:()=>rd,MediaQueryList:()=>id,NestingSelector:()=>ad,Nth:()=>cd,Number:()=>pd,Operator:()=>fd,Parentheses:()=>md,Percentage:()=>xd,PseudoClassSelector:()=>bd,PseudoElementSelector:()=>wd,Ratio:()=>kd,Raw:()=>Td,Rule:()=>Fd,Scope:()=>Ad,Selector:()=>Ld,SelectorList:()=>Bd,String:()=>zd,StyleSheet:()=>Od,SupportsDeclaration:()=>$d,TypeSelector:()=>Hd,UnicodeRange:()=>Gd,Url:()=>Kd,Value:()=>Qd,WhiteSpace:()=>Zd});var qb={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:tf,atrule:Wb,pseudo:Gb,node:of};var Yb={node:Fs};var Kb=Ky({...Cb,...qb,...Yb});var{tokenize:J9,parse:Xb,generate:Z9,lexer:eG,createLexer:tG,walk:Qb,find:nG,findLast:rG,findAll:oG,toPlainObject:iG,fromPlainObject:sG,fork:aG}=Kb;var jL=new Set(["padding","margin","border-radius","borderradius","inset","border-width","borderwidth"]);function HL(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Zb(e){try{let t=Xb(e.trim(),{context:"value"}),n=[];return Qb(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 WL(e,t){let n=HL(e);if(!jL.has(n))return t;let r=Zb(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 Jb(e,t){let n=t.trim();if(!n)return"";let r=WL(e,n);return Zb(r).map(i=>i==="0"?"0px":i).join(" ")}function e0(e,t,n){let r=Jb(e,t),o=Jb(e,n);return r!==""&&o!==""&&r===o}function VL(e){let t=e.toLowerCase();return t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function GL(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 t0(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=GL(n[0]);if(i)return i}let r=t.match(/#([0-9a-fA-F]{3,8})/);if(r)return VL(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 zo(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),p=c.test(o);if(l!==p)return!1;let f=t0(r),d=t0(o);return!!(f===d||n&&e0(n,r,o))}var r0=.5,o0=2,i0=2,qL=5,YL=["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"],KL=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],XL=["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 QL(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 n0(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 JL(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 ZL(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&&QL(n)||n0(r)||n0(o)||n&&JL(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<o0:a<r0}return r.includes("%")||o.includes("%")?a<1:!1}function eM(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(XL.some(s=>t.includes(s))||!YL.some(s=>t.includes(s)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!zo(o,i,e.property))}function tM(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 nM(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)<i0}function rM(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(!KL.some(p=>t.includes(p)||n.includes(p)))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]))>qL)}function oM(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 As(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(zo(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(nM(e))return{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${i0}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"};if(ZL(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")?o0:r0}px)`,dismissedBy:"post-ai-validation"}}return oM(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:eM(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:rM(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:tM(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var gM=["flex","inline-flex"],mM=["grid","inline-grid"],CG=[...gM,...mM];Me();var fl=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function yM(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function sf(e,t){let n=[],r=e.split(`
|
|
15
|
-
`);for(let s=0;s<r.length;s++){let a=yM(r[s]),u=fl.exec(a);if(u){let[,c,l,,p]=u,f=bM(l),d=SM(r,s+1),m={id:to(),reviewId:t,type:c.trim(),severity:f,title:p.trim(),description:d.description,file:d.file,lineNumber:d.lineNumber,property:d.property,currentValue:d.currentValue,suggestedValue:d.suggestedValue,suggestedCode:d.suggestedCode,suggestedFix:d.suggestedFix,fixTarget:d.fixTarget,fixRequired:d.fixRequired,status:"pending",selectedForFix:!1,createdAt:new Date};n.push(m)}fl.lastIndex=0}return n.map(s=>{let a=As(s);return a.dismissed?(b.debug(`[parseIssues] Auto-dismissed: ${s.title} - ${a.dismissReason}`),{...s,dismissed:!0,dismissReason:a.dismissReason,dismissedBy:a.dismissedBy,dismissedAt:new Date}):s})}function bM(e){let t=e.toLowerCase().trim();return t.includes("critical")||t.includes("high")?"critical":t.includes("major")||t.includes("medium")?"major":"minor"}function SM(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||fl.test(i)){fl.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}Me();var Ps=null,a0=0,wM=3e4;async function vM(){let e=Date.now();if(Ps&&e-a0<wM)return Ps;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 Ps=n.entries||n.stories||{},a0=e,b.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(Ps).length),Ps}catch(t){throw b.error("[storyFilePaths] Error fetching index.json:",t),t}}async function Ls(e){try{let n=(await vM())[e];if(!n?.importPath)return b.warn("[storyFilePaths] No importPath found for story:",e),null;let r=n.importPath;b.debug("[storyFilePaths] Found importPath:",r);let o=r.replace(/^\.\//,""),i;n.componentPath?(i=n.componentPath.replace(/^\.\//,""),b.debug("[storyFilePaths] Using Storybook componentPath:",i)):(i=`${o.replace(/\.stories\.tsx$/,"").replace(/\.stories\.ts$/,"").replace(/\.stories\.jsx$/,"").replace(/\.stories\.js$/,"")}.tsx`,b.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 b.debug("[storyFilePaths] Final paths:",u),u}catch(t){return b.error("[storyFilePaths] Error getting file paths:",t),null}}function af(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function kM(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 lf(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?(b.debug(`[storyFilePaths] \u{1F50D} INLINE ATTRIBUTE: domElement="${e.domElement}", property="${e.property}" \u2192 component file`),t.componentFile):kM(e.type,t)}Me();function CM(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 TM(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 IM(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 FM(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(p=>p.currentValue).filter(Boolean),l=e.map(p=>p.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 cf(e){if(!e||e.length===0)return[];let t=e.filter(i=>!IM(i)),n=[],r=[];for(let i of t){let s=CM(i),a=TM(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(FM(n,"icon","dimensions"))),o.push(...r),b.debug("[deduplicateIssues] Input:",e.length,"issues, Output:",o.length,"issues"),b.debug("[deduplicateIssues] Removed",e.length-t.length,"summary issues"),b.debug("[deduplicateIssues] Merged",n.length,"icon issues into",n.length>0?1:0),o}Me();Re();import{addons as gl}from"storybook/manager-api";var uf="uireview/badge",xi={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error"};function EM(e){return e.criticalCount>0||e.score<70?"status-value:error":e.majorCount>0||e.score<90?"status-value:warning":"status-value:success"}function AM(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 PM(e){return e.score>=90?`\u2713 Score ${e.score}`:e.score>=70?`\u26A0 Score ${e.score}`:`\u2717 Score ${e.score}`}function yi(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function c0(e){if(yi())try{gl.getChannel().emit(xi.REVIEW_START,{storyId:e})}catch{}}function ao(e,t){if(yi())try{gl.getChannel().emit(xi.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function u0(e){if(yi())try{gl.getChannel().emit(xi.REVIEW_ERROR,{storyId:e})}catch{}}function l0(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}}function p0(e){let t=gl.getChannel(),n=o=>i=>{yi()&&o(i)};t.on(xi.REVIEW_START,n(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:uf,storyId:o,title:"Reviewing...",description:"AI review in progress"}])})),t.on(xi.REVIEW_COMPLETE,n(({storyId:o,summary:i})=>{e.set([{value:EM(i),typeId:uf,storyId:o,title:PM(i),description:AM(i)}])})),t.on(xi.REVIEW_ERROR,n(({storyId:o})=>{e.set([{value:"status-value:error",typeId:uf,storyId:o,title:"Review Failed",description:"An error occurred during review"}])}));let r=yi();r||l0(e),setInterval(()=>{let o=yi();o!==r&&(r=o,o||l0(e))},1500)}var df=G(),ff=180;function lo(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 gf=()=>{let{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,selectedModels:l,setIsReviewing:p,setReviewError:f,setReviewResults:d,setShowReviewMenu:m,setSeverityFilter:S,setShowStreamingPanel:T,setStreamingPanelCollapsed:F,addStreamingMessage:k,updateStreamingMessage:z,clearStreamingMessages:R,setStreamingProgress:O,setStreamingStatus:E,setFullPrompt:D,setFullResponse:g,setFigmaImageUrl:w,setStorybookImageUrl:v,setFigmaDimensions:A,setMultiModelResults:h,updateMultiModelStreamingMessages:C,setModelCompleted:I,setActiveModelId:y,resetReview:P,addReview:L,setReviewDetailTab:B,includeTextComparison:N,usePromptCache:x,setApplyFixesResult:U,featureFlags:H}=se(),{sessionToken:M,setUsageData:Q}=Ie(),{selectedProjectId:ee}=Qe(),{currentStoryId:J,currentStoryName:Le}=Ye(),Ee=pf(null),We=pf(null),st=pf({}),te=Ms((ct,Ge)=>{k({role:ct,content:Ge})},[k]),Y=Ms((ct,Ge)=>{O(ct),E(Ge)},[O,E]),ce=Ms(async ct=>{let{isIteration:Ge=!1,parentReviewId:xt=null}=ct||{};if(!M)throw new Error("Not authenticated");if(!ee)throw new Error("No project selected");if(!J||!Le)throw new Error("No story is currently selected in Storybook");if(e){b.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let yn=Date.now();try{p(!0),f(null),d(null),U(null),J&&H.enableReviewBadges&&c0(J),We.current&&clearTimeout(We.current),We.current=setTimeout(()=>{b.debug(`[useAIReview] Auto-stopping review after ${ff}s timeout`),Ee.current&&Ee.current.abort(),k({role:"system",content:`Review auto-stopped after ${ff} seconds timeout.`})},ff*1e3),D(""),g(""),T(!0),F(!1),R(),Y(0,"Starting review..."),Y(5,"Refreshing component preview..."),b.debug("[Review] Forcing iframe reload for fresh styles..."),await ka(),b.debug("[Review] Iframe reloaded, styles should be fresh"),Y(20,"Capturing screenshot & extracting styles..."),b.debug("[Review] Starting parallel data collection...");let[qe,fe,kt]=await Promise.all([wa({sessionToken:M||void 0}),Promise.resolve(ns()),Promise.resolve(Xc())]);if(qe&&(v(qe),b.debug("[Review] Storybook screenshot captured and set")),!fe)throw new Error("Failed to extract styles from component");let{computed:yr,declared:pe,markup:Xe,textElementStyles:_,nestedElementStyles:$}=fe;kt?b.debug("[Review] DOM tree extracted:",{selector:kt.selector,childrenCount:kt.children.length}):(b.error("[Review] DOM tree extraction FAILED - domTree is null"),b.error("[Review] This will cause AI to use comparison table instead of tree comparison")),Y(50,"Preparing metadata..."),b.debug("[Review] Current story:",{id:J,name:Le});let W=at.getState().currentMapping?.figmaNodeId??null,Z=at.getState().figmaImageUrl;if(W&&(b.debug("[Review] Using Figma node ID from store:",W),Z&&(Y(65,"Using existing Figma design..."),b.debug("[Review] Reusing already-loaded Figma image"))),!W)try{let tt=await fetch(`${df}/api/mappings?projectId=${ee}&storyId=${J}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${M}`}});if(tt.ok){let Lt=await tt.json();Lt.mapping?.figmaNodeId?(W=Lt.mapping.figmaNodeId,b.debug("[Review] Found Figma node ID from API:",W)):b.debug("[Review] No mapping found for story:",J)}else b.debug("[Review] Failed to fetch mapping:",tt.status)}catch(tt){b.error("[Review] Error fetching mapping:",tt)}if(W&&!Z){Y(65,"Fetching Figma design...");try{let tt=await fetch(`${df}/api/figma/frames?projectId=${ee}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${M}`}});if(tt.ok){let Wt=(await tt.json()).thumbnails?.[W];Wt?(w(Wt),b.debug("[Review] Figma thumbnail fetched and displayed:",Wt)):b.warn("[Review] No thumbnail found for node:",W)}else b.warn("[Review] Failed to fetch Figma frames:",tt.status)}catch(tt){b.error("[Review] Error fetching Figma frames:",tt)}}if(!W)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');Y(80,"AI is analyzing your component..."),b.debug("[Review] Sending to streaming API...");let et={projectId:ee,storyId:J,storyName:Le,storybookScreenshot:qe,computedStyles:yr,declaredStyles:pe,textElementStyles:_,nestedElementStyles:$,componentMarkup:Xe,domTree:kt,figmaNodeId:W,figmaImageUrl:Z||void 0,aiModels:l,includeTextComparison:N,usePromptCache:x,parentReviewId:Ge?xt:void 0,isIteration:Ge};b.debug("[Review] Request payload:",{...et,storybookScreenshot:qe?`${qe.substring(0,50)}...`:null,domTree:kt?{selector:kt.selector,childrenCount:kt.children.length}:null}),Ee.current=new AbortController;let qt=await fetch(`${df}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${M}`},body:JSON.stringify(et),signal:Ee.current.signal});if(b.debug("[Review] Response status:",qt.status,qt.statusText),!qt.ok){let tt=await qt.json();if(b.error("[Review] API error response:",tt),qt.status===429){let Lt=tt.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${Lt} seconds before trying again.`)}throw new Error(tt.error||tt.message||"Review request failed")}let br=qt.body?.getReader(),or=new TextDecoder,Pr="",bn="",xe=null,Sr=null,$n=l.length>1,Co={},Vi={},bj={};if(!br)throw new Error("Response body is not readable");let eh=at.getState().streamingMessages.length;for(te("assistant","");;){let{done:tt,value:Lt}=await br.read();if(tt)break;Pr+=or.decode(Lt,{stream:!0});let Wt=Pr.split(`
|
|
17
|
-
`);
|
|
18
|
-
${Ze}`).join(`
|
|
12
|
+
--`+new Array((n||t.length)+1).join("-")+"^"})}var vb=$(()=>{"use strict";Ya()});var kA,CA,TA,IA,FA,kb,ul,Cb=$(()=>{"use strict";vb();kA=9,CA=10,TA=12,IA=13,FA=32,kb=new Uint8Array(128).map((e,t)=>/[a-zA-Z0-9\-]/.test(String.fromCharCode(t))?1:0),ul=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&&kb[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!==IA&&n!==CA&&n!==TA&&n!==FA&&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 wb(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||kb[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 Pb(e){let t=null,n=null;return e.eat(fl),e.skipWs(),t=e.scanNumber(e),e.skipWs(),e.charCode()===Wu?(e.pos++,e.skipWs(),e.charCode()!==Uu&&(n=e.scanNumber(e),e.skipWs())):n=t,e.eat(Uu),{min:Number(t),max:n?Number(n):0}}function DA(e){let t=null,n=!1;switch(e.charCode()){case Db:e.pos++,t={min:0,max:0};break;case Hu:e.pos++,t={min:1,max:0};break;case dl:e.pos++,t={min:0,max:1};break;case ju:e.pos++,n=!0,e.charCode()===fl?t=Pb(e):e.charCode()===dl?(e.pos++,t={min:0,max:0}):t={min:1,max:0};break;case fl:t=Pb(e);break;default:return null}return{type:"Multiplier",comma:n,min:t.min,max:t.max,term:null}}function Gr(e,t){let n=DA(e);return n!==null?(n.term=t,e.charCode()===ju&&e.charCodeAt(e.pos-1)===Hu||e.charCode()===dl&&e.charCodeAt(e.pos-1)===Uu?Gr(e,n):n):t}function _u(e){let t=e.peek();return t===""?null:Gr(e,{type:"Token",value:t})}function RA(e){let t;return e.eat(Vu),e.eat(pl),t=e.scanWord(),e.eat(pl),e.eat($u),Gr(e,{type:"Property",name:t})}function zA(e){let t=null,n=null,r=1;return e.eat(bs),e.charCode()===Ib&&(e.peek(),r=-1),r==-1&&e.charCode()===Eb?e.peek():(t=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(t+=e.scanWord())),e.skipWs(),e.eat(Wu),e.skipWs(),e.charCode()===Eb?e.peek():(r=1,e.charCode()===Ib&&(e.peek(),r=-1),n=r*Number(e.scanNumber(e)),e.isNameCharCode()&&(n+=e.scanWord())),e.eat(hi),{type:"Range",min:t,max:n}}function NA(e){let t,n=null;if(e.eat(Vu),t=e.scanWord(),t==="boolean-expr"){e.eat(bs);let r=gl(e,hi);return e.eat(hi),e.eat($u),Gr(e,{type:"Boolean",term:r.terms.length===1?r.terms[0]:r})}return e.charCode()===Mb&&e.nextCharCode()===Bb&&(e.pos+=2,t+="()"),e.charCodeAt(e.findWsEnd(e.pos))===bs&&(e.skipWs(),n=zA(e)),e.eat($u),Gr(e,{type:"Type",name:t,opts:n})}function OA(e){let t=e.scanWord();return e.charCode()===Mb?(e.pos++,{type:"Function",name:t}):Gr(e,{type:"Keyword",name:t})}function _A(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)=>Ab[o]-Ab[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 gl(e,t=-1){let n=Object.create(null),r=[],o=null,i=e.pos,s=!1;for(;e.charCode()!==t;){let a=s?gl(e,Bb):UA(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:_A(r,n)||" ",disallowEmpty:!1,explicit:!1}}function $A(e){let t;return e.eat(bs),t=gl(e,hi),e.eat(hi),t.explicit=!0,e.charCode()===Lb&&(e.pos++,t.disallowEmpty=!0),t}function UA(e){let t=e.charCode();switch(t){case hi:break;case bs:return Gr(e,$A(e));case Vu:return e.nextCharCode()===pl?RA(e):NA(e);case Fb:return{type:"Combinator",value:e.substringToPos(e.pos+(e.nextCharCode()===Fb?2:1))};case Tb:return e.pos++,e.eat(Tb),{type:"Combinator",value:"&&"};case Wu:return e.pos++,{type:"Comma"};case pl:return Gr(e,{type:"String",value:e.scanString()});case MA:case EA:case AA:case LA:case PA:return{type:"Spaces",value:e.scanSpaces()};case BA:return t=e.nextCharCode(),e.isNameCharCode(t)?(e.pos++,{type:"AtKeyword",name:e.scanWord()}):_u(e);case Db:case Hu:case dl:case ju:case Lb:break;case fl:if(t=e.nextCharCode(),t<48||t>57)return _u(e);break;default:return e.isNameCharCode(t)?OA(e):_u(e)}}function Ss(e){let t=new ul(e),n=gl(t);return t.pos!==e.length&&t.error("Unexpected input"),n.terms.length===1&&n.terms[0].type==="Group"?n.terms[0]:n}var EA,AA,PA,LA,MA,Lb,ju,Tb,pl,Mb,Bb,Db,Hu,Wu,Ib,Vu,$u,dl,BA,bs,hi,fl,Fb,Uu,Eb,Ab,Gu=$(()=>{"use strict";Cb();EA=9,AA=10,PA=12,LA=13,MA=32,Lb=33,ju=35,Tb=38,pl=39,Mb=40,Bb=41,Db=42,Hu=43,Wu=44,Ib=45,Vu=60,$u=62,dl=63,BA=64,bs=91,hi=93,fl=123,Fb=124,Uu=125,Eb=8734,Ab={" ":1,"&&":2,"||":3,"|":4}});function Rb(e){return typeof e=="function"?e:ws}function qu(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=ws,i=ws;if(typeof t=="function"?o=t:t&&(o=Rb(t.enter),i=Rb(t.leave)),o===ws&&i===ws)throw new Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");r(e,n)}var ws,zb=$(()=>{"use strict";ws=function(){}});var Yu=$(()=>{"use strict";Tu();Gu();zb()});function WA(e){let t=[];return lo(e,(n,r,o)=>t.push({type:n,value:e.slice(r,o),node:null})),t}function Nb(e,t){return typeof e=="string"?WA(e):t.generate(e,HA)}var HA,Ob=$(()=>{"use strict";nr();HA={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 xn(e,t,n){return t===ut&&n===bt||e===ut&&t===ut&&n===ut?e:(e.type==="If"&&e.else===bt&&t===ut&&(t=e.then,e=e.match),{type:"If",match:e,then:t,else:n})}function $b(e){return e.length>2&&e.charCodeAt(e.length-2)===VA&&e.charCodeAt(e.length-1)===GA}function _b(e){return e.type==="Keyword"||e.type==="AtKeyword"||e.type==="Function"||e.type==="Type"&&$b(e.name)}function uo(e,t=" ",n=!1){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:n}}function vs(e,t,n=new Set){if(!n.has(e))switch(n.add(e),e.type){case"If":e.match=vs(e.match,t,n),e.then=vs(e.then,t,n),e.else=vs(e.else,t,n);break;case"Type":return t[e.name]||e}return e}function Ku(e,t,n){switch(e){case" ":{let r=ut;for(let o=t.length-1;o>=0;o--){let i=t[o];r=xn(i,r,bt)}return r}case"|":{let r=bt,o=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(_b(s)&&(o===null&&i>0&&_b(t[i-1])&&(o=Object.create(null),r=xn({type:"Enum",map:o},ut,r)),o!==null)){let a=($b(s.name)?s.name.slice(0,-1):s.name).toLowerCase();if(!(a in o)){o[a]=s;continue}}o=null,r=xn(s,ut,r)}return r}case"&&":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!0};let r=bt;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=Ku(e,t.filter(function(a){return a!==i}),!1):s=ut,r=xn(i,s,r)}return r}case"||":{if(t.length>5)return{type:"MatchOnce",terms:t,all:!1};let r=n?ut:bt;for(let o=t.length-1;o>=0;o--){let i=t[o],s;t.length>1?s=Ku(e,t.filter(function(a){return a!==i}),!0):s=ut,r=xn(i,s,r)}return r}}}function qA(e){let t=ut,n=xi(e.term);if(e.max===0)n=xn(n,ml,bt),t=xn(n,null,bt),t.then=xn(ut,ut,t),e.comma&&(t.then.else=xn({type:"Comma",syntax:e},t,bt));else for(let r=e.min||1;r<=e.max;r++)e.comma&&t!==ut&&(t=xn({type:"Comma",syntax:e},t,bt)),t=xn(n,xn(ut,ut,t),bt);if(e.min===0)t=xn(ut,ut,t);else for(let r=0;r<e.min-1;r++)e.comma&&t!==ut&&(t=xn({type:"Comma",syntax:e},t,bt)),t=xn(n,t,bt);return t}function xi(e){if(typeof e=="function")return{type:"Generic",fn:e};switch(e.type){case"Group":{let t=Ku(e.combinator,e.terms.map(xi),!1);return e.disallowEmpty&&(t=xn(t,ml,bt)),t}case"Multiplier":return qA(e);case"Boolean":{let t=xi(e.term),n=xi(uo([uo([{type:"Keyword",name:"not"},{type:"Type",name:"!boolean-group"}]),uo([{type:"Type",name:"!boolean-group"},uo([{type:"Multiplier",comma:!1,min:0,max:0,term:uo([{type:"Keyword",name:"and"},{type:"Type",name:"!boolean-group"}])},{type:"Multiplier",comma:!1,min:0,max:0,term:uo([{type:"Keyword",name:"or"},{type:"Type",name:"!boolean-group"}])}],"|")])],"|")),r=xi(uo([{type:"Type",name:"!term"},uo([{type:"Token",value:"("},{type:"Type",name:"!self"},{type:"Token",value:")"}]),{type:"Type",name:"general-enclosed"}],"|"));return vs(r,{"!term":t,"!self":n}),vs(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 ks(e,t){return typeof e=="string"&&(e=Ss(e)),{type:"MatchGraph",match:xi(e),syntax:t||null,source:e}}var ut,bt,ml,VA,GA,Xu=$(()=>{"use strict";Gu();ut={type:"Match"},bt={type:"Mismatch"},ml={type:"DisallowEmpty"},VA=40,GA=41});function ZA(e){let t=null,n=null,r=e;for(;r!==null;)n=r.prev,r.prev=t,t=r,r=n;return t}function Qu(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 eP(e){return e.type!==9?!1:e.value!=="?"}function Wb(e){return e===null?!0:e.type===18||e.type===2||e.type===21||e.type===19||e.type===23||eP(e)}function Vb(e){return e===null?!0:e.type===22||e.type===20||e.type===24||e.type===9&&e.value==="/"}function tP(e,t,n){function r(){do k++,F=k<e.length?e[k]:null;while(F!==null&&(F.type===13||F.type===25))}function o(_){let M=k+_;return M<e.length?e[M]:null}function i(_,M){return{nextState:_,matchStack:z,syntaxStack:d,thenStack:f,tokenIndex:k,prev:M}}function s(_){f={nextState:_,matchStack:z,syntaxStack:d,prev:f}}function a(_){p=i(_,p)}function u(){z={type:KA,syntax:t.syntax,token:F,prev:z},r(),g=null,k>R&&(R=k)}function c(){d={syntax:t.syntax,opts:t.syntax.opts||d!==null&&d.opts||null,prev:d},z={type:Ju,syntax:t.syntax,token:z.token,prev:z}}function l(){z.type===Ju?z=z.prev:z={type:Gb,syntax:d.syntax,token:z.token,prev:z},d=d.prev}let d=null,f=null,p=null,g=null,S=0,C=null,F=null,k=-1,R=0,z={type:YA,syntax:null,token:null,prev:null};for(r();C===null&&++S<Hb;)switch(t.type){case"Match":if(f===null){if(F!==null&&(k!==e.length-1||F.value!=="\\0"&&F.value!=="\\9")){t=bt;break}C=jb;break}if(t=f.nextState,t===ml)if(f.matchStack===z){t=bt;break}else t=ut;for(;f.syntaxStack!==d;)l();f=f.prev;break;case"Mismatch":if(g!==null&&g!==!1)(p===null||k>p.tokenIndex)&&(p=g,g=!1);else if(p===null){C=XA;break}t=p.nextState,f=p.thenStack,d=p.syntaxStack,z=p.matchStack,k=p.tokenIndex,F=k<e.length?e[k]:null,p=p.prev;break;case"MatchGraph":t=t.match;break;case"If":t.else!==bt&&a(t.else),t.then!==ut&&s(t.then),t=t.match;break;case"MatchOnce":t={type:"MatchOnceBuffer",syntax:t,index:0,mask:0};break;case"MatchOnceBuffer":{let B=t.syntax.terms;if(t.index===B.length){if(t.mask===0||t.syntax.all){t=bt;break}t=ut;break}if(t.mask===(1<<B.length)-1){t=ut;break}for(;t.index<B.length;t.index++){let m=1<<t.index;if((t.mask&m)===0){a(t),s({type:"AddMatchOnce",syntax:t.syntax,mask:t.mask|m}),t=B[t.index++];break}}break}case"AddMatchOnce":t={type:"MatchOnceBuffer",syntax:t.syntax,index:0,mask:t.mask};break;case"Enum":if(F!==null){let B=F.value.toLowerCase();if(B.indexOf("\\")!==-1&&(B=B.replace(/\\[09].*$/,"")),Ub.call(t.map,B)){t=t.map[B];break}}t=bt;break;case"Generic":{let B=d!==null?d.opts:null,m=k+Math.floor(t.fn(F,o,B));if(!isNaN(m)&&m>k){for(;k<m;)u();t=ut}else t=bt;break}case"Type":case"Property":{let B=t.type==="Type"?"types":"properties",m=Ub.call(n,B)?n[B][t.name]:null;if(!m||!m.match)throw new Error("Bad syntax reference: "+(t.type==="Type"?"<"+t.name+">":"<'"+t.name+"'>"));if(g!==!1&&F!==null&&t.type==="Type"&&(t.name==="custom-ident"&&F.type===1||t.name==="length"&&F.value==="0")){g===null&&(g=i(t,p)),t=bt;break}c(),t=m.matchRef||m.match;break}case"Keyword":{let B=t.name;if(F!==null){let m=F.value;if(m.indexOf("\\")!==-1&&(m=m.replace(/\\[09].*$/,"")),Qu(m,B)){u(),t=ut;break}}t=bt;break}case"AtKeyword":case"Function":if(F!==null&&Qu(F.value,t.name)){u(),t=ut;break}t=bt;break;case"Token":if(F!==null&&F.value===t.value){u(),t=ut;break}t=bt;break;case"Comma":F!==null&&F.type===18?Wb(z.token)?t=bt:(u(),t=Vb(F)?bt:ut):t=Wb(z.token)||Vb(F)?ut:bt;break;case"String":let _="",M=k;for(;M<e.length&&_.length<t.value.length;M++)_+=e[M].value;if(Qu(_,t.value)){for(;k<M;)u();t=ut}else t=bt;break;default:throw new Error("Unknown node type: "+t.type)}switch(JA+=S,C){case null:console.warn("[csstree-match] BREAK after "+Hb+" iterations"),C=QA,z=null;break;case jb:for(;d!==null;)l();break;default:z=null}return{tokens:e,reason:C,iterations:S,match:z,longestMatch:R}}function Zu(e,t,n){let r=tP(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=ZA(o).prev;o!==null;){switch(o.type){case Ju:i.match.push(i={syntax:o.syntax,match:[]}),s.push(i);break;case Gb: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 Ub,YA,KA,Ju,Gb,jb,XA,QA,Hb,JA,qb=$(()=>{"use strict";Xu();({hasOwnProperty:Ub}=Object.prototype),YA=0,KA=1,Ju=2,Gb=3,jb="Match",XA="Mismatch",QA="Maximum iteration number exceeded (please fill an issue on https://github.com/csstree/csstree/issues)",Hb=15e3,JA=0});var tp={};ye(tp,{getTrace:()=>Yb,isKeyword:()=>oP,isProperty:()=>rP,isType:()=>nP});function Yb(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 nP(e,t){return ep(this,e,n=>n.type==="Type"&&n.name===t)}function rP(e,t){return ep(this,e,n=>n.type==="Property"&&n.name===t)}function oP(e){return ep(this,e,t=>t.type==="Keyword")}function ep(e,t,n){let r=Yb.call(e,t);return r===null?!1:r.some(n)}var Kb=$(()=>{"use strict"});function Xb(e){return"node"in e?e.node:Xb(e.match[0])}function Qb(e){return"node"in e?e.node:Qb(e.match[e.match.length-1])}function np(e,t,n,r,o){function i(a){if(a.syntax!==null&&a.syntax.type===r&&a.syntax.name===o){let u=Xb(a),c=Qb(a);e.syntax.walk(t,function(l,d,f){if(l===u){let p=new Vn;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 Jb=$(()=>{"use strict";ps()});function rp(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&e>=0}function Zb(e){return!!e&&rp(e.offset)&&rp(e.line)&&rp(e.column)}function iP(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(Cs.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(!Zb(r.loc.start))i+=".start";else if(!Zb(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 Vn)}}}else o(r,"Unknown field `"+i+"` for "+e+" node type");s||o(r,"Bad value for `"+e+"."+i+"`")}}for(let i in t)Cs.call(t,i)&&Cs.call(r,i)===!1&&o(r,"Field `"+e+"."+i+"` is missed")}}function e0(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<"+(e0(o,t)||"any")+">");else throw new Error("Wrong value `"+o+"` in `"+t+"` structure definition")}return n.join(" | ")}function sP(e,t){let n=t.structure,r={type:String,loc:!0},o={type:'"'+e+'"'};for(let i in n){if(Cs.call(n,i)===!1)continue;let s=r[i]=Array.isArray(n[i])?n[i].slice():[n[i]];o[i]=e0(s,e+"."+i)}return{docs:o,check:iP(e,r)}}function t0(e){let t={};if(e.node){for(let n in e.node)if(Cs.call(e.node,n)){let r=e.node[n];if(r.structure)t[n]=sP(n,r);else throw new Error("Missed `structure` field in `"+n+"` node type definition")}}return t}var Cs,n0=$(()=>{"use strict";ps();({hasOwnProperty:Cs}=Object.prototype)});function op(e,t,n){let r={};for(let o in e)e[o].syntax&&(r[o]=n?e[o].syntax:pi(e[o].syntax,{compact:t}));return r}function aP(e,t,n){let r={};for(let[o,i]of Object.entries(e))r[o]={prelude:i.prelude&&(n?i.prelude.syntax:pi(i.prelude.syntax,{compact:t})),descriptors:i.descriptors&&op(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 cP(e){let t=e.terms[0];return e.explicit===!1&&e.terms.length===1&&t.type==="Multiplier"&&t.comma===!0}function br(e,t,n){return{matched:e,iterations:n,error:t,...tp}}function yi(e,t,n,r){let o=Nb(n,e.syntax),i;return lP(o)?br(null,new Error("Matching for a tree with var() is not supported")):(r&&(i=Zu(o,e.cssWideKeywordsSyntax,e)),(!r||!i.match)&&(i=Zu(o,t.match,e),!i.match)?br(null,new ib(i.reason,t.syntax,n,i),i.iterations):br(i.match,null,i.iterations))}var Ts,r0=$(()=>{"use strict";sb();il();sl();bb();Sb();Yu();Ob();Xu();qb();Kb();Jb();n0();Ts=class{constructor(t,n,r){if(this.cssWideKeywords=gi,this.syntax=n,this.generic=!1,this.units={...cl},this.atrules=Object.create(null),this.properties=Object.create(null),this.types=Object.create(null),this.structure=r||t0(t),t){if(t.cssWideKeywords&&(this.cssWideKeywords=t.cssWideKeywords),t.units)for(let o of Object.keys(cl))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(yb(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=ks(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=ks(t,i):(typeof t=="string"?Object.defineProperty(s,"syntax",{get(){return Object.defineProperty(s,"syntax",{value:Ss(t)}),s.syntax}}):s.syntax=t,Object.defineProperty(s,"match",{get(){return Object.defineProperty(s,"match",{value:ks(s.syntax,i)}),s.match}}),n==="Property"&&Object.defineProperty(s,"matchRef",{get(){let a=s.syntax,u=cP(a)?ks({...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 di("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&&!yi(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=rl(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 di("Unknown at-rule descriptor",n)}checkPropertyName(t){if(!this.getProperty(t))return new di("Unknown property",t)}matchAtrulePrelude(t,n){let r=this.checkAtrulePrelude(t,n);if(r)return br(null,r);let o=this.getAtrule(t);return o.prelude?yi(this,o.prelude,n||"",!1):br(null,null)}matchAtruleDescriptor(t,n,r){let o=this.checkAtruleDescriptorName(t,n);if(o)return br(null,o);let i=this.getAtrule(t),s=rl(n);return yi(this,i.descriptors[s.name]||i.descriptors[s.basename],r,!1)}matchDeclaration(t){return t.type!=="Declaration"?br(null,new Error("Not a Declaration node")):this.matchProperty(t.property,t.value)}matchProperty(t,n){if(Iu(t).custom)return br(null,new Error("Lexer matching doesn't applicable for custom properties"));let r=this.checkPropertyName(t);return r?br(null,r):yi(this,this.getProperty(t),n,!0)}matchType(t,n){let r=this.getType(t);return r?yi(this,r,n,!1):br(null,new di("Unknown type",t))}match(t,n){return typeof t!="string"&&(!t||!t.type)?br(null,new di("Bad syntax")):((typeof t=="string"||!t.match)&&(t=this.createDescriptor(t,"Type","anonymous")),yi(this,t,n,!1))}findValueFragments(t,n,r,o){return np(this,n,this.matchProperty(t,n),r,o)}findDeclarationValueFragments(t,n,r){return np(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=rl(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=Iu(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&&qu(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:op(this.types,!n,t),properties:op(this.properties,!n,t),atrules:aP(this.atrules,!n,t)}}toString(){return JSON.stringify(this.dump())}}});function ip(e,t){return typeof t=="string"&&/^\s*\|/.test(t)?typeof e=="string"?e+t:t.replace(/^\s*\|\s*/,""):t||null}function uP(e,t){let n=Object.create(null);for(let r of Object.keys(e))t.includes(r)&&(n[r]=e[r]);return n}function sp(e,t,n){let r={...e};for(let[o,i]of Object.entries(t))r[o]={...r[o],...n?uP(i,n):i};return r}function Is(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?ip(u.prelude,s.prelude):u.prelude||null;for(let[c,l]of Object.entries(s.descriptors||{}))u.descriptors[c]=l?ip(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]=ip(n[r][i],s);break;case"parseContext":n[r]={...e[r],...o};break;case"scope":case"features":n[r]=sp(e[r],o);break;case"atrule":case"pseudo":n[r]=sp(e[r],o,["parse"]);break;case"node":n[r]=sp(e[r],o,["name","structure","parse","generate","walkContext"]);break}return n}var o0=$(()=>{"use strict"});function i0(e){let t=Sy(e),n=nb(e),r=Yy(e),{fromPlainObject:o,toPlainObject:i}=Xy(n),s={lexer:null,createLexer:a=>new Ts(a,s,s.lexer.structure),tokenize:lo,parse:t,generate:r,walk:n,find:n.find,findLast:n.findLast,findAll:n.findAll,fromPlainObject:o,toPlainObject:i,fork(a){let u=Is({},e);return i0(typeof a=="function"?a(u):Is(u,a))}};return s.lexer=new Ts({generic:e.generic,cssWideKeywords:e.cssWideKeywords,units:e.units,types:e.types,atrules:e.atrules,properties:e.properties,node:e.node},s),s}var s0,a0=$(()=>{"use strict";nr();wy();Ky();Qy();rb();r0();o0();s0=e=>i0(Is({},e))});var l0,c0=$(()=>{"use strict";l0={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 cp={};ye(cp,{generate:()=>gP,name:()=>dP,parse:()=>lp,structure:()=>fP});function xl(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===Lr||r===Gn)&&(t&&this.error("Number sign is not allowed"),n++);n<this.tokenEnd;n++)_t(this.charCodeAt(n))||this.error("Integer is expected",n)}function bi(e){return xl.call(this,0,e)}function po(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n="";switch(t){case hl:n="N is expected";break;case Gn:n="HyphenMinus is expected";break}this.error(n,this.tokenStart+e)}}function ap(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10)if(this.isDelim(Lr,e)||this.isDelim(Gn,e)){t=this.isDelim(Lr,e)?Lr:Gn;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),bi.call(this,Oo))}else return null;return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==Lr&&n!==Gn&&this.error("Number sign is expected")),bi.call(this,t!==0),t===Gn?"-"+this.consume(10):this.consume(10)}function lp(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)bi.call(this,pP),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Gn))switch(t="-1",po.call(this,1,hl),this.tokenEnd-this.tokenStart){case 2:this.next(),n=ap.call(this);break;case 3:po.call(this,2,Gn),this.next(),this.skipSC(),bi.call(this,Oo),n="-"+this.consume(10);break;default:po.call(this,2,Gn),xl.call(this,3,Oo),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(Lr)&&this.lookupType(1)===1){let r=0;switch(t="1",this.isDelim(Lr)&&(r=1,this.next()),po.call(this,0,hl),this.tokenEnd-this.tokenStart){case 1:this.next(),n=ap.call(this);break;case 2:po.call(this,1,Gn),this.next(),this.skipSC(),bi.call(this,Oo),n="-"+this.consume(10);break;default:po.call(this,1,Gn),xl.call(this,2,Oo),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),o=r===Lr||r===Gn,i=this.tokenStart+o;for(;i<this.tokenEnd&&_t(this.charCodeAt(i));i++);i===this.tokenStart+o&&this.error("Integer is expected",this.tokenStart+o),po.call(this,i-this.tokenStart,hl),t=this.substring(e,i),i+1===this.tokenEnd?(this.next(),n=ap.call(this)):(po.call(this,i-this.tokenStart+1,Gn),i+2===this.tokenEnd?(this.next(),this.skipSC(),bi.call(this,Oo),n="-"+this.consume(10)):(xl.call(this,i-this.tokenStart+2,Oo),this.next(),n=this.substrToCursor(i+1)))}else this.error();return t!==null&&t.charCodeAt(0)===Lr&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===Lr&&(n=n.substr(1)),{type:"AnPlusB",loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function gP(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 Lr,Gn,hl,Oo,pP,dP,fP,up=$(()=>{"use strict";nr();Lr=43,Gn=45,hl=110,Oo=!0,pP=!1;dP="AnPlusB",fP={a:[String,null],b:[String,null]}});var dp={};ye(dp,{generate:()=>bP,name:()=>hP,parse:()=>pp,structure:()=>yP,walkContext:()=>xP});function u0(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function mP(){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 pp(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),u0):o=u0.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(mP.call(this));break}return{type:"Atrule",loc:this.getLocation(t,this.tokenStart),name:n,prelude:o,block:i}}function bP(e){this.token(3,"@"+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,";")}var hP,xP,yP,fp=$(()=>{"use strict";hP="Atrule",xP="atrule",yP={name:String,prelude:["AtrulePrelude","Raw",null],block:["Block",null]}});var mp={};ye(mp,{generate:()=>kP,name:()=>SP,parse:()=>gp,structure:()=>vP,walkContext:()=>wP});function gp(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 SP,wP,vP,hp=$(()=>{"use strict";SP="AtrulePrelude",wP="atrulePrelude",vP={children:[[]]}});var bp={};ye(bp,{generate:()=>LP,name:()=>AP,parse:()=>yp,structure:()=>PP});function FP(){this.eof&&this.error("Unexpected end of input");let e=this.tokenStart,t=!1;return this.isDelim(p0)?(t=!0,this.next()):this.isDelim(xp)||this.eat(1),this.isDelim(xp)?this.charCodeAt(this.tokenStart+1)!==yl?(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 EP(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==yl&&t!==IP&&t!==TP&&t!==CP&&t!==p0&&t!==xp&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.next(),t!==yl&&(this.isDelim(yl)||this.error("Equal sign is expected"),this.next()),this.substrToCursor(e)}function yp(){let e=this.tokenStart,t,n=null,r=null,o=null;return this.eat(19),this.skipSC(),t=FP.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=EP.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 LP(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 CP,p0,yl,TP,xp,IP,AP,PP,Sp=$(()=>{"use strict";CP=36,p0=42,yl=61,TP=94,xp=124,IP=126;AP="AttributeSelector",PP={name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]}});var vp={};ye(vp,{generate:()=>NP,name:()=>DP,parse:()=>wp,structure:()=>zP,walkContext:()=>RP});function g0(){return this.Raw(null,!0)}function d0(){return this.parseWithFallback(this.Rule,g0)}function f0(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function BP(){if(this.tokenType===17)return f0.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,f0);return this.tokenType===17&&this.next(),e}function wp(e){let t=e?BP:d0,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),g0));break;default:e&&this.isDelim(MP)?r.push(d0.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:"Block",loc:this.getLocation(n,this.tokenStart),children:r}}function NP(e){this.token(23,"{"),this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")}),this.token(24,"}")}var MP,DP,RP,zP,kp=$(()=>{"use strict";MP=38;DP="Block",RP="block",zP={children:[["Atrule","Rule","Declaration"]]}});var Tp={};ye(Tp,{generate:()=>$P,name:()=>OP,parse:()=>Cp,structure:()=>_P});function Cp(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 $P(e){this.token(9,"["),this.children(e),this.token(9,"]")}var OP,_P,Ip=$(()=>{"use strict";OP="Brackets",_P={children:[[]]}});var Ep={};ye(Ep,{generate:()=>HP,name:()=>UP,parse:()=>Fp,structure:()=>jP});function Fp(){let e=this.tokenStart;return this.eat(15),{type:"CDC",loc:this.getLocation(e,this.tokenStart)}}function HP(){this.token(15,"-->")}var UP,jP,Ap=$(()=>{"use strict";UP="CDC",jP=[]});var Lp={};ye(Lp,{generate:()=>GP,name:()=>WP,parse:()=>Pp,structure:()=>VP});function Pp(){let e=this.tokenStart;return this.eat(14),{type:"CDO",loc:this.getLocation(e,this.tokenStart)}}function GP(){this.token(14,"<!--")}var WP,VP,Mp=$(()=>{"use strict";WP="CDO",VP=[]});var Dp={};ye(Dp,{generate:()=>XP,name:()=>YP,parse:()=>Bp,structure:()=>KP});function Bp(){return this.eatDelim(qP),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function XP(e){this.token(9,"."),this.token(1,e.name)}var qP,YP,KP,Rp=$(()=>{"use strict";qP=46,YP="ClassSelector",KP={name:String}});var Np={};ye(Np,{generate:()=>n2,name:()=>e2,parse:()=>zp,structure:()=>t2});function zp(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case JP:case QP:case ZP: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 n2(e){this.tokenize(e.name)}var QP,m0,JP,ZP,e2,t2,Op=$(()=>{"use strict";QP=43,m0=47,JP=62,ZP=126,e2="Combinator",t2={name:String}});var $p={};ye($p,{generate:()=>a2,name:()=>i2,parse:()=>_p,structure:()=>s2});function _p(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===r2&&this.charCodeAt(t-1)===o2&&(t-=2),{type:"Comment",loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function a2(e){this.token(25,"/*"+e.value+"*/")}var r2,o2,i2,s2,Up=$(()=>{"use strict";r2=42,o2=47,i2="Comment",s2={value:String}});var Hp={};ye(Hp,{generate:()=>d2,name:()=>c2,parse:()=>jp,structure:()=>u2});function h0(e){return this.lookupTypeNonSC(1)===1&&l2.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}function jp(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(()=>p2[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 d2(e){e.children.forEach(t=>{t.type==="Condition"?(this.token(21,"("),this.node(t),this.token(22,")")):this.node(t)})}var l2,c2,u2,p2,Wp=$(()=>{"use strict";l2=new Set([16,22,0]),c2="Condition",u2={kind:String,children:[["Identifier","Feature","FeatureFunction","FeatureRange","SupportsDeclaration"]]};p2={media:h0,container:h0,supports(){return this.SupportsDeclaration()}}});var Gp={};ye(Gp,{generate:()=>C2,name:()=>w2,parse:()=>Vp,structure:()=>k2,walkContext:()=>v2});function y2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function b2(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function S2(){let e=this.tokenIndex,t=this.Value();return t.type!=="Raw"&&this.eof===!1&&this.tokenType!==17&&this.isDelim(y0)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}function Vp(){let e=this.tokenStart,t=this.tokenIndex,n=T2.call(this),r=ol(n),o=r?this.parseCustomProperty:this.parseValue,i=r?b2:y2,s=!1,a;this.skipSC(),this.eat(16);let u=this.tokenIndex;if(r||this.skipSC(),o?a=this.parseWithFallback(S2,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(y0)&&(s=I2.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 C2(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 T2(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case h2:case g2:case x2:case f2:case m2:this.next();break;case x0:this.next(),this.isDelim(x0)&&this.next();break}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function I2(){this.eat(9),this.skipSC();let e=this.consume(1);return e==="important"?!0:e}var y0,f2,g2,m2,h2,x2,x0,w2,v2,k2,qp=$(()=>{"use strict";il();y0=33,f2=35,g2=36,m2=38,h2=42,x2=43,x0=47;w2="Declaration",v2="declaration",k2={important:[Boolean,String],property:String,value:["Value","Raw"]}});var Xp={};ye(Xp,{generate:()=>P2,name:()=>E2,parse:()=>Kp,structure:()=>A2});function Yp(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function Kp(){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),Yp));break;default:this.isDelim(F2)?e.push(this.parseWithFallback(this.Rule,Yp)):e.push(this.parseWithFallback(this.Declaration,Yp))}return{type:"DeclarationList",loc:this.getLocationFromList(e),children:e}}function P2(e){this.children(e,t=>{t.type==="Declaration"&&this.token(17,";")})}var F2,E2,A2,Qp=$(()=>{"use strict";F2=38;E2="DeclarationList",A2={children:[["Declaration","Atrule","Rule"]]}});var Zp={};ye(Zp,{generate:()=>B2,name:()=>L2,parse:()=>Jp,structure:()=>M2});function Jp(){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 B2(e){this.token(12,e.value+e.unit)}var L2,M2,ed=$(()=>{"use strict";L2="Dimension",M2={value:String,unit:String}});var nd={};ye(nd,{generate:()=>N2,name:()=>R2,parse:()=>td,structure:()=>z2});function td(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(D2)&&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 N2(e){this.token(21,"("),this.token(1,e.name),e.value!==null&&(this.token(16,":"),this.node(e.value)),this.token(22,")")}var D2,R2,z2,rd=$(()=>{"use strict";D2=47,R2="Feature",z2={kind:String,name:String,value:["Identifier","Number","Dimension","Ratio","Function",null]}});var id={};ye(id,{generate:()=>U2,name:()=>O2,parse:()=>od,structure:()=>_2});function $2(e,t){let r=(this.features[e]||{})[t];return typeof r!="function"&&this.error(`Unknown feature ${t}()`),r}function od(e="unknown"){let t=this.tokenStart,n=this.consumeFunctionName(),r=$2.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 U2(e){this.token(2,e.feature+"("),this.node(e.value),this.token(22,")")}var O2,_2,sd=$(()=>{"use strict";O2="FeatureFunction",_2={kind:String,feature:String,value:["Declaration","Selector"]}});var cd={};ye(cd,{generate:()=>G2,name:()=>W2,parse:()=>ld,structure:()=>V2});function ad(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(b0,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(b0)&&this.error(),e},()=>this.Ratio());default:this.error("Number, dimension, ratio or identifier is expected")}}function w0(e){if(this.skipSC(),this.isDelim(j2)||this.isDelim(H2)){let t=this.source[this.tokenStart];return this.next(),this.isDelim(S0)?(this.next(),t+"="):t}if(this.isDelim(S0))return"=";this.error(`Expected ${e?'":", ':""}"<", ">", "=" or ")"`)}function ld(e="unknown"){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=ad.call(this),r=w0.call(this,n.type==="Identifier"),o=ad.call(this),i=null,s=null;return this.lookupNonWSType(0)!==22&&(i=w0.call(this),s=ad.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 G2(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 b0,j2,S0,H2,W2,V2,ud=$(()=>{"use strict";b0=47,j2=60,S0=61,H2=62,W2="FeatureRange",V2={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 dd={};ye(dd,{generate:()=>X2,name:()=>q2,parse:()=>pd,structure:()=>K2,walkContext:()=>Y2});function pd(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 X2(e){this.token(2,e.name+"("),this.children(e),this.token(22,")")}var q2,Y2,K2,fd=$(()=>{"use strict";q2="Function",Y2="function",K2={name:String,children:[[]]}});var md={};ye(md,{generate:()=>Z2,name:()=>Q2,parse:()=>gd,structure:()=>J2});function gd(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 Z2(e){e.function?this.token(2,e.function+"("):this.token(21,"("),this.children(e),this.token(22,")")}var Q2,J2,hd=$(()=>{"use strict";Q2="GeneralEnclosed",J2={kind:String,function:[String,null],children:[[]]}});var yd={};ye(yd,{generate:()=>rL,name:()=>tL,parse:()=>xd,structure:()=>nL,xxx:()=>eL});function xd(){let e=this.tokenStart;return this.eat(4),{type:"Hash",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function rL(e){this.token(4,"#"+e.value)}var eL,tL,nL,bd=$(()=>{"use strict";eL="XXX",tL="Hash",nL={value:String}});var wd={};ye(wd,{generate:()=>sL,name:()=>oL,parse:()=>Sd,structure:()=>iL});function Sd(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function sL(e){this.token(1,e.name)}var oL,iL,vd=$(()=>{"use strict";oL="Identifier",iL={name:String}});var Cd={};ye(Cd,{generate:()=>cL,name:()=>aL,parse:()=>kd,structure:()=>lL});function kd(){let e=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function cL(e){this.token(9,"#"+e.name)}var aL,lL,Td=$(()=>{"use strict";aL="IdSelector",lL={name:String}});var Fd={};ye(Fd,{generate:()=>fL,name:()=>pL,parse:()=>Id,structure:()=>dL});function Id(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(uL);)this.eat(9),t+="."+this.consume(1);return{type:"Layer",loc:this.getLocation(e,this.tokenStart),name:t}}function fL(e){this.tokenize(e.name)}var uL,pL,dL,Ed=$(()=>{"use strict";uL=46,pL="Layer",dL={name:String}});var Pd={};ye(Pd,{generate:()=>hL,name:()=>gL,parse:()=>Ad,structure:()=>mL});function Ad(){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 hL(e){this.children(e,()=>this.token(18,","))}var gL,mL,Ld=$(()=>{"use strict";gL="LayerList",mL={children:[["Layer"]]}});var Bd={};ye(Bd,{generate:()=>bL,name:()=>xL,parse:()=>Md,structure:()=>yL});function Md(){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 bL(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 xL,yL,Dd=$(()=>{"use strict";xL="MediaQuery",yL={modifier:[String,null],mediaType:[String,null],condition:["Condition",null]}});var zd={};ye(zd,{generate:()=>vL,name:()=>SL,parse:()=>Rd,structure:()=>wL});function Rd(){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 SL,wL,Nd=$(()=>{"use strict";SL="MediaQueryList",wL={children:[["MediaQuery"]]}});var _d={};ye(_d,{generate:()=>IL,name:()=>CL,parse:()=>Od,structure:()=>TL});function Od(){let e=this.tokenStart;return this.eatDelim(kL),{type:"NestingSelector",loc:this.getLocation(e,this.tokenStart)}}function IL(){this.token(9,"&")}var kL,CL,TL,$d=$(()=>{"use strict";kL=38,CL="NestingSelector",TL={}});var jd={};ye(jd,{generate:()=>AL,name:()=>FL,parse:()=>Ud,structure:()=>EL});function Ud(){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 AL(e){this.node(e.nth),e.selector!==null&&(this.token(1,"of"),this.node(e.selector))}var FL,EL,Hd=$(()=>{"use strict";FL="Nth",EL={nth:["AnPlusB","Identifier"],selector:["SelectorList",null]}});var Vd={};ye(Vd,{generate:()=>ML,name:()=>PL,parse:()=>Wd,structure:()=>LL});function Wd(){return{type:"Number",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function ML(e){this.token(10,e.value)}var PL,LL,Gd=$(()=>{"use strict";PL="Number",LL={value:String}});var Yd={};ye(Yd,{generate:()=>RL,name:()=>BL,parse:()=>qd,structure:()=>DL});function qd(){let e=this.tokenStart;return this.next(),{type:"Operator",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function RL(e){this.tokenize(e.value)}var BL,DL,Kd=$(()=>{"use strict";BL="Operator",DL={value:String}});var Qd={};ye(Qd,{generate:()=>OL,name:()=>zL,parse:()=>Xd,structure:()=>NL});function Xd(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 OL(e){this.token(21,"("),this.children(e),this.token(22,")")}var zL,NL,Jd=$(()=>{"use strict";zL="Parentheses",NL={children:[[]]}});var ef={};ye(ef,{generate:()=>UL,name:()=>_L,parse:()=>Zd,structure:()=>$L});function Zd(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function UL(e){this.token(11,e.value+"%")}var _L,$L,tf=$(()=>{"use strict";_L="Percentage",$L={value:String}});var rf={};ye(rf,{generate:()=>VL,name:()=>jL,parse:()=>nf,structure:()=>WL,walkContext:()=>HL});function nf(){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 VL(e){this.token(16,":"),e.children===null?this.token(1,e.name):(this.token(2,e.name+"("),this.children(e),this.token(22,")"))}var jL,HL,WL,of=$(()=>{"use strict";jL="PseudoClassSelector",HL="function",WL={name:String,children:[["Raw"],null]}});var af={};ye(af,{generate:()=>KL,name:()=>GL,parse:()=>sf,structure:()=>YL,walkContext:()=>qL});function sf(){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 KL(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 GL,qL,YL,lf=$(()=>{"use strict";GL="PseudoElementSelector",qL="function",YL={name:String,children:[["Raw"],null]}});var uf={};ye(uf,{generate:()=>JL,name:()=>XL,parse:()=>cf,structure:()=>QL});function k0(){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 cf(){let e=this.tokenStart,t=k0.call(this),n=null;return this.skipSC(),this.isDelim(v0)&&(this.eatDelim(v0),n=k0.call(this)),{type:"Ratio",loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function JL(e){this.node(e.left),this.token(9,"/"),e.right?this.node(e.right):this.node(10,1)}var v0,XL,QL,pf=$(()=>{"use strict";v0=47;XL="Ratio",QL={left:["Number","Function"],right:["Number","Function",null]}});var ff={};ye(ff,{generate:()=>nM,name:()=>eM,parse:()=>df,structure:()=>tM});function ZL(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function df(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),t&&this.tokenStart>n?r=ZL.call(this):r=this.tokenStart,{type:"Raw",loc:this.getLocation(n,r),value:this.substring(n,r)}}function nM(e){this.tokenize(e.value)}var eM,tM,gf=$(()=>{"use strict";eM="Raw",tM={value:String}});var hf={};ye(hf,{generate:()=>aM,name:()=>oM,parse:()=>mf,structure:()=>sM,walkContext:()=>iM});function C0(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function rM(){let e=this.SelectorList();return e.type!=="Raw"&&this.eof===!1&&this.tokenType!==23&&this.error(),e}function mf(){let e=this.tokenIndex,t=this.tokenStart,n,r;return this.parseRulePrelude?n=this.parseWithFallback(rM,C0):n=C0.call(this,e),r=this.Block(!0),{type:"Rule",loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function aM(e){this.node(e.prelude),this.node(e.block)}var oM,iM,sM,xf=$(()=>{"use strict";oM="Rule",iM="rule",sM={prelude:["SelectorList","Raw"],block:["Block"]}});var bf={};ye(bf,{generate:()=>uM,name:()=>lM,parse:()=>yf,structure:()=>cM});function yf(){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 uM(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,cM,Sf=$(()=>{"use strict";lM="Scope",cM={root:["SelectorList","Raw",null],limit:["SelectorList","Raw",null]}});var vf={};ye(vf,{generate:()=>fM,name:()=>pM,parse:()=>wf,structure:()=>dM});function wf(){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 fM(e){this.children(e)}var pM,dM,kf=$(()=>{"use strict";pM="Selector",dM={children:[["TypeSelector","IdSelector","ClassSelector","AttributeSelector","PseudoClassSelector","PseudoElementSelector","Combinator"]]}});var Tf={};ye(Tf,{generate:()=>xM,name:()=>gM,parse:()=>Cf,structure:()=>hM,walkContext:()=>mM});function Cf(){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 xM(e){this.children(e,()=>this.token(18,","))}var gM,mM,hM,If=$(()=>{"use strict";gM="SelectorList",mM="selector",hM={children:[["Selector","Raw"]]}});function bl(e){let t=e.length,n=e.charCodeAt(0),r=n===T0||n===I0?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===Ff){if(s===o){s!==t-1&&(i=e.substr(s+1));break}if(a=e.charCodeAt(++s),An(Ff,a)){let u=s-1,c=Ur(e,u);s=c-1,i+=ja(e.substring(u+1,c))}else a===13&&e.charCodeAt(s+1)===10&&s++}else i+=e[s]}return i}function F0(e,t){let n=t?"'":'"',r=t?I0:T0,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===Ff?(o+="\\"+e.charAt(s),i=!1):(i&&(Pn(a)||Ar(a))&&(o+=" "),o+=e.charAt(s),i=!1)}return n+o+n}var Ff,T0,I0,Sl=$(()=>{"use strict";nr();Ff=92,T0=34,I0=39});var Af={};ye(Af,{generate:()=>SM,name:()=>yM,parse:()=>Ef,structure:()=>bM});function Ef(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:bl(this.consume(5))}}function SM(e){this.token(5,F0(e.value))}var yM,bM,Pf=$(()=>{"use strict";Sl();yM="String",bM={value:String}});var Mf={};ye(Mf,{generate:()=>TM,name:()=>vM,parse:()=>Lf,structure:()=>CM,walkContext:()=>kM});function A0(){return this.Raw(null,!1)}function Lf(){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,A0);break;default:n=this.parseWithFallback(this.Rule,A0)}t.push(n)}return{type:"StyleSheet",loc:this.getLocation(e,this.tokenStart),children:t}}function TM(e){this.children(e)}var wM,vM,kM,CM,Bf=$(()=>{"use strict";wM=33;vM="StyleSheet",kM="stylesheet",CM={children:[["Comment","CDO","CDC","Atrule","Rule","Raw"]]}});var Rf={};ye(Rf,{generate:()=>EM,name:()=>IM,parse:()=>Df,structure:()=>FM});function Df(){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 EM(e){this.token(21,"("),this.node(e.declaration),this.token(22,")")}var IM,FM,zf=$(()=>{"use strict";IM="SupportsDeclaration",FM={declaration:"Declaration"}});var _f={};ye(_f,{generate:()=>MM,name:()=>PM,parse:()=>Of,structure:()=>LM});function Nf(){this.tokenType!==1&&this.isDelim(AM)===!1&&this.error("Identifier or asterisk is expected"),this.next()}function Of(){let e=this.tokenStart;return this.isDelim(P0)?(this.next(),Nf.call(this)):(Nf.call(this),this.isDelim(P0)&&(this.next(),Nf.call(this))),{type:"TypeSelector",loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function MM(e){this.tokenize(e.name)}var AM,P0,PM,LM,$f=$(()=>{"use strict";AM=42,P0=124;PM="TypeSelector",LM={name:String}});var Hf={};ye(Hf,{generate:()=>NM,name:()=>RM,parse:()=>jf,structure:()=>zM});function Fs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let o=this.charCodeAt(r);if(o===M0&&t&&n!==0)return Fs.call(this,e+n+1,!1),-1;Pn(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 wl(e){let t=0;for(;this.isDelim(Uf);)++t>e&&this.error("Too many question marks"),this.next()}function BM(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===L0?"Plus sign":"Hyphen minus")+" is expected")}function DM(){let e=0;switch(this.tokenType){case 10:if(e=Fs.call(this,1,!0),this.isDelim(Uf)){wl.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){BM.call(this,M0),Fs.call(this,1,!1);break}break;case 12:e=Fs.call(this,1,!0),e>0&&wl.call(this,6-e);break;default:if(this.eatDelim(L0),this.tokenType===1){e=Fs.call(this,0,!0),e>0&&wl.call(this,6-e);break}if(this.isDelim(Uf)){this.next(),wl.call(this,5);break}this.error("Hex digit or question mark is expected")}}function jf(){let e=this.tokenStart;return this.eatIdent("u"),DM.call(this),{type:"UnicodeRange",loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function NM(e){this.tokenize(e.value)}var L0,M0,Uf,RM,zM,Wf=$(()=>{"use strict";nr();L0=43,M0=45,Uf=63;RM="UnicodeRange",zM={value:String}});function D0(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===B0?t-2:t-1,o="";for(;n<r&&Ar(e.charCodeAt(n));)n++;for(;n<r&&Ar(e.charCodeAt(r));)r--;for(let i=n;i<=r;i++){let s=e.charCodeAt(i);if(s===Vf){if(i===r){i!==t-1&&(o=e.substr(i+1));break}if(s=e.charCodeAt(++i),An(Vf,s)){let a=i-1,u=Ur(e,a);i=u-1,o+=ja(e.substring(a+1,u))}else s===13&&e.charCodeAt(i+1)===10&&i++}else o+=e[i]}return o}function R0(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===OM||o===Vf||o===_M||o===$M||o===UM||o===B0?(t+="\\"+e.charAt(r),n=!1):(n&&Pn(o)&&(t+=" "),t+=e.charAt(r),n=!1)}return"url("+t+")"}var OM,Vf,_M,$M,UM,B0,Gf=$(()=>{"use strict";nr();OM=32,Vf=92,_M=34,$M=39,UM=40,B0=41});var Yf={};ye(Yf,{generate:()=>WM,name:()=>jM,parse:()=>qf,structure:()=>HM});function qf(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=D0(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=bl(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 WM(e){this.token(7,R0(e.value))}var jM,HM,Kf=$(()=>{"use strict";Gf();Sl();jM="Url",HM={value:String}});var Qf={};ye(Qf,{generate:()=>qM,name:()=>VM,parse:()=>Xf,structure:()=>GM});function Xf(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:"Value",loc:this.getLocation(e,this.tokenStart),children:t}}function qM(e){this.children(e)}var VM,GM,Jf=$(()=>{"use strict";VM="Value",GM={children:[[]]}});var eg={};ye(eg,{generate:()=>QM,name:()=>KM,parse:()=>Zf,structure:()=>XM});function Zf(){return this.eat(13),YM}function QM(e){this.token(13,e.value)}var YM,KM,XM,tg=$(()=>{"use strict";YM=Object.freeze({type:"WhiteSpace",loc:null,value:" "}),KM="WhiteSpace",XM={value:String}});var Es={};ye(Es,{AnPlusB:()=>cp,Atrule:()=>dp,AtrulePrelude:()=>mp,AttributeSelector:()=>bp,Block:()=>vp,Brackets:()=>Tp,CDC:()=>Ep,CDO:()=>Lp,ClassSelector:()=>Dp,Combinator:()=>Np,Comment:()=>$p,Condition:()=>Hp,Declaration:()=>Gp,DeclarationList:()=>Xp,Dimension:()=>Zp,Feature:()=>nd,FeatureFunction:()=>id,FeatureRange:()=>cd,Function:()=>dd,GeneralEnclosed:()=>md,Hash:()=>yd,IdSelector:()=>Cd,Identifier:()=>wd,Layer:()=>Fd,LayerList:()=>Pd,MediaQuery:()=>Bd,MediaQueryList:()=>zd,NestingSelector:()=>_d,Nth:()=>jd,Number:()=>Vd,Operator:()=>Yd,Parentheses:()=>Qd,Percentage:()=>ef,PseudoClassSelector:()=>rf,PseudoElementSelector:()=>af,Ratio:()=>uf,Raw:()=>ff,Rule:()=>hf,Scope:()=>bf,Selector:()=>vf,SelectorList:()=>Tf,String:()=>Af,StyleSheet:()=>Mf,SupportsDeclaration:()=>Rf,TypeSelector:()=>_f,UnicodeRange:()=>Hf,Url:()=>Yf,Value:()=>Qf,WhiteSpace:()=>eg});var ng=$(()=>{"use strict";up();fp();hp();Sp();kp();Ip();Ap();Mp();Rp();Op();Up();Wp();qp();Qp();ed();rd();sd();ud();fd();hd();bd();vd();Td();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tf();of();lf();pf();gf();xf();Sf();kf();If();Pf();Bf();zf();$f();Wf();Kf();Jf();tg()});var N0,O0=$(()=>{"use strict";sl();c0();ng();N0={generic:!0,cssWideKeywords:gi,...l0,node:Es}});function As(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,nB)&&this.cmpChar(this.tokenStart+1,_0)?this.UnicodeRange():this.Identifier();case 9:{let t=this.charCodeAt(this.tokenStart);if(t===tB||t===ZM||t===_0||t===eB)return this.Operator();t===JM&&this.error("Hex or identifier is expected",this.tokenStart+1);break}}}var JM,ZM,_0,eB,tB,nB,rg=$(()=>{"use strict";JM=35,ZM=42,_0=43,eB=45,tB=47,nB=117});var $0,U0=$(()=>{"use strict";rg();$0={getNode:As}});function pB(e,t){t.last!==null&&t.last.type!=="Combinator"&&e!==null&&e.type!=="Combinator"&&t.push({type:"Combinator",loc:null,name:" "})}function dB(){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)===j0&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:{switch(this.charCodeAt(this.tokenStart)){case sB:case lB:case uB:case aB:return this.Combinator();case j0:return this.ClassSelector();case iB:case cB:return this.TypeSelector();case rB:return this.IdSelector();case oB:return this.NestingSelector()}break}}}var rB,oB,iB,sB,aB,j0,lB,cB,uB,H0,W0=$(()=>{"use strict";rB=35,oB=38,iB=42,sB=43,aB=47,j0=46,lB=62,cB=124,uB=126;H0={onWhiteSpace:pB,getNode:dB}});function V0(){return this.createSingleNodeList(this.Raw(null,!1))}var G0=$(()=>{"use strict"});function q0(){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 Y0=$(()=>{"use strict"});function K0(e){return e!==null&&e.type==="Operator"&&(e.value[e.value.length-1]==="-"||e.value[e.value.length-1]==="+")}var X0,Q0=$(()=>{"use strict";rg();G0();Y0();X0={getNode:As,onWhiteSpace(e,t){K0(e)&&(e.value=" "+e.value),K0(t.last)&&(t.last.value+=" ")},expression:V0,var:q0}});var og={};ye(og,{AtrulePrelude:()=>$0,Selector:()=>H0,Value:()=>X0});var J0=$(()=>{"use strict";U0();W0();Q0()});var fB,Z0,eS=$(()=>{"use strict";fB=new Set(["none","and","not","or"]),Z0={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);fB.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition("container")),e},block(e=!1){return this.Block(e)}}}});var tS,nS=$(()=>{"use strict";tS={parse:{prelude:null,block(){return this.Block(!0)}}}});function ig(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 rS,oS,iS=$(()=>{"use strict";rS={layer(){this.skipSC();let e=this.createList(),t=ig.call(this,this.Layer);return(t.type!=="Raw"||t.value!=="")&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=ig.call(this,this.Declaration,()=>ig.call(this,()=>this.Condition("supports")));return(t.type!=="Raw"||t.value!=="")&&e.push(t),e}},oS={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,rS)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,"supports(")&&e.push(this.Function(null,rS)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}}});var sS,aS=$(()=>{"use strict";sS={parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}}});var lS,cS=$(()=>{"use strict";lS={parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}}});var uS,pS=$(()=>{"use strict";uS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var dS,fS=$(()=>{"use strict";dS={parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}}});var gS,mS=$(()=>{"use strict";gS={parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}}});var hS,xS=$(()=>{"use strict";hS={parse:{prelude:null,block(e=!1){return this.Block(e)}}}});var yS,bS=$(()=>{"use strict";yS={parse:{prelude(){return this.createSingleNodeList(this.Condition("supports"))},block(e=!1){return this.Block(e)}}}});var SS,wS=$(()=>{"use strict";eS();nS();iS();aS();cS();pS();fS();mS();xS();bS();SS={container:Z0,"font-face":tS,import:oS,layer:sS,media:lS,nest:uS,page:dS,scope:gS,"starting-style":hS,supports:yS}});function vS(){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 kS=$(()=>{"use strict"});var _o,sg,gB,mB,vl,CS,TS=$(()=>{"use strict";kS();_o={parse(){return this.createSingleNodeList(this.SelectorList())}},sg={parse(){return this.createSingleNodeList(this.Selector())}},gB={parse(){return this.createSingleNodeList(this.Identifier())}},mB={parse:vS},vl={parse(){return this.createSingleNodeList(this.Nth())}},CS={dir:gB,has:_o,lang:mB,matches:_o,is:_o,"-moz-any":_o,"-webkit-any":_o,where:_o,not:_o,"nth-child":vl,"nth-last-child":vl,"nth-last-of-type":vl,"nth-of-type":vl,slotted:sg,host:sg,"host-context":sg}});var ag={};ye(ag,{AnPlusB:()=>lp,Atrule:()=>pp,AtrulePrelude:()=>gp,AttributeSelector:()=>yp,Block:()=>wp,Brackets:()=>Cp,CDC:()=>Fp,CDO:()=>Pp,ClassSelector:()=>Bp,Combinator:()=>zp,Comment:()=>_p,Condition:()=>jp,Declaration:()=>Vp,DeclarationList:()=>Kp,Dimension:()=>Jp,Feature:()=>td,FeatureFunction:()=>od,FeatureRange:()=>ld,Function:()=>pd,GeneralEnclosed:()=>gd,Hash:()=>xd,IdSelector:()=>kd,Identifier:()=>Sd,Layer:()=>Id,LayerList:()=>Ad,MediaQuery:()=>Md,MediaQueryList:()=>Rd,NestingSelector:()=>Od,Nth:()=>Ud,Number:()=>Wd,Operator:()=>qd,Parentheses:()=>Xd,Percentage:()=>Zd,PseudoClassSelector:()=>nf,PseudoElementSelector:()=>sf,Ratio:()=>cf,Raw:()=>df,Rule:()=>mf,Scope:()=>yf,Selector:()=>wf,SelectorList:()=>Cf,String:()=>Ef,StyleSheet:()=>Lf,SupportsDeclaration:()=>Df,TypeSelector:()=>Of,UnicodeRange:()=>jf,Url:()=>qf,Value:()=>Xf,WhiteSpace:()=>Zf});var IS=$(()=>{"use strict";up();fp();hp();Sp();kp();Ip();Ap();Mp();Rp();Op();Up();Wp();qp();Qp();ed();rd();sd();ud();fd();hd();bd();vd();Td();Ed();Ld();Dd();Nd();$d();Hd();Gd();Kd();Jd();tf();of();lf();pf();gf();xf();Sf();kf();If();Pf();Bf();zf();$f();Wf();Kf();Jf();tg()});var FS,ES=$(()=>{"use strict";J0();wS();TS();IS();FS={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:og,atrule:SS,pseudo:CS,node:ag}});var AS,PS=$(()=>{"use strict";ng();AS={node:Es}});var LS,MS=$(()=>{"use strict";a0();O0();ES();PS();LS=s0({...N0,...FS,...AS})});var BS=$(()=>{"use strict"});var DS=$(()=>{"use strict"});var rq,RS,oq,iq,sq,zS,aq,lq,cq,uq,pq,dq,NS=$(()=>{"use strict";MS();BS();Yu();il();DS();Sl();Gf();({tokenize:rq,parse:RS,generate:oq,lexer:iq,createLexer:sq,walk:zS,find:aq,findLast:lq,findAll:cq,toPlainObject:uq,fromPlainObject:pq,fork:dq}=LS)});function bB(e){return e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _S(e){try{let t=RS(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 SB(e,t){let n=bB(e);if(!yB.has(n))return t;let r=_S(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 OS(e,t){let n=t.trim();if(!n)return"";let r=SB(e,n);return _S(r).map(i=>i==="0"?"0px":i).join(" ")}function $S(e,t,n){let r=OS(e,t),o=OS(e,n);return r!==""&&o!==""&&r===o}var yB,US=$(()=>{"use strict";NS();yB=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 jS(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 $o(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=jS(r),p=jS(o);return!!(f===p||n&&$S(n,r,o))}var lg=$(()=>{"use strict";US()});function FB(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 HS(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 EB(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 AB(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&&FB(n)||HS(r)||HS(o)||n&&EB(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<VS:a<WS}return r.includes("%")||o.includes("%")?a<1:!1}function PB(e){let t=`${e.description||""} ${e.title||""} ${e.suggestedFix||""}`.toLowerCase();if(IB.some(s=>t.includes(s))||!CB.some(s=>t.includes(s)))return!1;let o=e.expected||e.suggestedValue,i=e.actual||e.currentValue;return!(o&&i&&!$o(o,i,e.property))}function LB(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 MB(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)<GS}function BB(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(!TB.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 DB(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 Ps(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($o(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(MB(e))return{dismissed:!0,dismissReason:`Auto-dismissed: text dimension variance (<${GS}px) - font rendering difference, not actionable`,dismissedBy:"post-ai-validation"};if(AB(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")?VS:WS}px)`,dismissedBy:"post-ai-validation"}}return DB(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no measurable values to compare",dismissedBy:"post-ai-validation"}:PB(e)?{dismissed:!0,dismissReason:"Auto-dismissed: no fix needed",dismissedBy:"post-ai-validation"}:BB(e)?{dismissed:!0,dismissReason:"Auto-dismissed: HUG sizing - CSS auto-sizes content without explicit dimensions",dismissedBy:"post-ai-validation"}:LB(e)?{dismissed:!0,dismissReason:"Auto-dismissed: SVG container fill - child elements use their own fills",dismissedBy:"post-ai-validation"}:{dismissed:!1}}var WS,VS,GS,kB,CB,TB,IB,qS=$(()=>{"use strict";lg();WS=.5,VS=2,GS=2,kB=5,CB=["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"],TB=["hug","auto (hug)","should be hug","fixed pixel values are being rendered","fixed values are being rendered"],IB=["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 Si(e,t,n){let r=100-n*1-t*3-e*10;return Math.max(0,Math.min(100,r))}var YS=$(()=>{"use strict"});var KS=$(()=>{"use strict"});var XS=$(()=>{"use strict"});var cg=$(()=>{"use strict";lg();qS();YS();KS();XS()});var HB,WB,Aq,ug=$(()=>{"use strict";HB=["flex","inline-flex"],WB=["grid","inline-grid"],Aq=[...HB,...WB]});var JS=$(()=>{"use strict";cg();ug()});var ZS=$(()=>{"use strict"});var Ls=$(()=>{"use strict";oy();cg();ug();JS();ZS()});function GB(e){let{aiPrompt:t,aiResponse:n,...r}=e;return r}function qn(e){try{let t=e.map(GB),n=JSON.stringify(t,qB);sessionStorage.setItem(pg,n)}catch(t){y.error("[SessionStorage] Failed to save review history:",t)}}function dg(){try{let e=sessionStorage.getItem(pg);if(!e)return[];let t=JSON.parse(e,YB);return Array.isArray(t)?t:[]}catch(e){return y.error("[SessionStorage] Failed to load review history:",e),[]}}function ew(){try{let e=dg();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&&(qn(n),y.debug("[SessionStorage] Stripped aiPrompt/aiResponse from existing review history"))}catch(e){y.error("[SessionStorage] Failed to strip sensitive fields:",e)}}function tw(){try{sessionStorage.removeItem(pg),y.debug("[SessionStorage] Review history cleared")}catch(e){y.error("[SessionStorage] Failed to clear review history:",e)}}function qB(e,t){return t instanceof Date?{__type:"Date",value:t.toISOString()}:t}function YB(e,t){return t&&t.__type==="Date"?new Date(t.value):t}var pg,fg=$(()=>{"use strict";De();pg="uicopilot_review_history"});import KB,{createContext as XB,useContext as QB,useReducer as JB,useMemo as nw,useRef as ZB,useEffect as eD}from"react";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],qn(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=[...e.reviewHistory,...r];return qn(o),{...e,reviewHistory:o}}case"ADD_REVIEW":{let n=[...e.reviewHistory,t.payload];return qn(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 qn(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 qn(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 qn(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 qn(r),{...e,reviewHistory:r}}case"DISMISS_ISSUE":{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,dismissed:!0,dismissReason:t.payload.reason,dismissedAt:new Date,dismissedBy:t.payload.dismissedBy}:o)});return qn(n),{...e,reviewHistory:n}}case"UNDISMISS_ISSUE":{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,dismissed:!1,dismissReason:void 0,dismissedAt:void 0}:o)});return qn(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=Si(i,s,a);return y.debug(`[recalculateScore] Active: ${o.length}, score: ${u}`),{...r,complianceScore:u,issuesCount:o.length}});return qn(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 qn(n),{...e,reviewHistory:n}}case"CLEAR_ALL_REVIEWS":return tw(),{...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 mg({children:e}){let[t,n]=JB(tD,sD),r=ZB(t);eD(()=>{r.current=t},[t]);let o=nw(()=>({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=nw(()=>({...t,...o}),[t,o]);return KB.createElement(rw.Provider,{value:i},e)}function ie(){let e=QB(rw);if(!e)throw new Error("useReviewStore must be used within a ReviewProvider");return e}var nD,rD,gg,oD,iD,sD,rw,hg=$(()=>{"use strict";Ls();fg();De();nD=()=>{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},rD=()=>{if(typeof localStorage>"u")return null;try{let e=localStorage.getItem("uicopilot_role_override");if(e==="admin"||e==="beta")return e}catch{}return null},gg={enableFixGeneration:!1,enableFixApply:!1,enableAutoMap:!1,enableReviewBadges:!1,showCosts:!1,enableParallelReview:!1,enableModelSelection:!1},oD=()=>{if(typeof localStorage>"u")return gg;try{let e=localStorage.getItem("uicopilot_feature_flags");if(!e)return gg;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 gg},iD=()=>{if(typeof localStorage>"u")return"beta";try{let e=localStorage.getItem("uicopilot_user_role");if(e==="admin"||e==="beta")return e}catch{}return"beta"},sD={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:dg(),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:iD(),roleOverride:rD(),featureFlags:oD(),reviewAllConcurrency:nD(),hoveredIssueId:null},rw=XB(null)});import Ms,{useMemo as aD}from"react";function yg({children:e}){return Ms.createElement(Zc,null,Ms.createElement(tu,null,Ms.createElement(ru,null,Ms.createElement(mg,null,Ms.createElement(lD,null),e))))}function ow(e){let t=we(),n=Ze(),r=rt(),o=ie(),i=aD(()=>({...t,...n,...r,...o}),[t,n,r,o]);return e?e(i):i}function lD(){return xg=ow(),null}var xg,ht,iw=$(()=>{"use strict";eu();nu();ou();hg();xg=null,ht=Object.assign(ow,{getState:()=>{if(!xg)throw new Error("Store not initialized. Make sure StoreProvider is mounted.");return xg}})});var ve=$(()=>{"use strict";iw();eu();nu();ou();hg()});function q(){return(process.env.STORYBOOK_UICOPILOT_URL||cD).replace(/\/$/,"")}var cD,sw,je=$(()=>{"use strict";cD="https://app.uicopilot.dev",sw=3.6});async function oe(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 pt=$(()=>{"use strict"});import{useEffect as zs,useState as Cl,useRef as ZD,useCallback as Sg}from"react";import{addons as wg}from"storybook/manager-api";async function eR(e,t,n){let r=`${e}:${t}`,o=vg.get(r);if(o)return y.debug("[useReviewScreenshots] Reusing in-flight Figma image fetch for",r),o;let i=(async()=>{let s=await oe(`${kw}/api/figma/image?projectId=${e}&nodeId=${t}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`}});return s.ok?s.json():{imageUrl:null}})().finally(()=>{vg.delete(r)});return vg.set(r,i),i}function tR(e,t,n){try{sessionStorage.setItem(`${Tl}${e}`,JSON.stringify({figmaNodeId:t,imageUrl:n,timestamp:Date.now()}))}catch{}}function nR(e,t){try{let n=sessionStorage.getItem(`${Tl}${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(`${Tl}${e}`)}catch{}return null}function rR(e){try{let t=sessionStorage.getItem(`${Tl}${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 bw,Sw,ww,vw,Ci,kw,ir,kg,vg,Tl,Cw,Uo,Ns=$(()=>{"use strict";ve();Cg();De();je();pt();bw="storyArgsUpdated",Sw="storyRendered",ww="forceRemount",vw=null,Ci=()=>vw,kw=q(),ir=new Map,kg=null,vg=new Map;Tl="uicopilot-figma-image-";Cw=(e,t,n)=>{kg=t;let r=ir.get(e);r?r.figmaImageUrl=n:ir.set(e,{storybookImageUrl:null,figmaImageUrl:n}),y.debug("[useReviewScreenshots] Pre-set Figma image for mapping:",{storyId:e,figmaNodeId:t,imageUrl:n.substring(0,50)+"..."})},Uo=()=>{let[e,t]=Cl(!1),[n,r]=Cl(!1),[o,i]=Cl(!1),[s,a]=Cl(null),u=ZD(null),{screenshotRefreshKey:c,triggerScreenshotRefresh:l}=ie(),d=Sg(()=>{let z=ht.getState().currentStoryId;z&&(y.debug("[useReviewScreenshots] Refreshing screenshots for story:",z),ir.delete(z),u.current=null,i(!0),l())},[l]),f=Sg(()=>{let z=ht.getState().currentStoryId;if(z){y.debug("[useReviewScreenshots] Refreshing Storybook screenshot only for story:",z);let _=ir.get(z);_&&(_.storybookImageUrl=null),u.current=null,i(!0),l()}},[l]),{sessionToken:p}=we(),{selectedProjectId:g}=Ze(),{currentStoryId:S,currentMapping:C}=rt(),{setStorybookImageUrl:F,setFigmaImageUrl:k}=ie();zs(()=>{if(!S||ht.getState().figmaImageUrl)return;let _=rR(S);_&&(y.debug("[useReviewScreenshots] Quick-restored Figma image for:",S),k(_))},[S,k]),zs(()=>{(async()=>{if(!p||!g||!S){y.debug("[useReviewScreenshots] Missing required context, skipping auto-load");return}let _=ht.getState();if(_.storybookImageUrl&&_.figmaImageUrl){y.debug("[useReviewScreenshots] Screenshots already loaded from persisted review, skipping capture"),u.current=S;return}let M=C?.figmaNodeId??null;if(M!==kg){y.debug("[useReviewScreenshots] Figma mapping changed, invalidating Figma image only for story:",S);let I=ir.get(S);I&&(I.figmaImageUrl=null),kg=M,u.current=null}let B=C?.figmaNodeId;if(B&&!ir.get(S)?.figmaImageUrl){let I=nR(S,B);if(I){y.debug("[useReviewScreenshots] Hydrated Figma image from sessionStorage for story:",S),k(I);let v=ir.get(S);v?v.figmaImageUrl=I:ir.set(S,{storybookImageUrl:null,figmaImageUrl:I})}}let m=ir.get(S),x=m&&m.storybookImageUrl&&m.figmaImageUrl,b=m&&m.storybookImageUrl&&!m.figmaImageUrl,E=m&&!m.storybookImageUrl&&m.figmaImageUrl;if(x){y.debug("[useReviewScreenshots] Using fully cached screenshots for story:",S),F(m.storybookImageUrl),k(m.figmaImageUrl),u.current=S;return}let h=b&&C?.figmaNodeId;h&&(y.debug("[useReviewScreenshots] Using cached Storybook, fetching new Figma for story:",S),F(m.storybookImageUrl));let T=E;if(T&&(y.debug("[useReviewScreenshots] Using cached Figma, recapturing Storybook for story:",S),k(m.figmaImageUrl)),u.current===S&&C?.figmaNodeId){y.debug("[useReviewScreenshots] Screenshots already loaded for this story, skipping");return}try{a(null),h?r(!0):(T||(t(!0),r(!0)),i(!0)),u.current=S;let I=T?m.figmaImageUrl:null,v;if(T)y.debug("[useReviewScreenshots] Figma cached (storybookOnlyRefresh), skipping fetch"),r(!1);else if(B){y.debug("[useReviewScreenshots] Found Figma node ID from mapping:",B);let P=null;try{y.debug("[useReviewScreenshots] Fetching Figma image (with caching)...");let D=await eR(g,B,p);P=D.imageUrl||null;let N=D.cached?"(cached)":"(fresh)";y.debug(`[useReviewScreenshots] Figma image fetched ${N}:`,P?"success":"not found")}catch(D){y.warn("[useReviewScreenshots] Failed to fetch Figma image:",D)}if(P)if(P.includes(".azureedge.net")||P.includes(".blob.core.windows.net")||P.includes(".blob.vercel-storage.com")){y.debug("[useReviewScreenshots] Using cached CDN URL directly (fast)"),I=P,k(P);let N=new Image;N.crossOrigin="anonymous",await new Promise(w=>{N.onload=()=>{v={width:N.naturalWidth,height:N.naturalHeight},y.debug("[useReviewScreenshots] Figma dimensions:",v),w()},N.onerror=()=>w(),N.src=P})}else try{y.debug("[useReviewScreenshots] Converting Figma S3 URL to data URL via proxy...");let N=`${kw}/api/proxy/image?url=${encodeURIComponent(P)}`,w=await oe(N);if(w.ok){let j=await w.blob(),G=new FileReader,L=await new Promise((ee,re)=>{G.onloadend=()=>ee(G.result),G.onerror=re,G.readAsDataURL(j)});I=L,k(L),y.debug("[useReviewScreenshots] Figma thumbnail converted to data URL");let K=new Image;await new Promise(ee=>{K.onload=()=>{v={width:K.naturalWidth,height:K.naturalHeight},y.debug("[useReviewScreenshots] Figma dimensions:",v),ee()},K.onerror=()=>ee(),K.src=L})}else I=P,k(P),y.debug("[useReviewScreenshots] Figma thumbnail loaded (external URL)")}catch(N){y.warn("[useReviewScreenshots] Failed to convert to data URL, using external URL:",N),I=P,k(P)}else y.warn("[useReviewScreenshots] No thumbnail found for node:",B),k(null);I&&B&&tR(S,B,I),r(!1)}else y.debug("[useReviewScreenshots] No Figma mapping exists for this component"),k(null),r(!1);let A=m?.storybookImageUrl||null;if(A)y.debug("[useReviewScreenshots] Using cached Storybook screenshot"),i(!1);else{y.debug("[useReviewScreenshots] Capturing Storybook screenshot for story:",S);let P=await Il({storyId:S,sessionToken:p||void 0,...v&&{figmaWidth:v.width,figmaHeight:v.height}});P?(A=P,F(P),y.debug("[useReviewScreenshots] Storybook screenshot captured at dimensions:",v||"natural")):y.warn("[useReviewScreenshots] Failed to capture Storybook screenshot"),i(!1)}ir.set(S,{storybookImageUrl:A,figmaImageUrl:I}),y.debug("[useReviewScreenshots] Screenshots cached for story:",S)}catch(I){y.error("[useReviewScreenshots] Error loading screenshots:",I),a(I instanceof Error?I.message:"Failed to load screenshots"),u.current=null,r(!1),i(!1)}finally{t(!1)}})()},[p,g,S,C?.figmaNodeId,c]),zs(()=>{let z=wg.getChannel(),_=null,M=B=>{vw=B.args,y.debug("[useReviewScreenshots] Args updated for story:",B.storyId,"args:",B.args),_&&clearTimeout(_),_=setTimeout(()=>{y.debug("[useReviewScreenshots] Story args changed, refreshing screenshot"),d()},500)};return z.on(bw,M),()=>{z.off(bw,M),_&&clearTimeout(_)}},[d]),zs(()=>{let z=wg.getChannel(),_=!1,M=null,B=()=>{y.debug("[useReviewScreenshots] FORCE_REMOUNT detected, showing Storybook loader"),_=!0,i(!0)},m=()=>{_&&(y.debug("[useReviewScreenshots] STORY_RENDERED after remount, waiting for styles to settle..."),M&&clearTimeout(M),M=setTimeout(()=>{_=!1,y.debug("[useReviewScreenshots] Refreshing Storybook screenshot after HMR (preserving Figma)"),f()},500))};return z.on(ww,B),z.on(Sw,m),()=>{z.off(ww,B),z.off(Sw,m),M&&clearTimeout(M)}},[f]),zs(()=>{let z=wg.getChannel(),_=async M=>{if(!M?.snapshot?.html){y.debug("[useReviewScreenshots] DOM mutated but no snapshot available");return}y.debug("[useReviewScreenshots] DOM mutated, capturing snapshot screenshot"),i(!0);try{let B=ht.getState().currentStoryId,m=await fetch("/__uicopilot/screenshot-snapshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...M.snapshot,storyId:B})});if(m.ok){let x=await m.json();if(x.screenshot){F(x.screenshot);let b=ht.getState().currentStoryId;if(b){let E=ir.get(b);E?E.storybookImageUrl=x.screenshot:ir.set(b,{storybookImageUrl:x.screenshot,figmaImageUrl:null})}}}else y.error("[useReviewScreenshots] Snapshot screenshot failed:",await m.text())}catch(B){y.error("[useReviewScreenshots] Snapshot screenshot error:",B)}finally{i(!1)}};return z.on("UICOPILOT/STORY_DOM_MUTATED",_),()=>{z.off("UICOPILOT/STORY_DOM_MUTATED",_)}},[]);let R=Sg((z,_,M)=>{y.debug("[useReviewScreenshots] setFigmaImageDirect called - bypassing load"),Cw(z,_,M),k(M),r(!1),u.current=z},[k]);return{isLoadingScreenshots:e,isLoadingFigma:n,isLoadingStorybook:o,screenshotError:s,refreshScreenshots:d,refreshStorybookOnly:f,setFigmaImageDirect:R}}});function iR(){return!q().startsWith("http://localhost")}function sR(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 Tw(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=sR(o,t,n);return r.set(o,i),i})}async function aR(){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=Tw(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=Tw(d,o,r),u.replaceWith(f)}}catch{}})}})).toDataURL("image/png")}function lR(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 cR(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 oe(`${oR}/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 uR(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 pR(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=Ci();if(!s||Object.keys(s).length===0){let a=t.get("args");a&&(s=uR(a),y.debug("[Screenshot] Parsed args from URL:",s))}if(s&&Object.keys(s).length>0){let a=lR(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 dR(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 Il(e){let t=e?.storyId||fR();if(t){let n=Tg.get(t);if(n)return y.debug("[Screenshot] Reusing in-flight capture for",t),n;let r=Iw(t,e).finally(()=>{Tg.delete(t)});return Tg.set(t,r),r}return Iw(void 0,e)}async function Iw(e,t){try{if(e){let n=await dR(e);if(n)return n}if(!iR()){let n=pR(t?.storyId);return await cR(n,{...t,selector:"#storybook-root > *"})}return y.info("[Screenshot] Using client-side capture (html2canvas fallback)"),await aR()}catch(n){throw y.error("Error capturing screenshot:",n),new Error(`Failed to capture screenshot: ${n instanceof Error?n.message:"Unknown error"}`)}}function fR(){return(new URLSearchParams(window.location.search).get("path")||"").replace("/story/","").replace("/docs/","")||void 0}var oR,Tg,Cg=$(()=>{"use strict";je();Ns();De();pt();oR=q();Tg=new Map});function vn(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 Dn(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 Os(e){return e.split(",").map(n=>n.trim().replace(/['"]/g,""))[0]||e}function Fw(e){let t=e.ownerDocument,r=(t.defaultView||window).getComputedStyle(e);if("fonts"in t){let C=r.fontSize||"16px",F=r.fontWeight||"400";if(r.fontFamily.includes("Roboto")){let k=t.fonts.check(`${F} ${C} Roboto`);if(y.debug("[computedStyles] Roboto check:",{cssFamily:r.fontFamily,robotoLoaded:k,fontWeight:F,fontSize:C,isIframe:t!==document,fontStatus:Array.from(t.fonts).map(R=>({family:R.family,status:R.status}))}),k)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(C=>C.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",S=new Map;for(let C of f){s.font=`${c} ${u} ${a} "${C}", monospace`;let F=s.measureText(o).width;if(S.set(C,F),F!==p){s.font=`${c} ${u} ${a} "${C}"`;let k=s.measureText(o).width;s.font=`${c} ${u} ${a} ${r.fontFamily}`;let R=s.measureText(o).width;if(Math.abs(k-R)<.1){g=C;break}}}return y.debug("[computedStyles] Font detection:",{declared:r.fontFamily,detected:g,declaredFonts:l,fontWidths:Array.from(S.entries()),isIframe:t!==document}),g}var _s=$(()=>{"use strict";De()});function Ti(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 Ig(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:vn(n.color),backgroundColor:vn(n.backgroundColor),borderColor:vn(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:Fw(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 Fg(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 Fl=$(()=>{"use strict";De();_s()});function gR(e){let t=[],n=new Set,r=Ew.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(Ew.includes(e.tagName.toLowerCase())){let i=`${e.tagName.toLowerCase()}.${e.className}`;n.has(i)||t.unshift(e)}return t}function mR(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:Ti(r,i),tagName:r,className:i,styles:{fontSize:n.fontSize,fontFamily:Os(n.fontFamily),fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,color:vn(n.color),textAlign:n.textAlign,textTransform:n.textTransform}}}function hR(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 xR(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=vn(n.borderColor),p=s?`${l} ${d} ${f}`:"none";return{selector:Ti(r,i),className:i,border:p,borderRadius:n.borderRadius,backgroundColor:vn(n.backgroundColor),gap:n.gap}}function $s(){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=hR(r,2),i=o.map(xR).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=gR(r);s=a.map(mR),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:Ig(r),declared:Fg(r,t),markup:r.outerHTML,textElementStyles:s,nestedElementStyles:i}}catch(e){return y.error("Error extracting computed styles:",e),null}}var Ew,Aw=$(()=>{"use strict";De();_s();Fl();Ew=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});function Eg(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 bR(e,t,n){if(!(e==="0px"||t==="none"))return`${e} ${t} ${n}`}function SR(e){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e),r={},o=vn(n.backgroundColor);Dn("backgroundColor",o)||(r.backgroundColor=o);let i=bR(n.borderWidth,n.borderStyle,vn(n.borderColor));i&&(r.border=i),Dn("borderRadius",n.borderRadius)||(r.borderRadius=n.borderRadius),Dn("boxShadow",n.boxShadow)||(r.boxShadow=n.boxShadow),Dn("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 C=0;C<e.attributes.length;C++){let F=e.attributes[C];if(["class","style","id","xmlns","xmlns:xlink"].includes(F.name))continue;let k=F.name.replace(/-([a-z])/g,(z,_)=>_.toUpperCase()),R=F.value.startsWith("rgb")?vn(F.value):F.value;k==="d"&&R.length>100?r[k]=R.substring(0,100)+"...":r[k]=R}let p=n.getPropertyValue("fill"),g=n.getPropertyValue("stroke");if(p&&p!=="none"&&(r.fill=p.startsWith("rgb")?vn(p):p),g&&g!=="none"&&(r.stroke=g.startsWith("rgb")?vn(g):g),["circle","ellipse","rect","path","line","polyline","polygon"].includes(s)){let C=e.getBoundingClientRect();C.width>0&&(r.width=`${Math.round(C.width*100)/100}px`),C.height>0&&(r.height=`${Math.round(C.height*100)/100}px`)}}let c=e.textContent&&e.textContent.trim().length>0,l=yR.includes(e.tagName.toLowerCase());(c||l)&&(r.fontSize=n.fontSize,r.fontFamily=Os(n.fontFamily),r.fontWeight=n.fontWeight,r.lineHeight=n.lineHeight,r.color=vn(n.color),Dn("letterSpacing",n.letterSpacing)||(r.letterSpacing=n.letterSpacing),Dn("textAlign",n.textAlign)||(r.textAlign=n.textAlign)),r.display=n.display;let d=Eg(n.paddingTop,n.paddingRight,n.paddingBottom,n.paddingLeft);Dn("padding",d)||(r.padding=d);let f=Eg(n.marginTop,n.marginRight,n.marginBottom,n.marginLeft);return Dn("margin",f)||(r.margin=f),Dn("gap",n.gap)||(r.gap=n.gap),(n.display==="flex"||n.display==="inline-flex")&&(Dn("flexDirection",n.flexDirection)||(r.flexDirection=n.flexDirection),Dn("justifyContent",n.justifyContent)||(r.justifyContent=n.justifyContent),Dn("alignItems",n.alignItems)||(r.alignItems=n.alignItems)),r.width||(r.width=n.width),r.height||(r.height=n.height),r}function Pw(e){let t=1;for(let n of e.children)t+=Pw(n);return t}function Lw(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 S of Array.from(o.childNodes))if(S.nodeType===Node.TEXT_NODE){let C=S.textContent?.trim();if(C){d=C.length>50?C.substring(0,50)+"...":C;break}}let f=s;c?f=`${s}#${c}`:u&&(f=Ti(s,u));let p=SR(o),g=[];if(i<t){let S=Array.from(o.children);for(let C of S){let F=C.tagName.toLowerCase();if(["script","style","link","meta","br","hr","noscript"].includes(F))continue;let R=(C.ownerDocument.defaultView||window).getComputedStyle(C);R.display==="none"||R.visibility==="hidden"||g.push(n(C,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:Pw(r)}),r}function Ag(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=Lw(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 yR,Mw=$(()=>{"use strict";De();_s();Fl();yR=["input","textarea","button","select","label","span","a","p","h1","h2","h3","h4","h5","h6"]});var Pg=$(()=>{"use strict";_s();Fl();Aw();Mw()});var ov=Jn((nX,rv)=>{"use strict";rv.exports={compareTwoStrings:nv,findBestMatch:VR};function nv(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 VR(e,t){if(!GR(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=nv(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 GR(e,t){return!(typeof e!="string"||!Array.isArray(t)||!t.length||t.find(function(n){return typeof n!="string"}))}});var KC=Jn((Joe,YC)=>{"use strict";var WC=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,O4=/\n/g,_4=/^\s*/,$4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,U4=/^:\s*/,j4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,H4=/^[;\s]*/,W4=/^\s+|\s+$/g,V4=`
|
|
14
|
+
`,VC="/",GC="*",Qo="",G4="comment",q4="declaration";function Y4(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 S=g.match(O4);S&&(n+=S.length);var C=g.lastIndexOf(V4);r=~C?g.length-C:r+g.length}function i(){var g={line:n,column:r};return function(S){return S.position=new s(g),c(),S}}function s(g){this.start=g,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(g){var S=new Error(t.source+":"+n+":"+r+": "+g);if(S.reason=g,S.filename=t.source,S.line=n,S.column=r,S.source=e,!t.silent)throw S}function u(g){var S=g.exec(e);if(S){var C=S[0];return o(C),e=e.slice(C.length),S}}function c(){u(_4)}function l(g){var S;for(g=g||[];S=d();)S!==!1&&g.push(S);return g}function d(){var g=i();if(!(VC!=e.charAt(0)||GC!=e.charAt(1))){for(var S=2;Qo!=e.charAt(S)&&(GC!=e.charAt(S)||VC!=e.charAt(S+1));)++S;if(S+=2,Qo===e.charAt(S-1))return a("End of comment missing");var C=e.slice(2,S-2);return r+=2,o(C),e=e.slice(S),r+=2,g({type:G4,comment:C})}}function f(){var g=i(),S=u($4);if(S){if(d(),!u(U4))return a("property missing ':'");var C=u(j4),F=g({type:q4,property:qC(S[0].replace(WC,Qo)),value:C?qC(C[0].replace(WC,Qo)):Qo});return u(H4),F}}function p(){var g=[];l(g);for(var S;S=f();)S!==!1&&(g.push(S),l(g));return g}return c(),p()}function qC(e){return e?e.replace(W4,Qo):Qo}YC.exports=Y4});var XC=Jn(oa=>{"use strict";var K4=oa&&oa.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oa,"__esModule",{value:!0});oa.default=Q4;var X4=K4(KC());function Q4(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,X4.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 JC=Jn(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.camelCase=void 0;var J4=/^--[a-zA-Z0-9_-]+$/,Z4=/-([a-z])/g,eU=/^[^-]+$/,tU=/^-(webkit|moz|ms|o|khtml)-/,nU=/^-(ms)-/,rU=function(e){return!e||eU.test(e)||J4.test(e)},oU=function(e,t){return t.toUpperCase()},QC=function(e,t){return"".concat(t,"-")},iU=function(e,t){return t===void 0&&(t={}),rU(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(nU,QC):e=e.replace(tU,QC),e.replace(Z4,oU))};uc.camelCase=iU});var e1=Jn((dh,ZC)=>{"use strict";var sU=dh&&dh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},aU=sU(XC()),lU=JC();function ph(e,t){var n={};return!e||typeof e!="string"||(0,aU.default)(e,function(r,o){r&&o&&(n[(0,lU.camelCase)(r,t)]=o)}),n}ph.default=ph;ZC.exports=ph});var FT=Jn((Fue,IT)=>{"use strict";var Bc=Object.prototype.hasOwnProperty,TT=Object.prototype.toString,bT=Object.defineProperty,ST=Object.getOwnPropertyDescriptor,wT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):TT.call(t)==="[object Array]"},vT=function(t){if(!t||TT.call(t)!=="[object Object]")return!1;var n=Bc.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Bc.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Bc.call(t,o)},kT=function(t,n){bT&&n.name==="__proto__"?bT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},CT=function(t,n){if(n==="__proto__")if(Bc.call(t,n)){if(ST)return ST(t,n).value}else return;return t[n]};IT.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=CT(a,n),o=CT(t,n),a!==o&&(l&&o&&(vT(o)||(i=wT(o)))?(i?(i=!1,s=r&&wT(r)?r:[]):s=r&&vT(r)?r:{},kT(a,{name:n,newValue:e(l,s,o)})):typeof o<"u"&&kT(a,{name:n,newValue:o}));return a}});import Ia from"react";import{addons as Vc,types as _x,experimental_getStatusStore as hF}from"storybook/manager-api";import{AddonPanel as E8}from"storybook/internal/components";import Mt,{useState as qW,useEffect as YW}from"react";import{styled as fr}from"storybook/theming";import Yx from"react";import{styled as At}from"storybook/theming";var le="#ea580c",Yc="#c2410c",Pa="#ff6b35";var jx=At.div(({theme:e})=>({fontFamily:e.typography.fonts.base,height:"100%",display:"flex",flexDirection:"column",backgroundColor:e.background.content,color:e.color.defaultText})),Hx=At.div({flex:1,overflow:"auto",padding:"6px 20px 20px"}),ts=At.div({marginBottom:"20px"}),ns=At.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})),rs=At.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`}})),En=At.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"}})),Wx=At(En)(({theme:e})=>({width:"auto",padding:`${e.layoutMargin*.6}px 28px ${e.layoutMargin*.6}px ${e.layoutMargin}px`,fontSize:e.typography.size.s1})),La=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"}}),er=At.button(({theme:e})=>({...La(e),backgroundColor:e.color.secondary,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),qt=At.button(({theme:e})=>({...La(e),backgroundColor:le,color:e.color.inverseText,boxShadow:`0 2px 4px ${le}4d`,"&:hover:not(:disabled)":{backgroundColor:Yc,transform:"translateY(-1px)",boxShadow:`0 4px 8px ${le}66`}})),Er=At.button(({theme:e})=>({...La(e),backgroundColor:"transparent",border:`1px solid ${e.appBorderColor}`,color:e.color.defaultText,"&:hover:not(:disabled)":{backgroundColor:e.background.hoverable}})),Vx=At.button(({theme:e})=>({...La(e),backgroundColor:e.color.negative,color:e.color.inverseText,"&:hover:not(:disabled)":{opacity:.9}})),wn=At.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"}})),Kc=At.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"}})),io=At.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}})),so=At(rs)(({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"})),z8=At.div(({theme:e})=>({padding:`${e.layoutMargin*1.6}px`,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),Gx=At.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})),N8=At.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})),Xc=At.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})),O8=At.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%)"}}})),qx=At.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}}),_8=At.div(({theme:e})=>({padding:"40px 20px",textAlign:"center",color:e.color.mediumdark})),$8=At.div(({theme:e})=>({fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,marginBottom:`${e.layoutMargin*.8}px`,color:e.color.defaultText})),U8=At.div(({theme:e})=>({fontSize:e.typography.size.s2,color:e.color.mediumdark}));var Qc=({header:e,children:t,footer:n})=>Yx.createElement(jx,null,e,Yx.createElement(Hx,null,t),n);import TF from"react";import{styled as IF}from"storybook/theming";var FF=IF.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})),Jc=({toolbar:e})=>TF.createElement(FF,null,e);import Q8 from"react";import{styled as Ma}from"storybook/theming";var eV=Ma.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})),tV=Ma.div({display:"flex",flex:1}),nV=Ma(io)(({theme:e,disabled:t})=>({padding:"6px 12px",...t?{color:e.color.mediumlight,cursor:"not-allowed",opacity:.5,"&:hover":{}}:{}})),rV=Ma.div({display:"flex",gap:"8px",alignItems:"center"});import pn,{useState as gw,useCallback as mw,useEffect as hw}from"react";import{styled as fo}from"storybook/theming";import Re,{useEffect as aw}from"react";import{styled as at}from"storybook/theming";ve();je();De();pt();var lw=at.div({position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4}),cw=at.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})),uD=at.div({display:"flex",alignItems:"center",gap:"12px",padding:"16px 16px 12px"}),pD=at.div({width:"36px",height:"36px",borderRadius:"50%",backgroundColor:le,display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:"14px",fontWeight:700,flexShrink:0}),dD=at.div({display:"flex",flexDirection:"column",gap:"4px"}),fD=at.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,lineHeight:1.2})),gD=at.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"}),mD=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px 8px",fontSize:"14px",color:e.color.defaultText})),hD=at.span(({theme:e})=>({color:e.textMutedColor,fontSize:"13px"})),xD=at.span(({theme:e})=>({color:e.color.defaultText,fontSize:"15px",fontWeight:600})),yD=at.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"})),bD=at.div(({percent:e})=>({height:"100%",width:`${Math.min(100,Math.max(0,e))}%`,background:`linear-gradient(90deg, #f59e0b 0%, ${le} 100%)`,transition:"width 0.3s ease"})),SD=at.div(({theme:e})=>({padding:"0 16px 14px",fontSize:"12px",color:e.textMutedColor})),wD=at.div(({theme:e})=>({height:"1px",backgroundColor:e.appBorderColor})),vD=at.button({width:"100%",padding:"14px 16px",background:"transparent",border:"none",color:le,fontSize:"14px",fontWeight:500,textAlign:"left",cursor:"pointer",display:"flex",alignItems:"center",gap:"6px","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.03)"}}),kD=at.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}})),CD=at.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:`1px solid ${e.appBorderColor}`})),TD=at.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"10px",color:e.color.defaultText,fontSize:"14px",fontWeight:500})),ID=at.div(({theme:e})=>({width:"32px",height:"32px",borderRadius:"50%",backgroundColor:le,display:"flex",alignItems:"center",justifyContent:"center",color:e.color.inverseText,fontSize:"14px",fontWeight:600})),FD=at.div({display:"flex",gap:"8px"}),uw=at(wn)({fontSize:"18px"}),ED=at.div({padding:"20px 16px"}),AD=at.div(({theme:e})=>({padding:"16px",borderRadius:"8px",background:"linear-gradient(135deg, #10B981 0%, #3B82F6 100%)",marginBottom:"16px",color:"#fff"})),PD=at.div({fontSize:"12px",fontWeight:500,opacity:.9,marginBottom:"4px"}),LD=at.div({fontSize:"28px",fontWeight:700}),MD=at.div({fontSize:"11px",opacity:.8,marginTop:"4px"}),BD=at.div(({theme:e})=>({padding:"16px",borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),DD=at.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),RD=at.div({display:"flex",alignItems:"center",gap:"8px"}),zD=at.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),ND=at.span(({theme:e})=>({fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:le,color:e.color.inverseText})),OD=at.button(({theme:e})=>({background:"none",border:"none",color:le,fontSize:"12px",cursor:"pointer","&:hover":{textDecoration:"underline"}})),_D=at.div(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),$D=at.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"?le:e.background.hoverable,color:t==="primary"?e.color.inverseText:e.color.defaultText,"&:hover":{opacity:.9}})),UD=30*1e3,pw=({onClose:e})=>{let{sessionToken:t,resetAuth:n,usageData:r,usageLastFetched:o,setUsageData:i}=we(),{featureFlags:s}=ie(),a=s.showCosts,u=r,c=!r&&t,l=async(g=!1)=>{if(!t)return;let S=o&&Date.now()-o<UD;if(!(!g&&S&&r))try{let C=q(),F=await oe(`${C}/api/addon/account`,{headers:{Authorization:`Bearer ${t}`}});if(F.ok){let k=await F.json();i(k)}}catch(C){y.error("Failed to fetch usage:",C)}};aw(()=>{l()},[t]),aw(()=>{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=()=>{n(),e()},f=()=>{let g=q();window.open(`${g}/pricing`,"_blank")},p=()=>{let g=q();window.open(`${g}/pricing#add-credits`,"_blank")};if(t&&!a&&!c){let g=Math.floor(u?.creditBalance??0),C=Math.max(g,10),F=Math.max(0,C-g),k=C>0?g/C*100:0;return Re.createElement(Re.Fragment,null,Re.createElement(lw,{onClick:e}),Re.createElement(cw,{onClick:R=>R.stopPropagation(),style:{width:"320px"}},Re.createElement(kD,{onClick:e,title:"Close"},"\xD7"),Re.createElement(uD,null,Re.createElement(pD,null,u?.email?u.email[0].toUpperCase():"U"),Re.createElement(dD,null,Re.createElement(fD,null,"UI Review"),Re.createElement(gD,null,(u?.plan||"BETA").toUpperCase()))),Re.createElement(mD,null,Re.createElement(hD,null,"Credits"),Re.createElement(xD,null,g," left")),Re.createElement(yD,null,Re.createElement(bD,{percent:k})),Re.createElement(SD,null,F," used \xB7 ",g," remaining"),Re.createElement(wD,null),Re.createElement(vD,{onClick:p},"Get free credits \u2192")))}return Re.createElement(Re.Fragment,null,Re.createElement(lw,{onClick:e}),Re.createElement(cw,{onClick:g=>g.stopPropagation()},Re.createElement(CD,null,Re.createElement(TD,null,Re.createElement(ID,null,u?.email?u.email[0].toUpperCase():"U"),Re.createElement("span",null,u?.email||"Loading...")),Re.createElement(FD,null,Re.createElement(uw,{onClick:d,title:"Sign out"},"\u2192"),Re.createElement(uw,{onClick:e,title:"Close"},"\xD7"))),Re.createElement(ED,null,c?Re.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Loading..."):t?Re.createElement(Re.Fragment,null,Re.createElement(AD,null,Re.createElement(PD,null,"Credit Balance"),Re.createElement(LD,null,"$",(u?.creditBalance??0).toFixed(2)),Re.createElement(MD,null,(u?.creditBalance??0)<2?"Low balance - consider topping up":"Pay only for what you use")),Re.createElement(BD,null,Re.createElement(DD,null,Re.createElement(RD,null,Re.createElement(zD,null,"Current Plan"),Re.createElement(ND,null,u?.plan||"Free")),Re.createElement(OD,{onClick:f},"View detail >")),Re.createElement(_D,null,"~$0.02-0.05 per review depending on complexity"),Re.createElement($D,{onClick:p,style:{marginTop:"16px"}},"Add Credits"))):Re.createElement("div",{style:{textAlign:"center",padding:"20px"}},"Please sign in to view usage"))))};ve();import wi from"react";import{styled as dw}from"storybook/theming";je();ve();pt();De();var jD=dw.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}),HD=dw.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark})),WD={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}},fw=()=>{let{userRole:e,roleOverride:t,setRoleOverride:n,setFeatureFlags:r}=ie(),{sessionToken:o}=we();return e!=="admin"?null:wi.createElement(jD,null,wi.createElement(HD,null,"View as:"),wi.createElement(Wx,{value:t??e,onChange:a=>{let u=a.target.value;if(u===e)n(null),o&&oe(`${q()}/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=WD[u];r(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c))}catch{}}},style:{width:"auto",minWidth:"100px"}},wi.createElement("option",{value:"admin"},"Admin"),wi.createElement("option",{value:"beta"},"Beta Tester")),t&&wi.createElement(qx,{variant:"warning"},"Previewing as ",t))};ve();je();pt();var VD=fo.div({display:"flex",alignItems:"center"}),vi=fo.div(({theme:e})=>({display:"flex",alignItems:"center",paddingLeft:"8px",borderLeft:`1px solid ${e.appBorderColor}`,"&:first-of-type":{paddingLeft:0,borderLeft:"none"}})),GD=fo.span(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.secondary,fontWeight:e.typography.weight.bold,paddingRight:"8px",opacity:.8})),qD=fo.div({position:"relative"}),YD=fo.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`}})),xw=fo.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)"}})),KD=fo.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)"}}}),XD=fo.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}})),QD=30*1e3,bg=({onOpenSettings:e})=>{let[t,n]=gw(!1),[r,o]=gw(!1),{usageData:i,usageLastFetched:s,setUsageData:a,sessionToken:u}=we(),{userRole:c,roleOverride:l,featureFlags:d}=ie(),f=l??c;hw(()=>{(async()=>{if(!(!u||s&&Date.now()-s<QD&&i)){o(!0);try{let R=q(),z=await oe(`${R}/api/addon/account`,{headers:{Authorization:`Bearer ${u}`}});if(z.ok){let _=await z.json();a(_)}}catch(R){console.error("Failed to fetch balance:",R)}finally{o(!1)}}})()},[u,s,i,a]),hw(()=>{let F=()=>{document.visibilityState==="visible"&&t&&n(!1)},k=()=>{t&&n(!1)};return document.addEventListener("visibilitychange",F),window.addEventListener("focus",k),()=>{document.removeEventListener("visibilitychange",F),window.removeEventListener("focus",k)}},[t]);let p=mw(()=>{n(!0)},[]),g=mw(()=>{n(!1)},[]),S=i?.creditBalance??0,C=S<2&&!r;return pn.createElement(VD,null,e&&pn.createElement(vi,null,pn.createElement(XD,{onClick:e,title:"Settings"},pn.createElement("span",{style:{fontSize:"14px"}},"\u2699"),"Settings")),u&&c==="admin"&&f==="admin"&&pn.createElement(vi,null,pn.createElement(fw,null)),pn.createElement(vi,null,pn.createElement(GD,null,"v","0.5.3")),u&&d.showCosts&&pn.createElement(vi,null,pn.createElement(xw,{onClick:p,isLow:C,title:r?"Loading...":i?C?"Low balance - click to top up":"Credit balance - click for details":"Click to load balance"},r?pn.createElement(KD,null):i?`$${S.toFixed(2)}`:"...")),u&&!d.showCosts&&i&&pn.createElement(vi,null,pn.createElement(xw,{onClick:p,isLow:Math.floor(S)<=3,title:`${Math.floor(S)} review credits remaining \u2014 click to manage`},"\u26A1 ",Math.floor(S))),pn.createElement(vi,null,pn.createElement(qD,null,pn.createElement(YD,{title:"Account & Usage",onClick:p},i?.email?i.email[0].toUpperCase():"?"),t&&pn.createElement(pw,{onClose:g}))))};import Et from"react";import{styled as cr}from"storybook/theming";import Lt from"react";ve();De();je();pt();import{useCallback as ki,useRef as yw,useEffect as JD}from"react";var go=q();y.debug("[useAuth] Module loaded, APP_URL:",go);var Bs=()=>{let e=yw(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:S,setAuthError:C,resetAuth:F}=we(),k=yw(null),R=ki(async()=>{try{y.debug("[useAuth] Starting OAuth flow, requesting poll_code...");let x;try{x=await oe(`${go}/api/addon/auth/oauth-poll`,{method:"POST"})}catch(A){let D=A instanceof Error&&A.message.includes("timed out")?`Cannot reach UI Copilot server at ${go}. Is the dashboard running?`:`Connection failed: ${go} is not responding.`;C(D),y.error("[useAuth]",D);return}if(!x.ok)throw new Error("Failed to create poll code");let{poll_code:b}=await x.json();y.debug("[useAuth] Got poll_code:",b.substring(0,15)+"...");let E=600,h=700,T=window.screenX+(window.outerWidth-E)/2,I=window.screenY+(window.outerHeight-h)/2;window.open(`${go}/addon/auth?poll_code=${b}`,"figma-auth",`width=${E},height=${h},left=${T},top=${I}`),y.debug("[useAuth] Starting OAuth poll for token..."),k.current&&clearInterval(k.current);let v=async()=>{try{let P=await(await fetch(`${go}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:b})})).json();P.status==="authorized"&&P.session_token?(y.debug("[useAuth] \u2705 OAuth poll successful! Got token."),k.current&&(clearInterval(k.current),k.current=null),localStorage.setItem("uicopilot_session_token",P.session_token),c(P.session_token)):P.status==="expired"&&(y.debug("[useAuth] OAuth poll_code expired"),k.current&&(clearInterval(k.current),k.current=null))}catch(A){y.error("[useAuth] OAuth poll error:",A)}};k.current=setInterval(v,2e3),setTimeout(v,1e3)}catch(x){y.error("[useAuth] OAuth flow error:",x)}},[c]),z=ki(async()=>{try{let x=await fetch(`${go}/api/addon/auth/device`,{method:"POST"});if(!x.ok)throw new Error("Failed to start device code flow");let b=await x.json();f(b.device_code),p(b.user_code),g(b.verification_uri),window.open(b.verification_uri,"_blank"),_(b.device_code,b.interval*1e3)}catch(x){throw y.error("[useAuth] Device code flow error:",x),x}},[f,p,g]),_=ki((x,b)=>{y.debug("[useAuth] Starting polling. Device code:",x,"Interval:",b),e.current&&clearInterval(e.current);let E=async()=>{try{let T=await(await fetch(`${go}/api/addon/auth/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:x})})).json();T.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",T.session_token),c(T.session_token)):(T.status==="expired"||T.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(h){y.error("[useAuth] Polling error:",h)}};e.current=setInterval(E,b),S(b)},[f,p,g,c,S]),M=ki(()=>{e.current&&(clearInterval(e.current),e.current=null),f(null),p(null),g(null),S(null)},[f,p,g,S]),B=ki(x=>{l(x),localStorage.setItem("uicopilot_api_key",x)},[l]),m=ki(()=>{F(),e.current&&(clearInterval(e.current),e.current=null)},[F]);return JD(()=>()=>{e.current&&clearInterval(e.current),k.current&&clearInterval(k.current)},[]),{sessionToken:t,apiKey:n,authMethod:r,deviceCode:o,userCode:i,verificationUri:s,isConnected:a,authError:u,setAuthMethod:d,startOAuth:R,startDeviceCode:z,cancelDeviceCode:M,saveApiKey:B,logout:m}};ve();De();je();pt();import{useCallback as kl}from"react";var Ds=q(),qr=()=>{let{projects:e,selectedProjectId:t,loadingProjects:n,setProjects:r,setSelectedProjectId:o,setLoadingProjects:i,getSelectedProject:s}=Ze(),{sessionToken:a}=we(),u=kl(async()=>{if(!a){y.debug("[useProjects] No session token, skipping fetch");return}try{i(!0),y.debug("[useProjects] Fetching from:",`${Ds}/api/projects`);let f=await oe(`${Ds}/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=kl(async f=>{if(!a)throw new Error("Not authenticated");let p=await oe(`${Ds}/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=kl(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 oe(`${Ds}/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=kl(async f=>{if(!a)throw new Error("Not authenticated");if(!(await oe(`${Ds}/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}};ve();var Rs=()=>{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}=rt();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)}};ve();Cg();Pg();import{useCallback as Vs,useRef as Rl}from"react";De();function El(){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 Al=BigInt(4294967295),Bw=BigInt(32);function wR(e,t=!1){return t?{h:Number(e&Al),l:Number(e>>Bw&Al)}:{h:Number(e>>Bw&Al)|0,l:Number(e&Al)|0}}function Dw(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}=wR(e[i],t);[r[i],o[i]]=[s,a]}return[r,o]}var Rw=(e,t,n)=>e<<n|t>>>32-n,zw=(e,t,n)=>t<<n|e>>>32-n,Nw=(e,t,n)=>t<<n-32|e>>>64-n,Ow=(e,t,n)=>e<<n-32|t>>>64-n;function vR(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Lg(e,t=""){if(!Number.isSafeInteger(e)||e<0){let n=t&&`"${t}" `;throw new Error(`${n}expected integer >= 0, got ${e}`)}}function Pl(e,t,n=""){let r=vR(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 Mg(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 _w(e,t){Pl(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 $w(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Bg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var kR=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function CR(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function TR(e){for(let t=0;t<e.length;t++)e[t]=CR(e[t]);return e}var Dg=kR?e=>e:TR;function Uw(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 jw=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var IR=BigInt(0),Us=BigInt(1),FR=BigInt(2),ER=BigInt(7),AR=BigInt(256),PR=BigInt(113),Vw=[],Gw=[],qw=[];for(let e=0,t=Us,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Vw.push(2*(5*r+n)),Gw.push((e+1)*(e+2)/2%64);let o=IR;for(let i=0;i<7;i++)t=(t<<Us^(t>>ER)*PR)%AR,t&FR&&(o^=Us<<(Us<<BigInt(i))-Us);qw.push(o)}var Yw=Dw(qw,!0),LR=Yw[0],MR=Yw[1],Hw=(e,t,n)=>n>32?Nw(e,t,n):Rw(e,t,n),Ww=(e,t,n)=>n>32?Ow(e,t,n):zw(e,t,n);function BR(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=Hw(c,l,1)^n[a],f=Ww(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=Gw[s],u=Hw(o,i,a),c=Ww(o,i,a),l=Vw[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]^=LR[r],e[1]^=MR[r]}Bg(n)}var Rg=class e{constructor(t,n,r,o=!1,i=24){Zn(this,"state");Zn(this,"pos",0);Zn(this,"posOut",0);Zn(this,"finished",!1);Zn(this,"state32");Zn(this,"destroyed",!1);Zn(this,"blockLen");Zn(this,"suffix");Zn(this,"outputLen");Zn(this,"enableXOF",!1);Zn(this,"rounds");if(this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,Lg(r,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$w(this.state)}clone(){return this._cloneInto()}keccak(){Dg(this.state32),BR(this.state32,this.rounds),Dg(this.state32),this.posOut=0,this.pos=0}update(t){Mg(this),Pl(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){Mg(this,!1),Pl(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 Lg(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(_w(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,Bg(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}},DR=(e,t,n,r={})=>Uw(()=>new Rg(t,e,n),r);var Kw=DR(6,72,64,jw(10));var RR=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,zg=Math.ceil,ar=Math.floor,Rn="[BigNumber Error] ",Xw=Rn+"Number primitive has more than 15 significant digits: ",Sr=1e14,He=14,Ng=9007199254740991,Og=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],mo=1e7,rn=1e9;function Qw(e){var t,n,r,o=k.prototype={constructor:k,toString:null,valueOf:null},i=new k(1),s=20,a=4,u=-7,c=21,l=-1e7,d=1e7,f=!1,p=1,g=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",F=!0;function k(m,x){var b,E,h,T,I,v,A,P,D=this;if(!(D instanceof k))return new k(m,x);if(x==null){if(m&&m._isBigNumber===!0){D.s=m.s,!m.c||m.e>d?D.c=D.e=null:m.e<l?D.c=[D.e=0]:(D.e=m.e,D.c=m.c.slice());return}if((v=typeof m=="number")&&m*0==0){if(D.s=1/m<0?(m=-m,-1):1,m===~~m){for(T=0,I=m;I>=10;I/=10,T++);T>d?D.c=D.e=null:(D.e=T,D.c=[m]);return}P=String(m)}else{if(!RR.test(P=String(m)))return r(D,P,v);D.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(T=P.indexOf("."))>-1&&(P=P.replace(".","")),(I=P.search(/e/i))>0?(T<0&&(T=I),T+=+P.slice(I+1),P=P.substring(0,I)):T<0&&(T=P.length)}else{if(Dt(x,2,C.length,"Base"),x==10&&F)return D=new k(m),M(D,s+D.e+1,a);if(P=String(m),v=typeof m=="number"){if(m*0!=0)return r(D,P,v,x);if(D.s=1/m<0?(P=P.slice(1),-1):1,k.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(Xw+m)}else D.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(b=C.slice(0,x),T=I=0,A=P.length;I<A;I++)if(b.indexOf(E=P.charAt(I))<0){if(E=="."){if(I>T){T=A;continue}}else if(!h&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){h=!0,I=-1,T=0;continue}return r(D,String(m),v,x)}v=!1,P=n(P,x,10,D.s),(T=P.indexOf("."))>-1?P=P.replace(".",""):T=P.length}for(I=0;P.charCodeAt(I)===48;I++);for(A=P.length;P.charCodeAt(--A)===48;);if(P=P.slice(I,++A)){if(A-=I,v&&k.DEBUG&&A>15&&(m>Ng||m!==ar(m)))throw Error(Xw+D.s*m);if((T=T-I-1)>d)D.c=D.e=null;else if(T<l)D.c=[D.e=0];else{if(D.e=T,D.c=[],I=(T+1)%He,T<0&&(I+=He),I<A){for(I&&D.c.push(+P.slice(0,I)),A-=He;I<A;)D.c.push(+P.slice(I,I+=He));I=He-(P=P.slice(I)).length}else I-=A;for(;I--;P+="0");D.c.push(+P)}}else D.c=[D.e=0]}k.clone=Qw,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(m){var x,b;if(m!=null)if(typeof m=="object"){if(m.hasOwnProperty(x="DECIMAL_PLACES")&&(b=m[x],Dt(b,0,rn,x),s=b),m.hasOwnProperty(x="ROUNDING_MODE")&&(b=m[x],Dt(b,0,8,x),a=b),m.hasOwnProperty(x="EXPONENTIAL_AT")&&(b=m[x],b&&b.pop?(Dt(b[0],-rn,0,x),Dt(b[1],0,rn,x),u=b[0],c=b[1]):(Dt(b,-rn,rn,x),u=-(c=b<0?-b:b))),m.hasOwnProperty(x="RANGE"))if(b=m[x],b&&b.pop)Dt(b[0],-rn,-1,x),Dt(b[1],1,rn,x),l=b[0],d=b[1];else if(Dt(b,-rn,rn,x),b)l=-(d=b<0?-b:b);else throw Error(Rn+x+" cannot be zero: "+b);if(m.hasOwnProperty(x="CRYPTO"))if(b=m[x],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=b;else throw f=!b,Error(Rn+"crypto unavailable");else f=b;else throw Error(Rn+x+" not true or false: "+b);if(m.hasOwnProperty(x="MODULO_MODE")&&(b=m[x],Dt(b,0,9,x),p=b),m.hasOwnProperty(x="POW_PRECISION")&&(b=m[x],Dt(b,0,rn,x),g=b),m.hasOwnProperty(x="FORMAT"))if(b=m[x],typeof b=="object")S=b;else throw Error(Rn+x+" not an object: "+b);if(m.hasOwnProperty(x="ALPHABET"))if(b=m[x],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))F=b.slice(0,10)=="0123456789",C=b;else throw Error(Rn+x+" invalid: "+b)}else throw Error(Rn+"Object expected: "+m);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,c],RANGE:[l,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:g,FORMAT:S,ALPHABET:C}},k.isBigNumber=function(m){if(!m||m._isBigNumber!==!0)return!1;if(!k.DEBUG)return!0;var x,b,E=m.c,h=m.e,T=m.s;e:if({}.toString.call(E)=="[object Array]"){if((T===1||T===-1)&&h>=-rn&&h<=rn&&h===ar(h)){if(E[0]===0){if(h===0&&E.length===1)return!0;break e}if(x=(h+1)%He,x<1&&(x+=He),String(E[0]).length==x){for(x=0;x<E.length;x++)if(b=E[x],b<0||b>=Sr||b!==ar(b))break e;if(b!==0)return!0}}}else if(E===null&&h===null&&(T===null||T===1||T===-1))return!0;throw Error(Rn+"Invalid BigNumber: "+m)},k.maximum=k.max=function(){return z(arguments,-1)},k.minimum=k.min=function(){return z(arguments,1)},k.random=(function(){var m=9007199254740992,x=Math.random()*m&2097151?function(){return ar(Math.random()*m)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var E,h,T,I,v,A=0,P=[],D=new k(i);if(b==null?b=s:Dt(b,0,rn),I=zg(b/He),f)if(crypto.getRandomValues){for(E=crypto.getRandomValues(new Uint32Array(I*=2));A<I;)v=E[A]*131072+(E[A+1]>>>11),v>=9e15?(h=crypto.getRandomValues(new Uint32Array(2)),E[A]=h[0],E[A+1]=h[1]):(P.push(v%1e14),A+=2);A=I/2}else if(crypto.randomBytes){for(E=crypto.randomBytes(I*=7);A<I;)v=(E[A]&31)*281474976710656+E[A+1]*1099511627776+E[A+2]*4294967296+E[A+3]*16777216+(E[A+4]<<16)+(E[A+5]<<8)+E[A+6],v>=9e15?crypto.randomBytes(7).copy(E,A):(P.push(v%1e14),A+=7);A=I/7}else throw f=!1,Error(Rn+"crypto unavailable");if(!f)for(;A<I;)v=x(),v<9e15&&(P[A++]=v%1e14);for(I=P[--A],b%=He,I&&b&&(v=Og[He-b],P[A]=ar(I/v)*v);P[A]===0;P.pop(),A--);if(A<0)P=[T=0];else{for(T=-1;P[0]===0;P.splice(0,1),T-=He);for(A=1,v=P[0];v>=10;v/=10,A++);A<He&&(T-=He-A)}return D.e=T,D.c=P,D}})(),k.sum=function(){for(var m=1,x=arguments,b=new k(x[0]);m<x.length;)b=b.plus(x[m++]);return b},n=(function(){var m="0123456789";function x(b,E,h,T){for(var I,v=[0],A,P=0,D=b.length;P<D;){for(A=v.length;A--;v[A]*=E);for(v[0]+=T.indexOf(b.charAt(P++)),I=0;I<v.length;I++)v[I]>h-1&&(v[I+1]==null&&(v[I+1]=0),v[I+1]+=v[I]/h|0,v[I]%=h)}return v.reverse()}return function(b,E,h,T,I){var v,A,P,D,N,w,j,G,L=b.indexOf("."),K=s,ee=a;for(L>=0&&(D=g,g=0,b=b.replace(".",""),G=new k(E),w=G.pow(b.length-L),g=D,G.c=x(Yr(sr(w.c),w.e,"0"),10,h,m),G.e=G.c.length),j=x(b,E,h,I?(v=C,m):(v=m,C)),P=D=j.length;j[--D]==0;j.pop());if(!j[0])return v.charAt(0);if(L<0?--P:(w.c=j,w.e=P,w.s=T,w=t(w,G,K,ee,h),j=w.c,N=w.r,P=w.e),A=P+K+1,L=j[A],D=h/2,N=N||A<0||j[A+1]!=null,N=ee<4?(L!=null||N)&&(ee==0||ee==(w.s<0?3:2)):L>D||L==D&&(ee==4||N||ee==6&&j[A-1]&1||ee==(w.s<0?8:7)),A<1||!j[0])b=N?Yr(v.charAt(1),-K,v.charAt(0)):v.charAt(0);else{if(j.length=A,N)for(--h;++j[--A]>h;)j[A]=0,A||(++P,j=[1].concat(j));for(D=j.length;!j[--D];);for(L=0,b="";L<=D;b+=v.charAt(j[L++]));b=Yr(b,P,v.charAt(0))}return b}})(),t=(function(){function m(E,h,T){var I,v,A,P,D=0,N=E.length,w=h%mo,j=h/mo|0;for(E=E.slice();N--;)A=E[N]%mo,P=E[N]/mo|0,I=j*A+P*w,v=w*A+I%mo*mo+D,D=(v/T|0)+(I/mo|0)+j*P,E[N]=v%T;return D&&(E=[D].concat(E)),E}function x(E,h,T,I){var v,A;if(T!=I)A=T>I?1:-1;else for(v=A=0;v<T;v++)if(E[v]!=h[v]){A=E[v]>h[v]?1:-1;break}return A}function b(E,h,T,I){for(var v=0;T--;)E[T]-=v,v=E[T]<h[T]?1:0,E[T]=v*I+E[T]-h[T];for(;!E[0]&&E.length>1;E.splice(0,1));}return function(E,h,T,I,v){var A,P,D,N,w,j,G,L,K,ee,re,de,ae,qe,tt,se,pe,Ie=E.s==h.s?1:-1,ze=E.c,me=h.c;if(!ze||!ze[0]||!me||!me[0])return new k(!E.s||!h.s||(ze?me&&ze[0]==me[0]:!me)?NaN:ze&&ze[0]==0||!me?Ie*0:Ie/0);for(L=new k(Ie),K=L.c=[],P=E.e-h.e,Ie=T+P+1,v||(v=Sr,P=lr(E.e/He)-lr(h.e/He),Ie=Ie/He|0),D=0;me[D]==(ze[D]||0);D++);if(me[D]>(ze[D]||0)&&P--,Ie<0)K.push(1),N=!0;else{for(qe=ze.length,se=me.length,D=0,Ie+=2,w=ar(v/(me[0]+1)),w>1&&(me=m(me,w,v),ze=m(ze,w,v),se=me.length,qe=ze.length),ae=se,ee=ze.slice(0,se),re=ee.length;re<se;ee[re++]=0);pe=me.slice(),pe=[0].concat(pe),tt=me[0],me[1]>=v/2&&tt++;do{if(w=0,A=x(me,ee,se,re),A<0){if(de=ee[0],se!=re&&(de=de*v+(ee[1]||0)),w=ar(de/tt),w>1)for(w>=v&&(w=v-1),j=m(me,w,v),G=j.length,re=ee.length;x(j,ee,G,re)==1;)w--,b(j,se<G?pe:me,G,v),G=j.length,A=1;else w==0&&(A=w=1),j=me.slice(),G=j.length;if(G<re&&(j=[0].concat(j)),b(ee,j,re,v),re=ee.length,A==-1)for(;x(me,ee,se,re)<1;)w++,b(ee,se<re?pe:me,re,v),re=ee.length}else A===0&&(w++,ee=[0]);K[D++]=w,ee[0]?ee[re++]=ze[ae]||0:(ee=[ze[ae]],re=1)}while((ae++<qe||ee[0]!=null)&&Ie--);N=ee[0]!=null,K[0]||K.splice(0,1)}if(v==Sr){for(D=1,Ie=K[0];Ie>=10;Ie/=10,D++);M(L,T+(L.e=D+P*He-1)+1,I,N)}else L.e=P,L.r=+N;return L}})();function R(m,x,b,E){var h,T,I,v,A;if(b==null?b=a:Dt(b,0,8),!m.c)return m.toString();if(h=m.c[0],I=m.e,x==null)A=sr(m.c),A=E==1||E==2&&(I<=u||I>=c)?Ml(A,I):Yr(A,I,"0");else if(m=M(new k(m),x,b),T=m.e,A=sr(m.c),v=A.length,E==1||E==2&&(x<=T||T<=u)){for(;v<x;A+="0",v++);A=Ml(A,T)}else if(x-=I+(E===2&&T>I),A=Yr(A,T,"0"),T+1>v){if(--x>0)for(A+=".";x--;A+="0");}else if(x+=T-v,x>0)for(T+1==v&&(A+=".");x--;A+="0");return m.s<0&&h?"-"+A:A}function z(m,x){for(var b,E,h=1,T=new k(m[0]);h<m.length;h++)E=new k(m[h]),(!E.s||(b=jo(T,E))===x||b===0&&T.s===x)&&(T=E);return T}function _(m,x,b){for(var E=1,h=x.length;!x[--h];x.pop());for(h=x[0];h>=10;h/=10,E++);return(b=E+b*He-1)>d?m.c=m.e=null:b<l?m.c=[m.e=0]:(m.e=b,m.c=x),m}r=(function(){var m=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,b=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(T,I,v,A){var P,D=v?I:I.replace(h,"");if(E.test(D))T.s=isNaN(D)?null:D<0?-1:1;else{if(!v&&(D=D.replace(m,function(N,w,j){return P=(j=j.toLowerCase())=="x"?16:j=="b"?2:8,!A||A==P?w:N}),A&&(P=A,D=D.replace(x,"$1").replace(b,"0.$1")),I!=D))return new k(D,P);if(k.DEBUG)throw Error(Rn+"Not a"+(A?" base "+A:"")+" number: "+I);T.s=null}T.c=T.e=null}})();function M(m,x,b,E){var h,T,I,v,A,P,D,N=m.c,w=Og;if(N){e:{for(h=1,v=N[0];v>=10;v/=10,h++);if(T=x-h,T<0)T+=He,I=x,A=N[P=0],D=ar(A/w[h-I-1]%10);else if(P=zg((T+1)/He),P>=N.length)if(E){for(;N.length<=P;N.push(0));A=D=0,h=1,T%=He,I=T-He+1}else break e;else{for(A=v=N[P],h=1;v>=10;v/=10,h++);T%=He,I=T-He+h,D=I<0?0:ar(A/w[h-I-1]%10)}if(E=E||x<0||N[P+1]!=null||(I<0?A:A%w[h-I-1]),E=b<4?(D||E)&&(b==0||b==(m.s<0?3:2)):D>5||D==5&&(b==4||E||b==6&&(T>0?I>0?A/w[h-I]:0:N[P-1])%10&1||b==(m.s<0?8:7)),x<1||!N[0])return N.length=0,E?(x-=m.e+1,N[0]=w[(He-x%He)%He],m.e=-x||0):N[0]=m.e=0,m;if(T==0?(N.length=P,v=1,P--):(N.length=P+1,v=w[He-T],N[P]=I>0?ar(A/w[h-I]%w[I])*v:0),E)for(;;)if(P==0){for(T=1,I=N[0];I>=10;I/=10,T++);for(I=N[0]+=v,v=1;I>=10;I/=10,v++);T!=v&&(m.e++,N[0]==Sr&&(N[0]=1));break}else{if(N[P]+=v,N[P]!=Sr)break;N[P--]=0,v=1}for(T=N.length;N[--T]===0;N.pop());}m.e>d?m.c=m.e=null:m.e<l&&(m.c=[m.e=0])}return m}function B(m){var x,b=m.e;return b===null?m.toString():(x=sr(m.c),x=b<=u||b>=c?Ml(x,b):Yr(x,b,"0"),m.s<0?"-"+x:x)}return o.absoluteValue=o.abs=function(){var m=new k(this);return m.s<0&&(m.s=1),m},o.comparedTo=function(m,x){return jo(this,new k(m,x))},o.decimalPlaces=o.dp=function(m,x){var b,E,h,T=this;if(m!=null)return Dt(m,0,rn),x==null?x=a:Dt(x,0,8),M(new k(T),m+T.e+1,x);if(!(b=T.c))return null;if(E=((h=b.length-1)-lr(this.e/He))*He,h=b[h])for(;h%10==0;h/=10,E--);return E<0&&(E=0),E},o.dividedBy=o.div=function(m,x){return t(this,new k(m,x),s,a)},o.dividedToIntegerBy=o.idiv=function(m,x){return t(this,new k(m,x),0,1)},o.exponentiatedBy=o.pow=function(m,x){var b,E,h,T,I,v,A,P,D,N=this;if(m=new k(m),m.c&&!m.isInteger())throw Error(Rn+"Exponent not an integer: "+B(m));if(x!=null&&(x=new k(x)),v=m.e>14,!N.c||!N.c[0]||N.c[0]==1&&!N.e&&N.c.length==1||!m.c||!m.c[0])return D=new k(Math.pow(+B(N),v?m.s*(2-Ll(m)):+B(m))),x?D.mod(x):D;if(A=m.s<0,x){if(x.c?!x.c[0]:!x.s)return new k(NaN);E=!A&&N.isInteger()&&x.isInteger(),E&&(N=N.mod(x))}else{if(m.e>9&&(N.e>0||N.e<-1||(N.e==0?N.c[0]>1||v&&N.c[1]>=24e7:N.c[0]<8e13||v&&N.c[0]<=9999975e7)))return T=N.s<0&&Ll(m)?-0:0,N.e>-1&&(T=1/T),new k(A?1/T:T);g&&(T=zg(g/He+2))}for(v?(b=new k(.5),A&&(m.s=1),P=Ll(m)):(h=Math.abs(+B(m)),P=h%2),D=new k(i);;){if(P){if(D=D.times(N),!D.c)break;T?D.c.length>T&&(D.c.length=T):E&&(D=D.mod(x))}if(h){if(h=ar(h/2),h===0)break;P=h%2}else if(m=m.times(b),M(m,m.e+1,1),m.e>14)P=Ll(m);else{if(h=+B(m),h===0)break;P=h%2}N=N.times(N),T?N.c&&N.c.length>T&&(N.c.length=T):E&&(N=N.mod(x))}return E?D:(A&&(D=i.div(D)),x?D.mod(x):T?M(D,g,a,I):D)},o.integerValue=function(m){var x=new k(this);return m==null?m=a:Dt(m,0,8),M(x,x.e+1,m)},o.isEqualTo=o.eq=function(m,x){return jo(this,new k(m,x))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(m,x){return jo(this,new k(m,x))>0},o.isGreaterThanOrEqualTo=o.gte=function(m,x){return(x=jo(this,new k(m,x)))===1||x===0},o.isInteger=function(){return!!this.c&&lr(this.e/He)>this.c.length-2},o.isLessThan=o.lt=function(m,x){return jo(this,new k(m,x))<0},o.isLessThanOrEqualTo=o.lte=function(m,x){return(x=jo(this,new k(m,x)))===-1||x===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(m,x){var b,E,h,T,I=this,v=I.s;if(m=new k(m,x),x=m.s,!v||!x)return new k(NaN);if(v!=x)return m.s=-x,I.plus(m);var A=I.e/He,P=m.e/He,D=I.c,N=m.c;if(!A||!P){if(!D||!N)return D?(m.s=-x,m):new k(N?I:NaN);if(!D[0]||!N[0])return N[0]?(m.s=-x,m):new k(D[0]?I:a==3?-0:0)}if(A=lr(A),P=lr(P),D=D.slice(),v=A-P){for((T=v<0)?(v=-v,h=D):(P=A,h=N),h.reverse(),x=v;x--;h.push(0));h.reverse()}else for(E=(T=(v=D.length)<(x=N.length))?v:x,v=x=0;x<E;x++)if(D[x]!=N[x]){T=D[x]<N[x];break}if(T&&(h=D,D=N,N=h,m.s=-m.s),x=(E=N.length)-(b=D.length),x>0)for(;x--;D[b++]=0);for(x=Sr-1;E>v;){if(D[--E]<N[E]){for(b=E;b&&!D[--b];D[b]=x);--D[b],D[E]+=Sr}D[E]-=N[E]}for(;D[0]==0;D.splice(0,1),--P);return D[0]?_(m,D,P):(m.s=a==3?-1:1,m.c=[m.e=0],m)},o.modulo=o.mod=function(m,x){var b,E,h=this;return m=new k(m,x),!h.c||!m.s||m.c&&!m.c[0]?new k(NaN):!m.c||h.c&&!h.c[0]?new k(h):(p==9?(E=m.s,m.s=1,b=t(h,m,0,3),m.s=E,b.s*=E):b=t(h,m,0,p),m=h.minus(b.times(m)),!m.c[0]&&p==1&&(m.s=h.s),m)},o.multipliedBy=o.times=function(m,x){var b,E,h,T,I,v,A,P,D,N,w,j,G,L,K,ee=this,re=ee.c,de=(m=new k(m,x)).c;if(!re||!de||!re[0]||!de[0])return!ee.s||!m.s||re&&!re[0]&&!de||de&&!de[0]&&!re?m.c=m.e=m.s=null:(m.s*=ee.s,!re||!de?m.c=m.e=null:(m.c=[0],m.e=0)),m;for(E=lr(ee.e/He)+lr(m.e/He),m.s*=ee.s,A=re.length,N=de.length,A<N&&(G=re,re=de,de=G,h=A,A=N,N=h),h=A+N,G=[];h--;G.push(0));for(L=Sr,K=mo,h=N;--h>=0;){for(b=0,w=de[h]%K,j=de[h]/K|0,I=A,T=h+I;T>h;)P=re[--I]%K,D=re[I]/K|0,v=j*P+D*w,P=w*P+v%K*K+G[T]+b,b=(P/L|0)+(v/K|0)+j*D,G[T--]=P%L;G[T]=b}return b?++E:G.splice(0,1),_(m,G,E)},o.negated=function(){var m=new k(this);return m.s=-m.s||null,m},o.plus=function(m,x){var b,E=this,h=E.s;if(m=new k(m,x),x=m.s,!h||!x)return new k(NaN);if(h!=x)return m.s=-x,E.minus(m);var T=E.e/He,I=m.e/He,v=E.c,A=m.c;if(!T||!I){if(!v||!A)return new k(h/0);if(!v[0]||!A[0])return A[0]?m:new k(v[0]?E:h*0)}if(T=lr(T),I=lr(I),v=v.slice(),h=T-I){for(h>0?(I=T,b=A):(h=-h,b=v),b.reverse();h--;b.push(0));b.reverse()}for(h=v.length,x=A.length,h-x<0&&(b=A,A=v,v=b,x=h),h=0;x;)h=(v[--x]=v[x]+A[x]+h)/Sr|0,v[x]=Sr===v[x]?0:v[x]%Sr;return h&&(v=[h].concat(v),++I),_(m,v,I)},o.precision=o.sd=function(m,x){var b,E,h,T=this;if(m!=null&&m!==!!m)return Dt(m,1,rn),x==null?x=a:Dt(x,0,8),M(new k(T),m,x);if(!(b=T.c))return null;if(h=b.length-1,E=h*He+1,h=b[h]){for(;h%10==0;h/=10,E--);for(h=b[0];h>=10;h/=10,E++);}return m&&T.e+1>E&&(E=T.e+1),E},o.shiftedBy=function(m){return Dt(m,-Ng,Ng),this.times("1e"+m)},o.squareRoot=o.sqrt=function(){var m,x,b,E,h,T=this,I=T.c,v=T.s,A=T.e,P=s+4,D=new k("0.5");if(v!==1||!I||!I[0])return new k(!v||v<0&&(!I||I[0])?NaN:I?T:1/0);if(v=Math.sqrt(+B(T)),v==0||v==1/0?(x=sr(I),(x.length+A)%2==0&&(x+="0"),v=Math.sqrt(+x),A=lr((A+1)/2)-(A<0||A%2),v==1/0?x="5e"+A:(x=v.toExponential(),x=x.slice(0,x.indexOf("e")+1)+A),b=new k(x)):b=new k(v+""),b.c[0]){for(A=b.e,v=A+P,v<3&&(v=0);;)if(h=b,b=D.times(h.plus(t(T,h,P,1))),sr(h.c).slice(0,v)===(x=sr(b.c)).slice(0,v))if(b.e<A&&--v,x=x.slice(v-3,v+1),x=="9999"||!E&&x=="4999"){if(!E&&(M(h,h.e+s+2,0),h.times(h).eq(T))){b=h;break}P+=4,v+=4,E=1}else{(!+x||!+x.slice(1)&&x.charAt(0)=="5")&&(M(b,b.e+s+2,1),m=!b.times(b).eq(T));break}}return M(b,b.e+s+1,a,m)},o.toExponential=function(m,x){return m!=null&&(Dt(m,0,rn),m++),R(this,m,x,1)},o.toFixed=function(m,x){return m!=null&&(Dt(m,0,rn),m=m+this.e+1),R(this,m,x)},o.toFormat=function(m,x,b){var E,h=this;if(b==null)m!=null&&x&&typeof x=="object"?(b=x,x=null):m&&typeof m=="object"?(b=m,m=x=null):b=S;else if(typeof b!="object")throw Error(Rn+"Argument not an object: "+b);if(E=h.toFixed(m,x),h.c){var T,I=E.split("."),v=+b.groupSize,A=+b.secondaryGroupSize,P=b.groupSeparator||"",D=I[0],N=I[1],w=h.s<0,j=w?D.slice(1):D,G=j.length;if(A&&(T=v,v=A,A=T,G-=T),v>0&&G>0){for(T=G%v||v,D=j.substr(0,T);T<G;T+=v)D+=P+j.substr(T,v);A>0&&(D+=P+j.slice(T)),w&&(D="-"+D)}E=N?D+(b.decimalSeparator||"")+((A=+b.fractionGroupSize)?N.replace(new RegExp("\\d{"+A+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):N):D}return(b.prefix||"")+E+(b.suffix||"")},o.toFraction=function(m){var x,b,E,h,T,I,v,A,P,D,N,w,j=this,G=j.c;if(m!=null&&(v=new k(m),!v.isInteger()&&(v.c||v.s!==1)||v.lt(i)))throw Error(Rn+"Argument "+(v.isInteger()?"out of range: ":"not an integer: ")+B(v));if(!G)return new k(j);for(x=new k(i),P=b=new k(i),E=A=new k(i),w=sr(G),T=x.e=w.length-j.e-1,x.c[0]=Og[(I=T%He)<0?He+I:I],m=!m||v.comparedTo(x)>0?T>0?x:P:v,I=d,d=1/0,v=new k(w),A.c[0]=0;D=t(v,x,0,1),h=b.plus(D.times(E)),h.comparedTo(m)!=1;)b=E,E=h,P=A.plus(D.times(h=P)),A=h,x=v.minus(D.times(h=x)),v=h;return h=t(m.minus(b),E,0,1),A=A.plus(h.times(P)),b=b.plus(h.times(E)),A.s=P.s=j.s,T=T*2,N=t(P,E,T,a).minus(j).abs().comparedTo(t(A,b,T,a).minus(j).abs())<1?[P,E]:[A,b],d=I,N},o.toNumber=function(){return+B(this)},o.toPrecision=function(m,x){return m!=null&&Dt(m,1,rn),R(this,m,x,2)},o.toString=function(m){var x,b=this,E=b.s,h=b.e;return h===null?E?(x="Infinity",E<0&&(x="-"+x)):x="NaN":(m==null?x=h<=u||h>=c?Ml(sr(b.c),h):Yr(sr(b.c),h,"0"):m===10&&F?(b=M(new k(b),s+h+1,a),x=Yr(sr(b.c),b.e,"0")):(Dt(m,2,C.length,"Base"),x=n(Yr(sr(b.c),h,"0"),10,m,E,!0)),E<0&&b.c[0]&&(x="-"+x)),x},o.valueOf=o.toJSON=function(){return B(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&k.set(e),k}function lr(e){var t=e|0;return e>0||e===t?t:t-1}function sr(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=He-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function jo(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 Dt(e,t,n,r){if(e<t||e>n||e!==ar(e))throw Error(Rn+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Ll(e){var t=e.c.length-1;return lr(e.e/He)==t&&e.c[t]%2!=0}function Ml(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Yr(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 zR=Qw(),Jw=zR;var NR=24,js=32,OR=()=>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,$g=OR(),_g=(e=4,t=$g)=>{let n="";for(;n.length<e;)n=n+Math.floor(t()*36).toString(36);return n};function _R(e){let t=new Jw(0);for(let n of e.values())t=t.multipliedBy(256).plus(n);return t}var ev=(e="")=>{let t=new TextEncoder;return _R(Kw(t.encode(e))).toString(36).slice(1)},Zw=Array.from({length:26},(e,t)=>String.fromCharCode(t+97)),$R=e=>Zw[Math.floor(e()*Zw.length)],UR=({globalObj:e=typeof global<"u"?global:typeof window<"u"?window:{},random:t=$g}={})=>{let n=Object.keys(e).toString(),r=n.length?n+_g(js,t):_g(js,t);return ev(r).substring(0,js)},jR=e=>()=>e++,HR=476782367,tv=({random:e=$g,counter:t=jR(Math.floor(e()*HR)),length:n=NR,fingerprint:r=UR({random:e})}={})=>{if(n>js)throw new Error(`Length must be between 2 and ${js}. Received: ${n}`);return function(){let i=$R(e),s=Date.now().toString(36),a=t().toString(36),u=_g(n,e),c=`${s+u+a+r}`;return`${i+ev(c).substring(1,n)}`}},ho=WR(tv);function WR(e){let t;return()=>(t||(t=e()),t())}var qR=Aa(ov());Ls();De();var Bl=/\[([^\]]+)\]\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*-\s*(.+)/g;function YR(e){return e.replace(/\*\*/g,"").replace(/\*/g,"").replace(/__/g,"").replace(/_/g," ").trim()}function Ug(e,t){let n=[],r=e.split(`
|
|
15
|
+
`);for(let s=0;s<r.length;s++){let a=YR(r[s]),u=Bl.exec(a);if(u){let[,c,l,,d]=u,f=KR(l),p=XR(r,s+1),g={id:ho(),reviewId:t,type:c.trim(),severity:f,title:d.trim(),description:p.description,file:p.file,lineNumber:p.lineNumber,property:p.property,currentValue:p.currentValue,suggestedValue:p.suggestedValue,suggestedCode:p.suggestedCode,suggestedFix:p.suggestedFix,fixTarget:p.fixTarget,fixRequired:p.fixRequired,status:"pending",selectedForFix:!1,createdAt:new Date};n.push(g)}Bl.lastIndex=0}return n.map(s=>{let a=Ps(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 KR(e){let t=e.toLowerCase().trim();return t.includes("critical")||t.includes("high")?"critical":t.includes("major")||t.includes("medium")?"major":"minor"}function XR(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||Bl.test(i)){Bl.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}De();var Hs=null,iv=0,QR=3e4;async function JR(){let e=Date.now();if(Hs&&e-iv<QR)return Hs;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 Hs=n.entries||n.stories||{},iv=e,y.debug("[storyFilePaths] Fetched index.json, entries:",Object.keys(Hs).length),Hs}catch(t){throw y.error("[storyFilePaths] Error fetching index.json:",t),t}}async function Ws(e){try{let n=(await JR())[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 jg(e,t){if(e==="css")return t.cssFile;if(e==="component")return t.componentFile;if(e==="story")return t.storyFile}function ZR(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 Hg(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):ZR(e.type,t)}De();function ez(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 tz(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 rz(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 Wg(e){if(!e||e.length===0)return[];let t=e.filter(i=>!nz(i)),n=[],r=[];for(let i of t){let s=ez(i),a=tz(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(rz(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}De();je();import{addons as Dl}from"storybook/manager-api";var Vg="uireview/badge",Ii={REVIEW_START:"uireview/review-start",REVIEW_COMPLETE:"uireview/review-complete",REVIEW_ERROR:"uireview/review-error"};function oz(e){return e.criticalCount>0||e.score<70?"status-value:error":e.majorCount>0||e.score<90?"status-value:warning":"status-value:success"}function iz(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 sz(e){return e.score>=90?`\u2713 Score ${e.score}`:e.score>=70?`\u26A0 Score ${e.score}`:`\u2717 Score ${e.score}`}function Fi(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableReviewBadges:!1}catch{return!1}}function av(e){if(Fi())try{Dl.getChannel().emit(Ii.REVIEW_START,{storyId:e})}catch{}}function xo(e,t){if(Fi())try{Dl.getChannel().emit(Ii.REVIEW_COMPLETE,{storyId:e,summary:t})}catch{}}function lv(e){if(Fi())try{Dl.getChannel().emit(Ii.REVIEW_ERROR,{storyId:e})}catch{}}function sv(e){try{typeof e.unset=="function"?e.unset():typeof e.set=="function"&&e.set([])}catch{}}function cv(e){let t=Dl.getChannel(),n=o=>i=>{Fi()&&o(i)};t.on(Ii.REVIEW_START,n(({storyId:o})=>{e.set([{value:"status-value:pending",typeId:Vg,storyId:o,title:"Reviewing...",description:"AI review in progress"}])})),t.on(Ii.REVIEW_COMPLETE,n(({storyId:o,summary:i})=>{e.set([{value:oz(i),typeId:Vg,storyId:o,title:sz(i),description:iz(i)}])})),t.on(Ii.REVIEW_ERROR,n(({storyId:o})=>{e.set([{value:"status-value:error",typeId:Vg,storyId:o,title:"Review Failed",description:"An error occurred during review"}])}));let r=Fi();r||sv(e),setInterval(()=>{let o=Fi();o!==r&&(r=o,o||sv(e))},1500)}var Gg=q(),qg=180;function yo(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 Yg=()=>{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:S,setShowStreamingPanel:C,setStreamingPanelCollapsed:F,addStreamingMessage:k,updateStreamingMessage:R,clearStreamingMessages:z,setStreamingProgress:_,setStreamingStatus:M,setFullPrompt:B,setFullResponse:m,setFigmaImageUrl:x,storybookImageUrl:b,setStorybookImageUrl:E,setFigmaDimensions:h,setMultiModelResults:T,updateMultiModelStreamingMessages:I,setModelCompleted:v,setActiveModelId:A,resetReview:P,addReview:D,setReviewDetailTab:N,includeTextComparison:w,usePromptCache:j,setApplyFixesResult:G,featureFlags:L}=ie(),{sessionToken:K,usageData:ee,setUsageData:re}=we(),{selectedProjectId:de}=Ze(),{currentStoryId:ae,currentStoryName:qe}=rt(),tt=Rl(ee);tt.current=ee;let se=Rl(null),pe=Rl(null),Ie=Rl({}),ze=Vs((Ge,lt)=>{k({role:Ge,content:lt})},[k]),me=Vs((Ge,lt)=>{_(Ge),M(lt)},[_,M]),Nt=Vs(async Ge=>{let{isIteration:lt=!1,parentReviewId:nt=null}=Ge||{};if(!K)throw new Error("Not authenticated");if(!de)throw new Error("No project selected");if(!ae||!qe)throw new Error("No story is currently selected in Storybook");if(e){y.debug("[useAIReview] Review already in progress, ignoring duplicate request");return}let ne=Date.now();try{d(!0),f(null),p(null),N("issues"),G(null),ae&&L.enableReviewBadges&&av(ae),pe.current&&clearTimeout(pe.current),pe.current=setTimeout(()=>{y.debug(`[useAIReview] Auto-stopping review after ${qg}s timeout`),se.current&&se.current.abort(),k({role:"system",content:`Review auto-stopped after ${qg} seconds timeout.`})},qg*1e3),B(""),m(""),C(!0),F(!1),z(),me(0,"Starting review..."),me(5,"Refreshing component preview..."),y.debug("[Review] Forcing iframe reload for fresh styles..."),await El(),y.debug("[Review] Iframe reloaded, styles should be fresh"),me(20,"Capturing screenshot & extracting styles..."),y.debug("[Review] Starting parallel data collection...");let[W,Ae,ge]=await Promise.all([Il({sessionToken:K||void 0}),Promise.resolve($s()),Promise.resolve(Ag())]);if(W&&W!==b&&(E(W),y.debug("[Review] Storybook screenshot captured and set")),!Ae)throw new Error("Failed to extract styles from component");let{computed:O,declared:U,markup:H,textElementStyles:Pe,nestedElementStyles:Ne}=Ae;ge?y.debug("[Review] DOM tree extracted:",{selector:ge.selector,childrenCount:ge.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")),me(50,"Preparing metadata..."),y.debug("[Review] Current story:",{id:ae,name:qe});let yt=ht.getState().currentMapping?.figmaNodeId??null,Un=ht.getState().figmaImageUrl;if(yt&&(y.debug("[Review] Using Figma node ID from store:",yt),Un&&(me(65,"Using existing Figma design..."),y.debug("[Review] Reusing already-loaded Figma image"))),!yt)try{let Xe=await fetch(`${Gg}/api/mappings?projectId=${de}&storyId=${ae}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Xe.ok){let Bt=await Xe.json();Bt.mapping?.figmaNodeId?(yt=Bt.mapping.figmaNodeId,y.debug("[Review] Found Figma node ID from API:",yt)):y.debug("[Review] No mapping found for story:",ae)}else y.debug("[Review] Failed to fetch mapping:",Xe.status)}catch(Xe){y.error("[Review] Error fetching mapping:",Xe)}if(yt&&!Un){me(65,"Fetching Figma design...");try{let Xe=await fetch(`${Gg}/api/figma/frames?projectId=${de}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`}});if(Xe.ok){let Ot=(await Xe.json()).thumbnails?.[yt];Ot?(x(Ot),y.debug("[Review] Figma thumbnail fetched and displayed:",Ot)):y.warn("[Review] No thumbnail found for node:",yt)}else y.warn("[Review] Failed to fetch Figma frames:",Xe.status)}catch(Xe){y.error("[Review] Error fetching Figma frames:",Xe)}}if(!yt)throw new Error('Figma mapping required. Please link this story to a Figma frame using the "Map to Figma" button before reviewing.');me(80,"AI is analyzing your component..."),y.debug("[Review] Sending to streaming API...");let Qn={projectId:de,storyId:ae,storyName:qe,storybookScreenshot:W,computedStyles:O,declaredStyles:U,textElementStyles:Pe,nestedElementStyles:Ne,componentMarkup:H,domTree:ge,figmaNodeId:yt,figmaImageUrl:Un||void 0,aiModels:l,includeTextComparison:w,usePromptCache:j,parentReviewId:lt?nt:void 0,isIteration:lt};y.debug("[Review] Request payload:",{...Qn,storybookScreenshot:W?`${W.substring(0,50)}...`:null,domTree:ge?{selector:ge.selector,childrenCount:ge.children.length}:null}),se.current=new AbortController;let In=await fetch(`${Gg}/api/review/stream`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${K}`},body:JSON.stringify(Qn),signal:se.current.signal});if(y.debug("[Review] Response status:",In.status,In.statusText),!In.ok){let Xe=await In.json();if(y.error("[Review] API error response:",Xe),In.status===429){let Bt=Xe.retryAfter||60;throw new Error(`Rate limit exceeded. Please wait ${Bt} seconds before trying again.`)}if(In.status===402){if(Xe.code==="INSUFFICIENT_CREDITS"){let Bt=Xe.details?.required??1,Ot=Xe.details?.balance??0;throw new Error(`Not enough credits. This review requires ${Bt} credit(s) but you have ${Ot}. Visit Settings to add more.`)}throw Xe.code==="SUBSCRIPTION_LIMIT_EXCEEDED"?new Error(Xe.message||"Monthly review limit reached. Upgrade your plan to continue."):new Error(Xe.message||"Payment required")}throw In.status===401&&Xe.code==="FIGMA_AUTH_EXPIRED"?new Error("Figma connection expired. Open Settings \u2192 Disconnect \u2192 Reconnect Figma to continue."):new Error(Xe.error||Xe.message||"Review request failed")}let oo=In.body?.getReader(),bn=new TextDecoder,Ir="",en="",Oe=null,qc=null,$x=l.length>1,Bo={},Zi={},L8={};if(!oo)throw new Error("Response body is not readable");let Ux=ht.getState().streamingMessages.length;for(ze("assistant","");;){let{done:Xe,value:Bt}=await oo.read();if(Xe)break;Ir+=bn.decode(Bt,{stream:!0});let Ot=Ir.split(`
|
|
17
|
+
`);Ir=Ot.pop()||"";for(let jn of Ot)if(jn.startsWith("data: ")){let ln=jn.slice(6);if(ln==="[DONE]")continue;try{let te=JSON.parse(ln);if(te.type!=="text"&&te.type!=="content"&&y.debug("[Review] SSE Event received:",te.type),te.type==="prompt")te.prompt&&(B(te.prompt),y.debug("[Review] Prompt received early"));else if(te.type==="model_started")y.debug("[Review] Model started:",te.modelId),Bo[te.modelId]||(Bo[te.modelId]="",Zi[te.modelId]=[{role:"assistant",content:""}]);else if(te.type==="text"||te.type==="content")if($x&&te.modelId){Bo[te.modelId]||(Bo[te.modelId]="",Zi[te.modelId]=[{role:"assistant",content:""}]),Bo[te.modelId]+=te.content,Zi[te.modelId][0].content=Bo[te.modelId],I(te.modelId,Zi[te.modelId]);let Gt=Object.entries(Bo).map(([cn,st])=>`[${cn}]
|
|
18
|
+
${st}`).join(`
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
-
`);
|
|
22
|
+
`);R(Ux,Gt)}else en+=te.content,R(Ux,en);else if(te.type==="model_completed")y.debug("[Review] Model completed:",te.modelId,te.complianceScore),v(te.modelId);else if(te.type==="figma_image")te.url&&(x(te.url),y.debug("[Review] Figma image URL received:",te.url));else if(te.type==="figma_dimensions")te.width&&te.height&&(h({width:te.width,height:te.height}),y.debug("[Review] Figma dimensions received:",te.width,"x",te.height));else if(te.type==="complete"||te.type==="result")Oe=te,y.debug("[Review] Final result received! Type:",te.type),y.debug("[Review] Final result issues count:",te.issues?.length||0),y.debug("[Review] Final result score:",te.validation?.complianceScore),te.remainingCredits!=null&&tt.current&&re({...tt.current,creditBalance:te.remainingCredits,reviewCredits:Math.floor(te.remainingCredits)});else if(te.type==="all_complete")Oe=te,y.debug("[Review] Multi-model results received:",Object.keys(te.byModel)),te.remainingCredits!=null&&tt.current&&re({...tt.current,creditBalance:te.remainingCredits,reviewCredits:Math.floor(te.remainingCredits)});else if(te.type==="error"||te.type==="model_error"){let Gt=new Error(te.message||te.error||"Streaming error");throw Gt.isServerError=!0,Gt}}catch(te){if(te.isServerError)throw te;let Gt=te instanceof Error?{message:te.message,name:te.name,stack:te.stack}:String(te);y.error("[Review] Error parsing SSE data:",Gt),y.error("[Review] Failed to parse data:",ln.substring(0,200)+(ln.length>200?"...":"")),qc=te instanceof Error?te:new Error(String(te))}}}if(me(100,"Review complete!"),!Oe&&qc&&(y.error("[Review] No final result received. Last parse error:",qc),y.error("[Review] Streaming text available:",en.length,"chars")),$x&&Oe?.type==="all_complete"){let Xe=Object.keys(Oe.byModel).reduce((Ot,jn)=>{let ln=Oe.byModel[jn];return Ot[jn]={...ln,fullResponse:ln.response||ln.fullResponse||"",fullPrompt:ln.prompt||ln.fullPrompt||"",streamingMessages:Zi[jn]||[]},Ot},{}),Bt=Object.keys(Oe.byModel)[0];T({byModel:Xe,activeModelId:Bt}),Xe[Bt]?.fullPrompt&&B(Xe[Bt].fullPrompt),y.debug("[Review] Multi-model results stored:",Object.keys(Oe.byModel));try{let Ot=ho(),jn=Oe.byModel?.[Bt]?.issues,ln=jn&&jn.length>0,te=ln?jn.map(fe=>({id:ho(),reviewId:Ot,dbId:fe.dbId,type:fe.type,severity:fe.severity,title:fe.description,description:fe.description,property:fe.property,expected:yo(fe.expected),actual:yo(fe.actual),currentValue:yo(fe.actual),suggestedValue:yo(fe.expected),source:fe.source||"computed-styles",suggestedFix:fe.suggestedFix,file:fe.file,domElement:fe.domElement,figmaElement:fe.figmaElement,fixTarget:fe.fixTarget,fixRequired:fe.fixRequired,detectedBy:fe.detectedBy,dismissed:fe.dismissed??!1,dismissReason:fe.dismissReason,dismissedAt:fe.dismissed?new Date:void 0,_unreliable:fe._unreliable,_validationError:fe._validationError,figmaContext:fe.figmaContext,relatedTo:Array.isArray(fe.relatedTo)?fe.relatedTo:void 0,status:"pending",selectedForFix:!1,createdAt:new Date})):Ug(Xe[Bt]?.fullResponse||"",Ot);y.debug("[Review] Multi-model issues source:",ln?"API (server-side dismissal)":"client-side parsing"),y.debug("[Review] Multi-model issues count:",te.length,"issues");let Gt=te.filter(fe=>fe.dismissed).length;Gt>0&&(y.debug("[Review] Multi-model auto-dismissed:",Gt,"false positive issues"),ze("system",`
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
\u2705 ${
|
|
26
|
+
\u2705 ${Gt} issue${Gt>1?"s were":" was"} auto-dismissed as false positive${Gt>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let cn=Ie.current[ae];cn||(cn=await Ws(ae)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},cn.storyFile&&(Ie.current[ae]=cn)),y.debug("[Review] Story file paths:",cn);let st=te.map(fe=>({...fe,file:fe.file||jg(fe.fixTarget,cn)||Hg(fe,cn)}));if(st=Wg(st),y.debug("[Review] After de-duplication:",st.length,"issues"),!w){let fe=st.length;st=st.filter(Sn=>Sn.property?.toLowerCase()!=="textcontent"&&!Sn.description?.toLowerCase().includes("text content")),fe!==st.length&&y.debug("[Review] Filtered out",fe-st.length,"textContent issues (toggle OFF)")}let Fr=Oe.validation?.complianceScore??Xe[Bt]?.complianceScore;if(y.debug("[Review] Multi-model score sources:",{firstModelId:Bt,validationScore:Oe.validation?.complianceScore,modelScore:Xe[Bt]?.complianceScore,multiModelScore:Fr}),Fr==null){let Sn=(Xe[Bt]?.fullResponse||"").match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);Fr=Sn?parseInt(Sn[1],10):void 0,y.debug("[Review] Parsed multi-model score from response:",Fr)}let Fn;lt&&nt&&(Fn=(ht.getState().reviewHistory.find(Sn=>Sn.id===nt)?.iterationNumber||0)+1);let es={id:Ot,componentId:ae,storyId:ae,modelId:Bt,parentReviewId:lt&&nt||void 0,iterationNumber:Fn,figmaFileKey:void 0,figmaNodeId:yt||void 0,figmaFileUrl:Un||void 0,complianceScore:Fr,visualSimilarity:Oe.visualSimilarity,issuesCount:st.filter(fe=>!fe.dismissed).length,issues:st,createdAt:new Date,reviewDurationMs:Date.now()-ne,costUsd:Oe.costUsd,inputTokens:Oe.inputTokens,outputTokens:Oe.outputTokens,cacheCreationTokens:Oe.cacheCreationTokens,cacheReadTokens:Oe.cacheReadTokens};if(y.debug("[Review] Multi-model token data:",{costUsd:Oe.costUsd,inputTokens:Oe.inputTokens,outputTokens:Oe.outputTokens,cacheCreationTokens:Oe.cacheCreationTokens,cacheReadTokens:Oe.cacheReadTokens,reviewTokens:es.inputTokens}),D(es),ae&&L.enableReviewBadges){let fe=st.filter(Sn=>!Sn.dismissed);xo(ae,{score:Fr??100,issueCount:fe.length,criticalCount:fe.filter(Sn=>Sn.severity==="critical").length,majorCount:fe.filter(Sn=>Sn.severity==="major").length,minorCount:fe.filter(Sn=>Sn.severity==="minor").length})}N("issues");let Fa=st.filter(fe=>!fe.dismissed).length;y.debug("[Review] Created multi-model review with",Fa,"active issues,",st.length-Fa,"dismissed");let Se=yt||ht.getState().currentMapping?.figmaNodeId;y.debug("[Review] Issue validation handled server-side. Active:",st.filter(fe=>!fe.dismissed).length,"Dismissed:",st.filter(fe=>fe.dismissed).length)}catch(Ot){y.error("[Review] Failed to parse issues from multi-model response:",Ot)}}else if(Oe){Oe.prompt&&B(Oe.prompt),(Oe.response||en)&&m(Oe.response||en),Oe.figmaImageUrl&&x(Oe.figmaImageUrl),y.debug("[Review] State updated with prompt, response, and screenshots");try{let Xe=ho(),Bt=Oe.response||en,Ot=Oe.issues,jn=Ot&&Ot.length>0,ln=jn?Ot.map(Se=>({id:ho(),reviewId:Xe,dbId:Se.dbId,type:Se.type,severity:Se.severity,title:Se.description,description:Se.description,property:Se.property,expected:yo(Se.expected),actual:yo(Se.actual),currentValue:yo(Se.actual),suggestedValue:yo(Se.expected),source:Se.source||"computed-styles",suggestedFix:Se.suggestedFix,file:Se.file,domElement:Se.domElement,figmaElement:Se.figmaElement,fixTarget:Se.fixTarget,fixRequired:Se.fixRequired,detectedBy:Se.detectedBy,dismissed:Se.dismissed??!1,dismissReason:Se.dismissReason,dismissedAt:Se.dismissed?new Date:void 0,_unreliable:Se._unreliable,_validationError:Se._validationError,figmaContext:Se.figmaContext,relatedTo:Array.isArray(Se.relatedTo)?Se.relatedTo:void 0,status:"pending",selectedForFix:!1,createdAt:new Date})):Ug(Bt,Xe);y.debug("[Review] Issues source:",jn?"API (server-side dismissal)":"client-side parsing"),y.debug("[Review] Issues count:",ln.length,"issues");let te=ln.filter(Se=>Se.dismissed).length;te>0&&(y.debug("[Review] Auto-dismissed:",te,"false positive issues"),ze("system",`
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
\u2705 ${oe} issue${oe>1?"s were":" was"} auto-dismissed as false positive${oe>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let Ot=xe.complianceScore??xe.validation?.complianceScore;if(b.debug("[Review] Score sources:",{directScore:xe.complianceScore,validationScore:xe.validation?.complianceScore,parsedScore:Ot}),Ot==null){let we=Lt.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);Ot=we?parseInt(we[1],10):void 0,b.debug("[Review] Parsed score from response:",Ot)}let rn=st.current[J];rn||(rn=await Ls(J)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},rn.storyFile&&(st.current[J]=rn)),b.debug("[Review] Story file paths:",rn);let Ze=nn.map(we=>({...we,file:we.file||af(we.fixTarget,rn)||lf(we,rn)}));if(Ze=cf(Ze),b.debug("[Review] After de-duplication:",Ze.length,"issues"),!N){let we=Ze.length;Ze=Ze.filter(de=>de.property?.toLowerCase()!=="textcontent"&&!de.description?.toLowerCase().includes("text content")),we!==Ze.length&&b.debug("[Review] Filtered out",we-Ze.length,"textContent issues (toggle OFF)")}let wr;Ge&&xt&&(wr=(at.getState().reviewHistory.find(de=>de.id===xt)?.iterationNumber||0)+1);let Sn={id:tt,componentId:J,storyId:J,modelId:l[0],parentReviewId:Ge&&xt||void 0,iterationNumber:wr,figmaFileKey:void 0,figmaNodeId:W||void 0,figmaFileUrl:Z||void 0,complianceScore:Ot,visualSimilarity:xe.visualSimilarity,issuesCount:Ze.filter(we=>!we.dismissed).length,issues:Ze,createdAt:new Date,reviewDurationMs:Date.now()-yn,costUsd:xe.costUsd,inputTokens:xe.inputTokens,outputTokens:xe.outputTokens,cacheCreationTokens:xe.cacheCreationTokens,cacheReadTokens:xe.cacheReadTokens,variantMismatch:xe.variantMismatch,storybookVariant:xe.storybookVariant,figmaVariant:xe.figmaVariant};if(b.debug("[useAIReview] About to call addReview with review:",{id:Sn.id,storyId:Sn.storyId,issueCount:Sn.issues?.length,complianceScore:Sn.complianceScore,createdAt:Sn.createdAt?.toISOString(),inputTokens:Sn.inputTokens,outputTokens:Sn.outputTokens,costUsd:Sn.costUsd,cacheCreationTokens:Sn.cacheCreationTokens,cacheReadTokens:Sn.cacheReadTokens}),L(Sn),b.debug("[useAIReview] addReview called successfully"),J&&H.enableReviewBadges){let we=Ze.filter(de=>!de.dismissed);ao(J,{score:Ot??100,issueCount:we.length,criticalCount:we.filter(de=>de.severity==="critical").length,majorCount:we.filter(de=>de.severity==="major").length,minorCount:we.filter(de=>de.severity==="minor").length})}B("issues");let Gi=Ze.filter(we=>!we.dismissed).length;b.debug("[Review] Created review with",Gi,"active issues,",Ze.length-Gi,"dismissed");let da=W||at.getState().currentMapping?.figmaNodeId;b.debug("[Review] Validation check:",{figmaNodeId:W,effectiveFigmaNodeIdSingle:da,hasSessionToken:!!M,selectedProjectId:ee,issueCount:Ze.length}),b.debug("[Review] Issue validation handled server-side. Active:",Ze.filter(we=>!we.dismissed).length,"Dismissed:",Ze.filter(we=>we.dismissed).length)}catch(tt){b.error("[Review] Failed to parse issues:",tt)}}else throw bn?(b.error("[Review] ERROR: No structured result received from backend!"),b.error("[Review] Streaming text length:",bn.length),b.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(qe){if(qe instanceof Error&&qe.name==="AbortError"){b.debug("[useAIReview] Review cancelled by user"),Y(0,"Review cancelled");return}b.error("[useAIReview] Review error:",qe);let fe=qe instanceof Error?qe.message:"Review failed";throw f(fe),J&&H.enableReviewBadges&&u0(J),Y(0,`Error: ${fe}`),qe}finally{p(!1),Ee.current=null,We.current&&(clearTimeout(We.current),We.current=null),Q(null)}},[e,M,ee,J,Le,l,p,f,d,h,C,I,y,T,F,R,te,Y,z,v,w,D,g,Q]),ie=Ms(()=>n?.issues?o==="all"?n.issues:n.issues.filter(ct=>ct.severity===o):[],[n,o]),ue=Ms(()=>{Ee.current&&(b.debug("[useAIReview] Cancelling review..."),Ee.current.abort())},[]);return{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,startReview:ce,cancelReview:ue,setShowReviewMenu:m,setSeverityFilter:S,setShowStreamingPanel:T,setStreamingPanelCollapsed:F,addStreamingMessage:k,updateStreamingMessage:z,clearStreamingMessages:R,setStreamingProgress:O,setStreamingStatus:E,resetReview:P,getFilteredIssues:ie}};ke();Me();Re();import{useCallback as x7}from"react";var w7=G();ke();Me();import{useEffect as d0,useRef as f0}from"react";import{useStorybookApi as LM,useStorybookState as MM,addons as BM}from"storybook/manager-api";var g0="storyArgsUpdated",mf=()=>{let e=LM(),t=MM(),{currentStoryId:n,currentStoryName:r,setCurrentStoryId:o,setCurrentStoryName:i}=Ye(),{clearStaleReviewsForStory:s,resetReview:a,isReviewing:u,isValidating:c}=se(),l=f0(null),p=f0(0);return d0(()=>{let f=t.storyId;if(f){l.current!==f&&(b.debug("[useCurrentStory] Story changed from",l.current,"to",f),s(f),l.current=f,p.current=Date.now()),o(f);let d=e.getData(f),m=d?.name&&d.name!=="default"?`${d.title} / ${d.name}`:d?.title||f;i(m),b.debug("[useCurrentStory] Current story:",{storyId:f,fullName:m})}else o(null),i(""),l.current=null},[t.storyId,e,o,i,s]),d0(()=>{let f=BM.getChannel(),d=null,m=S=>{if(S.storyId===n){if(u||c){b.debug("[useCurrentStory] Story args changed but review in progress, skipping reset");return}d&&clearTimeout(d),d=setTimeout(()=>{let{isReviewing:T,isValidating:F}=at.getState();if(T||F){b.debug("[useCurrentStory] Story args changed but review started, skipping reset");return}if(Date.now()-p.current<2e3){b.debug("[useCurrentStory] Story args changed but story just navigated, skipping reset");return}b.debug("[useCurrentStory] Story args changed, clearing stale review"),a()},500)}};return f.on(g0,m),()=>{f.off(g0,m),d&&clearTimeout(d)}},[n,a,u,c]),{currentStoryId:n,currentStoryName:r}};ke();Re();nt();import{useCallback as m0}from"react";import{addons as h0}from"storybook/manager-api";var x0=G(),No=()=>{let{currentMapping:e,loadingMapping:t,setCurrentMapping:n,refreshMappings:r}=Ye(),{sessionToken:o}=Ie(),{selectedProjectId:i}=Qe(),s=m0(async c=>{if(!o)throw new Error("Not authenticated");if(!i)throw new Error("No project selected");let l=await ne(`${x0}/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 p=await l.json();r();try{h0.getChannel().emit("uireview/mappings-changed")}catch{}return p.mapping},[o,i,r]),a=m0(async c=>{if(!o)throw new Error("Not authenticated");if(!(await ne(`${x0}/api/mappings?id=${encodeURIComponent(c)}`,{method:"DELETE",headers:{Authorization:`Bearer ${o}`}})).ok)throw new Error("Failed to delete mapping");r();try{h0.getChannel().emit("uireview/mappings-changed")}catch{}},[o,r]);return{currentMapping:e,loadingMapping:t,hasMapping:!!e,setCurrentMapping:n,createMapping:s,deleteMapping:a,refreshMappings:r}};Zi();ke();import{useCallback as hf,useEffect as y0,useRef as DM}from"react";import{useChannel as RM,addons as b0}from"storybook/manager-api";Me();var zM=3e4,NM="forceRemount";function OM(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 _M(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 $M="UICOPILOT/APPLY_FIXES",UM="UICOPILOT/FIX_STARTED",jM="UICOPILOT/FIX_COMPLETED",HM="UICOPILOT/FIX_FAILED",WM="UICOPILOT/ALL_FIXES_APPLIED",xf=(e={})=>{let{onComplete:t,storybookRoot:n}=e,{isApplying:r,setIsApplying:o,setApplyFixesResult:i,updateIssueStatus:s,updateIssueGeneratedFix:a,setReviewDetailTab:u}=se(),c=DM(null),l=hf(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);y0(()=>()=>l(),[l]),y0(()=>{let m=b0.getChannel(),S=()=>{at.getState().isApplying&&(b.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 m.on("channelWSDisconnect",S),()=>m.off("channelWSDisconnect",S)},[l,o,i]);let p=RM({[UM]:({issueId:m})=>{b.debug(`[useApplyFixes] Fix started for issue: ${m}`),a(m,{status:"applying"})},[jM]:({issueId:m,result:S})=>{b.debug(`[useApplyFixes] Fix completed for issue: ${m}`,S),s(m,"applied"),a(m,{status:"applied"})},[HM]:({issueId:m,error:S})=>{b.error(`[useApplyFixes] Fix failed for issue: ${m}`,S),s(m,"failed",S),a(m,{status:"failed",error:S})},[WM]:async({summary:m})=>{if(b.debug("[useApplyFixes] All fixes applied:",m),l(),o(!1),i({succeeded:m.succeeded,failed:m.failed,total:m.total}),m.failed>0?b.warn(`Applied ${m.succeeded}/${m.total} fixes. ${m.failed} failed.`):b.debug(`Successfully applied all ${m.total} fixes!`),m.succeeded>0){b.debug("[useApplyFixes] Emitting FORCE_REMOUNT to refresh story...");try{b0.getChannel().emit(NM,{storyId:at.getState().currentStoryId}),b.debug("[useApplyFixes] FORCE_REMOUNT emitted")}catch(S){b.warn("[useApplyFixes] Failed to emit FORCE_REMOUNT:",S)}b.debug("[useApplyFixes] Reloading Storybook preview to load fresh CSS..."),await ka(),b.debug("[useApplyFixes] Storybook preview reloaded")}t&&(b.debug("[useApplyFixes] Triggering screenshot refresh after fixes"),t()),b.debug("[useApplyFixes] Switching to Issues tab to show results"),u("issues")}}),f=hf(m=>{let S=[],T=[],F=[];for(let k of m){let z=k.currentValue||k.actual||"",R=k.suggestedValue||k.expected||"";if(z&&R&&OM(z,R)){S.push(k);continue}if(_M(k)){T.push(k);continue}let O=k.generatedFix?.filePath||k.file||"";if(!O){b.warn(`[useApplyFixes] Skipping issue ${k.id} - no target file path`);continue}let E=O.toLowerCase().split(".").pop()||"",D=["tsx","jsx","ts","js"].includes(E)?"component":"css";F.push({...k,targetFilePath:O,targetFileType:D})}return{actionable:F,negligible:S,designTokens:T}},[]);return{applyFixes:hf(m=>{if(r){b.warn("[useApplyFixes] Already applying fixes");return}if(m.length===0){b.warn("[useApplyFixes] No issues to fix");return}let S=f(m);if(S.negligible.length>0&&b.debug(`[useApplyFixes] Filtered ${S.negligible.length} negligible issue(s)`),S.designTokens.length>0&&b.debug(`[useApplyFixes] Skipped ${S.designTokens.length} design token suggestion(s)`),S.actionable.length===0){b.warn("[useApplyFixes] No actionable issues to fix after filtering");return}let T=S.actionable.filter(z=>z.targetFileType==="css"),F=S.actionable.filter(z=>z.targetFileType==="component");if(b.debug("[useApplyFixes] Applying fixes:"),T.length>0){let z=[...new Set(T.map(R=>R.targetFilePath))];b.debug(` - ${T.length} CSS issue(s) in: ${z.join(", ")}`)}if(F.length>0){let z=[...new Set(F.map(R=>R.targetFilePath))];b.debug(` - ${F.length} component issue(s) in: ${z.join(", ")}`),b.warn(" \u26A0\uFE0F Component files will be modified - review changes carefully!")}if(!document.querySelector("#storybook-preview-iframe")?.contentWindow){b.error("[useApplyFixes] Storybook preview iframe not found \u2014 connection lost"),i({succeeded:0,failed:0,total:S.actionable.length,error:"Connection lost. Please reload the page and try again."});return}o(!0),l(),c.current=setTimeout(()=>{at.getState().isApplying&&(b.error("[useApplyFixes] Apply timed out \u2014 no response from server"),o(!1),i({succeeded:0,failed:0,total:S.actionable.length,error:"Apply timed out. The Storybook server may have disconnected. Please reload the page and try again."}))},zM),p($M,{issues:S.actionable,storybookRoot:n||void 0})},[p,r,o,i,f,n,l]),isApplying:r}};ke();Re();import{useState as j7}from"react";var V7=G();ke();import{useState as Oo}from"react";Re();Me();nt();var VM=G();async function GM(e,t,n,r,o){if(!e)return b.warn("[DismissalSync] No database ID provided, skipping server sync"),{success:!1,error:"No database ID"};try{let i=await ne(`${VM}/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 b.error("[DismissalSync] API error:",i.status,a),{success:!1,error:`API error: ${i.status}`}}let s=await i.json();return b.debug(`[DismissalSync] Synced issue ${e}, new score: ${s.newScore}`),{success:!0,newScore:s.newScore,activeIssuesCount:s.activeIssuesCount}}catch(i){return b.error("[DismissalSync] Failed to sync:",i),{success:!1,error:i.message}}}async function S0(e,t){let n=e.filter(i=>i.dbId);if(n.length===0)return b.warn("[DismissalSync] No valid dismissals to sync (missing dbIds)"),{success:!1,error:"No valid dismissals"};let o=(await Promise.all(n.map(i=>GM(i.dbId,i.dismissed,i.dismissReason,i.dismissedBy,t)))).filter(i=>i.success);if(o.length>0){let i=o[o.length-1];return b.debug(`[DismissalSync] Batch synced ${o.length}/${n.length} dismissals`),i}return{success:!1,error:"All dismissals failed"}}Qc();Zi();Me();Re();var qM=["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"],YM=["no changes required","no changes needed","no fix required","no fix needed","values already match","already matches","matches expected","correctly implemented","implementation is correct"],KM=G();function yf(){let[e,t]=Oo(!1),[n,r]=Oo(null),[o,i]=Oo(null),[s,a]=Oo(null),[u,c]=Oo(null),[l,p]=Oo(null),[f,d]=Oo(null),{sessionToken:m}=Ie(),{selectedProjectId:S}=Qe(),{currentStoryId:T,currentStoryName:F}=Ye(),{workspacePath:k,updateIssueGeneratedFix:z,batchUpdateIssueGeneratedFixes:R,includeComponentIssues:O,dismissIssue:E,recalculateScore:D,addStreamingMessage:g}=se();return{generateBatchFixes:async v=>{if(!m){r("Not authenticated");return}if(!S){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),p(null),a({total:v.length,completed:0});let A=v.map(h=>({issueId:h.id,generatedFix:{code:"",diffPreview:"",filePath:h.file||"",confidence:0,strategy:"",status:"generating"}}));R(A);try{b.debug("[useBatchGenerateFixes] Generating fixes for",v.length,"issues");let h=null;try{let x=ns();x?.computed&&(h=x.computed,b.debug("[useBatchGenerateFixes] Extracted computed styles for fix context"))}catch(x){b.warn("[useBatchGenerateFixes] Could not extract computed styles:",x)}let C=null;try{C=await Ls(T),C&&b.debug("[useBatchGenerateFixes] Resolved file paths from index.json:",C)}catch(x){b.warn("[useBatchGenerateFixes] Could not resolve story file paths:",x)}let I=await fetch(`${KM}/api/fixes/generate-batch`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify({projectId:S,storyId:T,workspacePath:k,includeComponentIssues:O,computedStyles:h,storyFilePaths:C,reviewContext:{storyName:F||void 0,variantArgs:Zo()||void 0},issues:v.map(x=>({id:x.id,dbId:x.dbId,title:x.title,description:x.description,property:x.property,currentValue:x.currentValue,suggestedValue:x.suggestedValue,file:x.file,lineNumber:x.lineNumber,severity:x.severity,type:x.type,fixTarget:x.fixTarget,domElement:x.domElement,figmaContext:x.figmaContext,suggestedFix:x.suggestedFix}))})});if(!I.ok){let x=await I.json().catch(()=>({}));throw new Error(x.error||"Batch fix generation failed")}let y=await I.json();if(!y.success)throw new Error(y.error||"Batch fix generation failed");if(b.debug("[useBatchGenerateFixes] Generated",y.result.fixes.length,"fixes"),y.result.storybookRoot&&(d(y.result.storybookRoot),b.debug("[useBatchGenerateFixes] Stored storybookRoot:",y.result.storybookRoot)),y.result.selfReview&&(p(y.result.selfReview),b.debug("[useBatchGenerateFixes] Self-review:",y.result.selfReview)),y.result.partialFailure){let{failedBatches:x,errors:U}=y.result.partialFailure;b.warn(`[useBatchGenerateFixes] Partial failure: ${x.join(", ")} batch(es) failed`),b.warn("[useBatchGenerateFixes] Errors:",U),r(`Some fixes couldn't be generated (${x.join(", ")}): ${U[0]||"Unknown error"}`)}a({total:v.length,completed:y.result.fixes.length});let P=new Set(y.result.fixes.map(x=>x.issueId)),L=v.filter(x=>!P.has(x.id));L.length>0&&(b.warn(`[useBatchGenerateFixes] ${L.length} issues not returned by API, marking as failed`),L.forEach(x=>{z(x.id,{code:"",diffPreview:"",filePath:x.file||"",confidence:0,strategy:"skipped",status:"failed",error:"Fix generation skipped by server"})})),y.timing&&(i({durationSec:y.timing.durationSec,issueCount:y.timing.issueCount,avgPerIssueSec:y.timing.avgPerIssueSec}),b.debug(`[useBatchGenerateFixes] Generation took ${y.timing.durationSec}s for ${y.timing.issueCount} issues`)),y.result?.usage&&(c({inputTokens:y.result.usage.inputTokens||0,outputTokens:y.result.usage.outputTokens||0,costUsd:y.result.usage.costUsd||0,modelId:y.result.usage.modelId||"unknown",provider:y.result.usage.provider||"unknown"}),b.debug(`[useBatchGenerateFixes] Token usage: ${y.result.usage.inputTokens} in, ${y.result.usage.outputTokens} out, $${y.result.usage.costUsd?.toFixed(4)}`));let B=[],N=[];if(y.result.fixes.forEach(x=>{let U=x.noChangesNeeded===!0;if(!U){let Q=(x.fixStrategy||"").toLowerCase(),ee=(x.generatedCode||"").toLowerCase(),J=(x.diffPreview||"").toLowerCase(),Le=qM.some(We=>Q.includes(We.toLowerCase())||Q.replace(/[-_]/g,"").includes(We.replace(/[-_]/g,""))),Ee=YM.some(We=>ee.includes(We)||J.includes(We));U=Le||Ee}let H=v.find(Q=>Q.id===x.issueId);if(U&&H){let Q=H.suggestedValue,ee=H.currentValue;Q&&ee&&!zo(Q,ee)&&(b.debug(`[useBatchGenerateFixes] SAFETY CHECK: values differ (expected="${Q}", actual="${ee}"), NOT auto-dismissing issue ${x.issueId}`),U=!1)}let M=H?.programmaticallyVerified===!0;if(b.debug(`[useBatchGenerateFixes] Processing fix for issue ${x.issueId}:`,{isFalsePositive:U,isProgrammaticIssue:M,detectedBy:H?.detectedBy,noChangesNeeded:x.noChangesNeeded,fixStrategy:x.fixStrategy,title:H?.title?.substring(0,50)}),M&&U&&(b.debug(`[useBatchGenerateFixes] SKIPPING auto-dismiss for programmatic issue ${x.issueId} (detectedBy: ${H?.detectedBy})`),U=!1),U){let Q=`Auto-dismissed: ${x.fixStrategy} - values already match`;b.debug(`[useBatchGenerateFixes] Auto-dismissing issue ${x.issueId} - noChangesNeeded: ${x.noChangesNeeded}, strategy: "${x.fixStrategy}"`),E(x.issueId,Q),B.push({localId:x.issueId,dbId:H?.dbId,dismissReason:Q}),N.push({issueId:x.issueId,generatedFix:{code:x.generatedCode||"",diffPreview:x.diffPreview||"",filePath:x.filePath,confidence:x.confidence,strategy:x.fixStrategy,status:"ready",error:void 0,noChangesExplanation:x.noChangesExplanation}})}else{let Q=x.error||x.fixStrategy==="skipped"?"failed":"ready";N.push({issueId:x.issueId,generatedFix:{code:x.generatedCode,diffPreview:x.diffPreview,filePath:x.filePath,confidence:x.confidence,strategy:x.fixStrategy,status:Q,error:x.error,noChangesExplanation:x.noChangesExplanation}})}}),N.length>0&&(b.debug(`[useBatchGenerateFixes] Applying ${N.length} fix updates in batch`),R(N)),B.length>0){if(b.debug(`[useBatchGenerateFixes] Auto-dismissed ${B.length} false positive(s), recalculating score`),D(),m){let U=B.filter(H=>H.dbId).map(H=>({dbId:H.dbId,dismissed:!0,dismissReason:H.dismissReason,dismissedBy:"system"}));U.length>0&&(b.debug(`[useBatchGenerateFixes] Syncing ${U.length} dismissals to server`),S0(U,m).then(H=>{H.success?b.debug(`[useBatchGenerateFixes] Server score updated to: ${H.newScore}`):b.warn("[useBatchGenerateFixes] Failed to sync dismissals:",H.error)}).catch(H=>{b.error("[useBatchGenerateFixes] Error syncing dismissals:",H)}))}let x=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.`;g({role:"system",content:x})}b.debug("[useBatchGenerateFixes] Updated",y.result.fixes.length,"issues with fixes")}catch(h){b.error("[useBatchGenerateFixes] Failed to generate batch fixes:",h),r(h?.message||"Failed to generate batch fixes");let C=v.map(I=>({issueId:I.id,generatedFix:{code:"",diffPreview:"",filePath:I.file||"",confidence:0,strategy:"",status:"failed",error:h?.message||"Failed to generate fix"}}));R(C)}finally{t(!1),setTimeout(()=>a(null),1500)}},isGenerating:e,error:n,timing:o,progress:s,usage:u,selfReview:l,lastStorybookRoot:f}}ke();Me();Re();nt();import{useState as bf,useCallback as Sf}from"react";var XM=G();function wf(){let[e,t]=bf([]),[n,r]=bf(!1),[o,i]=bf(null),{sessionToken:s}=Ie(),{selectedProjectId:a}=Qe(),{currentStoryId:u}=Ye(),{setReviewResults:c}=se(),l=Sf(async()=>{if(!(!s||!a)){r(!0),i(null);try{let d=new URLSearchParams({projectId:a,limit:"10"});u&&d.append("storyId",u);let m=await ne(`${XM}/api/reviews/list?${d.toString()}`,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${s}`}});if(!m.ok){let T=await m.json().catch(()=>({}));throw new Error(T.error||"Failed to fetch reviews")}let S=await m.json();if(!S.success)throw new Error("Failed to fetch reviews");b.debug("[useReviewHistory] Fetched",S.reviews.length,"reviews for:",u),t(S.reviews)}catch(d){b.error("[useReviewHistory] Failed to fetch reviews:",d),i(d instanceof Error?d.message:"Failed to fetch reviews")}finally{r(!1)}}},[s,a,u]),p=Sf(d=>{b.debug("[useReviewHistory] Applying review:",d.id,"with",d.issues.length,"issues");let m=[];if(typeof d.models=="string")try{m=JSON.parse(d.models)}catch(k){b.error("[useReviewHistory] Failed to parse models:",k),m=["claude-sonnet-4-20250514"]}else m=d.models;let S=d.issues.map(k=>({id:k.id,reviewId:d.id,type:k.type,severity:k.severity,title:k.description,description:k.description,file:k.fixTarget||void 0,lineNumber:void 0,property:k.property,currentValue:k.actual,suggestedValue:k.expected,suggestedCode:k.suggestedFix||void 0,status:k.status,dismissed:k.dismissed||!1,dismissReason:k.dismissReason,dismissedBy:k.dismissedBy,selectedForFix:!1,error:void 0,createdAt:new Date(k.createdAt)})),T=d.completedAt&&d.createdAt?new Date(d.completedAt).getTime()-new Date(d.createdAt).getTime():void 0,F=d.storyId||"";if(c({id:d.id,componentId:"",storyId:F,modelId:m[0]||"claude-sonnet-4-5-20250929",complianceScore:d.complianceScore,issuesCount:d.issuesCount,issues:S,createdAt:new Date(d.createdAt),timestamp:new Date(d.createdAt).toISOString(),costUsd:d.costUsd,inputTokens:d.inputTokens,outputTokens:d.outputTokens,reviewDurationMs:T}),F){let k=d.issues.filter(E=>!E.dismissed),z=k.filter(E=>E.severity==="critical").length,R=k.filter(E=>E.severity==="major").length,O=k.filter(E=>E.severity==="minor").length;ao(F,{score:d.complianceScore,issueCount:k.length,criticalCount:z,majorCount:R,minorCount:O})}},[c]),f=Sf(d=>{let m=e.find(S=>S.id===d);if(!m){b.error("[useReviewHistory] Review not found:",d);return}p(m)},[e,p]);return{reviews:e,isLoading:n,error:o,fetchReviews:l,loadReview:f}}ke();Me();import{useEffect as QM,useState as JM,useRef as ml}from"react";import{useChannel as ZM}from"storybook/manager-api";var eB="UICOPILOT/WORKSPACE_PATH",w0="UICOPILOT/REQUEST_WORKSPACE_PATH",tB=3e3,nB=500,rB=5,vf=()=>{let[e,t]=JM({isSupported:!1,isDetecting:!0,workspacePath:null}),{setWorkspacePath:n}=se(),r=ml(!1),o=ml(null),i=ml(0),s=ml(null),a=ZM({[eB]:({path:u})=>{r.current||(r.current=!0,o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current),b.debug("[useAutoApplySupport] Server responded - auto-apply supported"),b.debug("[useAutoApplySupport] Workspace path:",u),t({isSupported:!0,isDetecting:!1,workspacePath:u}),n(u))}});return QM(()=>(b.debug("[useAutoApplySupport] Requesting workspace path from server (retry 0)..."),a(w0,{}),s.current=setInterval(()=>{!r.current&&i.current<rB&&(i.current++,b.debug(`[useAutoApplySupport] Requesting workspace path from server (retry ${i.current})...`),a(w0,{}))},nB),o.current=setTimeout(async()=>{if(s.current&&clearInterval(s.current),!r.current){b.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,b.debug("[useAutoApplySupport] HTTP fallback succeeded - auto-apply supported"),b.debug("[useAutoApplySupport] Workspace path:",c.workspacePath),t({isSupported:!0,isDetecting:!1,workspacePath:c.workspacePath}),n(c.workspacePath);return}}}catch{}r.current||(r.current=!0,b.debug("[useAutoApplySupport] Both channel and HTTP detection failed - auto-apply NOT supported"),t({isSupported:!1,isDetecting:!1,workspacePath:null}))}},tB),()=>{o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current)}),[a]),e},kf=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 b.error("[copyToClipboard] Failed to copy:",t),!1}};ke();Re();import{useEffect as oB,useRef as iB}from"react";var vq=G(),sB=new Set;function Cf(){let{sessionToken:e}=Ie(),{selectedProjectId:t}=Qe(),n=iB(!1);oB(()=>{t&&sB.add(t)},[e,t])}ke();import{useCallback as aB,useState as v0}from"react";function Tf(){let[e,t]=v0(!1),[n,r]=v0(null),{currentStoryId:o}=Ye(),{currentReviewId:i}=se();return{exportPDF:aB(async()=>{if(!i){r("No review to export");return}t(!0),r(null);try{let[{default:a},{jsPDF:u}]=await Promise.all([import("html2canvas"),import("jspdf")]),c=document.querySelector('[data-testid="issues-panel"]')||document.querySelector(".issues-list-container")||document.querySelector('[class*="IssuesList"]');if(c)await k0(a,u,c,o);else{let l=document.querySelector("#storybook-panel-root")||document.querySelector('[id*="panel-tab-content"]')||document.querySelector(".sb-show-main");if(!l)throw new Error("Could not find panel to export");await k0(a,u,l,o)}}catch(a){console.error("[useExportPDF] Export failed:",a),r(a instanceof Error?a.message:"Failed to export PDF")}finally{t(!1)}},[i,o]),isExporting:e,error:n}}async function k0(e,t,n,r){let o=await e(n,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0,allowTaint:!0}),i=o.toDataURL("image/png"),s=o.width,a=o.height,u=210,c=297,l=10,p=u-l*2,f=p/(s/2),d=a/2*f,m=new t({orientation:(d>c-l*2,"portrait"),unit:"mm",format:"a4"});m.setFillColor("#0ea5e9"),m.rect(0,0,u,20,"F"),m.setTextColor("#ffffff"),m.setFontSize(14),m.setFont("helvetica","bold"),m.text("Design Review Report",l,13);let S=new Date().toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});m.setFontSize(10),m.setFont("helvetica","normal"),m.text(S,u-l,13,{align:"right"});let T=r?lB(r):"Component Review";m.setTextColor("#1f2937"),m.setFontSize(16),m.setFont("helvetica","bold"),m.text(T,l,30);let F=38,k=c-F-15;if(d<=k)m.addImage(i,"PNG",l,F,p,d);else{let O=d,E=0,D=!0;for(;O>0;){D||m.addPage();let g=D?F:l,w=D?k:c-l*2-10,v=Math.min(O,w),A=v/f*2,h=document.createElement("canvas");h.width=s,h.height=A;let C=h.getContext("2d");if(C){C.drawImage(o,0,E,s,A,0,0,s,A);let I=h.toDataURL("image/png");m.addImage(I,"PNG",l,g,p,v)}E+=A,O-=v,D=!1}}let z=m.getNumberOfPages();for(let O=1;O<=z;O++)m.setPage(O),m.setDrawColor("#e5e7eb"),m.setLineWidth(.3),m.line(l,c-12,u-l,c-12),m.setTextColor("#6b7280"),m.setFontSize(8),m.setFont("helvetica","normal"),m.text("Generated by UI Copilot",l,c-7),m.text(`Page ${O} of ${z}`,u-l,c-7,{align:"right"});let R=`design-review-${(r||"report").replace(/[^a-zA-Z0-9]/g,"-")}.pdf`;m.save(R)}function lB(e){let t=e.replace(/^(example|stories)-/i,""),[n,r]=t.split("--"),o=n.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "),i=r?r.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "):null;return i?`${o} / ${i}`:o}import{useState as _o,useMemo as D0,useCallback as Si}from"react";Re();Me();nt();import{useState as $r,useEffect as hl,useRef as bi,useCallback as If}from"react";var cB=300;function C0({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o=20,enabled:i=!0}){let[s,a]=$r([]),[u,c]=$r({}),[l,p]=$r(0),[f,d]=$r([]),[m,S]=$r(new Set),[T,F]=$r(!1),[k,z]=$r(!1),[R,O]=$r(null),E=bi(1),D=bi(null),g=bi(null),[w,v]=$r(0),A=bi(!1),h=bi({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o});h.current={projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o};let C=If(async(B,N,x=!1)=>{let{projectId:U,typeFilter:H,search:M,figmaPage:Q,limit:ee}=h.current;if(!U||!H)return;D.current&&D.current.abort();let J=new AbortController;D.current=J,N?z(!0):F(!0),O(null);try{let Le=G(),Ee=localStorage.getItem("uicopilot_session_token");if(!Ee)throw new Error("Not authenticated. Please connect to UI Copilot first.");let We=new URLSearchParams({projectId:U,page:String(B),limit:String(ee)});H&&We.append("type",H),Q&&We.append("figmaPage",Q),M.trim()&&We.append("search",M.trim()),x&&We.append("refresh","true");let st=await fetch(`${Le}/api/figma/frames?${We.toString()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ee}`},signal:J.signal});if(!st.ok){let ue=await st.json();throw new Error(ue.error||"Failed to fetch frames")}let te=await st.json(),Y=te.frames||[],ce=te.thumbnails||{},ie=st.headers.get("X-Cache-Status");if(Y.length===0&&B===1&&!N&&!x&&!A.current&&ie!=="HIT"){b.debug("[useFigmaFrameFetch] Empty result (cache miss), retrying with refresh=true"),A.current=!0,await C(1,!1,!0);return}N?(a(ue=>[...ue,...Y]),c(ue=>({...ue,...ce}))):(a(Y),c(ce)),p(te.total||Y.length),te.pages&&d(te.pages),te.cacheDiff?.added&&S(new Set(te.cacheDiff.added)),E.current=B}catch(Le){if(Le instanceof DOMException&&Le.name==="AbortError")return;let Ee=Le instanceof Error?Le.message:"Failed to fetch Figma frames.";O(Ee),b.error("Error fetching frames:",Le)}finally{J.signal.aborted||(F(!1),z(!1))}},[]);hl(()=>{if(!i||!e||!t)return;A.current=!1,g.current&&clearTimeout(g.current);let B=n.trim()?cB:0;return g.current=setTimeout(()=>{E.current=1,C(1,!1)},B),()=>{g.current&&clearTimeout(g.current)}},[e,t,n,r,i,w,C]);let I=bi(new Set);hl(()=>{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]),hl(()=>{if(s.length===0)return;let B=s.filter(x=>!x.thumbnailCdnUrl&&!u[x.id]&&!I.current.has(x.id)).map(x=>x.id);if(B.length===0)return;B.forEach(x=>I.current.add(x)),(async()=>{try{let{projectId:x}=h.current,U=G(),H=localStorage.getItem("uicopilot_session_token");if(!H||!x)return;let M=await ne(`${U}/api/figma/frames?projectId=${x}&thumbnailIds=${B.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${H}`}});if(M.ok){let Q=await M.json();Q.thumbnails&&Object.keys(Q.thumbnails).length>0&&c(ee=>({...ee,...Q.thumbnails}))}}catch(x){B.forEach(U=>I.current.delete(U)),b.error("Failed to fetch frame thumbnails:",x)}})()},[s,u]),hl(()=>()=>{D.current&&D.current.abort(),g.current&&clearTimeout(g.current)},[]);let y=If(async()=>{let B=E.current+1;await C(B,!0)},[C]),P=If(()=>{A.current=!1,E.current=1,a([]),c({}),v(B=>B+1)},[]),L=s.length<l;return{frames:s,thumbnails:u,totalFrames:l,availablePages:f,recentlyAdded:m,isLoading:T,loadingMore:k,hasMore:L,loadMore:y,refresh:P,error:R}}Re();Me();nt();import{useState as xl,useCallback as yl,useRef as uB}from"react";function T0({projectId:e}){let[t,n]=xl({}),[r,o]=xl({}),[i,s]=xl(new Set),[a,u]=xl(new Set),c=uB({}),l=yl(async m=>{if(!(!e||i.has(m))){s(S=>new Set(S).add(m));try{let S=G(),T=localStorage.getItem("uicopilot_session_token"),F=await ne(`${S}/api/figma/variants?projectId=${e}&componentSetId=${m}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`}});if(F.ok){let k=await F.json();if(k.variants){n(R=>({...R,[m]:k.variants}));let z={};for(let R of k.variants)R.thumbnailCdnUrl&&(z[R.id]=R.thumbnailCdnUrl);o(R=>({...R,[m]:{...R[m]||{},...z}})),c.current[m]||(c.current[m]=new Set),Object.keys(z).forEach(R=>c.current[m].add(R))}else o(z=>({...z,[m]:z[m]||{}}))}else o(k=>({...k,[m]:{}}))}catch(S){b.error("Failed to fetch variant metadata:",S),o(T=>({...T,[m]:{}}))}finally{s(S=>{let T=new Set(S);return T.delete(m),T})}}},[e,i]),p=yl(async(m,S)=>{if(!e||S.length===0)return;c.current[m]||(c.current[m]=new Set);let T=r[m]||{},F=S.filter(k=>!c.current[m].has(k)&&!T[k]);if(F.length!==0){F.forEach(k=>c.current[m].add(k)),u(k=>new Set(k).add(m));try{let k=G(),z=localStorage.getItem("uicopilot_session_token"),R=await ne(`${k}/api/figma/variants?projectId=${e}&componentSetId=${m}&thumbnailIds=${F.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}});if(R.ok){let O=await R.json();O.thumbnails&&Object.keys(O.thumbnails).length>0&&o(E=>({...E,[m]:{...E[m]||{},...O.thumbnails}}))}}catch(k){b.error("Failed to fetch variant thumbnails:",k),F.forEach(z=>c.current[m]?.delete(z))}finally{u(k=>{let z=new Set(k);return z.delete(m),z})}}},[e]),f=yl(m=>{o(S=>{let T={...S};return delete T[m],T}),n(S=>{let T={...S};return delete T[m],T}),delete c.current[m]},[]),d=yl(()=>{o({}),n({}),c.current={}},[]);return{variantChildren:t,variantThumbnails:r,loadingVariants:i,loadingThumbnails:a,fetchVariants:l,fetchVariantThumbnails:p,clearVariantsForSet:f,clearAllVariants:d}}Re();Zi();ke();Me();nt();import{useState as I0,useEffect as F0,useRef as E0,useCallback as Ff}from"react";function A0({expandedSetId:e,availableFilters:t,filtersReady:n}){let[r,o]=I0(null),[i,s]=I0(!1),a=E0(null),u=E0(new Set),c=Ff(async()=>{if(!e||!n||t.length===0||a.current===e||u.current.has(e))return;let f=Zo();if(!f||Object.keys(f).length===0)return;let d=at.getState().currentStoryId||"",m=d.replace(/--/g," / ").replace(/-/g," ").replace(/\b\w/g,S=>S.toUpperCase());a.current=e,s(!0),o(null);try{let S=G(),T=localStorage.getItem("uicopilot_session_token"),F=await ne(`${S}/api/figma/match-filters`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({storyName:m,storyId:d,storyArgs:f,availableFilters:t.map(k=>({property:k.property,values:k.values}))})});if(F.ok){let k=await F.json();k.confidence>0&&Object.keys(k.suggestedFilters).length>0&&(b.debug("[useFilterSuggestion] Suggestion:",k),o(k))}}catch(S){b.error("[useFilterSuggestion] Error:",S)}finally{s(!1)}},[e,t,n]);F0(()=>{c()},[c]),F0(()=>{e||(o(null),a.current=null)},[e]);let l=Ff(()=>{},[]),p=Ff(()=>{e&&u.current.add(e),o(null)},[e]);return{suggestion:r,isLoading:i,applySuggestion:l,dismissSuggestion:p}}function P0(e,t,n){let r=[];return e&&r.push("COMPONENT_SET"),t&&r.push("FRAME"),n&&r.push("COMPONENT"),r.join(",")}function L0(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 M0(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 B0(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 Bs({projectId:e,limit:t=20,enabled:n=!0}){let[r,o]=_o(!0),[i,s]=_o(!1),[a,u]=_o(!1),[c,l]=_o(""),[p,f]=_o(""),[d,m]=_o([]),[S,T]=_o(new Set),F=Si(te=>{l(te),d.length>0&&m([]),S.size>0&&T(new Set)},[d.length,S.size]),k=P0(r,i,a),{frames:z,thumbnails:R,totalFrames:O,availablePages:E,recentlyAdded:D,isLoading:g,loadingMore:w,hasMore:v,loadMore:A,refresh:h,error:C}=C0({projectId:e,typeFilter:k,search:c,figmaPage:p||void 0,limit:t,enabled:n&&!!k}),{variantChildren:I,variantThumbnails:y,loadingVariants:P,loadingThumbnails:L,fetchVariants:B,fetchVariantThumbnails:N,clearVariantsForSet:x,clearAllVariants:U}=T0({projectId:e}),H=D0(()=>{let te=L0(I),Y=M0(z),ce={};for(let ie of[...te,...Y])ce[ie.property]||(ce[ie.property]=new Set),ie.values.forEach(ue=>ce[ie.property].add(ue));return Object.entries(ce).map(([ie,ue])=>({property:ie,values:Array.from(ue).sort()}))},[I,z]),M=S.size===1?Array.from(S)[0]:null,Q=A0({expandedSetId:M,availableFilters:H,filtersReady:H.length>0}),ee=Si(()=>{if(!Q.suggestion)return;let{suggestedFilters:te}=Q.suggestion,Y=Object.entries(te).map(([ce,ie])=>({property:ce,value:ie}));m(Y),Q.dismissSuggestion()},[Q.suggestion]),J=D0(()=>d.some(te=>te.value)?z.filter(te=>B0(te,d,I[te.id])):z,[z,d,I]),Le=Si((te,Y)=>{Y.stopPropagation();let ce=!S.has(te);T(ie=>{let ue=new Set(ie);return ue.has(te)?ue.delete(te):ue.add(te),ue}),ce&&!I[te]&&!P.has(te)&&B(te)},[S,I,P,B]),Ee=Si((te,Y)=>{let ce=Y===""?null:Y;m(ie=>ie.find(ct=>ct.property===te)?ie.map(ct=>ct.property===te?{...ct,value:ce}:ct):[...ie,{property:te,value:ce}])},[]),We=Si(()=>{m([])},[]),st=Si(te=>{let Y=z.find(ce=>ce.id===te);if(Y?.thumbnailCdnUrl)return Y.thumbnailCdnUrl;if(R[te])return R[te];for(let ce of Object.values(y))if(ce[te])return ce[te]},[R,y]);return{frames:z,filteredFrames:J,thumbnails:R,totalFrames:O,isLoading:g,loadingMore:w,hasMore:v,error:C,loadMore:A,refresh:h,search:c,setSearch:F,figmaPage:p,setFigmaPage:f,availablePages:E,recentlyAdded:D,showComponentSets:r,showFrames:i,showComponents:a,setShowComponentSets:o,setShowFrames:s,setShowComponents:u,variantFilters:d,availableFilters:H,handleFilterChange:Ee,clearFilters:We,expandedSets:S,toggleExpanded:Le,variantChildren:I,variantThumbnails:y,loadingVariants:P,loadingThumbnails:L,fetchVariantThumbnails:N,resolveThumbnail:st,filterSuggestion:Q.suggestion,filterSuggestionLoading:Q.isLoading,applySuggestedFilters:ee,dismissFilterSuggestion:Q.dismissSuggestion}}ke();import{useEffect as Tr,useCallback as mB,useState as hB,useRef as xB}from"react";import{useChannel as yB}from"storybook/manager-api";function co(e){return e.status===401||e.status===403}var hn=class extends Error{constructor(t){super(`Authentication failed (${t}). Please reconnect.`),this.name="AuthError",this.status=t}};function R0(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 console.error("UI Copilot: Error parsing Figma URL:",t),null}}Me();Re();Re();nt();var pB=G();async function Ef(e){let t=await ne(`${pB}/api/projects`,{headers:{Authorization:`Bearer ${e}`}});if(co(t))throw new hn(t.status);return t.ok?(await t.json()).projects||[]:[]}Re();nt();var dB=G();async function Af(e,t,n){let r=await ne(`${dB}/api/mappings?projectId=${t}&storyId=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(co(r))throw new hn(r.status);return r.ok&&(await r.json()).mapping||null}Re();nt();var fB=G();async function Pf(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(`${fB}/api/reviews/list?${i}`,{headers:{Authorization:`Bearer ${e}`}});if(co(s))throw new hn(s.status);if(!s.ok)return[];let a=await s.json();return a.success?a.reviews||[]:[]}Re();nt();var gB=G();async function Lf(e,t){let n=await ne(`${gB}/api/reviews/status?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(co(n))throw new hn(n.status);if(!n.ok)return{};let r=await n.json();return r.success?r.statuses||{}:{}}function bB(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 SB=G(),wB="UICOPILOT/WORKSPACE_PATH",vB="UICOPILOT/REQUEST_WORKSPACE_PATH",Mf=!1;function Bf(){let{sessionToken:e,setSessionToken:t,setAuthError:n}=Ie(),{projects:r,selectedProjectId:o,currentStorybookPath:i,setProjects:s,setSelectedProjectId:a,setLoadingProjects:u,setCurrentStorybookPath:c}=Qe(),{currentStoryId:l,mappingsRefreshKey:p,setFigmaFileUrl:f,setCurrentMapping:d,setMappingSource:m,setLoadingMapping:S}=Ye(),{setReviewResults:T,setReviewDetailTab:F,setStorybookImageUrl:k,setFigmaImageUrl:z,setFullPrompt:R,setFullResponse:O,bulkAddReviews:E}=se(),[D,g]=hB([]),w=xB(null);Tr(()=>{let h=C=>{C.origin.startsWith(SB)&&C.data?.type==="UICOPILOT_AUTH_SUCCESS"&&C.data.token&&(b.debug("[useDataInit] OAuth success, setting token"),t(C.data.token))};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[t]);let v=yB({[wB]:h=>{b.debug("[useDataInit] Received workspace path:",h.path),c(h.path)}});Tr(()=>{v(vB)},[v]),Tr(()=>{if(!e)return;let h=!1;return(async()=>{try{u(!0);let I=await Ef(e);h||(s(I),n(null))}catch(I){I instanceof hn&&n(I.message),b.error("[useDataInit] Failed to fetch projects:",I)}finally{h||u(!1)}})(),()=>{h=!0}},[e,s,u]),Tr(()=>{if(!i||r.length===0)return;let h=r.find(C=>C.storybookRoot===i);h&&o!==h.id&&(b.debug("[useDataInit] Auto-selecting project:",h.name),a(h.id))},[i,r,o,a]),Tr(()=>{if(!o||r.length===0)return;let h=r.find(I=>I.id===o),C=h?.figmaFileId;if(h&&typeof C=="string"&&C){let I=C,y=I.includes("figma.com")&&R0(I)?.fileKey||I;f(`https://www.figma.com/file/${y}`)}},[o,r,f]),Tr(()=>!e||!o||Mf?void 0:(Mf=!0,(async()=>{try{let C=await Lf(e,o);for(let[I,y]of Object.entries(C))ao(I,{score:y.score,issueCount:y.issueCount,criticalCount:y.criticalCount,majorCount:y.majorCount,minorCount:y.minorCount});b.debug("[useDataInit] Populated sidebar badges for",Object.keys(C).length,"stories")}catch(C){C instanceof hn&&n(C.message),b.error("[useDataInit] Failed to fetch review statuses:",C)}})(),()=>{Mf=!1}),[e,o]),Tr(()=>{if(!e||!o||!l)return;let h=!1;return(async()=>{try{S(!0);let I=await Af(e,o,l);if(h)return;I?(d(I),m("database")):(d(null),m(null))}catch(I){I instanceof hn&&n(I.message),b.error("[useDataInit] Failed to fetch mapping:",I)}finally{h||S(!1)}})(),()=>{h=!0}},[e,o,l,p,d,m,S]),Tr(()=>{g([]),w.current=null},[l]),Tr(()=>{if(!e||!o||!l)return;let h=!1;return(async()=>{try{let I=await Pf(e,o,l,10,!0);if(!h){g(I);let y=I.map(P=>bB(P)).filter(Boolean);y.length>0&&E(y)}}catch(I){I instanceof hn&&n(I.message),b.error("[useDataInit] Failed to fetch reviews:",I)}})(),()=>{h=!0}},[e,o,l]);let A=mB(h=>{b.debug("[useDataInit] Applying review:",h.id,"with",h.issues.length,"issues");let C=[];if(typeof h.models=="string")try{C=JSON.parse(h.models)}catch{C=["claude-sonnet-4-20250514"]}else C=h.models;let I=h.issues.map(L=>({id:L.id,reviewId:h.id,type:L.type,severity:L.severity,title:L.description,description:L.description,file:L.fixTarget,lineNumber:void 0,property:L.property,currentValue:L.actual,suggestedValue:L.expected,suggestedCode:L.suggestedFix||void 0,status:L.status,dismissed:L.dismissed||!1,dismissReason:L.dismissReason,dismissedBy:L.dismissedBy,figmaContext:L.figmaContext,selectedForFix:!1,error:void 0,createdAt:new Date(L.createdAt)})),y=h.completedAt&&h.createdAt?new Date(h.completedAt).getTime()-new Date(h.createdAt).getTime():void 0,P=h.storyId||"";if(T({id:h.id,componentId:"",storyId:P,modelId:C[0]||"claude-sonnet-4-5-20250929",complianceScore:h.complianceScore,issuesCount:h.issuesCount,issues:I,createdAt:new Date(h.createdAt),timestamp:new Date(h.createdAt).toISOString(),costUsd:h.costUsd,inputTokens:h.inputTokens,outputTokens:h.outputTokens,reviewDurationMs:y}),h.storybookScreenshot&&(k(h.storybookScreenshot),b.debug("[useDataInit] Loaded persisted Storybook screenshot")),h.figmaScreenshot&&(z(h.figmaScreenshot),b.debug("[useDataInit] Loaded persisted Figma screenshot")),h.aiPrompt&&(R(h.aiPrompt),b.debug("[useDataInit] Loaded persisted AI prompt")),h.aiResponse&&(O(h.aiResponse),b.debug("[useDataInit] Loaded persisted AI response")),P){let L=h.issues.filter(U=>!U.dismissed),B=L.filter(U=>U.severity==="critical").length,N=L.filter(U=>U.severity==="major").length,x=L.filter(U=>U.severity==="minor").length;ao(P,{score:h.complianceScore,issueCount:L.length,criticalCount:B,majorCount:N,minorCount:x})}},[T,k,z,R,O]);Tr(()=>{if(D.length>0&&l&&w.current!==l){let h=D[0];h&&h.storyId===l&&(b.debug("[useDataInit] Auto-loading review:",h.id,"for:",l),w.current=l,A(h),F("issues"))}},[D,l,A,F])}import{styled as Ds}from"storybook/theming";var kB=Ds.div({display:"flex",gap:"10px",marginTop:"8px"}),z0=Ds.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer"})),CB=Ds.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"})),TB=Ds.div({display:"flex",alignItems:"center",gap:"8px"}),IB=Ds(Hn)(({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"})),N0=()=>{let{sessionToken:e,authMethod:t,setAuthMethod:n,startOAuth:r,logout:o}=Ki();return It.createElement(It.Fragment,null,It.createElement(To,null,It.createElement(Io,null,"Authentication Method"),It.createElement(kB,null,It.createElement(z0,null,It.createElement("input",{type:"radio",name:"authMethod",checked:t==="oauth",onChange:()=>n("oauth")}),"OAuth (Recommended)"),It.createElement(z0,null,It.createElement("input",{type:"radio",name:"authMethod",checked:t==="apikey",onChange:()=>n("apikey")}),"API Key"))),t==="oauth"&&It.createElement(To,null,It.createElement(Io,null,"Connect to UI Copilot"),e?It.createElement(CB,null,It.createElement(TB,null,It.createElement("span",{style:{fontSize:"18px"}},"\u2713"),It.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to UI Copilot")),It.createElement(IB,{onClick:o},"Disconnect")):It.createElement("div",null,It.createElement(Ec,{style:{marginBottom:"12px"}},"Connect to UI Copilot to manage projects and integrations. This will open a browser window for authentication."),It.createElement(Hn,{onClick:r},"\u{1F517} Connect to UI Copilot"))),t==="apikey"&&It.createElement(To,null,It.createElement(Io,null,"API Key"),It.createElement(Ec,{style:{marginBottom:"12px"}},"Enter your UI Copilot API key below."),It.createElement(Fo,{type:"password",placeholder:"Enter API key",disabled:!0}),It.createElement(Hn,{disabled:!0,style:{marginTop:"12px"}},"Save API Key")))};import jt,{useState as Df}from"react";ke();import{styled as fr}from"storybook/theming";var FB=fr.div({marginBottom:"30px"}),EB=fr.div({display:"flex",gap:"8px",alignItems:"center"}),AB=fr(wn)({flex:1}),PB=fr(_t)({padding:"8px 12px",whiteSpace:"nowrap"}),LB=fr.div(({theme:e})=>({marginTop:"12px",padding:"12px",backgroundColor:e.background.hoverable,borderRadius:"6px"})),Rf=fr.div({marginBottom:"10px","&:last-child":{marginBottom:0}}),zf=fr.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:500,marginBottom:"4px",color:e.color.mediumdark})),Nf=fr(Fo)({fontSize:"13px",padding:"6px 8px"}),MB=fr.div({display:"flex",gap:"8px",marginTop:"12px"}),O0=fr(_t)({fontSize:"12px",padding:"6px 12px"}),BB=fr(O0)(({theme:e})=>({backgroundColor:"transparent",color:e.color.mediumdark,border:`1px solid ${e.appBorderColor}`,"&:hover":{backgroundColor:e.background.hoverable}})),_0=()=>{let{projects:e,selectedProjectId:t,setSelectedProjectId:n,loadingProjects:r,createProject:o}=ir(),{currentStorybookPath:i}=Qe(),[s,a]=Df(!1),[u,c]=Df(!1),[l,p]=Df({name:"",storybookRoot:"",figmaFileUrl:""}),f=T=>{n(T||null),a(!1)},d=()=>{if(a(!0),i){let T=i.replace(/\/+$/,"").split("/").pop()||"";p({storybookRoot:i,name:T,figmaFileUrl:""})}},m=async()=>{if(l.name.trim())try{c(!0);let T;if(l.figmaFileUrl.trim()){let k=l.figmaFileUrl.trim(),z=k.match(/figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)/);T=z?z[1]:k}let F=await o({name:l.name.trim(),storybookRoot:l.storybookRoot.trim()||void 0,figmaFileId:T});n(F.id),a(!1),p({name:"",storybookRoot:"",figmaFileUrl:""})}catch(T){console.error("Failed to create project:",T)}finally{c(!1)}},S=T=>{p(F=>{let k={...F,storybookRoot:T};if(!F.name&&T){let z=T.replace(/\/+$/,"").split("/").pop()||"";k.name=z}return k})};return jt.createElement(FB,null,jt.createElement(ih,null,"Project"),jt.createElement(EB,null,jt.createElement(AB,{value:t||"",onChange:T=>f(T.target.value),disabled:r||s},jt.createElement("option",{value:""},"-- Select a project --"),e.map(T=>jt.createElement("option",{key:T.id,value:T.id},T.name))),jt.createElement(PB,{onClick:d,disabled:r,type:"button"},"+ New")),s&&jt.createElement(LB,null,jt.createElement(Rf,null,jt.createElement(zf,null,"Storybook Path (for fix generation)"),jt.createElement(Nf,{type:"text",placeholder:"/path/to/your/storybook",value:l.storybookRoot,onChange:T=>S(T.target.value)})),jt.createElement(Rf,null,jt.createElement(zf,null,"Project Name *"),jt.createElement(Nf,{type:"text",placeholder:"my-storybook",value:l.name,onChange:T=>{let F=T.target.value;p(k=>({...k,name:F}))}})),jt.createElement(Rf,null,jt.createElement(zf,null,"Figma File URL (for design comparison)"),jt.createElement(Nf,{type:"text",placeholder:"https://www.figma.com/file/...",value:l.figmaFileUrl,onChange:T=>{let F=T.target.value;p(k=>({...k,figmaFileUrl:F}))}})),jt.createElement(MB,null,jt.createElement(O0,{onClick:m,disabled:u||!l.name.trim()},u?"Creating...":"Create"),jt.createElement(BB,{onClick:()=>{a(!1),p({name:"",storybookRoot:"",figmaFileUrl:""})}},"Cancel"))))};import dt,{useState as pg,useCallback as vw,useEffect as Iz}from"react";import{styled as gr}from"storybook/theming";import wi,{useState as Of,useEffect as DB,useCallback as $0}from"react";import{styled as vi}from"storybook/theming";ke();Re();nt();var RB=vi.div(({theme:e})=>({padding:"12px 16px",marginBottom:"16px"})),zB=vi.label(({theme:e})=>({display:"block",fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"8px"})),NB=vi.div({display:"flex",gap:"8px",alignItems:"center"}),OB=vi.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:ae,boxShadow:`0 0 0 1px ${ae}`},"&::placeholder":{color:e.color.mediumlight}})),_B=vi(_t)({whiteSpace:"nowrap"}),$B=vi.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":"#dc2626",marginTop:"4px",display:"block"})),U0=()=>{let{selectedProjectId:e,projects:t}=Qe(),{sessionToken:n}=Ie(),{updateProject:r}=ir(),o=t.find(S=>S.id===e),[i,s]=Of(""),[a,u]=Of(!1),[c,l]=Of(null),p=o?.figmaFileUrl||o?.figmaFileId||"";DB(()=>{s(p),l(null)},[o?.id,p]);let f=i!==p,d=$0(async()=>{if(!(!e||!f))try{u(!0),l(null),await r(e,{figmaFileUrl:i.trim()||void 0});try{let S=G();await ne(`${S}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})})}catch{}l({type:"success",message:"Saved"}),setTimeout(()=>l(null),3e3)}catch(S){l({type:"error",message:S instanceof Error?S.message:"Failed to save"})}finally{u(!1)}},[e,i,f,r]),m=$0(S=>{S.key==="Enter"&&f&&!a&&d()},[f,a,d]);return e?wi.createElement(RB,null,wi.createElement(zB,null,"Figma File URL"),wi.createElement(NB,null,wi.createElement(OB,{type:"text",value:i,onChange:S=>s(S.target.value),onKeyDown:m,placeholder:"https://www.figma.com/file/..."}),wi.createElement(_B,{onClick:d,disabled:!f||a},a?"Saving...":"Save")),c&&wi.createElement($B,{variant:c.type},c.message)):null};import gt,{useState as Bl,useEffect as rz}from"react";import{styled as Nn}from"storybook/theming";ke();Re();import He,{useState as Ii,useEffect as ER,useCallback as go}from"react";import{styled as Gt}from"storybook/theming";Re();Re();Me();import K,{useState as Ci,useEffect as ES,useMemo as Qf,useCallback as AS}from"react";import{styled as $e}from"storybook/theming";nt();import Ae,{useState as FS,useEffect as UB,memo as jB}from"react";import{styled as ye}from"storybook/theming";var j0=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}),H0=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}`})),W0=ye.div(({theme:e})=>({padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"space-between",alignItems:"center"})),V0=ye.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),G0=ye(fn)({fontSize:"20px",padding:"4px 8px"}),q0=ye.div({flex:1,overflow:"auto",padding:"20px"}),Y0=ye(Qr)({fontSize:"14px",marginBottom:"16px"}),_f=ye.div({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"}),K0=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:ae,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),$f=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"})),X0=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"})),Q0=ye.img(({theme:e})=>({maxWidth:"100%",maxHeight:"100%",objectFit:"cover",display:"block",backgroundColor:e.background.content,borderRadius:"4px"})),Rs=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})),Uf=ye.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTopColor:ae,borderRadius:"50%",animation:"thumbnail-spin 0.8s linear infinite","@keyframes thumbnail-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),zs=ye.div(({theme:e})=>({fontSize:"11px",fontWeight:500,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),jf=ye.div(({theme:e})=>({fontSize:"32px",opacity:.5,color:e.color.mediumdark})),Hf=ye.div(({theme:e})=>({padding:"12px",textAlign:"left",backgroundColor:e.background.content,borderTop:`1px solid ${e.appBorderColor}`})),Wf=ye.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3})),Vf=ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),J0=ye.div(({theme:e})=>({display:"flex",gap:"16px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),bl=ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer",userSelect:"none","& input":{cursor:"pointer"}})),Z0=ye.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"14px"})),eS=ye.div(({theme:e})=>({padding:"20px",backgroundColor:e.background.critical,color:e.color.inverseText,borderRadius:"4px",fontSize:"14px"})),tS=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:ae}})),nS=ye.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${ae}`,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:ae,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),rS=ye.div(({theme:e})=>({position:"absolute",top:"8px",right:"8px",padding:"2px 8px",background:ae,color:e.color.lightest,borderRadius:"4px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",zIndex:10})),oS=ye.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px",marginBottom:"4px"}),wK=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"})),iS=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${ae}`,borderRadius:"6px",backgroundColor:e.background.content,overflow:"hidden",minHeight:"200px"})),sS=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%"}}})),Gf=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"}})),aS=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})),lS=ye.span(({theme:e})=>({fontWeight:600,color:e.color.mediumdark})),cS=ye.span(({theme:e})=>({color:e.color.defaultText})),Sl=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%"}}})),uS=ye.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,overflow:"hidden"})),pS=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}`})),dS=ye.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),fS=ye(wn)({flex:1,width:"auto"}),gS=ye.span(({theme:e,hasMapping:t})=>({fontSize:"12px",color:t?e.color.positive:e.color.mediumdark,fontWeight:t?500:400})),mS=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"})),hS=ye.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),xS=ye.span(({theme:e})=>({color:e.color.defaultText})),yS=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}})),bS=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}})),SS=ye.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:"8px",fontStyle:"italic"})),wl=ye.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px",flexWrap:"wrap"})),Ns=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),ki=ye(wn)(({theme:e,isActive:t})=>({width:"auto",padding:"6px 28px 6px 10px",fontSize:"12px",...t&&{borderColor:e.color.secondary,backgroundColor:`${e.color.secondary}14`}})),vl=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`}})),wS=ye.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",padding:"8px 0",borderBottom:`1px solid ${e.appBorderColor}`})),vS=ye.button(({theme:e})=>({padding:"6px 12px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:ae,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:"rgba(234, 88, 12, 0.08)"}})),kS=ye.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),qf=ye.button(({theme:e,isSelected:t})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${t?ae: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:ae,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),Yf=ye.div(({theme:e,isSelected:t})=>({position:"absolute",top:"8px",left:"8px",width:"20px",height:"20px",borderRadius:"4px",border:`2px solid ${t?ae:e.appBorderColor}`,backgroundColor:t?ae:e.background.content,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,fontSize:"12px",color:t?e.color.lightest:"transparent"})),CS=ye.div(({theme:e})=>({padding:"16px 20px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"flex-end",gap:"12px"})),TS=ye.button(({theme:e,disabled:t})=>({padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:t?e.color.mediumdark:ae,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:ae,opacity:t?.6:.9}})),IS=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"}));Me();var Kf=jB(({src:e,alt:t,isComponentSet:n,loadingDone:r})=>{let[o,i]=FS(!1),[s,a]=FS(!1);return UB(()=>{i(!1),a(!1)},[e]),o?Ae.createElement(Rs,null,Ae.createElement(jf,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Ae.createElement(zs,null,"Failed to load")):e?Ae.createElement(Ae.Fragment,null,!s&&Ae.createElement(Rs,{style:{position:"absolute",inset:0}},Ae.createElement(Uf,null),Ae.createElement(zs,null,"Loading...")),Ae.createElement(Q0,{src:e,alt:t,onLoad:()=>a(!0),onError:()=>i(!0),style:{opacity:s?1:0}})):r?Ae.createElement(Rs,null,Ae.createElement(jf,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Ae.createElement(zs,null,"No preview")):Ae.createElement(Rs,null,Ae.createElement(Uf,null),Ae.createElement(zs,null,"Loading..."))}),Os=({frame:e,thumbnail:t,thumbnails:n,variantThumbnails:r,variantChildren:o,isLoadingVariants:i=!1,isExpanded:s,isNew:a=!1,onToggleExpand:u,onSelect:c,multiSelect:l=!1,selectedFrames:p=new Set,variantFilters:f=[]})=>{let d=e.type==="COMPONENT_SET",m=d&&(e.children&&e.children.length>0||(e.childCount??0)>0),S=e.children||o||[],T=Ae.useMemo(()=>S.length===0?[]:f.some(z=>z.value)?S.filter(z=>z.variantProperties?f.every(R=>R.value?z.variantProperties?.[R.property]===R.value:!0):!1):S,[S,f]),F=z=>{if(d&&m){u(e.id,z);return}c(e)},k=l?qf:K0;return Ae.createElement(Ae.Fragment,null,Ae.createElement(k,{onClick:F,title:e.name,isSelected:l?p.has(e.id):void 0,style:{cursor:"pointer"}},l&&!m&&Ae.createElement(Yf,{isSelected:p.has(e.id)},p.has(e.id)?"\u2713":""),d?Ae.createElement(X0,null,m&&Ae.createElement(tS,{onClick:z=>u(e.id,z),title:s?"Collapse variants":"Expand variants"},s?"\u25BC":"\u25B6"),m&&Ae.createElement(rS,null,T.length>0&&T.length!==S.length?`${T.length} / ${S.length}`:e.childCount??S.length," variants"),Ae.createElement(Kf,{src:t,alt:e.name,isComponentSet:!0})):Ae.createElement($f,null,Ae.createElement(Kf,{src:t,alt:e.name,isComponentSet:!1})),Ae.createElement(Hf,null,Ae.createElement(Wf,null,e.name,a&&Ae.createElement(IS,null,"New")),Ae.createElement(Vf,null,e.type))),m&&s&&i&&Ae.createElement(Ae.Fragment,null,Array.from({length:Math.min(6,e.childCount??e.children?.length??6)}).map((z,R)=>Ae.createElement(iS,{key:`skeleton-${R}`},Ae.createElement(sS,null),Ae.createElement(Gf,{width:"80%"}),Ae.createElement(Gf,{width:"50%"})))),m&&s&&!i&&T.map(z=>Ae.createElement(Xf,{key:z.id,variant:z,thumbnail:r?.[z.id]||n[z.id],onSelect:c,multiSelect:l,isSelected:p.has(z.id),loadingDone:!!t||r!==void 0&&z.id in(r||{})})))},Xf=({variant:e,thumbnail:t,onSelect:n,multiSelect:r=!1,isSelected:o=!1,loadingDone:i=!1})=>Ae.createElement(r?qf:nS,{onClick:()=>{b.debug("[VariantCard] Clicked:",e.id,e.name),n(e)},title:e.name,isSelected:r?o:void 0},r&&Ae.createElement(Yf,{isSelected:o},o?"\u2713":""),Ae.createElement($f,null,Ae.createElement(Kf,{src:t,alt:e.name,isComponentSet:!1,loadingDone:i})),Ae.createElement(Hf,null,Ae.createElement(Wf,null,e.name),e.variantProperties&&Object.keys(e.variantProperties).length>0&&Ae.createElement(oS,null,Object.entries(e.variantProperties).map(([u,c])=>Ae.createElement(aS,{key:u},Ae.createElement(lS,null,u,":")," ",Ae.createElement(cS,null,c)))),Ae.createElement(Vf,{style:{marginTop:"6px"}},"VARIANT")));var HB=$e.div({display:"flex",height:"100%",overflow:"hidden"}),WB=$e.div(({theme:e})=>({width:"380px",minWidth:"300px",borderRight:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",overflow:"hidden"})),VB=$e.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}),PS=$e.div(({theme:e})=>({padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),LS=$e.h4(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px",margin:0})),kl=$e.div({display:"flex",gap:"8px",marginTop:"10px"}),GB=$e(wn)({flex:1,width:"auto"}),MS=$e(Qr)({flex:1,fontSize:"13px"}),qB=$e.div({flex:1,overflow:"auto",padding:"8px"}),YB=$e.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}})),KB=$e.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"}),XB=$e.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),QB=$e.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})),JB=$e.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),ZB=$e.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"})),eD=$e.img(({theme:e})=>({width:"48px",height:"36px",objectFit:"contain",backgroundColor:e.background.content,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,flexShrink:0})),tD=$e.div({flex:1,overflow:"hidden"}),nD=$e.div({fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),rD=$e.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)"}}})),oD=$e.img(({theme:e})=>({width:"100%",maxWidth:"260px",maxHeight:"200px",objectFit:"contain",borderRadius:"4px",backgroundColor:e.background.app,display:"block"})),iD=$e.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",fontWeight:500,color:e.color.defaultText,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),sD=$e.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}),aD=$e.div({display:"flex",gap:"8px",flexWrap:"wrap"}),Jf=$e.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:e.color.mediumdark,cursor:"pointer","& input":{cursor:"pointer"}})),lD=$e.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),Zf=20,cD=$e.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",gap:"12px",padding:"12px 0",borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),uD=$e.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`}})),pD=$e.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px",backgroundColor:e.background.app,borderRadius:"6px",marginBottom:"8px"})),dD=$e.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`}})),fD=$e.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),eg=$e.div(({theme:e})=>({gridColumn:"1 / -1",fontSize:"12px",color:e.color.mediumdark,textAlign:"center",padding:"8px 0"})),tg=$e.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px"})),gD=$e.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),mD=$e.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),BS=$e.div(({theme:e})=>({borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,overflow:"hidden",backgroundColor:e.background.content})),DS=$e.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"}}})),RS=$e.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"}}})),hD=()=>K.createElement(mD,null,Array.from({length:8}).map((e,t)=>K.createElement(BS,{key:t},K.createElement(DS,null),K.createElement(RS,{width:`${60+t%3*15}%`})))),xD=$e.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"})),yD=$e.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"}),bD=$e.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)"}}})),SD=$e.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark})),zS=({stories:e,loading:t,selectedStoryId:n,onSelectStory:r,onStoryMapped:o,projectId:i})=>{let s=Bs({projectId:i,limit:Zf,enabled:!!i}),[a,u]=Ci("all"),[c,l]=Ci(""),[p,f]=Ci(null),[d,m]=Ci(1),[S,T]=Ci(null),[F,k]=Ci(!1),z=Qf(()=>{let h=new Set;return e.forEach(C=>{C.componentTitle&&h.add(C.componentTitle)}),Array.from(h).sort()},[e]),R=Qf(()=>e.filter(h=>{if(a!=="all"&&h.componentTitle!==a)return!1;if(c){let C=c.toLowerCase();return h.name.toLowerCase().includes(C)||h.title.toLowerCase().includes(C)}return!0}),[e,a,c]),O=p?s.frames.find(h=>h.id===p):null,E=Qf(()=>{if(!p)return[];let h=s.variantChildren[p]||[];return h.length===0?[]:s.variantFilters.some(C=>C.value)?h.filter(C=>C.variantProperties?s.variantFilters.every(I=>I.value?C.variantProperties?.[I.property]===I.value:!0):!1):h},[p,s.variantChildren,s.variantFilters]),D=E.slice(0,d*Zf),g=E.length>d*Zf;ES(()=>{if(!p||D.length===0)return;let h=D.map(C=>C.id);s.fetchVariantThumbnails(p,h)},[p,D.length,d]),ES(()=>{k(!1)},[]);let w=AS(async h=>{if(n)try{let C=G(),I=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${C}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({projectId:i,storyId:n,figmaNodeId:h.id,name:h.name})})).ok)throw new Error("Failed to save mapping");o(n,h.id,h.name)}catch(C){b.error("[MapStoriesTab] Error saving mapping:",C)}},[n,i,o]),v=AS((h,C)=>{if(C.stopPropagation(),p===h){f(null),m(1);return}f(h),m(1),!s.variantThumbnails[h]&&!s.loadingVariants.has(h)&&s.toggleExpanded(h,C)},[p,s]),A=e.find(h=>h.id===n);return t?K.createElement(gD,null,"Loading stories..."):K.createElement(HB,null,K.createElement(WB,null,K.createElement(PS,null,K.createElement(LS,null,"Storybook Stories"),K.createElement(kl,null,K.createElement(GB,{value:a,onChange:h=>u(h.target.value)},K.createElement("option",{value:"all"},"All Components"),z.map(h=>K.createElement("option",{key:h,value:h},h)))),K.createElement(kl,null,K.createElement(MS,{type:"text",placeholder:"Search stories...",value:c,onChange:h=>l(h.target.value)}))),K.createElement(qB,null,R.length===0?K.createElement(tg,null,"No stories found"):R.map(h=>K.createElement(YB,{key:h.id,selected:h.id===n,mapped:!!h.figmaMapping,onClick:()=>r(h.id)},K.createElement(KB,null,K.createElement(XB,null,h.name),K.createElement(QB,{mapped:!!h.figmaMapping},h.figmaMapping?"Mapped":"Unmapped")),K.createElement(JB,null,h.title),h.figmaMapping&&K.createElement(ZB,{onMouseEnter:()=>T(h.id),onMouseLeave:()=>T(null)},(()=>{let C=h.figmaMapping?.figmaNodeId,I=C?s.resolveThumbnail(C):void 0;return K.createElement(K.Fragment,null,I?K.createElement(eD,{src:I,alt:h.figmaMapping?.figmaFrameName||""}):K.createElement("span",null,"\u{1F517}"),S===h.id&&I&&K.createElement(rD,null,K.createElement(oD,{src:I,alt:h.figmaMapping?.figmaFrameName||""}),K.createElement(iD,null,h.figmaMapping?.figmaFrameName)))})(),K.createElement(tD,null,K.createElement(nD,null,h.figmaMapping.figmaFrameName))))))),K.createElement(VB,null,n?K.createElement(K.Fragment,null,K.createElement(xD,null,K.createElement("span",null,"Click a Figma component below to link it to"," ",K.createElement("strong",null,A?.name))),K.createElement(PS,null,K.createElement(LS,null,"Figma Components"),K.createElement(kl,null,K.createElement(aD,null,K.createElement(Jf,null,K.createElement("input",{type:"checkbox",checked:s.showComponentSets,onChange:h=>s.setShowComponentSets(h.target.checked)}),"Component Sets"),K.createElement(Jf,null,K.createElement("input",{type:"checkbox",checked:s.showFrames,onChange:h=>s.setShowFrames(h.target.checked)}),"Frames"),K.createElement(Jf,null,K.createElement("input",{type:"checkbox",checked:s.showComponents,onChange:h=>s.setShowComponents(h.target.checked)}),"Components")),s.availablePages.length>1&&K.createElement(ki,{isActive:!!s.figmaPage,value:s.figmaPage,onChange:h=>s.setFigmaPage(h.target.value)},K.createElement("option",{value:""},"All pages"),s.availablePages.map(h=>K.createElement("option",{key:h,value:h},h)))),s.availableFilters.length>0&&K.createElement(wl,null,K.createElement(Ns,null,"Filters:"),s.availableFilters.slice(0,5).map(({property:h,values:C})=>{let I=s.variantFilters.find(y=>y.property===h);return K.createElement(ki,{key:h,isActive:!!I?.value,value:I?.value||"",onChange:y=>s.handleFilterChange(h,y.target.value)},K.createElement("option",{value:""},h),C.map(y=>K.createElement("option",{key:y,value:y},h,"=",y)))}),s.availableFilters.length>5&&K.createElement(Ns,{style:{opacity:.6,fontSize:"11px"}},"+",s.availableFilters.length-5," more"),s.variantFilters.some(h=>h.value)&&K.createElement(vl,{onClick:s.clearFilters},"Clear All")),K.createElement(kl,null,K.createElement(MS,{type:"text",placeholder:"Search Figma components...",value:s.search,onChange:h=>s.setSearch(h.target.value)}))),K.createElement(sD,null,F&&K.createElement(yD,null,K.createElement(bD,null),K.createElement(SD,null,"Loading thumbnails...")),s.isLoading?K.createElement(hD,null):s.filteredFrames.length===0?K.createElement(tg,null,K.createElement("span",null,"No components found")):K.createElement(lD,null,p&&O?K.createElement(K.Fragment,null,K.createElement(pD,null,K.createElement(dD,{onClick:()=>{f(null),m(1)}},"Back"),K.createElement(fD,null,O.name)),s.loadingVariants.has(p)?K.createElement(K.Fragment,null,K.createElement(eg,null,"Loading ",O.childCount??"..."," variants..."),Array.from({length:Math.min(8,O.childCount??8)}).map((h,C)=>K.createElement(BS,{key:`variant-skeleton-${C}`},K.createElement(DS,null),K.createElement(RS,{width:`${60+C%3*15}%`})))):K.createElement(K.Fragment,null,K.createElement(eg,null,"Showing ",D.length," of ",E.length," variants"),D.map(h=>K.createElement(Xf,{key:h.id,variant:h,thumbnail:s.variantThumbnails[p]?.[h.id]||s.thumbnails[h.id],onSelect:w,loadingDone:s.variantThumbnails[p]!==void 0&&!s.loadingVariants.has(p)})))):K.createElement(K.Fragment,null,K.createElement(eg,null,"Showing ",s.frames.length," of ",s.totalFrames," components"),s.filteredFrames.map(h=>K.createElement(Os,{key:h.id,frame:h,thumbnail:s.thumbnails[h.id],thumbnails:s.thumbnails,variantThumbnails:s.variantThumbnails[h.id],variantChildren:s.variantChildren[h.id],isLoadingVariants:s.loadingVariants.has(h.id),isExpanded:!1,onToggleExpand:v,onSelect:w,variantFilters:s.variantFilters}))),(p?g:s.hasMore)&&K.createElement(cD,null,K.createElement(uD,{disabled:s.loadingMore,onClick:async()=>{p?m(h=>h+1):await s.loadMore()}},s.loadingMore?"Loading...":"Load More"))))):K.createElement(tg,null,K.createElement("span",null,"Select a story from the left to link it to Figma"))))};Re();import Ve,{useState as ng,useMemo as NS,useCallback as OS}from"react";import{styled as At}from"storybook/theming";nt();var wD=At.div({display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}),vD=At.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`,flexWrap:"wrap"})),kD=At(wn)({width:"auto",minWidth:"200px"}),CD=At(Qr)({fontSize:"13px",minWidth:"250px"}),TD=At.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}})),ID=At.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}})),FD=At.div({flex:1,overflow:"auto"}),ED=At.table(({theme:e})=>({width:"100%",borderCollapse:"collapse",fontSize:"13px"})),AD=At.thead(({theme:e})=>({position:"sticky",top:0,backgroundColor:e.background.app,zIndex:1})),Cl=At.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}`})),PD=At.tbody({}),LD=At.tr(({theme:e,mapped:t})=>({backgroundColor:t?"transparent":`${e.color.warning}05`,"&:hover":{backgroundColor:e.background.hoverable}})),Tl=At.td(({theme:e})=>({padding:"14px 20px",borderBottom:`1px solid ${e.appBorderColor}`,verticalAlign:"middle"})),MD=At.div({display:"flex",flexDirection:"column",gap:"2px"}),BD=At.div(({theme:e})=>({fontWeight:500,color:e.color.defaultText})),DD=At.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),RD=At.div(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumlight,fontWeight:t?500:400,display:"flex",alignItems:"center",gap:"6px"})),zD=At.div({display:"flex",alignItems:"center",gap:"8px"}),ND=At.span(({theme:e,mapped:t})=>({width:"10px",height:"10px",borderRadius:"50%",backgroundColor:t?e.color.positive:e.color.mediumlight})),OD=At.span(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumdark,fontWeight:500})),_S=At.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`}})),_D=At.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px",padding:"40px"})),$D=At.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),$S=({stories:e,loading:t,onLink:n,onUnlink:r,projectId:o})=>{let[i,s]=ng("all"),[a,u]=ng(""),[c,l]=ng(!0),p=NS(()=>{let T=new Set;return e.forEach(F=>{F.componentTitle&&T.add(F.componentTitle)}),Array.from(T).sort()},[e]),f=NS(()=>e.filter(T=>{if(i!=="all"&&T.componentTitle!==i||!c&&!T.figmaMapping)return!1;if(a){let F=a.toLowerCase();return T.name.toLowerCase().includes(F)||T.title.toLowerCase().includes(F)||(T.figmaMapping?.figmaFrameName?.toLowerCase().includes(F)??!1)}return!0}),[e,i,a,c]),d=OS(async T=>{try{let F=G(),k=localStorage.getItem("uicopilot_session_token");if(!(await ne(`${F}/api/mappings?projectId=${o}&storyId=${T}`,{method:"DELETE",headers:{Authorization:`Bearer ${k}`}})).ok)throw new Error("Failed to delete mapping");r(T)}catch(F){console.error("[ViewAllMappingsTab] Error unlinking:",F)}},[o,r]),m=OS(()=>{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})),F=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),k=URL.createObjectURL(F),z=document.createElement("a");z.href=k,z.download=`figma-mappings-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(k)},[e]);if(t)return Ve.createElement($D,null,"Loading mappings...");let S=e.filter(T=>T.figmaMapping).length;return Ve.createElement(wD,null,Ve.createElement(vD,null,Ve.createElement(kD,{value:i,onChange:T=>s(T.target.value)},Ve.createElement("option",{value:"all"},"All Components"),p.map(T=>Ve.createElement("option",{key:T,value:T},T))),Ve.createElement(CD,{type:"text",placeholder:"\u{1F50D} Search stories or Figma components...",value:a,onChange:T=>u(T.target.value)}),Ve.createElement(TD,{active:c,onClick:()=>l(!c)},c?"\u2611":"\u2610"," Show unmapped"),Ve.createElement(ID,{onClick:m,disabled:S===0},"\u{1F4E5} Export JSON")),f.length===0?Ve.createElement(_D,null,Ve.createElement("span",null,"\u{1F4ED}"),a?"No stories match your search":"No stories found"):Ve.createElement(FD,null,Ve.createElement(ED,null,Ve.createElement(AD,null,Ve.createElement("tr",null,Ve.createElement(Cl,{style:{width:"35%"}},"Story"),Ve.createElement(Cl,{style:{width:"35%"}},"Figma Component"),Ve.createElement(Cl,{style:{width:"15%"}},"Status"),Ve.createElement(Cl,{style:{width:"15%"}},"Actions"))),Ve.createElement(PD,null,f.map(T=>Ve.createElement(LD,{key:T.id,mapped:!!T.figmaMapping},Ve.createElement(Tl,null,Ve.createElement(MD,null,Ve.createElement(BD,null,T.name),Ve.createElement(DD,null,T.title))),Ve.createElement(Tl,null,Ve.createElement(RD,{mapped:!!T.figmaMapping},T.figmaMapping?Ve.createElement(Ve.Fragment,null,Ve.createElement("span",null,"\u{1F3A8}"),T.figmaMapping.figmaFrameName):"\u2014")),Ve.createElement(Tl,null,Ve.createElement(zD,null,Ve.createElement(ND,{mapped:!!T.figmaMapping}),Ve.createElement(OD,{mapped:!!T.figmaMapping},T.figmaMapping?"Mapped":"Unmapped"))),Ve.createElement(Tl,null,T.figmaMapping?Ve.createElement(_S,{variant:"unlink",onClick:()=>d(T.id)},"Unlink"):Ve.createElement(_S,{variant:"link",onClick:()=>n(T.id)},"Link"))))))))};import ve,{useState as Ll,useMemo as qS}from"react";import{styled as it}from"storybook/theming";import US from"react";import{styled as jS,keyframes as UD}from"storybook/theming";var jD=UD`
|
|
30
|
+
\u2705 ${te} issue${te>1?"s were":" was"} auto-dismissed as false positive${te>1?"s":""} (values already match design spec). Score recalculated to reflect active issues only.`));let Gt=Oe.complianceScore??Oe.validation?.complianceScore;if(y.debug("[Review] Score sources:",{directScore:Oe.complianceScore,validationScore:Oe.validation?.complianceScore,parsedScore:Gt}),Gt==null){let Se=Bt.match(/(?:\*?\*?(?:##?)?\s*)?SCORE:\s*(\d+)/i);Gt=Se?parseInt(Se[1],10):void 0,y.debug("[Review] Parsed score from response:",Gt)}let cn=Ie.current[ae];cn||(cn=await Ws(ae)||{storyFile:"",componentFile:"[Component].tsx",cssFile:"[Component].css",baseDir:""},cn.storyFile&&(Ie.current[ae]=cn)),y.debug("[Review] Story file paths:",cn);let st=ln.map(Se=>({...Se,file:Se.file||jg(Se.fixTarget,cn)||Hg(Se,cn)}));if(st=Wg(st),y.debug("[Review] After de-duplication:",st.length,"issues"),!w){let Se=st.length;st=st.filter(fe=>fe.property?.toLowerCase()!=="textcontent"&&!fe.description?.toLowerCase().includes("text content")),Se!==st.length&&y.debug("[Review] Filtered out",Se-st.length,"textContent issues (toggle OFF)")}let Fr;lt&&nt&&(Fr=(ht.getState().reviewHistory.find(fe=>fe.id===nt)?.iterationNumber||0)+1);let Fn={id:Xe,componentId:ae,storyId:ae,modelId:l[0],parentReviewId:lt&&nt||void 0,iterationNumber:Fr,figmaFileKey:void 0,figmaNodeId:yt||void 0,figmaFileUrl:Un||void 0,complianceScore:Gt,visualSimilarity:Oe.visualSimilarity,issuesCount:st.filter(Se=>!Se.dismissed).length,issues:st,createdAt:new Date,reviewDurationMs:Date.now()-ne,costUsd:Oe.costUsd,inputTokens:Oe.inputTokens,outputTokens:Oe.outputTokens,cacheCreationTokens:Oe.cacheCreationTokens,cacheReadTokens:Oe.cacheReadTokens,variantMismatch:Oe.variantMismatch,storybookVariant:Oe.storybookVariant,figmaVariant:Oe.figmaVariant};if(y.debug("[useAIReview] About to call addReview with review:",{id:Fn.id,storyId:Fn.storyId,issueCount:Fn.issues?.length,complianceScore:Fn.complianceScore,createdAt:Fn.createdAt?.toISOString(),inputTokens:Fn.inputTokens,outputTokens:Fn.outputTokens,costUsd:Fn.costUsd,cacheCreationTokens:Fn.cacheCreationTokens,cacheReadTokens:Fn.cacheReadTokens}),D(Fn),y.debug("[useAIReview] addReview called successfully"),ae&&L.enableReviewBadges){let Se=st.filter(fe=>!fe.dismissed);xo(ae,{score:Gt??100,issueCount:Se.length,criticalCount:Se.filter(fe=>fe.severity==="critical").length,majorCount:Se.filter(fe=>fe.severity==="major").length,minorCount:Se.filter(fe=>fe.severity==="minor").length})}N("issues");let es=st.filter(Se=>!Se.dismissed).length;y.debug("[Review] Created review with",es,"active issues,",st.length-es,"dismissed");let Fa=yt||ht.getState().currentMapping?.figmaNodeId;y.debug("[Review] Validation check:",{figmaNodeId:yt,effectiveFigmaNodeIdSingle:Fa,hasSessionToken:!!K,selectedProjectId:de,issueCount:st.length}),y.debug("[Review] Issue validation handled server-side. Active:",st.filter(Se=>!Se.dismissed).length,"Dismissed:",st.filter(Se=>Se.dismissed).length)}catch(Xe){y.error("[Review] Failed to parse issues:",Xe)}}else throw en?(y.error("[Review] ERROR: No structured result received from backend!"),y.error("[Review] Streaming text length:",en.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(W){if(W instanceof Error&&W.name==="AbortError"){y.debug("[useAIReview] Review cancelled by user"),me(0,"Review cancelled");return}y.error("[useAIReview] Review error:",W);let Ae=W instanceof Error?W.message:"Review failed";throw f(Ae),ae&&L.enableReviewBadges&&lv(ae),me(0,`Error: ${Ae}`),W}finally{d(!1),se.current=null,pe.current&&(clearTimeout(pe.current),pe.current=null),re(null)}},[e,K,de,ae,qe,l,d,f,p,T,I,v,A,C,F,z,ze,me,R,E,x,B,m,re]),he=Vs(()=>n?.issues?o==="all"?n.issues:n.issues.filter(Ge=>Ge.severity===o):[],[n,o]),vt=Vs(()=>{se.current&&(y.debug("[useAIReview] Cancelling review..."),se.current.abort())},[]);return{isReviewing:e,reviewError:t,reviewResults:n,showReviewMenu:r,severityFilter:o,showStreamingPanel:i,streamingPanelCollapsed:s,streamingMessages:a,streamingProgress:u,streamingStatus:c,startReview:Nt,cancelReview:vt,setShowReviewMenu:g,setSeverityFilter:S,setShowStreamingPanel:C,setStreamingPanelCollapsed:F,addStreamingMessage:k,updateStreamingMessage:R,clearStreamingMessages:z,setStreamingProgress:_,setStreamingStatus:M,resetReview:P,getFilteredIssues:he}};ve();De();je();import{useCallback as AX}from"react";var BX=q();ve();De();import{useEffect as uv,useRef as pv}from"react";import{useStorybookApi as az,useStorybookState as lz,addons as cz}from"storybook/manager-api";var dv="storyArgsUpdated",Kg=()=>{let e=az(),t=lz(),{currentStoryId:n,currentStoryName:r,setCurrentStoryId:o,setCurrentStoryName:i}=rt(),{clearStaleReviewsForStory:s,resetReview:a,isReviewing:u,isValidating:c}=ie(),l=pv(null),d=pv(0);return uv(()=>{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]),uv(()=>{let f=cz.getChannel(),p=null,g=S=>{if(S.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:C,isValidating:F}=ht.getState();if(C||F){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(dv,g),()=>{f.off(dv,g),p&&clearTimeout(p)}},[n,a,u,c]),{currentStoryId:n,currentStoryName:r}};ve();je();pt();import{useCallback as fv}from"react";import{addons as gv}from"storybook/manager-api";var mv=q(),Ho=()=>{let{currentMapping:e,loadingMapping:t,setCurrentMapping:n,refreshMappings:r}=rt(),{sessionToken:o}=we(),{selectedProjectId:i}=Ze(),s=fv(async c=>{if(!o)throw new Error("Not authenticated");if(!i)throw new Error("No project selected");let l=await oe(`${mv}/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{gv.getChannel().emit("uireview/mappings-changed")}catch{}return d.mapping},[o,i,r]),a=fv(async c=>{if(!o)throw new Error("Not authenticated");if(!(await oe(`${mv}/api/mappings?id=${encodeURIComponent(c)}`,{method:"DELETE",headers:{Authorization:`Bearer ${o}`}})).ok)throw new Error("Failed to delete mapping");r();try{gv.getChannel().emit("uireview/mappings-changed")}catch{}},[o,r]);return{currentMapping:e,loadingMapping:t,hasMapping:!!e,setCurrentMapping:n,createMapping:s,deleteMapping:a,refreshMappings:r}};Ns();ve();import{useCallback as Xg,useEffect as hv,useRef as uz}from"react";import{useChannel as pz,addons as xv}from"storybook/manager-api";De();var dz=3e4,fz="forceRemount";function gz(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 mz(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 hz="UICOPILOT/APPLY_FIXES",xz="UICOPILOT/FIX_STARTED",yz="UICOPILOT/FIX_COMPLETED",bz="UICOPILOT/FIX_FAILED",Sz="UICOPILOT/ALL_FIXES_APPLIED",Qg=(e={})=>{let{onComplete:t,storybookRoot:n}=e,{isApplying:r,setIsApplying:o,setApplyFixesResult:i,updateIssueStatus:s,updateIssueGeneratedFix:a,setReviewDetailTab:u}=ie(),c=uz(null),l=Xg(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);hv(()=>()=>l(),[l]),hv(()=>{let g=xv.getChannel(),S=()=>{ht.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",S),()=>g.off("channelWSDisconnect",S)},[l,o,i]);let d=pz({[xz]:({issueId:g})=>{y.debug(`[useApplyFixes] Fix started for issue: ${g}`),a(g,{status:"applying"})},[yz]:({issueId:g,result:S})=>{y.debug(`[useApplyFixes] Fix completed for issue: ${g}`,S),s(g,"applied"),a(g,{status:"applied"})},[bz]:({issueId:g,error:S})=>{y.error(`[useApplyFixes] Fix failed for issue: ${g}`,S),s(g,"failed",S),a(g,{status:"failed",error:S})},[Sz]: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{xv.getChannel().emit(fz,{storyId:ht.getState().currentStoryId}),y.debug("[useApplyFixes] FORCE_REMOUNT emitted")}catch(S){y.warn("[useApplyFixes] Failed to emit FORCE_REMOUNT:",S)}y.debug("[useApplyFixes] Reloading Storybook preview to load fresh CSS..."),await El(),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=Xg(g=>{let S=[],C=[],F=[];for(let k of g){let R=k.currentValue||k.actual||"",z=k.suggestedValue||k.expected||"";if(R&&z&&gz(R,z)){S.push(k);continue}if(mz(k)){C.push(k);continue}let _=k.generatedFix?.filePath||k.file||"";if(!_){y.warn(`[useApplyFixes] Skipping issue ${k.id} - no target file path`);continue}let M=_.toLowerCase().split(".").pop()||"",B=["tsx","jsx","ts","js"].includes(M)?"component":"css";F.push({...k,targetFilePath:_,targetFileType:B})}return{actionable:F,negligible:S,designTokens:C}},[]);return{applyFixes:Xg(g=>{if(r){y.warn("[useApplyFixes] Already applying fixes");return}if(g.length===0){y.warn("[useApplyFixes] No issues to fix");return}let S=f(g);if(S.negligible.length>0&&y.debug(`[useApplyFixes] Filtered ${S.negligible.length} negligible issue(s)`),S.designTokens.length>0&&y.debug(`[useApplyFixes] Skipped ${S.designTokens.length} design token suggestion(s)`),S.actionable.length===0){y.warn("[useApplyFixes] No actionable issues to fix after filtering");return}let C=S.actionable.filter(R=>R.targetFileType==="css"),F=S.actionable.filter(R=>R.targetFileType==="component");if(y.debug("[useApplyFixes] Applying fixes:"),C.length>0){let R=[...new Set(C.map(z=>z.targetFilePath))];y.debug(` - ${C.length} CSS issue(s) in: ${R.join(", ")}`)}if(F.length>0){let R=[...new Set(F.map(z=>z.targetFilePath))];y.debug(` - ${F.length} component issue(s) in: ${R.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:S.actionable.length,error:"Connection lost. Please reload the page and try again."});return}o(!0),l(),c.current=setTimeout(()=>{ht.getState().isApplying&&(y.error("[useApplyFixes] Apply timed out \u2014 no response from server"),o(!1),i({succeeded:0,failed:0,total:S.actionable.length,error:"Apply timed out. The Storybook server may have disconnected. Please reload the page and try again."}))},dz),d(hz,{issues:S.actionable,storybookRoot:n||void 0})},[d,r,o,i,f,n,l]),isApplying:r}};ve();je();import{useState as eQ}from"react";var rQ=q();ve();import{useState as Wo}from"react";je();De();pt();var wz=q();async function zl(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 oe(`${wz}/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 yv(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=>zl(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"}}Ls();Pg();Ns();De();je();var vz=["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"],kz=["no changes required","no changes needed","no fix required","no fix needed","values already match","already matches","matches expected","correctly implemented","implementation is correct"],Cz=q();function Jg(){let[e,t]=Wo(!1),[n,r]=Wo(null),[o,i]=Wo(null),[s,a]=Wo(null),[u,c]=Wo(null),[l,d]=Wo(null),[f,p]=Wo(null),{sessionToken:g}=we(),{selectedProjectId:S}=Ze(),{currentStoryId:C,currentStoryName:F}=rt(),{workspacePath:k,updateIssueGeneratedFix:R,batchUpdateIssueGeneratedFixes:z,includeComponentIssues:_,dismissIssue:M,recalculateScore:B,addStreamingMessage:m}=ie();return{generateBatchFixes:async b=>{if(!g){r("Not authenticated");return}if(!S){r("No project selected");return}if(!C){r("No story selected");return}if(b.length===0){r("No issues provided");return}t(!0),r(null),i(null),c(null),d(null),a({total:b.length,completed:0});let E=b.map(h=>({issueId:h.id,generatedFix:{code:"",diffPreview:"",filePath:h.file||"",confidence:0,strategy:"",status:"generating"}}));z(E);try{y.debug("[useBatchGenerateFixes] Generating fixes for",b.length,"issues");let h=null;try{let w=$s();w?.computed&&(h=w.computed,y.debug("[useBatchGenerateFixes] Extracted computed styles for fix context"))}catch(w){y.warn("[useBatchGenerateFixes] Could not extract computed styles:",w)}let T=null;try{T=await Ws(C),T&&y.debug("[useBatchGenerateFixes] Resolved file paths from index.json:",T)}catch(w){y.warn("[useBatchGenerateFixes] Could not resolve story file paths:",w)}let I=await fetch(`${Cz}/api/fixes/generate-batch`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({projectId:S,storyId:C,workspacePath:k,includeComponentIssues:_,computedStyles:h,storyFilePaths:T,reviewContext:{storyName:F||void 0,variantArgs:Ci()||void 0},issues:b.map(w=>({id:w.id,dbId:w.dbId,title:w.title,description:w.description,property:w.property,currentValue:w.currentValue,suggestedValue:w.suggestedValue,file:w.file,lineNumber:w.lineNumber,severity:w.severity,type:w.type,fixTarget:w.fixTarget,domElement:w.domElement,figmaContext:w.figmaContext,suggestedFix:w.suggestedFix}))})});if(!I.ok){let w=await I.json().catch(()=>({}));throw new Error(w.error||"Batch fix generation failed")}let v=await I.json();if(!v.success)throw new Error(v.error||"Batch fix generation failed");if(y.debug("[useBatchGenerateFixes] Generated",v.result.fixes.length,"fixes"),v.result.storybookRoot&&(p(v.result.storybookRoot),y.debug("[useBatchGenerateFixes] Stored storybookRoot:",v.result.storybookRoot)),v.result.selfReview&&(d(v.result.selfReview),y.debug("[useBatchGenerateFixes] Self-review:",v.result.selfReview)),v.result.partialFailure){let{failedBatches:w,errors:j}=v.result.partialFailure;y.warn(`[useBatchGenerateFixes] Partial failure: ${w.join(", ")} batch(es) failed`),y.warn("[useBatchGenerateFixes] Errors:",j),r(`Some fixes couldn't be generated (${w.join(", ")}): ${j[0]||"Unknown error"}`)}a({total:b.length,completed:v.result.fixes.length});let A=new Set(v.result.fixes.map(w=>w.issueId)),P=b.filter(w=>!A.has(w.id));P.length>0&&(y.warn(`[useBatchGenerateFixes] ${P.length} issues not returned by API, marking as failed`),P.forEach(w=>{R(w.id,{code:"",diffPreview:"",filePath:w.file||"",confidence:0,strategy:"skipped",status:"failed",error:"Fix generation skipped by server"})})),v.timing&&(i({durationSec:v.timing.durationSec,issueCount:v.timing.issueCount,avgPerIssueSec:v.timing.avgPerIssueSec}),y.debug(`[useBatchGenerateFixes] Generation took ${v.timing.durationSec}s for ${v.timing.issueCount} issues`)),v.result?.usage&&(c({inputTokens:v.result.usage.inputTokens||0,outputTokens:v.result.usage.outputTokens||0,costUsd:v.result.usage.costUsd||0,modelId:v.result.usage.modelId||"unknown",provider:v.result.usage.provider||"unknown"}),y.debug(`[useBatchGenerateFixes] Token usage: ${v.result.usage.inputTokens} in, ${v.result.usage.outputTokens} out, $${v.result.usage.costUsd?.toFixed(4)}`));let D=[],N=[];if(v.result.fixes.forEach(w=>{let j=w.noChangesNeeded===!0;if(!j){let K=(w.fixStrategy||"").toLowerCase(),ee=(w.generatedCode||"").toLowerCase(),re=(w.diffPreview||"").toLowerCase(),de=vz.some(qe=>K.includes(qe.toLowerCase())||K.replace(/[-_]/g,"").includes(qe.replace(/[-_]/g,""))),ae=kz.some(qe=>ee.includes(qe)||re.includes(qe));j=de||ae}let G=b.find(K=>K.id===w.issueId);if(j&&G){let K=G.suggestedValue,ee=G.currentValue;K&&ee&&!$o(K,ee)&&(y.debug(`[useBatchGenerateFixes] SAFETY CHECK: values differ (expected="${K}", actual="${ee}"), NOT auto-dismissing issue ${w.issueId}`),j=!1)}let L=G?.programmaticallyVerified===!0;if(y.debug(`[useBatchGenerateFixes] Processing fix for issue ${w.issueId}:`,{isFalsePositive:j,isProgrammaticIssue:L,detectedBy:G?.detectedBy,noChangesNeeded:w.noChangesNeeded,fixStrategy:w.fixStrategy,title:G?.title?.substring(0,50)}),L&&j&&(y.debug(`[useBatchGenerateFixes] SKIPPING auto-dismiss for programmatic issue ${w.issueId} (detectedBy: ${G?.detectedBy})`),j=!1),j){let K=`Auto-dismissed: ${w.fixStrategy} - values already match`;y.debug(`[useBatchGenerateFixes] Auto-dismissing issue ${w.issueId} - noChangesNeeded: ${w.noChangesNeeded}, strategy: "${w.fixStrategy}"`),M(w.issueId,K),D.push({localId:w.issueId,dbId:G?.dbId,dismissReason:K}),N.push({issueId:w.issueId,generatedFix:{code:w.generatedCode||"",diffPreview:w.diffPreview||"",filePath:w.filePath,confidence:w.confidence,strategy:w.fixStrategy,status:"ready",error:void 0,noChangesExplanation:w.noChangesExplanation}})}else{let K=w.error||w.fixStrategy==="skipped"?"failed":"ready";N.push({issueId:w.issueId,generatedFix:{code:w.generatedCode,diffPreview:w.diffPreview,filePath:w.filePath,confidence:w.confidence,strategy:w.fixStrategy,status:K,error:w.error,noChangesExplanation:w.noChangesExplanation}})}}),N.length>0&&(y.debug(`[useBatchGenerateFixes] Applying ${N.length} fix updates in batch`),z(N)),D.length>0){if(y.debug(`[useBatchGenerateFixes] Auto-dismissed ${D.length} false positive(s), recalculating score`),B(),g){let j=D.filter(G=>G.dbId).map(G=>({dbId:G.dbId,dismissed:!0,dismissReason:G.dismissReason,dismissedBy:"system"}));j.length>0&&(y.debug(`[useBatchGenerateFixes] Syncing ${j.length} dismissals to server`),yv(j,g).then(G=>{G.success?y.debug(`[useBatchGenerateFixes] Server score updated to: ${G.newScore}`):y.warn("[useBatchGenerateFixes] Failed to sync dismissals:",G.error)}).catch(G=>{y.error("[useBatchGenerateFixes] Error syncing dismissals:",G)}))}let w=D.length===1?"1 issue was auto-dismissed as a false positive (values already match the design). The compliance score has been recalculated.":`${D.length} issues were auto-dismissed as false positives (values already match the design). The compliance score has been recalculated.`;m({role:"system",content:w})}y.debug("[useBatchGenerateFixes] Updated",v.result.fixes.length,"issues with fixes")}catch(h){y.error("[useBatchGenerateFixes] Failed to generate batch fixes:",h),r(h?.message||"Failed to generate batch fixes");let T=b.map(I=>({issueId:I.id,generatedFix:{code:"",diffPreview:"",filePath:I.file||"",confidence:0,strategy:"",status:"failed",error:h?.message||"Failed to generate fix"}}));z(T)}finally{t(!1),setTimeout(()=>a(null),1500)}},isGenerating:e,error:n,timing:o,progress:s,usage:u,selfReview:l,lastStorybookRoot:f}}ve();De();je();pt();import{useState as Zg,useCallback as em}from"react";var Tz=q();function tm(){let[e,t]=Zg([]),[n,r]=Zg(!1),[o,i]=Zg(null),{sessionToken:s}=we(),{selectedProjectId:a}=Ze(),{currentStoryId:u}=rt(),{setReviewResults:c}=ie(),l=em(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 oe(`${Tz}/api/reviews/list?${p.toString()}`,{method:"GET",credentials:"include",headers:{Authorization:`Bearer ${s}`}});if(!g.ok){let C=await g.json().catch(()=>({}));throw new Error(C.error||"Failed to fetch reviews")}let S=await g.json();if(!S.success)throw new Error("Failed to fetch reviews");y.debug("[useReviewHistory] Fetched",S.reviews.length,"reviews for:",u),t(S.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=em(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(k){y.error("[useReviewHistory] Failed to parse models:",k),g=["claude-sonnet-4-20250514"]}else g=p.models;let S=p.issues.map(k=>({id:k.id,reviewId:p.id,type:k.type,severity:k.severity,title:k.description,description:k.description,file:void 0,lineNumber:void 0,property:k.property,currentValue:k.actual,suggestedValue:k.expected,suggestedCode:k.suggestedFix||void 0,status:k.status,dismissed:k.dismissed||!1,dismissReason:k.dismissReason,dismissedBy:k.dismissedBy,selectedForFix:!1,error:void 0,createdAt:new Date(k.createdAt)})),C=p.completedAt&&p.createdAt?new Date(p.completedAt).getTime()-new Date(p.createdAt).getTime():void 0,F=p.storyId||"";if(c({id:p.id,componentId:"",storyId:F,modelId:g[0]||"claude-sonnet-4-5-20250929",complianceScore:p.complianceScore,issuesCount:p.issuesCount,issues:S,createdAt:new Date(p.createdAt),timestamp:new Date(p.createdAt).toISOString(),costUsd:p.costUsd,inputTokens:p.inputTokens,outputTokens:p.outputTokens,reviewDurationMs:C}),F){let k=p.issues.filter(M=>!M.dismissed),R=k.filter(M=>M.severity==="critical").length,z=k.filter(M=>M.severity==="major").length,_=k.filter(M=>M.severity==="minor").length;xo(F,{score:p.complianceScore,issueCount:k.length,criticalCount:R,majorCount:z,minorCount:_})}},[c]),f=em(p=>{let g=e.find(S=>S.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}}ve();De();import{useEffect as Iz,useState as Fz,useRef as Nl}from"react";import{useChannel as Ez}from"storybook/manager-api";var Az="UICOPILOT/WORKSPACE_PATH",bv="UICOPILOT/REQUEST_WORKSPACE_PATH",Pz=3e3,Lz=500,Mz=5,nm=()=>{let[e,t]=Fz({isSupported:!1,isDetecting:!0,workspacePath:null}),{setWorkspacePath:n}=ie(),r=Nl(!1),o=Nl(null),i=Nl(0),s=Nl(null),a=Ez({[Az]:({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 Iz(()=>(y.debug("[useAutoApplySupport] Requesting workspace path from server (retry 0)..."),a(bv,{}),s.current=setInterval(()=>{!r.current&&i.current<Mz&&(i.current++,y.debug(`[useAutoApplySupport] Requesting workspace path from server (retry ${i.current})...`),a(bv,{}))},Lz),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}))}},Pz),()=>{o.current&&clearTimeout(o.current),s.current&&clearInterval(s.current)}),[a]),e},rm=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}};ve();je();import{useEffect as Bz,useRef as Dz}from"react";var DQ=q(),Rz=new Set;function om(){let{sessionToken:e}=we(),{selectedProjectId:t}=Ze(),n=Dz(!1);Bz(()=>{t&&Rz.add(t)},[e,t])}ve();import{useCallback as zz,useState as Sv}from"react";function im(){let[e,t]=Sv(!1),[n,r]=Sv(null),{currentStoryId:o}=rt(),{currentReviewId:i}=ie();return{exportPDF:zz(async()=>{if(!i){r("No review to export");return}t(!0),r(null);try{let[{default:a},{jsPDF:u}]=await Promise.all([import("html2canvas"),import("jspdf")]),c=document.querySelector('[data-testid="issues-panel"]')||document.querySelector(".issues-list-container")||document.querySelector('[class*="IssuesList"]');if(c)await wv(a,u,c,o);else{let l=document.querySelector("#storybook-panel-root")||document.querySelector('[id*="panel-tab-content"]')||document.querySelector(".sb-show-main");if(!l)throw new Error("Could not find panel to export");await wv(a,u,l,o)}}catch(a){console.error("[useExportPDF] Export failed:",a),r(a instanceof Error?a.message:"Failed to export PDF")}finally{t(!1)}},[i,o]),isExporting:e,error:n}}async function wv(e,t,n,r){let o=await e(n,{backgroundColor:"#ffffff",scale:2,logging:!1,useCORS:!0,allowTaint:!0}),i=o.toDataURL("image/png"),s=o.width,a=o.height,u=210,c=297,l=10,d=u-l*2,f=d/(s/2),p=a/2*f,g=new t({orientation:(p>c-l*2,"portrait"),unit:"mm",format:"a4"});g.setFillColor("#0ea5e9"),g.rect(0,0,u,20,"F"),g.setTextColor("#ffffff"),g.setFontSize(14),g.setFont("helvetica","bold"),g.text("Design Review Report",l,13);let S=new Date().toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});g.setFontSize(10),g.setFont("helvetica","normal"),g.text(S,u-l,13,{align:"right"});let C=r?Nz(r):"Component Review";g.setTextColor("#1f2937"),g.setFontSize(16),g.setFont("helvetica","bold"),g.text(C,l,30);let F=38,k=c-F-15;if(p<=k)g.addImage(i,"PNG",l,F,d,p);else{let _=p,M=0,B=!0;for(;_>0;){B||g.addPage();let m=B?F:l,x=B?k:c-l*2-10,b=Math.min(_,x),E=b/f*2,h=document.createElement("canvas");h.width=s,h.height=E;let T=h.getContext("2d");if(T){T.drawImage(o,0,M,s,E,0,0,s,E);let I=h.toDataURL("image/png");g.addImage(I,"PNG",l,m,d,b)}M+=E,_-=b,B=!1}}let R=g.getNumberOfPages();for(let _=1;_<=R;_++)g.setPage(_),g.setDrawColor("#e5e7eb"),g.setLineWidth(.3),g.line(l,c-12,u-l,c-12),g.setTextColor("#6b7280"),g.setFontSize(8),g.setFont("helvetica","normal"),g.text("Generated by UI Copilot",l,c-7),g.text(`Page ${_} of ${R}`,u-l,c-7,{align:"right"});let z=`design-review-${(r||"report").replace(/[^a-zA-Z0-9]/g,"-")}.pdf`;g.save(z)}function Nz(e){let t=e.replace(/^(example|stories)-/i,""),[n,r]=t.split("--"),o=n.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "),i=r?r.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" "):null;return i?`${o} / ${i}`:o}import{useState as Vo,useMemo as Mv,useCallback as Ai}from"react";je();De();pt();import{useState as Kr,useEffect as Ol,useRef as Ei,useCallback as sm}from"react";var Oz=300;function vv({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o=20,enabled:i=!0}){let[s,a]=Kr([]),[u,c]=Kr({}),[l,d]=Kr(0),[f,p]=Kr([]),[g,S]=Kr(new Set),[C,F]=Kr(!1),[k,R]=Kr(!1),[z,_]=Kr(null),M=Ei(1),B=Ei(null),m=Ei(null),[x,b]=Kr(0),E=Ei(!1),h=Ei({projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o});h.current={projectId:e,typeFilter:t,search:n,figmaPage:r,limit:o};let T=sm(async(D,N,w=!1)=>{let{projectId:j,typeFilter:G,search:L,figmaPage:K,limit:ee}=h.current;if(!j||!G)return;B.current&&B.current.abort();let re=new AbortController;B.current=re,N?R(!0):F(!0),_(null);try{let de=q(),ae=localStorage.getItem("uicopilot_session_token");if(!ae)throw new Error("Not authenticated. Please connect to UI Copilot first.");let qe=new URLSearchParams({projectId:j,page:String(D),limit:String(ee)});G&&qe.append("type",G),K&&qe.append("figmaPage",K),L.trim()&&qe.append("search",L.trim()),w&&qe.append("refresh","true");let tt=await fetch(`${de}/api/figma/frames?${qe.toString()}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${ae}`},signal:re.signal});if(!tt.ok){let me=await tt.json();throw new Error(me.error||"Failed to fetch frames")}let se=await tt.json(),pe=se.frames||[],Ie=se.thumbnails||{},ze=tt.headers.get("X-Cache-Status");if(pe.length===0&&D===1&&!N&&!w&&!E.current&&ze!=="HIT"){y.debug("[useFigmaFrameFetch] Empty result (cache miss), retrying with refresh=true"),E.current=!0,await T(1,!1,!0);return}N?(a(me=>[...me,...pe]),c(me=>({...me,...Ie}))):(a(pe),c(Ie)),d(se.total||pe.length),se.pages&&p(se.pages),se.cacheDiff?.added&&S(new Set(se.cacheDiff.added)),M.current=D}catch(de){if(de instanceof DOMException&&de.name==="AbortError")return;let ae=de instanceof Error?de.message:"Failed to fetch Figma frames.";_(ae),y.error("Error fetching frames:",de)}finally{re.signal.aborted||(F(!1),R(!1))}},[]);Ol(()=>{if(!i||!e||!t)return;E.current=!1,m.current&&clearTimeout(m.current);let D=n.trim()?Oz:0;return m.current=setTimeout(()=>{M.current=1,T(1,!1)},D),()=>{m.current&&clearTimeout(m.current)}},[e,t,n,r,i,x,T]);let I=Ei(new Set);Ol(()=>{if(s.length===0)return;let D={};for(let N of s)N.thumbnailCdnUrl&&!u[N.id]&&(D[N.id]=N.thumbnailCdnUrl);Object.keys(D).length>0&&c(N=>({...N,...D}))},[s]),Ol(()=>{if(s.length===0)return;let D=s.filter(w=>!w.thumbnailCdnUrl&&!u[w.id]&&!I.current.has(w.id)).map(w=>w.id);if(D.length===0)return;D.forEach(w=>I.current.add(w)),(async()=>{try{let{projectId:w}=h.current,j=q(),G=localStorage.getItem("uicopilot_session_token");if(!G||!w)return;let L=await oe(`${j}/api/figma/frames?projectId=${w}&thumbnailIds=${D.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${G}`}});if(L.ok){let K=await L.json();K.thumbnails&&Object.keys(K.thumbnails).length>0&&c(ee=>({...ee,...K.thumbnails}))}}catch(w){D.forEach(j=>I.current.delete(j)),y.error("Failed to fetch frame thumbnails:",w)}})()},[s,u]),Ol(()=>()=>{B.current&&B.current.abort(),m.current&&clearTimeout(m.current)},[]);let v=sm(async()=>{let D=M.current+1;await T(D,!0)},[T]),A=sm(()=>{E.current=!1,M.current=1,a([]),c({}),b(D=>D+1)},[]),P=s.length<l;return{frames:s,thumbnails:u,totalFrames:l,availablePages:f,recentlyAdded:g,isLoading:C,loadingMore:k,hasMore:P,loadMore:v,refresh:A,error:z}}je();De();pt();import{useState as _l,useCallback as $l,useRef as _z}from"react";function kv({projectId:e}){let[t,n]=_l({}),[r,o]=_l({}),[i,s]=_l(new Set),[a,u]=_l(new Set),c=_z({}),l=$l(async g=>{if(!(!e||i.has(g))){s(S=>new Set(S).add(g));try{let S=q(),C=localStorage.getItem("uicopilot_session_token"),F=await oe(`${S}/api/figma/variants?projectId=${e}&componentSetId=${g}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`}});if(F.ok){let k=await F.json();if(k.variants){n(z=>({...z,[g]:k.variants}));let R={};for(let z of k.variants)z.thumbnailCdnUrl&&(R[z.id]=z.thumbnailCdnUrl);o(z=>({...z,[g]:{...z[g]||{},...R}})),c.current[g]||(c.current[g]=new Set),Object.keys(R).forEach(z=>c.current[g].add(z))}else o(R=>({...R,[g]:R[g]||{}}))}else o(k=>({...k,[g]:{}}))}catch(S){y.error("Failed to fetch variant metadata:",S),o(C=>({...C,[g]:{}}))}finally{s(S=>{let C=new Set(S);return C.delete(g),C})}}},[e,i]),d=$l(async(g,S)=>{if(!e||S.length===0)return;c.current[g]||(c.current[g]=new Set);let C=r[g]||{},F=S.filter(k=>!c.current[g].has(k)&&!C[k]);if(F.length!==0){F.forEach(k=>c.current[g].add(k)),u(k=>new Set(k).add(g));try{let k=q(),R=localStorage.getItem("uicopilot_session_token"),z=await oe(`${k}/api/figma/variants?projectId=${e}&componentSetId=${g}&thumbnailIds=${F.join(",")}`,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${R}`}});if(z.ok){let _=await z.json();_.thumbnails&&Object.keys(_.thumbnails).length>0&&o(M=>({...M,[g]:{...M[g]||{},..._.thumbnails}}))}}catch(k){y.error("Failed to fetch variant thumbnails:",k),F.forEach(R=>c.current[g]?.delete(R))}finally{u(k=>{let R=new Set(k);return R.delete(g),R})}}},[e]),f=$l(g=>{o(S=>{let C={...S};return delete C[g],C}),n(S=>{let C={...S};return delete C[g],C}),delete c.current[g]},[]),p=$l(()=>{o({}),n({}),c.current={}},[]);return{variantChildren:t,variantThumbnails:r,loadingVariants:i,loadingThumbnails:a,fetchVariants:l,fetchVariantThumbnails:d,clearVariantsForSet:f,clearAllVariants:p}}je();Ns();ve();De();pt();import{useState as Cv,useEffect as Tv,useRef as Iv,useCallback as am}from"react";function Fv({expandedSetId:e,availableFilters:t,filtersReady:n}){let[r,o]=Cv(null),[i,s]=Cv(!1),a=Iv(null),u=Iv(new Set),c=am(async()=>{if(!e||!n||t.length===0||a.current===e||u.current.has(e))return;let f=Ci();if(!f||Object.keys(f).length===0)return;let p=ht.getState().currentStoryId||"",g=p.replace(/--/g," / ").replace(/-/g," ").replace(/\b\w/g,S=>S.toUpperCase());a.current=e,s(!0),o(null);try{let S=q(),C=localStorage.getItem("uicopilot_session_token"),F=await oe(`${S}/api/figma/match-filters`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({storyName:g,storyId:p,storyArgs:f,availableFilters:t.map(k=>({property:k.property,values:k.values}))})});if(F.ok){let k=await F.json();k.confidence>0&&Object.keys(k.suggestedFilters).length>0&&(y.debug("[useFilterSuggestion] Suggestion:",k),o(k))}}catch(S){y.error("[useFilterSuggestion] Error:",S)}finally{s(!1)}},[e,t,n]);Tv(()=>{c()},[c]),Tv(()=>{e||(o(null),a.current=null)},[e]);let l=am(()=>{},[]),d=am(()=>{e&&u.current.add(e),o(null)},[e]);return{suggestion:r,isLoading:i,applySuggestion:l,dismissSuggestion:d}}function Ev(e,t,n){let r=[];return e&&r.push("COMPONENT_SET"),t&&r.push("FRAME"),n&&r.push("COMPONENT"),r.join(",")}function Av(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 Pv(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 Lv(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 Gs({projectId:e,limit:t=20,enabled:n=!0}){let[r,o]=Vo(!0),[i,s]=Vo(!1),[a,u]=Vo(!1),[c,l]=Vo(""),[d,f]=Vo(""),[p,g]=Vo([]),[S,C]=Vo(new Set),F=Ai(se=>{l(se),p.length>0&&g([]),S.size>0&&C(new Set)},[p.length,S.size]),k=Ev(r,i,a),{frames:R,thumbnails:z,totalFrames:_,availablePages:M,recentlyAdded:B,isLoading:m,loadingMore:x,hasMore:b,loadMore:E,refresh:h,error:T}=vv({projectId:e,typeFilter:k,search:c,figmaPage:d||void 0,limit:t,enabled:n&&!!k}),{variantChildren:I,variantThumbnails:v,loadingVariants:A,loadingThumbnails:P,fetchVariants:D,fetchVariantThumbnails:N,clearVariantsForSet:w,clearAllVariants:j}=kv({projectId:e}),G=Mv(()=>{let se=Av(I),pe=Pv(R),Ie={};for(let ze of[...se,...pe])Ie[ze.property]||(Ie[ze.property]=new Set),ze.values.forEach(me=>Ie[ze.property].add(me));return Object.entries(Ie).map(([ze,me])=>({property:ze,values:Array.from(me).sort()}))},[I,R]),L=S.size===1?Array.from(S)[0]:null,K=Fv({expandedSetId:L,availableFilters:G,filtersReady:G.length>0}),ee=Ai(()=>{if(!K.suggestion)return;let{suggestedFilters:se}=K.suggestion,pe=Object.entries(se).map(([Ie,ze])=>({property:Ie,value:ze}));g(pe),K.dismissSuggestion()},[K.suggestion]),re=Mv(()=>p.some(se=>se.value)?R.filter(se=>Lv(se,p,I[se.id])):R,[R,p,I]),de=Ai((se,pe)=>{pe.stopPropagation();let Ie=!S.has(se);C(ze=>{let me=new Set(ze);return me.has(se)?me.delete(se):me.add(se),me}),Ie&&!I[se]&&!A.has(se)&&D(se)},[S,I,A,D]),ae=Ai((se,pe)=>{let Ie=pe===""?null:pe;g(ze=>ze.find(Nt=>Nt.property===se)?ze.map(Nt=>Nt.property===se?{...Nt,value:Ie}:Nt):[...ze,{property:se,value:Ie}])},[]),qe=Ai(()=>{g([])},[]),tt=Ai(se=>{let pe=R.find(Ie=>Ie.id===se);if(pe?.thumbnailCdnUrl)return pe.thumbnailCdnUrl;if(z[se])return z[se];for(let Ie of Object.values(v))if(Ie[se])return Ie[se]},[z,v]);return{frames:R,filteredFrames:re,thumbnails:z,totalFrames:_,isLoading:m,loadingMore:x,hasMore:b,error:T,loadMore:E,refresh:h,search:c,setSearch:F,figmaPage:d,setFigmaPage:f,availablePages:M,recentlyAdded:B,showComponentSets:r,showFrames:i,showComponents:a,setShowComponentSets:o,setShowFrames:s,setShowComponents:u,variantFilters:p,availableFilters:G,handleFilterChange:ae,clearFilters:qe,expandedSets:S,toggleExpanded:de,variantChildren:I,variantThumbnails:v,loadingVariants:A,loadingThumbnails:P,fetchVariantThumbnails:N,resolveThumbnail:tt,filterSuggestion:K.suggestion,filterSuggestionLoading:K.isLoading,applySuggestedFilters:ee,dismissFilterSuggestion:K.dismissSuggestion}}ve();import{useEffect as Mr,useCallback as Wz,useState as Vz,useRef as Gz}from"react";import{useChannel as qz}from"storybook/manager-api";function bo(e){return e.status===401||e.status===403}var kn=class extends Error{constructor(t){super(`Authentication failed (${t}). Please reconnect.`),this.name="AuthError",this.status=t}};function Bv(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 console.error("UI Copilot: Error parsing Figma URL:",t),null}}De();je();je();pt();var $z=q();async function lm(e){let t=await oe(`${$z}/api/projects`,{headers:{Authorization:`Bearer ${e}`}});if(bo(t))throw new kn(t.status);return t.ok?(await t.json()).projects||[]:[]}je();pt();var Uz=q();async function cm(e,t,n){let r=await oe(`${Uz}/api/mappings?projectId=${t}&storyId=${n}`,{headers:{Authorization:`Bearer ${e}`}});if(bo(r))throw new kn(r.status);return r.ok&&(await r.json()).mapping||null}je();pt();var jz=q();async function um(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 oe(`${jz}/api/reviews/list?${i}`,{headers:{Authorization:`Bearer ${e}`}});if(bo(s))throw new kn(s.status);if(!s.ok)return[];let a=await s.json();return a.success?a.reviews||[]:[]}je();pt();var Hz=q();async function pm(e,t){let n=await oe(`${Hz}/api/reviews/status?projectId=${t}`,{headers:{Authorization:`Bearer ${e}`}});if(bo(n))throw new kn(n.status);if(!n.ok)return{};let r=await n.json();return r.success?r.statuses||{}:{}}function Yz(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 Kz=q(),Xz="UICOPILOT/WORKSPACE_PATH",Qz="UICOPILOT/REQUEST_WORKSPACE_PATH",dm=!1;function fm(){let{sessionToken:e,setSessionToken:t,setAuthError:n}=we(),{projects:r,selectedProjectId:o,currentStorybookPath:i,setProjects:s,setSelectedProjectId:a,setLoadingProjects:u,setCurrentStorybookPath:c}=Ze(),{currentStoryId:l,mappingsRefreshKey:d,setFigmaFileUrl:f,setCurrentMapping:p,setMappingSource:g,setLoadingMapping:S}=rt(),{setReviewResults:C,setReviewDetailTab:F,setStorybookImageUrl:k,setFigmaImageUrl:R,setFullPrompt:z,setFullResponse:_,bulkAddReviews:M}=ie(),[B,m]=Vz([]),x=Gz(null);Mr(()=>{let h=T=>{T.origin.startsWith(Kz)&&T.data?.type==="UICOPILOT_AUTH_SUCCESS"&&T.data.token&&(y.debug("[useDataInit] OAuth success, setting token"),t(T.data.token))};return window.addEventListener("message",h),()=>window.removeEventListener("message",h)},[t]);let b=qz({[Xz]:h=>{y.debug("[useDataInit] Received workspace path:",h.path),c(h.path)}});Mr(()=>{b(Qz)},[b]),Mr(()=>{if(!e)return;let h=!1;return(async()=>{try{u(!0);let I=await lm(e);h||(s(I),n(null))}catch(I){I instanceof kn&&n(I.message),y.error("[useDataInit] Failed to fetch projects:",I)}finally{h||u(!1)}})(),()=>{h=!0}},[e,s,u]),Mr(()=>{if(!i||r.length===0)return;let h=r.find(T=>T.storybookRoot===i);h&&o!==h.id&&(y.debug("[useDataInit] Auto-selecting project:",h.name),a(h.id))},[i,r,o,a]),Mr(()=>{if(!o||r.length===0)return;let h=r.find(I=>I.id===o),T=h?.figmaFileId;if(h&&typeof T=="string"&&T){let I=T,v=I.includes("figma.com")&&Bv(I)?.fileKey||I;f(`https://www.figma.com/file/${v}`)}},[o,r,f]),Mr(()=>!e||!o||dm?void 0:(dm=!0,(async()=>{try{let T=await pm(e,o);for(let[I,v]of Object.entries(T))xo(I,{score:v.score,issueCount:v.issueCount,criticalCount:v.criticalCount,majorCount:v.majorCount,minorCount:v.minorCount});y.debug("[useDataInit] Populated sidebar badges for",Object.keys(T).length,"stories")}catch(T){T instanceof kn&&n(T.message),y.error("[useDataInit] Failed to fetch review statuses:",T)}})(),()=>{dm=!1}),[e,o]),Mr(()=>{if(!e||!o||!l)return;let h=!1;return(async()=>{try{S(!0);let I=await cm(e,o,l);if(h)return;I?(p(I),g("database")):(p(null),g(null))}catch(I){I instanceof kn&&n(I.message),y.error("[useDataInit] Failed to fetch mapping:",I)}finally{h||S(!1)}})(),()=>{h=!0}},[e,o,l,d,p,g,S]),Mr(()=>{m([]),x.current=null},[l]),Mr(()=>{if(!e||!o||!l)return;let h=!1;return(async()=>{try{let I=await um(e,o,l,10,!0);if(!h){m(I);let v=I.map(A=>Yz(A)).filter(Boolean);v.length>0&&M(v)}}catch(I){I instanceof kn&&n(I.message),y.error("[useDataInit] Failed to fetch reviews:",I)}})(),()=>{h=!0}},[e,o,l]);let E=Wz(h=>{y.debug("[useDataInit] Applying review:",h.id,"with",h.issues.length,"issues");let T=[];if(typeof h.models=="string")try{T=JSON.parse(h.models)}catch{T=["claude-sonnet-4-20250514"]}else T=h.models;let I=h.issues.map(P=>({id:P.id,reviewId:h.id,type:P.type,severity:P.severity,title:P.description,description:P.description,file:void 0,lineNumber:void 0,property:P.property,currentValue:P.actual,suggestedValue:P.expected,suggestedCode:P.suggestedFix||void 0,status:P.status,dismissed:P.dismissed||!1,dismissReason:P.dismissReason,dismissedBy:P.dismissedBy,figmaContext:P.figmaContext,selectedForFix:!1,error:void 0,createdAt:new Date(P.createdAt)})),v=h.completedAt&&h.createdAt?new Date(h.completedAt).getTime()-new Date(h.createdAt).getTime():void 0,A=h.storyId||"";if(C({id:h.id,componentId:"",storyId:A,modelId:T[0]||"claude-sonnet-4-5-20250929",complianceScore:h.complianceScore,issuesCount:h.issuesCount,issues:I,createdAt:new Date(h.createdAt),timestamp:new Date(h.createdAt).toISOString(),costUsd:h.costUsd,inputTokens:h.inputTokens,outputTokens:h.outputTokens,reviewDurationMs:v}),h.storybookScreenshot&&(k(h.storybookScreenshot),y.debug("[useDataInit] Loaded persisted Storybook screenshot")),h.figmaScreenshot&&(R(h.figmaScreenshot),y.debug("[useDataInit] Loaded persisted Figma screenshot")),h.aiPrompt&&(z(h.aiPrompt),y.debug("[useDataInit] Loaded persisted AI prompt")),h.aiResponse&&(_(h.aiResponse),y.debug("[useDataInit] Loaded persisted AI response")),A){let P=h.issues.filter(j=>!j.dismissed),D=P.filter(j=>j.severity==="critical").length,N=P.filter(j=>j.severity==="major").length,w=P.filter(j=>j.severity==="minor").length;xo(A,{score:h.complianceScore,issueCount:P.length,criticalCount:D,majorCount:N,minorCount:w})}},[C,k,R,z,_]);Mr(()=>{if(B.length>0&&l&&x.current!==l){let h=B[0];h&&h.storyId===l&&(y.debug("[useDataInit] Auto-loading review:",h.id,"for:",l),x.current=l,E(h),F("issues"))}},[B,l,E,F])}import{styled as qs}from"storybook/theming";var Jz=qs.div({display:"flex",gap:"10px",marginTop:"8px"}),Dv=qs.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer"})),Zz=qs.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"})),eN=qs.div({display:"flex",alignItems:"center",gap:"8px"}),tN=qs(er)(({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"})),Rv=()=>{let{sessionToken:e,authMethod:t,setAuthMethod:n,startOAuth:r,logout:o}=Bs();return Lt.createElement(Lt.Fragment,null,Lt.createElement(ts,null,Lt.createElement(ns,null,"Authentication Method"),Lt.createElement(Jz,null,Lt.createElement(Dv,null,Lt.createElement("input",{type:"radio",name:"authMethod",checked:t==="oauth",onChange:()=>n("oauth")}),"OAuth (Recommended)"),Lt.createElement(Dv,null,Lt.createElement("input",{type:"radio",name:"authMethod",checked:t==="apikey",onChange:()=>n("apikey")}),"API Key"))),t==="oauth"&&Lt.createElement(ts,null,Lt.createElement(ns,null,"Connect to UI Copilot"),e?Lt.createElement(Zz,null,Lt.createElement(eN,null,Lt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),Lt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to UI Copilot")),Lt.createElement(tN,{onClick:o},"Disconnect")):Lt.createElement("div",null,Lt.createElement(Xc,{style:{marginBottom:"12px"}},"Connect to UI Copilot to manage projects and integrations. This will open a browser window for authentication."),Lt.createElement(er,{onClick:r},"\u{1F517} Connect to UI Copilot"))),t==="apikey"&&Lt.createElement(ts,null,Lt.createElement(ns,null,"API Key"),Lt.createElement(Xc,{style:{marginBottom:"12px"}},"Enter your UI Copilot API key below."),Lt.createElement(rs,{type:"password",placeholder:"Enter API key",disabled:!0}),Lt.createElement(er,{disabled:!0,style:{marginTop:"12px"}},"Save API Key")))};import Kt,{useState as gm}from"react";ve();import{styled as wr}from"storybook/theming";var nN=wr.div({marginBottom:"30px"}),rN=wr.div({display:"flex",gap:"8px",alignItems:"center"}),oN=wr(En)({flex:1}),iN=wr(qt)({padding:"8px 12px",whiteSpace:"nowrap"}),sN=wr.div(({theme:e})=>({marginTop:"12px",padding:"12px",backgroundColor:e.background.hoverable,borderRadius:"6px"})),mm=wr.div({marginBottom:"10px","&:last-child":{marginBottom:0}}),hm=wr.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:500,marginBottom:"4px",color:e.color.mediumdark})),xm=wr(rs)({fontSize:"13px",padding:"6px 8px"}),aN=wr.div({display:"flex",gap:"8px",marginTop:"12px"}),zv=wr(qt)({fontSize:"12px",padding:"6px 12px"}),lN=wr(zv)(({theme:e})=>({backgroundColor:"transparent",color:e.color.mediumdark,border:`1px solid ${e.appBorderColor}`,"&:hover":{backgroundColor:e.background.hoverable}})),Nv=()=>{let{projects:e,selectedProjectId:t,setSelectedProjectId:n,loadingProjects:r,createProject:o}=qr(),{currentStorybookPath:i}=Ze(),[s,a]=gm(!1),[u,c]=gm(!1),[l,d]=gm({name:"",storybookRoot:"",figmaFileUrl:""}),f=C=>{n(C||null),a(!1)},p=()=>{if(a(!0),i){let C=i.replace(/\/+$/,"").split("/").pop()||"";d({storybookRoot:i,name:C,figmaFileUrl:""})}},g=async()=>{if(l.name.trim())try{c(!0);let C;if(l.figmaFileUrl.trim()){let k=l.figmaFileUrl.trim(),R=k.match(/figma\.com\/(?:file|design)\/([a-zA-Z0-9]+)/);C=R?R[1]:k}let F=await o({name:l.name.trim(),storybookRoot:l.storybookRoot.trim()||void 0,figmaFileId:C});n(F.id),a(!1),d({name:"",storybookRoot:"",figmaFileUrl:""})}catch(C){console.error("Failed to create project:",C)}finally{c(!1)}},S=C=>{d(F=>{let k={...F,storybookRoot:C};if(!F.name&&C){let R=C.replace(/\/+$/,"").split("/").pop()||"";k.name=R}return k})};return Kt.createElement(nN,null,Kt.createElement(Gx,null,"Project"),Kt.createElement(rN,null,Kt.createElement(oN,{value:t||"",onChange:C=>f(C.target.value),disabled:r||s},Kt.createElement("option",{value:""},"-- Select a project --"),e.map(C=>Kt.createElement("option",{key:C.id,value:C.id},C.name))),Kt.createElement(iN,{onClick:p,disabled:r,type:"button"},"+ New")),s&&Kt.createElement(sN,null,Kt.createElement(mm,null,Kt.createElement(hm,null,"Storybook Path (for fix generation)"),Kt.createElement(xm,{type:"text",placeholder:"/path/to/your/storybook",value:l.storybookRoot,onChange:C=>S(C.target.value)})),Kt.createElement(mm,null,Kt.createElement(hm,null,"Project Name *"),Kt.createElement(xm,{type:"text",placeholder:"my-storybook",value:l.name,onChange:C=>{let F=C.target.value;d(k=>({...k,name:F}))}})),Kt.createElement(mm,null,Kt.createElement(hm,null,"Figma File URL (for design comparison)"),Kt.createElement(xm,{type:"text",placeholder:"https://www.figma.com/file/...",value:l.figmaFileUrl,onChange:C=>{let F=C.target.value;d(k=>({...k,figmaFileUrl:F}))}})),Kt.createElement(aN,null,Kt.createElement(zv,{onClick:g,disabled:u||!l.name.trim()},u?"Creating...":"Create"),Kt.createElement(lN,{onClick:()=>{a(!1),d({name:"",storybookRoot:"",figmaFileUrl:""})}},"Cancel"))))};import St,{useState as Ym,useCallback as xC,useEffect as S$}from"react";import{styled as vr}from"storybook/theming";import So,{useState as bm,useEffect as FN,useCallback as _v}from"react";import{styled as Go}from"storybook/theming";ve();je();pt();ve();je();pt();import Ut,{useState as ym}from"react";import{styled as zn,keyframes as cN}from"storybook/theming";var uN={autoLayout:"Auto Layout",componentStructure:"Structure",naming:"Naming",constraints:"Constraints",spacing:"Spacing",styles:"Styles",variants:"Variants"},pN=e=>e==="pass"?"\u2713":e==="warn"?"\u26A0":"\u2717",dN=zn.div({position:"relative",display:"inline-flex"}),fN=cN`
|
|
31
31
|
0% { transform: rotate(0deg); }
|
|
32
32
|
100% { transform: rotate(360deg); }
|
|
33
|
-
`,HD=jS.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${jD} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),WD=jS.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}}})),Ir=({loading:e=!1,disabled:t=!1,onClick:n,variant:r="default",children:o,loadingText:i})=>US.createElement(WD,{variant:r,disabled:t||e,onClick:n},e&&US.createElement(HD,null),e&&i?i:o);Re();import Qt from"react";import{styled as _s}from"storybook/theming";var HS=_s.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"})),VD=_s.div({display:"flex",alignItems:"center",gap:"12px"}),Il=_s.span({whiteSpace:"nowrap"}),WS=_s.div({display:"flex",alignItems:"center",gap:"8px"}),Fl=_s.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),El=({inputTokens:e,outputTokens:t,costUsd:n,compact:r=!1})=>{let o=e+t,i=n*Ch;return r?Qt.createElement(HS,null,Qt.createElement(Il,null,o.toLocaleString()," tokens"),Qt.createElement(WS,null,Qt.createElement(Fl,null,"$",n.toFixed(4)),Qt.createElement("span",null,"\xB7"),Qt.createElement(Fl,null,"\u20AA",i.toFixed(2)))):Qt.createElement(HS,null,Qt.createElement(VD,null,Qt.createElement(Il,null,e.toLocaleString()," input"),Qt.createElement("span",null,"+"),Qt.createElement(Il,null,t.toLocaleString()," output"),Qt.createElement("span",null,"="),Qt.createElement(Il,null,Qt.createElement("strong",null,o.toLocaleString())," tokens")),Qt.createElement(WS,null,Qt.createElement(Fl,null,"$",n.toFixed(4)),Qt.createElement("span",null,"\xB7"),Qt.createElement(Fl,null,"\u20AA",i.toFixed(2))))};import An from"react";import{styled as uo}from"storybook/theming";function rg(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var GD=uo.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),VS=uo.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),qD=uo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),YD=uo.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})),KD=uo.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),XD=uo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),QD=uo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),JD=uo.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),GS=({data:e,color:t,compact:n})=>n?An.createElement(VS,{color:t},e.summary):An.createElement(GD,null,An.createElement(VS,{color:t},e.summary),e.mappings&&e.mappings.length>0&&An.createElement(qD,null,e.mappings.map((r,o)=>An.createElement(An.Fragment,{key:o},An.createElement(YD,null,r.from," ",An.createElement(KD,null,"\u2192")," ",r.to)))),e.candidates!=null&&e.candidates>1&&An.createElement(XD,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&An.createElement(An.Fragment,null,e.defaults.map((r,o)=>An.createElement(QD,{key:o},An.createElement(JD,null,r.choice),An.createElement("span",null,"\u2014 ",r.why)))));var ZD=it.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),eR=it.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),tR=it.div({display:"flex",flexDirection:"column",gap:"4px"}),nR=it.div({display:"flex",alignItems:"center",gap:"10px"}),rR=it.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"})),YS=it.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})),oR=it.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),iR=it.div({display:"flex",gap:"8px"}),sR=it.div(({theme:e})=>({display:"flex",alignItems:"center",padding:"12px 24px",gap:"12px",borderBottom:`1px solid ${e.appBorderColor}`})),aR=it(Qr)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),lR=it.div({display:"flex",gap:"4px"}),Al=it.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}})),cR=it.div({display:"flex",flexDirection:"column",flex:1,padding:"16px 24px",gap:"8px",overflowY:"auto"}),uR=it.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}})),pR=it.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}`}})),dR=it.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"})),Pl=it.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}`})),fR=it.img({width:"100%",height:"100%",objectFit:"contain"}),ZS=it.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)"}}})),KS=it.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),XS=it.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"})),og=it.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"})),aX=it.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"})),gR=it.div(({theme:e})=>({flexShrink:0,color:e.color.mediumlight,fontSize:"14px"})),mR=it.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})),hR=it.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}})),xR=it.div(({theme:e})=>({padding:"16px 0",marginTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",gap:"8px"})),yR=it.div({display:"flex",flexWrap:"wrap",gap:"6px"}),bR=it.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})),SR=it.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})),wR=it.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"}})),lX=it.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})),QS=({src:e,alt:t})=>{let[n,r]=Ll(!1);return ve.createElement(ve.Fragment,null,!n&&ve.createElement(ZS,null),ve.createElement(fR,{src:e,alt:t,onLoad:()=>r(!0),style:n?void 0:{position:"absolute",opacity:0}}))};function JS(e){return e>=90?"high":e>=70?"medium":"low"}function vR(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var ew=({results:e,stories:t,onApply:n,onCancel:r,onRerun:o,isApplying:i,isRerunning:s,source:a,resolveThumbnail:u,resolveStoryScreenshot:c,isCapturingScreenshots:l,onBrowse:p})=>{let[f,d]=Ll(()=>{let v=new Set;for(let A of e.mappings)A.confidence>=90&&v.add(A.storyId);return v}),[m,S]=Ll(""),[T,F]=Ll("all"),k=qS(()=>{let v=new Map;for(let A of t)v.set(A.id,{name:A.name,title:A.title});return v},[t]),z=qS(()=>{let v=e.mappings;if(T!=="all"&&(v=v.filter(A=>JS(A.confidence)===T)),m.trim()){let A=m.toLowerCase();v=v.filter(h=>{let C=k.get(h.storyId);return C?.name.toLowerCase().includes(A)||C?.title.toLowerCase().includes(A)||h.componentSetName.toLowerCase().includes(A)||h.figmaFrameName.toLowerCase().includes(A)})}return v},[e.mappings,T,m,k]),R=v=>{d(A=>{let h=new Set(A);return h.has(v)?h.delete(v):h.add(v),h})},O=()=>{let v=e.mappings.filter(A=>f.has(A.storyId));n(v)},E=e.mappings.filter(v=>v.confidence>=90).length,D=e.mappings.filter(v=>v.confidence>=70&&v.confidence<90).length,g=e.mappings.filter(v=>v.confidence<70).length,w=e.usage;return ve.createElement(ZD,null,ve.createElement(eR,null,ve.createElement(tR,null,ve.createElement(nR,null,ve.createElement(rR,null,"Auto-Map Results"),ve.createElement(YS,{variant:"success"},e.stats.matched," matched"),e.unmatched.length>0&&ve.createElement(YS,{variant:"danger"},e.unmatched.length," unmatched"),a&&ve.createElement(SR,{variant:a},a==="cache"?"Loaded from cache":"Fresh analysis")),ve.createElement(oR,null,"Review matches below. Uncheck any incorrect mappings before applying.")),ve.createElement(iR,null,a==="cache"&&o&&ve.createElement(wR,{onClick:o,disabled:s},s?"Re-running...":"Re-run LLM"),ve.createElement(Ir,{onClick:r,variant:"ghost"},"Cancel"),ve.createElement(Ir,{loading:i,onClick:O,loadingText:"Applying..."},"Apply ",f.size," Selected"))),ve.createElement(sR,null,ve.createElement(aR,{type:"text",placeholder:"Filter stories...",value:m,onChange:v=>S(v.target.value)}),ve.createElement(lR,null,ve.createElement(Al,{active:T==="all",onClick:()=>F("all")},"All ",e.mappings.length),E>0&&ve.createElement(Al,{active:T==="high",onClick:()=>F("high")},"\u226590% (",E,")"),D>0&&ve.createElement(Al,{active:T==="medium",onClick:()=>F("medium")},"70-89% (",D,")"),g>0&&ve.createElement(Al,{active:T==="low",onClick:()=>F("low")},"<70% (",g,")"))),ve.createElement(cR,null,z.map(v=>{let A=k.get(v.storyId),h=JS(v.confidence),C=f.has(v.storyId),I=h==="low";return ve.createElement(uR,{key:v.storyId,dimmed:I&&!C},ve.createElement(pR,{checked:C,onClick:()=>R(v.storyId)},C?"\u2713":""),(()=>{let y=c?.(v.storyId);return y?ve.createElement(Pl,null,ve.createElement(QS,{src:y,alt:A?.name||v.storyId})):l?ve.createElement(Pl,null,ve.createElement(ZS,null)):ve.createElement(dR,{bgColor:I?"#f1f5f9":"#eff6ff"},ve.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:I?"#94a3b8":"#3b82f6"}},(A?.name||"?").substring(0,4)))})(),ve.createElement(KS,null,ve.createElement(XS,null,A?.name||v.storyId),ve.createElement(og,null,A?.title||"")),ve.createElement(gR,null,"\u2192"),(()=>{let y=u?.(v.figmaNodeId),P=rg(v.reason),L=P.summary+(P.candidates?` (${P.candidates} candidates)`:"");return y?ve.createElement(Pl,{title:L},ve.createElement(QS,{src:y,alt:v.figmaFrameName})):ve.createElement(Pl,{title:L},ve.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:"#94a3b8"}},"No thumbnail"))})(),ve.createElement(KS,null,ve.createElement(XS,null,v.componentSetName),ve.createElement(og,null,v.figmaFrameName),ve.createElement(GS,{data:rg(v.reason),color:vR(h)})),ve.createElement(mR,{level:h},v.confidence,"%"),p&&ve.createElement(hR,{onClick:()=>p(v.componentSetName)},"Browse"))}),e.unmatched.length>0&&ve.createElement(xR,null,ve.createElement(og,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),ve.createElement(yR,null,e.unmatched.map(v=>{let A=k.get(v);return ve.createElement(bR,{key:v},ve.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),A?`${A.name} (${A.title})`:v)})))),w&&a!=="cache"&&ve.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},ve.createElement(El,{inputTokens:w.inputTokens||0,outputTokens:w.outputTokens||0,costUsd:w.costUsd||0})))};Re();Me();import{useState as po,useCallback as fo,useRef as kR}from"react";import{useStorybookApi as CR}from"storybook/manager-api";function tw({projectId:e}){let t=CR(),n=kR(null),[r,o]=po(!1),[i,s]=po(!1),[a,u]=po(!1),[c,l]=po(null),[p,f]=po(null),[d,m]=po(null),[S,T]=po(""),[F,k]=po(null),z=fo(async()=>{let A=await fetch("/index.json");if(!A.ok)throw new Error("Failed to fetch Storybook index");let h=await A.json(),C=h.entries||h.stories||{},I=Object.keys(C).filter(L=>C[L].type==="story");b.debug(`[useAutoMap] Found ${I.length} stories in index.json`);let y=[];for(let L of I){let B=C[L],N=t.getData(L),x={...N?.initialArgs||{}},U=N?.argTypes||{};for(let[H,M]of Object.entries(U))if(!(H in x)){let Q=M;if(Q.defaultValue!==void 0)x[H]=Q.defaultValue;else if(Q.table?.defaultValue?.summary!==void 0){let ee=Q.table.defaultValue.summary;ee==="false"?x[H]=!1:ee==="true"?x[H]=!0:x[H]=ee}}y.push({id:L,name:B.name||L.split("--").pop()||L,title:B.title||"",initialArgs:x,argTypes:U})}let P=y.filter(L=>Object.keys(L.initialArgs).length>0);return b.debug(`[useAutoMap] Manifest: ${y.length} stories, ${P.length} with args`),y},[t]),R=fo(async()=>{if(!e)return!1;try{let A=G(),h=localStorage.getItem("uicopilot_session_token");if(!h)return!1;let C=await fetch(`${A}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${h}`}});if(!C.ok)return!1;let I=await C.json();return I.hasSuggestions&&I.mappings?.length>0?(f(I),k("cache"),T(`Loaded ${I.mappings.length} saved suggestions`),b.debug(`[useAutoMap] Loaded ${I.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),O=fo(async A=>{o(!0),T("Collecting story information...");let h;try{if(h=await z(),A?.length&&(h=h.filter(I=>!A.includes(I.id)),b.debug(`[useAutoMap] After excluding mapped: ${h.length} stories`)),h.length===0){l("No unmapped stories found"),o(!1);return}m(h)}catch(I){l(I instanceof Error?I.message:"Failed to collect story manifest"),o(!1);return}o(!1),s(!0),T(`Analyzing ${h.length} stories against Figma components...`);let C=new AbortController;n.current=C;try{let I=G(),y=localStorage.getItem("uicopilot_session_token");if(!y)throw new Error("Not authenticated");let P=await fetch(`${I}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({projectId:e,stories:h.map(B=>({id:B.id,name:B.name,title:B.title,initialArgs:B.initialArgs,argTypes:B.argTypes}))}),signal:C.signal});if(!P.ok){let B=await P.json();throw new Error(B.error||"Auto-map failed")}let L=await P.json();f(L),k("llm"),T(`Found ${L.stats.matched} matches (${L.stats.highConfidence} high confidence)`),b.debug(`[useAutoMap] Results: ${L.stats.matched}/${L.stats.total} matched, ${L.unmatched.length} unmatched`)}catch(I){if(I instanceof DOMException&&I.name==="AbortError"){T("Cancelled");return}l(I instanceof Error?I.message:"Auto-map failed")}finally{s(!1),n.current=null}},[e,z]),E=fo(async A=>{if(!e)return;if(l(null),f(null),k(null),o(!0),T("Checking for existing suggestions..."),await R()){o(!1);return}await O(A)},[e,R,O]),D=fo(async A=>{e&&(l(null),f(null),k(null),await O(A))},[e,O]),g=fo(async A=>{if(!(!e||A.length===0)){u(!0),T(`Applying ${A.length} mappings...`);try{let h=G(),C=localStorage.getItem("uicopilot_session_token");if(!C)throw new Error("Not authenticated");let I=0;for(let y of A)try{(await fetch(`${h}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${C}`},body:JSON.stringify({projectId:e,storyId:y.storyId,figmaNodeId:y.figmaNodeId,name:y.figmaFrameName||y.componentSetName})})).ok?I++:b.warn(`[useAutoMap] Failed to apply mapping for ${y.storyId}`)}catch(P){b.error(`[useAutoMap] Error applying mapping for ${y.storyId}:`,P)}T(`Applied ${I}/${A.length} mappings`),b.debug(`[useAutoMap] Applied ${I}/${A.length} mappings`)}catch(h){l(h instanceof Error?h.message:"Failed to apply mappings")}finally{u(!1)}}},[e]),w=fo(()=>{n.current?.abort()},[]),v=fo(()=>{f(null),m(null),l(null),T(""),k(null)},[]);return{collectAndMap:E,rerun:D,loadExisting:R,applyMappings:g,cancel:w,reset:v,isCollecting:r,isMapping:i,isApplying:a,error:c,results:p,manifest:d,progress:S,source:F}}Me();import{useState as ig,useEffect as TR,useRef as nw}from"react";var rw=2;async function IR(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 ow(e){let[t,n]=ig({}),[r,o]=ig(0),[i,s]=ig(!1),a=nw(null),u=nw(""),c=e.join(",");return TR(()=>{if(!e.length||c===u.current)return;u.current=c,n({}),o(0),s(!0);let l=new AbortController;a.current=l;let p=0;return(async()=>{for(let d=0;d<e.length&&!l.signal.aborted;d+=rw){let m=e.slice(d,d+rw),S=await Promise.all(m.map(F=>IR(F,l.signal).then(k=>({id:F,img:k}))));if(l.signal.aborted)break;let T={};for(let{id:F,img:k}of S)p++,k&&(T[F]=k);Object.keys(T).length>0&&n(F=>({...F,...T})),o(p)}s(!1),b.debug(`[useStoryScreenshots] Captured ${p}/${e.length} screenshots`)})().catch(()=>s(!1)),()=>{l.abort()}},[c]),{screenshots:t,isCapturing:i,progress:{done:r,total:e.length}}}import Se,{useState as iw,useEffect as Ml,useMemo as FR}from"react";Me();var Ti=({isOpen:e,onClose:t,onSelect:n,projectId:r,stories:o=[],currentStoryId:i,onStoryChange:s,multiSelect:a=!1,onMultiSelect:u,initialSearch:c})=>{let l=Bs({projectId:r||"",enabled:e&&!!r}),p=Se.useRef(!1);Ml(()=>{e&&c&&!p.current&&(l.setSearch(c),p.current=!0),e||(p.current=!1)},[e,c]);let[f,d]=iw(new Set),[m,S]=iw(i||o[0]?.id||"");Ml(()=>{i&&S(i)},[i]),Ml(()=>{l.expandedSets.forEach(D=>{let g=l.variantChildren[D];if(!g||g.length===0)return;let w=g;l.variantFilters.some(A=>A.value)&&(w=g.filter(A=>A.variantProperties?l.variantFilters.every(h=>h.value?A.variantProperties?.[h.property]===h.value:!0):!1));let v=w.slice(0,20).map(A=>A.id);v.length>0&&l.fetchVariantThumbnails(D,v)})},[l.expandedSets,l.variantChildren,l.variantFilters]),Ml(()=>{d(new Set)},[m]);let T=FR(()=>{let D=[];return l.filteredFrames.forEach(g=>{if(g.type==="COMPONENT_SET"&&g.children){let w=l.variantFilters.some(v=>v.value)?g.children.filter(v=>v.variantProperties?l.variantFilters.every(A=>A.value?v.variantProperties?.[A.property]===A.value:!0):!1):g.children;D.push(...w)}else D.push(g)}),D},[l.filteredFrames,l.variantFilters]),F=D=>{if(a)d(g=>{let w=new Set(g);return w.has(D.id)?w.delete(D.id):w.add(D.id),w});else{let g=l.resolveThumbnail(D.id);try{n({...D,thumbnail:g})}catch(w){b.error("[ComponentBrowserModal] onSelect threw error:",w)}t()}},k=()=>{let D=T.map(w=>w.id),g=D.every(w=>f.has(w));d(g?new Set:new Set(D))},z=()=>{if(u&&f.size>0){let D=T.filter(g=>f.has(g.id)).map(g=>({...g,thumbnail:l.resolveThumbnail(g.id)}));u(D),d(new Set)}},R=D=>{S(D),s?.(D)},O=D=>{D.target===D.currentTarget&&t()},E=o.find(D=>D.id===m);return e?Se.createElement(j0,{onClick:O},Se.createElement(H0,null,Se.createElement(W0,null,Se.createElement(V0,null,"Link Figma Frames"),Se.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},Se.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"),Se.createElement(G0,{onClick:t},"\xD7"))),Se.createElement(q0,null,l.error&&Se.createElement(eS,null,l.error),!l.error&&Se.createElement(Se.Fragment,null,o.length>0&&Se.createElement(pS,null,Se.createElement(dS,null,"Story:"),Se.createElement(fS,{value:m,onChange:D=>R(D.target.value)},o.map(D=>Se.createElement("option",{key:D.id,value:D.id},D.name,D.mappingsCount?` (${D.mappingsCount} linked)`:""))),E?.mappingsCount?Se.createElement(gS,{hasMapping:!0},E.mappingsCount," frames linked"):null),Se.createElement(J0,null,Se.createElement(bl,null,Se.createElement("input",{type:"checkbox",checked:l.showComponentSets,onChange:D=>l.setShowComponentSets(D.target.checked)}),"Component Sets"),Se.createElement(bl,null,Se.createElement("input",{type:"checkbox",checked:l.showFrames,onChange:D=>l.setShowFrames(D.target.checked)}),"Frames"),Se.createElement(bl,null,Se.createElement("input",{type:"checkbox",checked:l.showComponents,onChange:D=>l.setShowComponents(D.target.checked)}),"Components"),l.availablePages.length>1&&Se.createElement(ki,{isActive:!!l.figmaPage,value:l.figmaPage,onChange:D=>l.setFigmaPage(D.target.value),style:{marginLeft:"auto"}},Se.createElement("option",{value:""},"All pages"),l.availablePages.map(D=>Se.createElement("option",{key:D,value:D},D)))),l.filterSuggestion&&Se.createElement(mS,null,Se.createElement(hS,null,"AI suggests:"),Se.createElement(xS,null,Object.entries(l.filterSuggestion.suggestedFilters).map(([D,g])=>`${D}=${g}`).join(", ")),Se.createElement(yS,{onClick:l.applySuggestedFilters},"Apply"),Se.createElement(bS,{onClick:l.dismissFilterSuggestion},"Dismiss")),l.filterSuggestionLoading&&Se.createElement(SS,null,"Matching story args to Figma filters..."),l.availableFilters.length>0&&Se.createElement(wl,null,Se.createElement(Ns,null,"Filters:"),l.availableFilters.map(({property:D,values:g})=>{let w=l.variantFilters.find(v=>v.property===D);return Se.createElement(ki,{key:D,isActive:!!w?.value,value:w?.value||"",onChange:v=>l.handleFilterChange(D,v.target.value)},Se.createElement("option",{value:""},D),g.map(v=>Se.createElement("option",{key:v,value:v},D,"=",v)))}),l.variantFilters.some(D=>D.value)&&Se.createElement(vl,{onClick:l.clearFilters},"Clear All")),Se.createElement(Y0,{type:"text",placeholder:"Search frames...",value:l.search,onChange:D=>l.setSearch(D.target.value),autoFocus:!0}),a&&T.length>0&&Se.createElement(wS,null,Se.createElement(vS,{onClick:k},f.size===T.length?"Deselect All":"Select All Visible"),Se.createElement(kS,null,f.size>0?`${f.size} selected of `:"Showing ",T.length," frames")),l.isLoading&&Se.createElement(_f,null,Array.from({length:6}).map((D,g)=>Se.createElement(uS,{key:g},Se.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},Se.createElement(Sl,{width:"100%",height:"100%"})),Se.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},Se.createElement(Sl,{width:"80%",height:"16px"}),Se.createElement(Sl,{width:"50%",height:"12px"}))))),!l.isLoading&&l.filteredFrames.length===0&&Se.createElement(Z0,null,l.search?"No frames match your search":"No frames found in this Figma file"),!l.isLoading&&l.filteredFrames.length>0&&Se.createElement(_f,null,l.filteredFrames.map(D=>Se.createElement(Os,{key:D.id,frame:D,thumbnail:l.thumbnails[D.id],thumbnails:l.thumbnails,variantThumbnails:l.variantThumbnails[D.id],variantChildren:l.variantChildren[D.id],isLoadingVariants:l.loadingVariants.has(D.id),isExpanded:l.expandedSets.has(D.id),isNew:l.recentlyAdded.has(D.name),onToggleExpand:l.toggleExpanded,onSelect:F,multiSelect:a,selectedFrames:f,variantFilters:l.variantFilters}))))),a&&Se.createElement(CS,null,Se.createElement(TS,{disabled:f.size===0,onClick:z},"Link ",f.size," Selected")))):null};ke();nt();var AR=Gt.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}),PR=Gt.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"})),LR=Gt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),MR=Gt.div({display:"flex",alignItems:"center",gap:"20px"}),BR=Gt.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),DR=Gt.div({display:"flex",gap:"4px"}),sw=Gt(Xr)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),RR=Gt(fn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),zR=Gt.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),NR=Gt.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),OR=Gt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),_R=Gt.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),$R=Gt.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),UR=Gt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),jR=Gt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),HR=Gt.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),WR=Gt.div(({theme:e})=>({width:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",opacity:.6})),VR=Gt.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"}})),aw=Gt.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"}})),lw=({isOpen:e,onClose:t,projectId:n})=>{let[r,o]=Ii("map"),[i,s]=Ii([]),[a,u]=Ii(!0),[c,l]=Ii(null),[p,f]=Ii(!1),[d,m]=Ii(null),S=tw({projectId:n}),{refreshMappings:T}=Ye(),{featureFlags:F}=se(),k=He.useMemo(()=>S.results?.mappings.map(y=>y.storyId)||[],[S.results]),z=ow(k),R=go(async()=>{u(!0);try{let y=await fetch("/index.json");if(!y.ok)throw new Error("Failed to fetch index.json");let P=await y.json(),L=P.entries||P.stories||{},B=Object.entries(L).filter(([,x])=>x.type==="story").map(([x,U])=>({id:x,name:U.name||x.split("--").pop()||x,title:U.title||"",importPath:U.importPath,componentTitle:U.title?.split("/").slice(0,-1).join("/")||U.title,figmaMapping:null}));try{let x=G(),U=localStorage.getItem("uicopilot_session_token"),H=await ne(`${x}/api/mappings?projectId=${n}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${U}`}});if(H.ok){let M=await H.json(),Q=new Map((M.mappings||[]).map(ee=>[ee.storyId,ee]));B.forEach(ee=>{let J=Q.get(ee.id);J&&J.figmaNodeId&&(ee.figmaMapping={figmaNodeId:J.figmaNodeId,figmaFrameName:J.name||J.figmaFrameName||""})})}}catch(x){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",x)}s(B);let N=B.find(x=>!x.figmaMapping);N?l(N.id):B.length>0&&l(B[0].id)}catch(y){console.error("[StoryMappingAssistant] Error fetching stories:",y)}finally{u(!1)}},[n]);ER(()=>{e&&R()},[e,R]);let O=go((y,P,L)=>{s(x=>x.map(U=>U.id===y?{...U,figmaMapping:{figmaNodeId:P,figmaFrameName:L}}:U));let B=i.findIndex(x=>x.id===y),N=i.find((x,U)=>U>B&&!x.figmaMapping);N&&l(N.id)},[i]),E=go(y=>{s(P=>P.map(L=>L.id===y?{...L,figmaMapping:null}:L))},[]),D=go(y=>{l(y),o("map")},[]),g=go(()=>{let y=i.filter(P=>P.figmaMapping).map(P=>P.id);S.collectAndMap(y)},[i,S]),w=go(()=>{let y=i.filter(P=>P.figmaMapping).map(P=>P.id);f(!1),S.rerun(y)},[i,S]),v=go(async y=>{await S.applyMappings(y),f(!1),S.reset(),R(),T()},[S,R,T]),A=go(()=>{f(!1),S.reset()},[S]);He.useEffect(()=>{S.results&&f(!0)},[S.results]);let h=y=>{y.target===y.currentTarget&&t()};if(!e)return null;let C=i.filter(y=>y.figmaMapping).length,I=i.length;return He.createElement(He.Fragment,null,He.createElement(AR,{onClick:h},He.createElement(PR,{onClick:y=>y.stopPropagation()},He.createElement(LR,null,He.createElement(MR,null,He.createElement(BR,null,He.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),He.createElement(DR,null,He.createElement(sw,{active:r==="map",onClick:()=>o("map")},"Map Stories"),He.createElement(sw,{active:r==="view",onClick:()=>o("view")},"View All Mappings"))),He.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},F.enableAutoMap&&!p&&!S.isCollecting&&!S.isMapping&&He.createElement(VR,{onClick:g,disabled:a||i.length===0},He.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},He.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),He.createElement("path",{d:"M2 17l10 5 10-5"}),He.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),He.createElement(RR,{onClick:t},"\xD7"))),He.createElement(zR,null,(S.isCollecting||S.isMapping)&&He.createElement(_R,null,He.createElement($R,null,He.createElement(HR,null,He.createElement(WR,null)),He.createElement(UR,null,"Auto-mapping stories to Figma"),He.createElement(jR,null,S.progress),He.createElement(Ir,{onClick:S.cancel,variant:"ghost"},"Cancel"))),p&&S.results&&He.createElement(ew,{results:S.results,stories:i,onApply:v,onCancel:A,onRerun:w,isApplying:S.isApplying,isRerunning:S.isCollecting||S.isMapping,source:S.source,resolveThumbnail:y=>S.results?.thumbnailUrls?.[y],resolveStoryScreenshot:y=>z.screenshots[y],isCapturingScreenshots:z.isCapturing,onBrowse:y=>m(y)}),!p&&!S.isCollecting&&!S.isMapping&&(r==="map"?He.createElement(zS,{stories:i,loading:a,selectedStoryId:c,onSelectStory:l,onStoryMapped:O,projectId:n}):He.createElement($S,{stories:i,loading:a,onLink:D,onUnlink:E,projectId:n}))),He.createElement(NR,null,He.createElement(OR,null,He.createElement("span",null,"Total: ",I," stories"),He.createElement(aw,{type:"mapped"},He.createElement("span",{className:"dot"}),C," mapped"),He.createElement(aw,{type:"unmapped"},He.createElement("span",{className:"dot"}),I-C," unmapped"))))),He.createElement(Ti,{isOpen:!!d,onClose:()=>m(null),onSelect:()=>m(null),projectId:n,initialSearch:d||void 0}))};import Ur,{useEffect as GR,useCallback as qR}from"react";import{styled as $o,keyframes as cw}from"storybook/theming";var YR=cw({from:{opacity:0},to:{opacity:1}}),KR=cw({from:{opacity:0,transform:"translate(-50%, -50%) scale(0.95)"},to:{opacity:1,transform:"translate(-50%, -50%) scale(1)"}}),XR=$o.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,animation:`${YR} 150ms ease-out`}),QR=$o.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:`${KR} 150ms ease-out`})),JR=$o.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),ZR=$o.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})),ez=$o.div(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:`${e.layoutMargin*.8}px`})),tz=$o.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}})),nz=$o.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":{opacity:.9}})),Fi=({isOpen:e,title:t,message:n,confirmLabel:r="OK",cancelLabel:o="Cancel",variant:i="default",onConfirm:s,onCancel:a})=>{let u=qR(c=>{c.key==="Escape"&&a()},[a]);return GR(()=>{if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,u]),e?Ur.createElement(Ur.Fragment,null,Ur.createElement(XR,{onClick:a}),Ur.createElement(QR,{role:"dialog","aria-modal":"true","aria-label":t},Ur.createElement(JR,null,t),Ur.createElement(ZR,null,n),Ur.createElement(ez,null,Ur.createElement(tz,{onClick:a},o),Ur.createElement(nz,{variant:i,onClick:s},r)))):null};nt();var uw=Nn.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}})),oz=Nn.div(({theme:e})=>({width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{width:"16px",height:"16px"}})),iz=Nn.div({display:"flex",alignItems:"center",gap:"12px",flex:1}),sz=Nn.div({display:"flex",alignItems:"center",gap:"8px"}),az=Nn.div(({theme:e})=>({width:"60px",height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),lz=Nn.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"})),cz=Nn.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"})),uz=Nn.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),pz=Nn(Fc)({padding:"4px 10px",fontSize:"12px",fontWeight:600,marginLeft:"auto"}),dz=Nn(Fc)(({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)"}})),fz=Nn.span(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontStyle:"italic"})),gz=Nn.div(({theme:e})=>({width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:ae,borderRadius:"50%",animation:"figma-mapping-spin 0.8s linear infinite","@keyframes figma-mapping-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),mz=Nn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),pw=()=>{let[e,t]=Bl(!1),[n,r]=Bl({totalStories:0,mappedStories:0,loading:!0}),{selectedProjectId:o}=Qe(),{sessionToken:i}=Ie();rz(()=>{o&&i?s():r({totalStories:0,mappedStories:0,loading:!1})},[o,i]);let s=async()=>{r(O=>({...O,loading:!0}));try{let O=await fetch("/index.json");if(!O.ok)throw new Error("Failed to fetch Storybook index");let E=await O.json(),D=E.entries||E.stories||{},g=Object.keys(D).filter(C=>D[C].type==="story").length,w=Object.keys(D).filter(C=>D[C].type==="story"),v=G(),A=await ne(`${v}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}}),h=0;if(A.ok){let C=await A.json(),I=C.mappings||C||[];if(Array.isArray(I)){let y=new Set(I.map(P=>P.storyId).filter(Boolean));h=w.filter(P=>y.has(P)).length}else{let y=await ne(`${v}/api/mappings/stats?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(y.ok){let P=await y.json();h=Math.min(P.mappedStoriesCount||0,g)}}}r({totalStories:g,mappedStories:h,loading:!1})}catch(O){console.error("[FigmaMappingsSection] Error fetching stats:",O),r(E=>({...E,loading:!1}))}},[a,u]=Bl(!1),[c,l]=Bl(!1),p=async()=>{!o||!i||l(!0)},f=async()=>{l(!1),u(!0);try{let O=G(),E=await ne(`${O}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(!E.ok)throw new Error("Failed to fetch mappings");let g=(await E.json()).mappings||[];await Promise.all(g.map(w=>ne(`${O}/api/mappings?id=${encodeURIComponent(w.id)}`,{method:"DELETE",headers:{Authorization:`Bearer ${i}`}}))),s()}catch(O){console.error("[FigmaMappingsSection] Unlink all failed:",O)}finally{u(!1)}},d=()=>t(!0),m=()=>{t(!1),o&&i&&s()};if(!o)return gt.createElement(uw,null,gt.createElement(fz,null,"Select a project to link Figma designs"));let{totalStories:S,loading:T}=n,F=Math.min(n.mappedStories,S),k=F===0?"none":F>=S?"complete":"partial",z=S>0?Math.min(100,Math.round(F/S*100)):0,R=k==="none"?"Link designs":"Manage";return gt.createElement(gt.Fragment,null,gt.createElement(uw,null,gt.createElement(oz,null,gt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},gt.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"}),gt.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"}),gt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),gt.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"}),gt.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"}))),gt.createElement(iz,null,gt.createElement(uz,null,"Figma Mappings"),gt.createElement(sz,null,T?gt.createElement(gt.Fragment,null,gt.createElement(gz,null),gt.createElement(mz,null,"Loading...")):gt.createElement(gt.Fragment,null,gt.createElement(az,null,gt.createElement(lz,{percent:z,state:k})),gt.createElement(cz,{state:k},`${F}/${S}`)))),F>0&>.createElement(dz,{onClick:p,disabled:T||a},a?"Unlinking...":"Unlink All"),gt.createElement(pz,{onClick:d,disabled:T},R)),e&>.createElement(lw,{isOpen:e,onClose:m,projectId:o}),gt.createElement(Fi,{isOpen:c,title:"Unlink All Mappings",message:`Unlink all ${n.mappedStories} Figma mappings?`,confirmLabel:"Unlink All",variant:"danger",onConfirm:f,onCancel:()=>l(!1)}))};import he,{useState as $s,useEffect as dw,useCallback as hz}from"react";import{styled as On}from"storybook/theming";ke();Re();nt();var fw=On.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",fontSize:"12px"})),gw=On.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),mw=On.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),pQ=On(Wn)({padding:"5px 12px",fontSize:"12px"}),hw=On.div(({theme:e})=>({display:"flex",gap:"16px",color:e.color.mediumdark,marginBottom:"4px"})),sg=On.span(({theme:e})=>({whiteSpace:"nowrap","& strong":{color:e.color.defaultText,fontWeight:600}})),xz=On.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})),yz=On.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),ag=On.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),bz=On.span(({theme:e})=>({color:e.color.mediumdark,fontSize:"12px"})),lg=On.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),cg=On.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"3px",transition:"width 0.5s ease"})),Uo=On.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText})),xw=()=>{let{featureFlags:e}=se(),[t,n]=$s(null),[r,o]=$s(!0),[i,s]=$s(!1),[a,u]=$s(!1),[c,l]=$s(!1),{selectedProjectId:p}=Qe(),{sessionToken:f}=Ie(),d=hz(async()=>{if(!(!p||!f))try{let R=G(),O=await ne(`${R}/api/figma/cache-status?projectId=${p}`,{headers:{Authorization:`Bearer ${f}`}});if(O.ok){let E=await O.json();n(E)}}catch(R){console.error("[FigmaCacheSection] Error:",R)}finally{o(!1)}},[p,f]);dw(()=>{d()},[d]),dw(()=>{let R=t?.thumbnailProgress?.status==="in-progress",O=t?.enrichmentProgress?.status==="in-progress",E=t?.thumbnailProgress&&t.thumbnailProgress.cached>0;if(!(R||O||!E&&t?.structureStatus==="cached")||!t||t.structureStatus==="none")return;let g=setInterval(()=>{d()},3e3),w=setTimeout(()=>clearInterval(g),3e5);return()=>{clearInterval(g),clearTimeout(w)}},[t?.thumbnailProgress?.status,t?.thumbnailProgress?.cached,t?.enrichmentProgress?.status,t?.structureStatus,d]);let m=async()=>{if(!(!p||!f)){s(!0);try{let R=G();await ne(`${R}/api/figma/frames?projectId=${p}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${f}`}},6e4),await new Promise(O=>setTimeout(O,1e3)),await d(),setTimeout(async()=>{await d()},3e3)}catch(R){console.error("[FigmaCacheSection] Reload error:",R)}finally{s(!1)}}},S=async()=>{if(!(!p||!f)){u(!0);try{let R=G(),O=await ne(`${R}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({projectId:p})});console.log("[FigmaCacheSection] Cache invalidate response:",O.status),await ne(`${R}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({projectId:p})}).catch(()=>{}),n({structureStatus:"none",structureCachedAt:null,componentSetCount:0,componentCount:0,pageCount:0,pages:[],cacheDiff:null,thumbnailProgress:null,enrichmentProgress:null})}catch(R){console.error("[FigmaCacheSection] Clear cache error:",R)}finally{u(!1)}}},T=async()=>{if(!(!p||!f)){l(!0);try{let R=G();await ne(`${R}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${f}`},body:JSON.stringify({projectId:p})});let O=setInterval(async()=>{await d()},3e3),E=setInterval(()=>{(t?.enrichmentProgress?.status==="complete"||t?.enrichmentProgress?.status==="error")&&(clearInterval(O),clearInterval(E),l(!1),d())},3e3);setTimeout(()=>{clearInterval(O),clearInterval(E),l(!1)},6e5)}catch(R){console.error("[FigmaCacheSection] Enrich error:",R),l(!1)}}};if(!p||r)return null;if(!t||t.structureStatus==="none")return he.createElement(fw,null,he.createElement(gw,null,he.createElement(mw,null,"Figma Cache"),he.createElement(Ir,{loading:i,onClick:m,loadingText:"Loading..."},"\u21BB Load")),i?he.createElement(he.Fragment,null,he.createElement(lg,null,he.createElement(cg,{percent:30,style:{animation:"none",width:"100%",opacity:.3}})),he.createElement(Uo,null,he.createElement("span",null,"Downloading structure from Figma... this may take 30-60 seconds"))):he.createElement(hw,null,he.createElement(sg,null,"No cache \u2014 click Load to fetch from Figma")));let F=R=>{let O=Date.now()-new Date(R).getTime(),E=Math.floor(O/6e4);if(E<1)return"just now";if(E<60)return`${E}m ago`;let D=Math.floor(E/60);return D<24?`${D}h ago`:`${Math.floor(D/24)}d ago`},k=t.cacheDiff,z=k&&(k.added.length>0||k.removed.length>0||k.renamed.length>0);return he.createElement(fw,null,he.createElement(gw,null,he.createElement(mw,null,"Figma Cache"," ",he.createElement(xz,{status:t.structureStatus},t.structureStatus)),he.createElement("div",{style:{display:"flex",gap:"6px"}},he.createElement(Ir,{loading:c,onClick:T,loadingText:"Enriching..."},"Enrich"),he.createElement(Ir,{loading:a,onClick:S,variant:"ghost",loadingText:"Clearing..."},"Clear"),he.createElement(Ir,{loading:i,onClick:m,loadingText:"Reloading..."},"\u21BB Reload"))),i&&he.createElement(Uo,null,he.createElement("span",null,"Downloading structure from Figma...")),he.createElement(hw,null,he.createElement(sg,null,he.createElement("strong",null,t.componentSetCount)," component sets"),he.createElement(sg,null,he.createElement("strong",null,t.pageCount)," pages"),t.structureCachedAt&&he.createElement(bz,null,"Updated ",F(t.structureCachedAt))),z&&he.createElement(yz,null,"Since last reload:"," ",k.added.length>0&&he.createElement(ag,{type:"added"},"+",k.added.length," added"),k.added.length>0&&k.removed.length>0&&" \xB7 ",k.removed.length>0&&he.createElement(ag,{type:"removed"},"\u2212",k.removed.length," removed"),(k.added.length>0||k.removed.length>0)&&k.renamed.length>0&&" \xB7 ",k.renamed.length>0&&he.createElement(ag,{type:"renamed"},k.renamed.length," renamed")),t.thumbnailProgress&&t.thumbnailProgress.status==="in-progress"&&he.createElement(he.Fragment,null,he.createElement(lg,null,he.createElement(cg,{percent:t.thumbnailProgress.total>0?Math.round(t.thumbnailProgress.cached/t.thumbnailProgress.total*100):0})),he.createElement(Uo,null,he.createElement("span",null,"Caching component set thumbnails to CDN...",t.thumbnailProgress.currentName&&he.createElement(he.Fragment,null," ",t.thumbnailProgress.currentName)),he.createElement("span",null,t.thumbnailProgress.cached," / ",t.thumbnailProgress.total))),t.thumbnailProgress&&t.thumbnailProgress.status==="complete"&&he.createElement(Uo,null,he.createElement("span",null,"Thumbnails: ",t.thumbnailProgress.cached," / ",t.thumbnailProgress.total," cached to CDN \u2713")),(!t.thumbnailProgress||t.thumbnailProgress.status==="pending")&&he.createElement(Uo,null,he.createElement("span",null,"Thumbnails: not pre-cached")),t.enrichmentProgress&&t.enrichmentProgress.status==="in-progress"&&he.createElement(he.Fragment,null,he.createElement(lg,null,he.createElement(cg,{percent:t.enrichmentProgress.total>0?Math.round(t.enrichmentProgress.enriched/t.enrichmentProgress.total*100):0})),he.createElement(Uo,null,he.createElement("span",null,"Enriching components with AI...",t.enrichmentProgress.currentName&&he.createElement(he.Fragment,null," ",t.enrichmentProgress.currentName)),he.createElement("span",null,t.enrichmentProgress.enriched," / ",t.enrichmentProgress.total))),t.enrichmentProgress&&t.enrichmentProgress.status==="complete"&&he.createElement(he.Fragment,null,he.createElement(Uo,null,he.createElement("span",null,"AI enrichment: ",t.enrichmentProgress.enriched," / ",t.enrichmentProgress.total," component sets \u2713")),e.showCosts&&t.enrichmentProgress.costUsd!=null&&t.enrichmentProgress.costUsd>0&&he.createElement("div",{style:{marginTop:"6px"}},he.createElement(El,{inputTokens:t.enrichmentProgress.inputTokens||0,outputTokens:t.enrichmentProgress.outputTokens||0,costUsd:t.enrichmentProgress.costUsd,compact:!0}))))};import lt,{useState as Ei}from"react";import{styled as Fr}from"storybook/theming";ke();Re();nt();var ug=Fr.div({padding:"12px 16px"}),Sz=Fr.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),yw=Fr.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),bw=Fr.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:ae,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),wz=Fr.div({display:"flex",gap:"8px",alignItems:"center"}),vz=Fr.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:ae,boxShadow:`0 0 0 1px ${ae}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),Sw=Fr.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":e==="error"?"#dc2626":"#6b7280",marginTop:"6px",display:"block",lineHeight:1.4})),kz=Fr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:ae,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),Cz=Fr.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})),Tz=Fr.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),ww=()=>{let{sessionToken:e}=Ie(),[t,n]=Ei(!1),[r,o]=Ei(""),[i,s]=Ei(!1),[a,u]=Ei(null),[c,l]=Ei(null),[p,f]=Ei(!1),d=async()=>{if(!(!r.trim()||!e)){s(!0),u(null);try{let m=G(),S=await ne(`${m}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({token:r.trim()})}),T=await S.json();if(!S.ok){u({type:"error",message:T.error||"Failed to save token"});return}l(T.figmaUser?.handle||T.figmaUser?.email||"Connected"),u({type:"success",message:`Connected as ${T.figmaUser?.handle||"Figma user"}`}),o("")}catch{u({type:"error",message:"Failed to connect. Check your token and try again."})}finally{s(!1)}}};return c?lt.createElement(ug,null,lt.createElement(yw,null,"Figma Personal Access Token"),lt.createElement(Cz,null,lt.createElement("span",null,"\u2713 Connected as ",lt.createElement("strong",null,c)),lt.createElement(Tz,{onClick:()=>{l(null),u(null)}},"Change token"))):t?lt.createElement(ug,null,lt.createElement(Sz,null,lt.createElement(yw,null,"Figma Personal Access Token"),lt.createElement(bw,{onClick:()=>f(!p)},p?"Hide instructions":"How to generate")),p&<.createElement(kz,null,lt.createElement("ol",null,lt.createElement("li",null,"Open ",lt.createElement("a",{href:"https://www.figma.com/settings",target:"_blank",rel:"noopener noreferrer"},"Figma Settings")),lt.createElement("li",null,"Click the ",lt.createElement("strong",null,"Security")," tab"),lt.createElement("li",null,"Scroll to ",lt.createElement("strong",null,"Personal access tokens")),lt.createElement("li",null,"Click ",lt.createElement("strong",null,"Generate new token")),lt.createElement("li",null,"Enable ",lt.createElement("strong",null,"File content: Read only")," under Scopes"),lt.createElement("li",null,"Copy the token and paste it below"))),lt.createElement(wz,null,lt.createElement(vz,{type:"password",value:r,onChange:m=>o(m.target.value),placeholder:"figd_...",onKeyDown:m=>{m.key==="Enter"&&r.trim()&&d()}}),lt.createElement(_t,{onClick:d,disabled:!r.trim()||i},i?"Verifying...":"Save & Verify")),a&<.createElement(Sw,{variant:a.type},a.message),lt.createElement(Sw,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):lt.createElement(ug,null,lt.createElement(bw,{onClick:()=>n(!0)},"Or use a Personal Access Token \u2192"))};ke();Re();nt();var Fz=dt.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},dt.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"}),dt.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"}),dt.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),dt.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"}),dt.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"})),dg=gr.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",marginBottom:"16px",backgroundColor:e.background.content})),Ez=gr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),Az=gr.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),Pz=gr.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),fg=gr.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),Lz=gr.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"})),Mz=gr.div({display:"flex",alignItems:"center",gap:"8px"}),Bz=gr(Hn)(({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"})),Dz=gr.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),LQ=gr.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"}}),Rz=gr.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}})),kw=()=>{let{sessionToken:e}=Ie(),[t,n]=pg(!1),[r,o]=pg(null),[i,s]=pg(!1);Iz(()=>{if(!e)return;let l=G();ne(`${l}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${e}`}}).then(p=>p.json()).then(p=>o(!!p.connected)).catch(()=>o(!1))},[e]);let a=vw(()=>{let p=`${G()}/addon/auth`;window.open(p,"figma-oauth","width=600,height=700,left=200,top=100")},[]),u=vw(async()=>{try{n(!0);let l=G(),p=await ne(`${l}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${e}`}});(p.ok||p.status===404)&&o(!1)}catch{}finally{n(!1)}},[e]),c=dt.createElement(Ez,null,dt.createElement(Az,null,Fz),dt.createElement(Pz,null,"Figma Integration"));return r===null?dt.createElement(dg,null,c,dt.createElement(fg,null,dt.createElement("div",{style:{padding:"16px",fontSize:"13px",color:"#9ca3af"}},"Checking Figma connection..."))):r===!1?dt.createElement(dg,null,c,dt.createElement(fg,null,dt.createElement(Dz,null,dt.createElement(_t,{onClick:a,style:{width:"100%"}},"Connect with Figma"),dt.createElement(Rz,null,"or"),dt.createElement(ww,null)))):dt.createElement(dg,null,c,dt.createElement(Lz,null,dt.createElement(Mz,null,dt.createElement("span",{style:{fontSize:"18px"}},"\u2713"),dt.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to Figma")),dt.createElement(Bz,{onClick:()=>s(!0),disabled:t},t?"Disconnecting...":"Disconnect")),dt.createElement(Fi,{isOpen:i,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:()=>{s(!1),u()},onCancel:()=>s(!1)}),dt.createElement(fg,null,dt.createElement(U0,null),dt.createElement(pw,null),dt.createElement(xw,null)))};ke();var zz=Ai.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"}),Nz=Ai.div(({theme:e})=>({backgroundColor:e.background.content,borderRadius:"10px",boxShadow:"0 16px 48px rgba(0, 0, 0, 0.2)",width:"480px",maxWidth:"90%",maxHeight:"calc(100vh - 64px)",overflow:"auto",position:"relative"})),Oz=Ai.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,position:"sticky",top:0,backgroundColor:e.background.content,borderRadius:"10px 10px 0 0",zIndex:1})),_z=Ai.h2(({theme:e})=>({margin:0,fontSize:"13px",fontWeight:600,color:e.color.defaultText})),$z=Ai(fn)({fontSize:"16px",padding:"2px 6px",lineHeight:1}),Uz=Ai.div(({theme:e})=>({padding:"4px 0",fontSize:"12px","& > div":{padding:"8px 16px"},"h3, h4":{fontSize:"12px",margin:"0 0 6px 0"},label:{fontSize:"12px"},"input, select":{fontSize:"12px",padding:"6px 10px",height:"auto"},button:{fontSize:"11px",padding:"5px 10px"},"& > div + div":{borderTop:`1px solid ${e.appBorderColor}`},'[class*="Connected"]':{padding:"8px 12px"},p:{fontSize:"11px",margin:"2px 0"}})),Cw=({onClose:e})=>{let{isConnected:t}=Ie(),{selectedProjectId:n}=Qe();return jr.createElement(zz,{onClick:e},jr.createElement(Nz,{onClick:r=>r.stopPropagation()},jr.createElement(Oz,null,jr.createElement(_z,null,"Settings"),jr.createElement($z,{onClick:e,title:"Close settings"},"x")),jr.createElement(Uz,null,jr.createElement(N0,null),t&&jr.createElement(_0,null),t&&n&&jr.createElement(kw,null))))};import Dt,{useEffect as mN,useMemo as hN}from"react";import{styled as Zn}from"storybook/theming";ke();ke();import Ht,{useState as jz}from"react";import{styled as Pn}from"storybook/theming";var Hr=[{id:"claude-sonnet-4-5-20250929",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 Hz=Pn.div({display:"flex",alignItems:"center",gap:"8px",width:"100%"}),Wz=Pn.div({display:"inline-flex",flexWrap:"nowrap",gap:"4px",alignItems:"center"}),Vz=Pn.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"}}),Gz=Pn.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}})),qz=Pn.div({position:"relative",display:"inline-block"}),Yz=Pn.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}})),Kz=Pn.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"})),gg=Pn.div(({theme:e})=>({borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),mg=Pn.div(({theme:e})=>({padding:"8px 12px",fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:e.background.app})),Xz=Pn.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}})),Qz=Pn.input({cursor:"pointer",flexShrink:0,"&:disabled":{cursor:"not-allowed"}}),Jz=Pn.div({flex:1,minWidth:0}),Zz=Pn.div({fontSize:"12px",fontWeight:500,marginBottom:"2px"}),eN=Pn.div(({theme:e})=>({fontSize:"10px",color:e.textMutedColor,lineHeight:"1.2"})),tN=5,Tw=()=>{let{selectedModels:e,toggleModel:t,isReviewing:n}=se(),[r,o]=jz(!1),i=Hr.filter(d=>d.provider==="anthropic"&&!e.includes(d.id)),s=Hr.filter(d=>d.provider==="openai"&&!e.includes(d.id)),a=Hr.filter(d=>d.provider==="google"&&!e.includes(d.id)),u=Hr.filter(d=>e.includes(d.id)),c=e.length<tN,l=(d,m)=>{m.stopPropagation(),e.length>1&&!n&&t(d)},p=d=>{let m=e.includes(d);m&&e.length===1||!m&&!c||n||(t(d),o(!1))},f=d=>{let m=e.includes(d.id),S=m&&e.length===1,T=n||S||!m&&!c;return Ht.createElement(Xz,{key:d.id,disabled:T,onClick:()=>p(d.id)},Ht.createElement(Qz,{type:"checkbox",checked:m,disabled:T,onChange:()=>{},onClick:F=>F.stopPropagation()}),Ht.createElement(Jz,null,Ht.createElement(Zz,null,d.name),d.description&&Ht.createElement(eN,null,d.description)))};return Ht.createElement(Hz,null,Ht.createElement(qz,null,Ht.createElement(Yz,{disabled:n,isOpen:r,onClick:()=>o(!r)},Ht.createElement("span",null,"Select model"),Ht.createElement("span",null,r?"\u25B2":"\u25BC")),r&&Ht.createElement(Kz,null,Ht.createElement(gg,null,Ht.createElement(mg,null,"Anthropic"),i.map(f)),Ht.createElement(gg,null,Ht.createElement(mg,null,"OpenAI"),s.map(f)),Ht.createElement(gg,null,Ht.createElement(mg,null,"Google"),a.map(f)))),Ht.createElement(Wz,null,u.map(d=>Ht.createElement(Vz,{key:d.id,disabled:n,provider:d.provider},d.name,e.length>1&&Ht.createElement(Gz,{disabled:n,onClick:m=>l(d.id,m),title:"Remove model"},"\xD7")))))};import ge,{useState as nN,useEffect as rN}from"react";import{styled as Jt,keyframes as Us}from"storybook/theming";ke();var oN=Us`
|
|
33
|
+
`,gN=zn.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}}}),mN=zn.span`
|
|
34
|
+
display: inline-block;
|
|
35
|
+
width: 10px;
|
|
36
|
+
height: 10px;
|
|
37
|
+
border: 2px solid rgba(255,255,255,0.3);
|
|
38
|
+
border-top-color: #fff;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
animation: ${fN} 0.8s linear infinite;
|
|
41
|
+
`,hN=zn.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})),xN=zn.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px",paddingBottom:"8px",borderBottom:`1px solid ${e.appBorderColor}`})),yN=zn.div(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText,fontSize:e.typography.size.s2})),bN=zn.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()}}),SN=zn.div({display:"flex",flexDirection:"column",gap:"6px",marginBottom:"10px"}),wN=zn.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:e.typography.size.s1,color:e.color.defaultText})),vN=zn.span({display:"flex",alignItems:"center",gap:"4px"}),kN=zn.span(({status:e,theme:t})=>({color:e==="pass"?t.color.positive:e==="warn"?t.color.warning:t.color.negative,fontSize:t.typography.size.s1})),CN=zn.span(({theme:e})=>({fontWeight:500,color:e.color.mediumdark})),TN=zn.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,lineHeight:1.4,fontStyle:"italic"})),IN=zn.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"}})),Ov=({figmaFileUrl:e})=>{let{selectedProjectId:t}=Ze(),[n,r]=ym(!1),[o,i]=ym(!1),[s,a]=ym(null),u=async()=>{if(!(!e||!t||o)){i(!0);try{let c=q(),l=localStorage.getItem("uicopilot_session_token"),d=await oe(`${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?Ut.createElement(dN,{onMouseEnter:()=>s&&r(!0),onMouseLeave:()=>r(!1)},Ut.createElement(gN,{score:s?.score,isLoading:o,onClick:u,disabled:o||!t,title:s?"Click to refresh quality check":"Click to check Figma design quality"},o?Ut.createElement(Ut.Fragment,null,Ut.createElement(mN,null)," Checking..."):s?Ut.createElement(Ut.Fragment,null,"\u{1F3A8} ",Math.round(s.score),"%"):Ut.createElement(Ut.Fragment,null,"\u{1F3A8} Check Quality")),n&&s&&Ut.createElement(hN,null,Ut.createElement(xN,null,Ut.createElement(yN,null,"Figma Design Quality"),Ut.createElement(bN,{score:s.score},Math.round(s.score),"%")),Ut.createElement(SN,null,Object.entries(s.categories).map(([c,l])=>Ut.createElement(wN,{key:c},Ut.createElement(vN,null,Ut.createElement(kN,{status:l.status},pN(l.status)),uN[c]||c),Ut.createElement(CN,null,l.score)))),s.summary&&Ut.createElement(TN,null,s.summary),s.recommendations?.length>0&&Ut.createElement(IN,null,s.recommendations.slice(0,2).map((c,l)=>Ut.createElement("li",{key:l},c))))):null};var EN=Go.div(({theme:e})=>({padding:"12px 16px",marginBottom:"16px"})),AN=Go.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"}),PN=Go.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),LN=Go.div({display:"flex",gap:"8px",alignItems:"center"}),MN=Go.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:le,boxShadow:`0 0 0 1px ${le}`},"&::placeholder":{color:e.color.mediumlight}})),BN=Go(qt)({whiteSpace:"nowrap"}),DN=Go.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":"#dc2626",marginTop:"4px",display:"block"})),$v=()=>{let{selectedProjectId:e,projects:t}=Ze(),{sessionToken:n}=we(),{updateProject:r}=qr(),o=t.find(S=>S.id===e),[i,s]=bm(""),[a,u]=bm(!1),[c,l]=bm(null),d=o?.figmaFileUrl||o?.figmaFileId||"";FN(()=>{s(d),l(null)},[o?.id,d]);let f=i!==d,p=_v(async()=>{if(!(!e||!f))try{u(!0),l(null),await r(e,{figmaFileUrl:i.trim()||void 0});let S=q();try{await oe(`${S}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({projectId:e})})}catch{}oe(`${S}/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(S){l({type:"error",message:S instanceof Error?S.message:"Failed to save"})}finally{u(!1)}},[e,i,f,r]),g=_v(S=>{S.key==="Enter"&&f&&!a&&p()},[f,a,p]);return e?So.createElement(EN,null,So.createElement(AN,null,So.createElement(PN,null,"Figma File URL"),So.createElement(Ov,{figmaFileUrl:d})),So.createElement(LN,null,So.createElement(MN,{type:"text",value:i,onChange:S=>s(S.target.value),onKeyDown:g,placeholder:"https://www.figma.com/file/..."}),So.createElement(BN,{onClick:p,disabled:!f||a},a?"Saving...":"Save")),c&&So.createElement(DN,{variant:c.type},c.message)):null};import kt,{useState as tc,useEffect as Q_}from"react";import{styled as Yn}from"storybook/theming";ve();je();import Je,{useState as Bi,useEffect as v_,useCallback as Co}from"react";import{styled as Zt}from"storybook/theming";je();je();De();import X,{useState as Li,useEffect as Fk,useMemo as Mm,useCallback as Ek}from"react";import{styled as Ye}from"storybook/theming";pt();import Me,{useState as Ik,useEffect as RN,memo as zN}from"react";import{styled as xe}from"storybook/theming";var Uv=xe.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}),jv=xe.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}`})),Hv=xe.div(({theme:e})=>({padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"space-between",alignItems:"center"})),Wv=xe.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),Vv=xe(wn)({fontSize:"20px",padding:"4px 8px"}),Gv=xe.div({flex:1,overflow:"auto",padding:"20px"}),qv=xe(so)({fontSize:"14px",marginBottom:"16px"}),Sm=xe.div({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"12px"}),Yv=xe.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:le,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),wm=xe.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"})),Kv=xe.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"})),Xv=xe.img(({theme:e})=>({maxWidth:"100%",maxHeight:"100%",objectFit:"cover",display:"block",backgroundColor:e.background.content,borderRadius:"4px"})),Ys=xe.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})),vm=xe.div(({theme:e})=>({width:"32px",height:"32px",border:`3px solid ${e.appBorderColor}`,borderTopColor:le,borderRadius:"50%",animation:"thumbnail-spin 0.8s linear infinite","@keyframes thumbnail-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),Ks=xe.div(({theme:e})=>({fontSize:"11px",fontWeight:500,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),km=xe.div(({theme:e})=>({fontSize:"32px",opacity:.5,color:e.color.mediumdark})),Cm=xe.div(({theme:e})=>({padding:"12px",textAlign:"left",backgroundColor:e.background.content,borderTop:`1px solid ${e.appBorderColor}`})),Tm=xe.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",lineHeight:1.3})),Im=xe.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px"})),Qv=xe.div(({theme:e})=>({display:"flex",gap:"16px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),Ul=xe.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.color.defaultText,cursor:"pointer",userSelect:"none","& input":{cursor:"pointer"}})),Jv=xe.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"14px"})),Zv=xe.div(({theme:e})=>({padding:"20px",backgroundColor:e.background.critical,color:e.color.inverseText,borderRadius:"4px",fontSize:"14px"})),ek=xe.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:le}})),tk=xe.button(({theme:e})=>({display:"flex",flexDirection:"column",padding:0,border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${le}`,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:le,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),nk=xe.div(({theme:e})=>({position:"absolute",top:"8px",right:"8px",padding:"2px 8px",background:le,color:e.color.lightest,borderRadius:"4px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",zIndex:10})),rk=xe.div({display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"4px",marginBottom:"4px"}),$Z=xe.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"})),ok=xe.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`1px solid ${e.appBorderColor}`,borderLeft:`3px solid ${le}`,borderRadius:"6px",backgroundColor:e.background.content,overflow:"hidden",minHeight:"200px"})),ik=xe.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%"}}})),Fm=xe.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"}})),sk=xe.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})),ak=xe.span(({theme:e})=>({fontWeight:600,color:e.color.mediumdark})),lk=xe.span(({theme:e})=>({color:e.color.defaultText})),jl=xe.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%"}}})),ck=xe.div(({theme:e})=>({display:"flex",flexDirection:"column",border:`2px solid ${e.appBorderColor}`,borderRadius:"8px",backgroundColor:e.background.app,overflow:"hidden"})),uk=xe.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",marginBottom:"16px",padding:"12px",backgroundColor:e.background.app,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`})),pk=xe.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),dk=xe(En)({flex:1,width:"auto"}),fk=xe.span(({theme:e,hasMapping:t})=>({fontSize:"12px",color:t?e.color.positive:e.color.mediumdark,fontWeight:t?500:400})),gk=xe.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"})),mk=xe.span(({theme:e})=>({color:e.color.secondary,fontWeight:e.typography.weight.bold})),hk=xe.span(({theme:e})=>({color:e.color.defaultText})),xk=xe.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=xe.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}})),bk=xe.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,marginBottom:"8px",fontStyle:"italic"})),Hl=xe.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",marginBottom:"12px",flexWrap:"wrap"})),Xs=xe.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Pi=xe(En)(({theme:e,isActive:t})=>({width:"auto",padding:"6px 28px 6px 10px",fontSize:"12px",...t&&{borderColor:e.color.secondary,backgroundColor:`${e.color.secondary}14`}})),Wl=xe.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`}})),Sk=xe.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",padding:"8px 0",borderBottom:`1px solid ${e.appBorderColor}`})),wk=xe.button(({theme:e})=>({padding:"6px 12px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:le,fontSize:"12px",cursor:"pointer","&:hover":{backgroundColor:"rgba(234, 88, 12, 0.08)"}})),vk=xe.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Em=xe.button(({theme:e,isSelected:t})=>({display:"flex",flexDirection:"column",padding:0,border:`2px solid ${t?le: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:le,transform:"translateY(-2px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)"}})),Am=xe.div(({theme:e,isSelected:t})=>({position:"absolute",top:"8px",left:"8px",width:"20px",height:"20px",borderRadius:"4px",border:`2px solid ${t?le:e.appBorderColor}`,backgroundColor:t?le:e.background.content,display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,fontSize:"12px",color:t?e.color.lightest:"transparent"})),kk=xe.div(({theme:e})=>({padding:"16px 20px",borderTop:`1px solid ${e.appBorderColor}`,display:"flex",justifyContent:"flex-end",gap:"12px"})),Ck=xe.button(({theme:e,disabled:t})=>({padding:"10px 20px",border:"none",borderRadius:"4px",backgroundColor:t?e.color.mediumdark:le,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:le,opacity:t?.6:.9}})),Tk=xe.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"}));De();var Pm=zN(({src:e,alt:t,isComponentSet:n,loadingDone:r})=>{let[o,i]=Ik(!1),[s,a]=Ik(!1);return RN(()=>{i(!1),a(!1)},[e]),o?Me.createElement(Ys,null,Me.createElement(km,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Me.createElement(Ks,null,"Failed to load")):e?Me.createElement(Me.Fragment,null,!s&&Me.createElement(Ys,{style:{position:"absolute",inset:0}},Me.createElement(vm,null),Me.createElement(Ks,null,"Loading...")),Me.createElement(Xv,{src:e,alt:t,onLoad:()=>a(!0),onError:()=>i(!0),style:{opacity:s?1:0}})):r?Me.createElement(Ys,null,Me.createElement(km,null,n?"\u229E":"\u{1F5BC}\uFE0F"),Me.createElement(Ks,null,"No preview")):Me.createElement(Ys,null,Me.createElement(vm,null),Me.createElement(Ks,null,"Loading..."))}),Qs=({frame:e,thumbnail:t,thumbnails:n,variantThumbnails:r,variantChildren:o,isLoadingVariants:i=!1,isExpanded:s,isNew:a=!1,onToggleExpand:u,onSelect:c,multiSelect:l=!1,selectedFrames:d=new Set,variantFilters:f=[]})=>{let p=e.type==="COMPONENT_SET",g=p&&(e.children&&e.children.length>0||(e.childCount??0)>0),S=e.children||o||[],C=Me.useMemo(()=>S.length===0?[]:f.some(R=>R.value)?S.filter(R=>R.variantProperties?f.every(z=>z.value?R.variantProperties?.[z.property]===z.value:!0):!1):S,[S,f]),F=R=>{if(p&&g){u(e.id,R);return}c(e)},k=l?Em:Yv;return Me.createElement(Me.Fragment,null,Me.createElement(k,{onClick:F,title:e.name,isSelected:l?d.has(e.id):void 0,style:{cursor:"pointer"}},l&&!g&&Me.createElement(Am,{isSelected:d.has(e.id)},d.has(e.id)?"\u2713":""),p?Me.createElement(Kv,null,g&&Me.createElement(ek,{onClick:R=>u(e.id,R),title:s?"Collapse variants":"Expand variants"},s?"\u25BC":"\u25B6"),g&&Me.createElement(nk,null,C.length>0&&C.length!==S.length?`${C.length} / ${S.length}`:e.childCount??S.length," variants"),Me.createElement(Pm,{src:t,alt:e.name,isComponentSet:!0})):Me.createElement(wm,null,Me.createElement(Pm,{src:t,alt:e.name,isComponentSet:!1})),Me.createElement(Cm,null,Me.createElement(Tm,null,e.name,a&&Me.createElement(Tk,null,"New")),Me.createElement(Im,null,e.type))),g&&s&&i&&Me.createElement(Me.Fragment,null,Array.from({length:Math.min(6,e.childCount??e.children?.length??6)}).map((R,z)=>Me.createElement(ok,{key:`skeleton-${z}`},Me.createElement(ik,null),Me.createElement(Fm,{width:"80%"}),Me.createElement(Fm,{width:"50%"})))),g&&s&&!i&&C.map(R=>Me.createElement(Lm,{key:R.id,variant:R,thumbnail:r?.[R.id]||n[R.id],onSelect:c,multiSelect:l,isSelected:d.has(R.id),loadingDone:!!t||r!==void 0&&R.id in(r||{})})))},Lm=({variant:e,thumbnail:t,onSelect:n,multiSelect:r=!1,isSelected:o=!1,loadingDone:i=!1})=>Me.createElement(r?Em:tk,{onClick:()=>{y.debug("[VariantCard] Clicked:",e.id,e.name),n(e)},title:e.name,isSelected:r?o:void 0},r&&Me.createElement(Am,{isSelected:o},o?"\u2713":""),Me.createElement(wm,null,Me.createElement(Pm,{src:t,alt:e.name,isComponentSet:!1,loadingDone:i})),Me.createElement(Cm,null,Me.createElement(Tm,null,e.name),e.variantProperties&&Object.keys(e.variantProperties).length>0&&Me.createElement(rk,null,Object.entries(e.variantProperties).map(([u,c])=>Me.createElement(sk,{key:u},Me.createElement(ak,null,u,":")," ",Me.createElement(lk,null,c)))),Me.createElement(Im,{style:{marginTop:"6px"}},"VARIANT")));var NN=Ye.div({display:"flex",height:"100%",overflow:"hidden"}),ON=Ye.div(({theme:e})=>({width:"380px",minWidth:"300px",borderRight:`1px solid ${e.appBorderColor}`,display:"flex",flexDirection:"column",overflow:"hidden"})),_N=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden"}),Ak=Ye.div(({theme:e})=>({padding:"12px 16px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),Pk=Ye.h4(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.mediumdark,textTransform:"uppercase",letterSpacing:"0.5px",margin:0})),Vl=Ye.div({display:"flex",gap:"8px",marginTop:"10px"}),$N=Ye(En)({flex:1,width:"auto"}),Lk=Ye(so)({flex:1,fontSize:"13px"}),UN=Ye.div({flex:1,overflow:"auto",padding:"8px"}),jN=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}})),HN=Ye.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"}),WN=Ye.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),VN=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})),GN=Ye.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),qN=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"})),YN=Ye.img(({theme:e})=>({width:"48px",height:"36px",objectFit:"contain",backgroundColor:e.background.content,borderRadius:"4px",border:`1px solid ${e.appBorderColor}`,flexShrink:0})),KN=Ye.div({flex:1,overflow:"hidden"}),XN=Ye.div({fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),QN=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)"}}})),JN=Ye.img(({theme:e})=>({width:"100%",maxWidth:"260px",maxHeight:"200px",objectFit:"contain",borderRadius:"4px",backgroundColor:e.background.app,display:"block"})),ZN=Ye.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",fontWeight:500,color:e.color.defaultText,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),eO=Ye.div({flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"}),tO=Ye.div({display:"flex",gap:"8px",flexWrap:"wrap"}),Bm=Ye.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",color:e.color.mediumdark,cursor:"pointer","& input":{cursor:"pointer"}})),nO=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),Dm=20,rO=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"})),oO=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`}})),iO=Ye.div(({theme:e})=>({gridColumn:"1 / -1",display:"flex",alignItems:"center",gap:"12px",padding:"8px 12px",backgroundColor:e.background.app,borderRadius:"6px",marginBottom:"8px"})),sO=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`}})),aO=Ye.span(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Rm=Ye.div(({theme:e})=>({gridColumn:"1 / -1",fontSize:"12px",color:e.color.mediumdark,textAlign:"center",padding:"8px 0"})),zm=Ye.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px"})),lO=Ye.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),cO=Ye.div({flex:1,overflow:"auto",padding:"12px",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"12px",alignContent:"start"}),Mk=Ye.div(({theme:e})=>({borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,overflow:"hidden",backgroundColor:e.background.content})),Bk=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"}}})),Dk=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"}}})),uO=()=>X.createElement(cO,null,Array.from({length:8}).map((e,t)=>X.createElement(Mk,{key:t},X.createElement(Bk,null),X.createElement(Dk,{width:`${60+t%3*15}%`})))),pO=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"})),dO=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"}),fO=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)"}}})),gO=Ye.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark})),Rk=({stories:e,loading:t,selectedStoryId:n,onSelectStory:r,onStoryMapped:o,projectId:i})=>{let s=Gs({projectId:i,limit:Dm,enabled:!!i}),[a,u]=Li("all"),[c,l]=Li(""),[d,f]=Li(null),[p,g]=Li(1),[S,C]=Li(null),[F,k]=Li(!1),R=Mm(()=>{let h=new Set;return e.forEach(T=>{T.componentTitle&&h.add(T.componentTitle)}),Array.from(h).sort()},[e]),z=Mm(()=>e.filter(h=>{if(a!=="all"&&h.componentTitle!==a)return!1;if(c){let T=c.toLowerCase();return h.name.toLowerCase().includes(T)||h.title.toLowerCase().includes(T)}return!0}),[e,a,c]),_=d?s.frames.find(h=>h.id===d):null,M=Mm(()=>{if(!d)return[];let h=s.variantChildren[d]||[];return h.length===0?[]:s.variantFilters.some(T=>T.value)?h.filter(T=>T.variantProperties?s.variantFilters.every(I=>I.value?T.variantProperties?.[I.property]===I.value:!0):!1):h},[d,s.variantChildren,s.variantFilters]),B=M.slice(0,p*Dm),m=M.length>p*Dm;Fk(()=>{if(!d||B.length===0)return;let h=B.map(T=>T.id);s.fetchVariantThumbnails(d,h)},[d,B.length,p]),Fk(()=>{k(!1)},[]);let x=Ek(async h=>{if(n)try{let T=q(),I=localStorage.getItem("uicopilot_session_token");if(!(await oe(`${T}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${I}`},body:JSON.stringify({projectId:i,storyId:n,figmaNodeId:h.id,name:h.name})})).ok)throw new Error("Failed to save mapping");o(n,h.id,h.name)}catch(T){y.error("[MapStoriesTab] Error saving mapping:",T)}},[n,i,o]),b=Ek((h,T)=>{if(T.stopPropagation(),d===h){f(null),g(1);return}f(h),g(1),!s.variantThumbnails[h]&&!s.loadingVariants.has(h)&&s.toggleExpanded(h,T)},[d,s]),E=e.find(h=>h.id===n);return t?X.createElement(lO,null,"Loading stories..."):X.createElement(NN,null,X.createElement(ON,null,X.createElement(Ak,null,X.createElement(Pk,null,"Storybook Stories"),X.createElement(Vl,null,X.createElement($N,{value:a,onChange:h=>u(h.target.value)},X.createElement("option",{value:"all"},"All Components"),R.map(h=>X.createElement("option",{key:h,value:h},h)))),X.createElement(Vl,null,X.createElement(Lk,{type:"text",placeholder:"Search stories...",value:c,onChange:h=>l(h.target.value)}))),X.createElement(UN,null,z.length===0?X.createElement(zm,null,"No stories found"):z.map(h=>X.createElement(jN,{key:h.id,selected:h.id===n,mapped:!!h.figmaMapping,onClick:()=>r(h.id)},X.createElement(HN,null,X.createElement(WN,null,h.name),X.createElement(VN,{mapped:!!h.figmaMapping},h.figmaMapping?"Mapped":"Unmapped")),X.createElement(GN,null,h.title),h.figmaMapping&&X.createElement(qN,{onMouseEnter:()=>C(h.id),onMouseLeave:()=>C(null)},(()=>{let T=h.figmaMapping?.figmaNodeId,I=T?s.resolveThumbnail(T):void 0;return X.createElement(X.Fragment,null,I?X.createElement(YN,{src:I,alt:h.figmaMapping?.figmaFrameName||""}):X.createElement("span",null,"\u{1F517}"),S===h.id&&I&&X.createElement(QN,null,X.createElement(JN,{src:I,alt:h.figmaMapping?.figmaFrameName||""}),X.createElement(ZN,null,h.figmaMapping?.figmaFrameName)))})(),X.createElement(KN,null,X.createElement(XN,null,h.figmaMapping.figmaFrameName))))))),X.createElement(_N,null,n?X.createElement(X.Fragment,null,X.createElement(pO,null,X.createElement("span",null,"Click a Figma component below to link it to"," ",X.createElement("strong",null,E?.name))),X.createElement(Ak,null,X.createElement(Pk,null,"Figma Components"),X.createElement(Vl,null,X.createElement(tO,null,X.createElement(Bm,null,X.createElement("input",{type:"checkbox",checked:s.showComponentSets,onChange:h=>s.setShowComponentSets(h.target.checked)}),"Component Sets"),X.createElement(Bm,null,X.createElement("input",{type:"checkbox",checked:s.showFrames,onChange:h=>s.setShowFrames(h.target.checked)}),"Frames"),X.createElement(Bm,null,X.createElement("input",{type:"checkbox",checked:s.showComponents,onChange:h=>s.setShowComponents(h.target.checked)}),"Components")),s.availablePages.length>1&&X.createElement(Pi,{isActive:!!s.figmaPage,value:s.figmaPage,onChange:h=>s.setFigmaPage(h.target.value)},X.createElement("option",{value:""},"All pages"),s.availablePages.map(h=>X.createElement("option",{key:h,value:h},h)))),s.availableFilters.length>0&&X.createElement(Hl,null,X.createElement(Xs,null,"Filters:"),s.availableFilters.slice(0,5).map(({property:h,values:T})=>{let I=s.variantFilters.find(v=>v.property===h);return X.createElement(Pi,{key:h,isActive:!!I?.value,value:I?.value||"",onChange:v=>s.handleFilterChange(h,v.target.value)},X.createElement("option",{value:""},h),T.map(v=>X.createElement("option",{key:v,value:v},h,"=",v)))}),s.availableFilters.length>5&&X.createElement(Xs,{style:{opacity:.6,fontSize:"11px"}},"+",s.availableFilters.length-5," more"),s.variantFilters.some(h=>h.value)&&X.createElement(Wl,{onClick:s.clearFilters},"Clear All")),X.createElement(Vl,null,X.createElement(Lk,{type:"text",placeholder:"Search Figma components...",value:s.search,onChange:h=>s.setSearch(h.target.value)}))),X.createElement(eO,null,F&&X.createElement(dO,null,X.createElement(fO,null),X.createElement(gO,null,"Loading thumbnails...")),s.isLoading?X.createElement(uO,null):s.filteredFrames.length===0?X.createElement(zm,null,X.createElement("span",null,"No components found")):X.createElement(nO,null,d&&_?X.createElement(X.Fragment,null,X.createElement(iO,null,X.createElement(sO,{onClick:()=>{f(null),g(1)}},"Back"),X.createElement(aO,null,_.name)),s.loadingVariants.has(d)?X.createElement(X.Fragment,null,X.createElement(Rm,null,"Loading ",_.childCount??"..."," variants..."),Array.from({length:Math.min(8,_.childCount??8)}).map((h,T)=>X.createElement(Mk,{key:`variant-skeleton-${T}`},X.createElement(Bk,null),X.createElement(Dk,{width:`${60+T%3*15}%`})))):X.createElement(X.Fragment,null,X.createElement(Rm,null,"Showing ",B.length," of ",M.length," variants"),B.map(h=>X.createElement(Lm,{key:h.id,variant:h,thumbnail:s.variantThumbnails[d]?.[h.id]||s.thumbnails[h.id],onSelect:x,loadingDone:s.variantThumbnails[d]!==void 0&&!s.loadingVariants.has(d)})))):X.createElement(X.Fragment,null,X.createElement(Rm,null,"Showing ",s.frames.length," of ",s.totalFrames," components"),s.filteredFrames.map(h=>X.createElement(Qs,{key:h.id,frame:h,thumbnail:s.thumbnails[h.id],thumbnails:s.thumbnails,variantThumbnails:s.variantThumbnails[h.id],variantChildren:s.variantChildren[h.id],isLoadingVariants:s.loadingVariants.has(h.id),isExpanded:!1,onToggleExpand:b,onSelect:x,variantFilters:s.variantFilters}))),(d?m:s.hasMore)&&X.createElement(rO,null,X.createElement(oO,{disabled:s.loadingMore,onClick:async()=>{d?g(h=>h+1):await s.loadMore()}},s.loadingMore?"Loading...":"Load More"))))):X.createElement(zm,null,X.createElement("span",null,"Select a story from the left to link it to Figma"))))};je();import et,{useState as Nm,useMemo as zk,useCallback as Nk}from"react";import{styled as Rt}from"storybook/theming";pt();var mO=Rt.div({display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}),hO=Rt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px 20px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`,flexWrap:"wrap"})),xO=Rt(En)({width:"auto",minWidth:"200px"}),yO=Rt(so)({fontSize:"13px",minWidth:"250px"}),bO=Rt.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}})),SO=Rt.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}})),wO=Rt.div({flex:1,overflow:"auto"}),vO=Rt.table(({theme:e})=>({width:"100%",borderCollapse:"collapse",fontSize:"13px"})),kO=Rt.thead(({theme:e})=>({position:"sticky",top:0,backgroundColor:e.background.app,zIndex:1})),Gl=Rt.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}`})),CO=Rt.tbody({}),TO=Rt.tr(({theme:e,mapped:t})=>({backgroundColor:t?"transparent":`${e.color.warning}05`,"&:hover":{backgroundColor:e.background.hoverable}})),ql=Rt.td(({theme:e})=>({padding:"14px 20px",borderBottom:`1px solid ${e.appBorderColor}`,verticalAlign:"middle"})),IO=Rt.div({display:"flex",flexDirection:"column",gap:"2px"}),FO=Rt.div(({theme:e})=>({fontWeight:500,color:e.color.defaultText})),EO=Rt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),AO=Rt.div(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumlight,fontWeight:t?500:400,display:"flex",alignItems:"center",gap:"6px"})),PO=Rt.div({display:"flex",alignItems:"center",gap:"8px"}),LO=Rt.span(({theme:e,mapped:t})=>({width:"10px",height:"10px",borderRadius:"50%",backgroundColor:t?e.color.positive:e.color.mediumlight})),MO=Rt.span(({theme:e,mapped:t})=>({color:t?e.color.positive:e.color.mediumdark,fontWeight:500})),Ok=Rt.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`}})),BO=Rt.div(({theme:e})=>({flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:e.color.mediumdark,fontSize:"14px",gap:"8px",padding:"40px"})),DO=Rt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.color.mediumdark,fontSize:"14px"})),_k=({stories:e,loading:t,onLink:n,onUnlink:r,projectId:o})=>{let[i,s]=Nm("all"),[a,u]=Nm(""),[c,l]=Nm(!0),d=zk(()=>{let C=new Set;return e.forEach(F=>{F.componentTitle&&C.add(F.componentTitle)}),Array.from(C).sort()},[e]),f=zk(()=>e.filter(C=>{if(i!=="all"&&C.componentTitle!==i||!c&&!C.figmaMapping)return!1;if(a){let F=a.toLowerCase();return C.name.toLowerCase().includes(F)||C.title.toLowerCase().includes(F)||(C.figmaMapping?.figmaFrameName?.toLowerCase().includes(F)??!1)}return!0}),[e,i,a,c]),p=Nk(async C=>{try{let F=q(),k=localStorage.getItem("uicopilot_session_token");if(!(await oe(`${F}/api/mappings?projectId=${o}&storyId=${C}`,{method:"DELETE",headers:{Authorization:`Bearer ${k}`}})).ok)throw new Error("Failed to delete mapping");r(C)}catch(F){console.error("[ViewAllMappingsTab] Error unlinking:",F)}},[o,r]),g=Nk(()=>{let C=e.filter(z=>z.figmaMapping).map(z=>({storyId:z.id,storyName:z.name,storyTitle:z.title,figmaNodeId:z.figmaMapping.figmaNodeId,figmaFrameName:z.figmaMapping.figmaFrameName})),F=new Blob([JSON.stringify(C,null,2)],{type:"application/json"}),k=URL.createObjectURL(F),R=document.createElement("a");R.href=k,R.download=`figma-mappings-${new Date().toISOString().split("T")[0]}.json`,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(k)},[e]);if(t)return et.createElement(DO,null,"Loading mappings...");let S=e.filter(C=>C.figmaMapping).length;return et.createElement(mO,null,et.createElement(hO,null,et.createElement(xO,{value:i,onChange:C=>s(C.target.value)},et.createElement("option",{value:"all"},"All Components"),d.map(C=>et.createElement("option",{key:C,value:C},C))),et.createElement(yO,{type:"text",placeholder:"\u{1F50D} Search stories or Figma components...",value:a,onChange:C=>u(C.target.value)}),et.createElement(bO,{active:c,onClick:()=>l(!c)},c?"\u2611":"\u2610"," Show unmapped"),et.createElement(SO,{onClick:g,disabled:S===0},"\u{1F4E5} Export JSON")),f.length===0?et.createElement(BO,null,et.createElement("span",null,"\u{1F4ED}"),a?"No stories match your search":"No stories found"):et.createElement(wO,null,et.createElement(vO,null,et.createElement(kO,null,et.createElement("tr",null,et.createElement(Gl,{style:{width:"35%"}},"Story"),et.createElement(Gl,{style:{width:"35%"}},"Figma Component"),et.createElement(Gl,{style:{width:"15%"}},"Status"),et.createElement(Gl,{style:{width:"15%"}},"Actions"))),et.createElement(CO,null,f.map(C=>et.createElement(TO,{key:C.id,mapped:!!C.figmaMapping},et.createElement(ql,null,et.createElement(IO,null,et.createElement(FO,null,C.name),et.createElement(EO,null,C.title))),et.createElement(ql,null,et.createElement(AO,{mapped:!!C.figmaMapping},C.figmaMapping?et.createElement(et.Fragment,null,et.createElement("span",null,"\u{1F3A8}"),C.figmaMapping.figmaFrameName):"\u2014")),et.createElement(ql,null,et.createElement(PO,null,et.createElement(LO,{mapped:!!C.figmaMapping}),et.createElement(MO,{mapped:!!C.figmaMapping},C.figmaMapping?"Mapped":"Unmapped"))),et.createElement(ql,null,C.figmaMapping?et.createElement(Ok,{variant:"unlink",onClick:()=>p(C.id)},"Unlink"):et.createElement(Ok,{variant:"link",onClick:()=>n(C.id)},"Link"))))))))};import ke,{useState as Zl,useMemo as Gk}from"react";import{styled as dt}from"storybook/theming";import $k from"react";import{styled as Uk,keyframes as RO}from"storybook/theming";var zO=RO`
|
|
42
|
+
0% { transform: rotate(0deg); }
|
|
43
|
+
100% { transform: rotate(360deg); }
|
|
44
|
+
`,NO=Uk.span(({theme:e})=>({display:"inline-block",width:"12px",height:"12px",border:`2px solid ${e.appBorderColor}`,borderTopColor:"currentColor",borderRadius:"50%",animation:`${zO} 0.6s linear infinite`,marginRight:"6px",verticalAlign:"middle"})),OO=Uk.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}}})),Br=({loading:e=!1,disabled:t=!1,onClick:n,variant:r="default",children:o,loadingText:i})=>$k.createElement(OO,{variant:r,disabled:t||e,onClick:n},e&&$k.createElement(NO,null),e&&i?i:o);je();import on from"react";import{styled as Js}from"storybook/theming";var jk=Js.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"})),_O=Js.div({display:"flex",alignItems:"center",gap:"12px"}),Yl=Js.span({whiteSpace:"nowrap"}),Hk=Js.div({display:"flex",alignItems:"center",gap:"8px"}),Kl=Js.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),Xl=({inputTokens:e,outputTokens:t,costUsd:n,compact:r=!1})=>{let o=e+t,i=n*sw;return r?on.createElement(jk,null,on.createElement(Yl,null,o.toLocaleString()," tokens"),on.createElement(Hk,null,on.createElement(Kl,null,"$",n.toFixed(4)),on.createElement("span",null,"\xB7"),on.createElement(Kl,null,"\u20AA",i.toFixed(2)))):on.createElement(jk,null,on.createElement(_O,null,on.createElement(Yl,null,e.toLocaleString()," input"),on.createElement("span",null,"+"),on.createElement(Yl,null,t.toLocaleString()," output"),on.createElement("span",null,"="),on.createElement(Yl,null,on.createElement("strong",null,o.toLocaleString())," tokens")),on.createElement(Hk,null,on.createElement(Kl,null,"$",n.toFixed(4)),on.createElement("span",null,"\xB7"),on.createElement(Kl,null,"\u20AA",i.toFixed(2))))};import Nn from"react";import{styled as wo}from"storybook/theming";function Om(e){if(typeof e!="string")return e;try{let t=JSON.parse(e);if(t.summary)return t}catch{}return{summary:e}}var $O=wo.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:`${e.layoutMargin*.5}px`})),Wk=wo.div(({theme:e,color:t})=>({fontSize:e.typography.size.s1,fontWeight:e.typography.weight.bold,color:t||e.color.defaultText,lineHeight:"1.4"})),UO=wo.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.25}px`,flexWrap:"wrap",fontSize:e.typography.size.s1,color:e.color.mediumdark})),jO=wo.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})),HO=wo.span(({theme:e})=>({color:e.color.mediumlight,fontSize:e.typography.size.s1})),WO=wo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,fontStyle:"italic"})),VO=wo.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.color.mediumdark,display:"flex",gap:`${e.layoutMargin*.25}px`})),GO=wo.span(({theme:e})=>({fontWeight:e.typography.weight.bold,color:e.color.defaultText})),Vk=({data:e,color:t,compact:n})=>n?Nn.createElement(Wk,{color:t},e.summary):Nn.createElement($O,null,Nn.createElement(Wk,{color:t},e.summary),e.mappings&&e.mappings.length>0&&Nn.createElement(UO,null,e.mappings.map((r,o)=>Nn.createElement(Nn.Fragment,{key:o},Nn.createElement(jO,null,r.from," ",Nn.createElement(HO,null,"\u2192")," ",r.to)))),e.candidates!=null&&e.candidates>1&&Nn.createElement(WO,null,e.candidates," candidate variants matched"),e.defaults&&e.defaults.length>0&&Nn.createElement(Nn.Fragment,null,e.defaults.map((r,o)=>Nn.createElement(VO,{key:o},Nn.createElement(GO,null,r.choice),Nn.createElement("span",null,"\u2014 ",r.why)))));var qO=dt.div({display:"flex",flexDirection:"column",flex:1,overflow:"hidden"}),YO=dt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:`1px solid ${e.appBorderColor}`})),KO=dt.div({display:"flex",flexDirection:"column",gap:"4px"}),XO=dt.div({display:"flex",alignItems:"center",gap:"10px"}),QO=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"})),qk=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})),JO=dt.span(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark})),ZO=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(so)(({theme:e})=>({flex:1,fontSize:e.typography.size.s2})),n_=dt.div({display:"flex",gap:"4px"}),Ql=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"})),Jl=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"}),Jk=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)"}}})),Yk=dt.div({flex:1,display:"flex",flexDirection:"column",gap:"2px",minWidth:0}),Kk=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"})),_m=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"})),Iee=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"}),f_=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})),g_=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"}})),Fee=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})),Xk=({src:e,alt:t})=>{let[n,r]=Zl(!1);return ke.createElement(ke.Fragment,null,!n&&ke.createElement(Jk,null),ke.createElement(a_,{src:e,alt:t,onLoad:()=>r(!0),style:n?void 0:{position:"absolute",opacity:0}}))};function Qk(e){return e>=90?"high":e>=70?"medium":"low"}function h_(e){return e==="high"?"#16a34a":e==="medium"?"#d97706":"#ef4444"}var Zk=({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]=Zl(()=>{let b=new Set;for(let E of e.mappings)E.confidence>=90&&b.add(E.storyId);return b}),[g,S]=Zl(""),[C,F]=Zl("all"),k=Gk(()=>{let b=new Map;for(let E of t)b.set(E.id,{name:E.name,title:E.title});return b},[t]),R=Gk(()=>{let b=e.mappings;if(C!=="all"&&(b=b.filter(E=>Qk(E.confidence)===C)),g.trim()){let E=g.toLowerCase();b=b.filter(h=>{let T=k.get(h.storyId);return T?.name.toLowerCase().includes(E)||T?.title.toLowerCase().includes(E)||h.componentSetName.toLowerCase().includes(E)||h.figmaFrameName.toLowerCase().includes(E)})}return b},[e.mappings,C,g,k]),z=b=>{p(E=>{let h=new Set(E);return h.has(b)?h.delete(b):h.add(b),h})},_=()=>{let b=e.mappings.filter(E=>f.has(E.storyId));n(b)},M=e.mappings.filter(b=>b.confidence>=90).length,B=e.mappings.filter(b=>b.confidence>=70&&b.confidence<90).length,m=e.mappings.filter(b=>b.confidence<70).length,x=e.usage;return ke.createElement(qO,null,ke.createElement(YO,null,ke.createElement(KO,null,ke.createElement(XO,null,ke.createElement(QO,null,"Auto-Map Results"),ke.createElement(qk,{variant:"success"},e.stats.matched," matched"),e.unmatched.length>0&&ke.createElement(qk,{variant:"danger"},e.unmatched.length," unmatched"),a&&ke.createElement(g_,{variant:a},a==="cache"?"Loaded from cache":"Fresh analysis")),ke.createElement(JO,null,"Review matches below. Uncheck any incorrect mappings before applying.")),ke.createElement(ZO,null,a==="cache"&&o&&ke.createElement(m_,{onClick:o,disabled:s},s?"Re-running...":"Re-run LLM"),ke.createElement(Br,{onClick:r,variant:"ghost"},"Cancel"),ke.createElement(Br,{loading:i,onClick:_,loadingText:"Applying..."},"Apply ",f.size," Selected"))),ke.createElement(e_,null,ke.createElement(t_,{type:"text",placeholder:"Filter stories...",value:g,onChange:b=>S(b.target.value)}),ke.createElement(n_,null,ke.createElement(Ql,{active:C==="all",onClick:()=>F("all")},"All ",e.mappings.length),M>0&&ke.createElement(Ql,{active:C==="high",onClick:()=>F("high")},"\u226590% (",M,")"),B>0&&ke.createElement(Ql,{active:C==="medium",onClick:()=>F("medium")},"70-89% (",B,")"),m>0&&ke.createElement(Ql,{active:C==="low",onClick:()=>F("low")},"<70% (",m,")"))),ke.createElement(r_,null,R.map(b=>{let E=k.get(b.storyId),h=Qk(b.confidence),T=f.has(b.storyId),I=h==="low";return ke.createElement(o_,{key:b.storyId,dimmed:I&&!T},ke.createElement(i_,{checked:T,onClick:()=>z(b.storyId)},T?"\u2713":""),(()=>{let v=c?.(b.storyId);return v?ke.createElement(Jl,null,ke.createElement(Xk,{src:v,alt:E?.name||b.storyId})):l?ke.createElement(Jl,null,ke.createElement(Jk,null)):ke.createElement(s_,{bgColor:I?"#f1f5f9":"#eff6ff"},ke.createElement("span",{style:{fontFamily:"Inter",fontSize:"8px",fontWeight:500,color:I?"#94a3b8":"#3b82f6"}},(E?.name||"?").substring(0,4)))})(),ke.createElement(Yk,null,ke.createElement(Kk,null,E?.name||b.storyId),ke.createElement(_m,null,E?.title||"")),ke.createElement(l_,null,"\u2192"),(()=>{let v=u?.(b.figmaNodeId),A=Om(b.reason),P=A.summary+(A.candidates?` (${A.candidates} candidates)`:"");return v?ke.createElement(Jl,{title:P},ke.createElement(Xk,{src:v,alt:b.figmaFrameName})):ke.createElement(Jl,{title:P},ke.createElement("span",{style:{fontFamily:"Inter",fontSize:"10px",fontWeight:500,color:"#94a3b8"}},"No thumbnail"))})(),ke.createElement(Yk,null,ke.createElement(Kk,null,b.componentSetName),ke.createElement(_m,null,b.figmaFrameName),ke.createElement(Vk,{data:Om(b.reason),color:h_(h)})),ke.createElement(c_,{level:h},b.confidence,"%"),d&&ke.createElement(u_,{onClick:()=>d(b.componentSetName)},"Browse"))}),e.unmatched.length>0&&ke.createElement(p_,null,ke.createElement(_m,null,e.unmatched.length," stories couldn't be matched \u2014 map manually after applying"),ke.createElement(d_,null,e.unmatched.map(b=>{let E=k.get(b);return ke.createElement(f_,{key:b},ke.createElement("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#cbd5e1"}}),E?`${E.name} (${E.title})`:b)})))),x&&a!=="cache"&&ke.createElement("div",{style:{padding:"8px 24px",borderTop:"1px solid #f0f0f0"}},ke.createElement(Xl,{inputTokens:x.inputTokens||0,outputTokens:x.outputTokens||0,costUsd:x.costUsd||0})))};je();De();import{useState as vo,useCallback as ko,useRef as x_}from"react";import{useStorybookApi as y_}from"storybook/manager-api";function eC({projectId:e}){let t=y_(),n=x_(null),[r,o]=vo(!1),[i,s]=vo(!1),[a,u]=vo(!1),[c,l]=vo(null),[d,f]=vo(null),[p,g]=vo(null),[S,C]=vo(""),[F,k]=vo(null),R=ko(async()=>{let E=await fetch("/index.json");if(!E.ok)throw new Error("Failed to fetch Storybook index");let h=await E.json(),T=h.entries||h.stories||{},I=Object.keys(T).filter(P=>T[P].type==="story");y.debug(`[useAutoMap] Found ${I.length} stories in index.json`);let v=[];for(let P of I){let D=T[P],N=t.getData(P),w={...N?.initialArgs||{}},j=N?.argTypes||{};for(let[G,L]of Object.entries(j))if(!(G in w)){let K=L;if(K.defaultValue!==void 0)w[G]=K.defaultValue;else if(K.table?.defaultValue?.summary!==void 0){let ee=K.table.defaultValue.summary;ee==="false"?w[G]=!1:ee==="true"?w[G]=!0:w[G]=ee}}v.push({id:P,name:D.name||P.split("--").pop()||P,title:D.title||"",initialArgs:w,argTypes:j})}let A=v.filter(P=>Object.keys(P.initialArgs).length>0);return y.debug(`[useAutoMap] Manifest: ${v.length} stories, ${A.length} with args`),v},[t]),z=ko(async()=>{if(!e)return!1;try{let E=q(),h=localStorage.getItem("uicopilot_session_token");if(!h)return!1;let T=await fetch(`${E}/api/figma/auto-map?projectId=${e}`,{headers:{Authorization:`Bearer ${h}`}});if(!T.ok)return!1;let I=await T.json();return I.hasSuggestions&&I.mappings?.length>0?(f(I),k("cache"),C(`Loaded ${I.mappings.length} saved suggestions`),y.debug(`[useAutoMap] Loaded ${I.mappings.length} existing suggestions from DB`),!0):!1}catch{return!1}},[e]),_=ko(async E=>{o(!0),C("Collecting story information...");let h;try{if(h=await R(),E?.length&&(h=h.filter(I=>!E.includes(I.id)),y.debug(`[useAutoMap] After excluding mapped: ${h.length} stories`)),h.length===0){l("No unmapped stories found"),o(!1);return}g(h)}catch(I){l(I instanceof Error?I.message:"Failed to collect story manifest"),o(!1);return}o(!1),s(!0),C(`Analyzing ${h.length} stories against Figma components...`);let T=new AbortController;n.current=T;try{let I=q(),v=localStorage.getItem("uicopilot_session_token");if(!v)throw new Error("Not authenticated");let A=await fetch(`${I}/api/figma/auto-map`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${v}`},body:JSON.stringify({projectId:e,stories:h.map(D=>({id:D.id,name:D.name,title:D.title,initialArgs:D.initialArgs,argTypes:D.argTypes}))}),signal:T.signal});if(!A.ok){let D=await A.json();throw new Error(D.error||"Auto-map failed")}let P=await A.json();f(P),k("llm"),C(`Found ${P.stats.matched} matches (${P.stats.highConfidence} high confidence)`),y.debug(`[useAutoMap] Results: ${P.stats.matched}/${P.stats.total} matched, ${P.unmatched.length} unmatched`)}catch(I){if(I instanceof DOMException&&I.name==="AbortError"){C("Cancelled");return}l(I instanceof Error?I.message:"Auto-map failed")}finally{s(!1),n.current=null}},[e,R]),M=ko(async E=>{if(!e)return;if(l(null),f(null),k(null),o(!0),C("Checking for existing suggestions..."),await z()){o(!1);return}await _(E)},[e,z,_]),B=ko(async E=>{e&&(l(null),f(null),k(null),await _(E))},[e,_]),m=ko(async E=>{if(!(!e||E.length===0)){u(!0),C(`Applying ${E.length} mappings...`);try{let h=q(),T=localStorage.getItem("uicopilot_session_token");if(!T)throw new Error("Not authenticated");let I=0;for(let v of E)try{(await fetch(`${h}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:e,storyId:v.storyId,figmaNodeId:v.figmaNodeId,name:v.figmaFrameName||v.componentSetName})})).ok?I++:y.warn(`[useAutoMap] Failed to apply mapping for ${v.storyId}`)}catch(A){y.error(`[useAutoMap] Error applying mapping for ${v.storyId}:`,A)}C(`Applied ${I}/${E.length} mappings`),y.debug(`[useAutoMap] Applied ${I}/${E.length} mappings`)}catch(h){l(h instanceof Error?h.message:"Failed to apply mappings")}finally{u(!1)}}},[e]),x=ko(()=>{n.current?.abort()},[]),b=ko(()=>{f(null),g(null),l(null),C(""),k(null)},[]);return{collectAndMap:M,rerun:B,loadExisting:z,applyMappings:m,cancel:x,reset:b,isCollecting:r,isMapping:i,isApplying:a,error:c,results:d,manifest:p,progress:S,source:F}}De();import{useState as $m,useEffect as b_,useRef as tC}from"react";var nC=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 rC(e){let[t,n]=$m({}),[r,o]=$m(0),[i,s]=$m(!1),a=tC(null),u=tC(""),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+=nC){let g=e.slice(p,p+nC),S=await Promise.all(g.map(F=>S_(F,l.signal).then(k=>({id:F,img:k}))));if(l.signal.aborted)break;let C={};for(let{id:F,img:k}of S)d++,k&&(C[F]=k);Object.keys(C).length>0&&n(F=>({...F,...C})),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 be,{useState as oC,useEffect as ec,useMemo as w_}from"react";De();var Mi=({isOpen:e,onClose:t,onSelect:n,projectId:r,stories:o=[],currentStoryId:i,onStoryChange:s,multiSelect:a=!1,onMultiSelect:u,initialSearch:c})=>{let l=Gs({projectId:r||"",enabled:e&&!!r}),d=be.useRef(!1);ec(()=>{e&&c&&!d.current&&(l.setSearch(c),d.current=!0),e||(d.current=!1)},[e,c]);let[f,p]=oC(new Set),[g,S]=oC(i||o[0]?.id||"");ec(()=>{i&&S(i)},[i]),ec(()=>{l.expandedSets.forEach(B=>{let m=l.variantChildren[B];if(!m||m.length===0)return;let x=m;l.variantFilters.some(E=>E.value)&&(x=m.filter(E=>E.variantProperties?l.variantFilters.every(h=>h.value?E.variantProperties?.[h.property]===h.value:!0):!1));let b=x.slice(0,20).map(E=>E.id);b.length>0&&l.fetchVariantThumbnails(B,b)})},[l.expandedSets,l.variantChildren,l.variantFilters]),ec(()=>{p(new Set)},[g]);let C=w_(()=>{let B=[];return l.filteredFrames.forEach(m=>{if(m.type==="COMPONENT_SET"&&m.children){let x=l.variantFilters.some(b=>b.value)?m.children.filter(b=>b.variantProperties?l.variantFilters.every(E=>E.value?b.variantProperties?.[E.property]===E.value:!0):!1):m.children;B.push(...x)}else B.push(m)}),B},[l.filteredFrames,l.variantFilters]),F=B=>{if(a)p(m=>{let x=new Set(m);return x.has(B.id)?x.delete(B.id):x.add(B.id),x});else{let m=l.resolveThumbnail(B.id);try{n({...B,thumbnail:m})}catch(x){y.error("[ComponentBrowserModal] onSelect threw error:",x)}t()}},k=()=>{let B=C.map(x=>x.id),m=B.every(x=>f.has(x));p(m?new Set:new Set(B))},R=()=>{if(u&&f.size>0){let B=C.filter(m=>f.has(m.id)).map(m=>({...m,thumbnail:l.resolveThumbnail(m.id)}));u(B),p(new Set)}},z=B=>{S(B),s?.(B)},_=B=>{B.target===B.currentTarget&&t()},M=o.find(B=>B.id===g);return e?be.createElement(Uv,{onClick:_},be.createElement(jv,null,be.createElement(Hv,null,be.createElement(Wv,null,"Link Figma Frames"),be.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},be.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"),be.createElement(Vv,{onClick:t},"\xD7"))),be.createElement(Gv,null,l.error&&be.createElement(Zv,null,l.error),!l.error&&be.createElement(be.Fragment,null,o.length>0&&be.createElement(uk,null,be.createElement(pk,null,"Story:"),be.createElement(dk,{value:g,onChange:B=>z(B.target.value)},o.map(B=>be.createElement("option",{key:B.id,value:B.id},B.name,B.mappingsCount?` (${B.mappingsCount} linked)`:""))),M?.mappingsCount?be.createElement(fk,{hasMapping:!0},M.mappingsCount," frames linked"):null),be.createElement(Qv,null,be.createElement(Ul,null,be.createElement("input",{type:"checkbox",checked:l.showComponentSets,onChange:B=>l.setShowComponentSets(B.target.checked)}),"Component Sets"),be.createElement(Ul,null,be.createElement("input",{type:"checkbox",checked:l.showFrames,onChange:B=>l.setShowFrames(B.target.checked)}),"Frames"),be.createElement(Ul,null,be.createElement("input",{type:"checkbox",checked:l.showComponents,onChange:B=>l.setShowComponents(B.target.checked)}),"Components"),l.availablePages.length>1&&be.createElement(Pi,{isActive:!!l.figmaPage,value:l.figmaPage,onChange:B=>l.setFigmaPage(B.target.value),style:{marginLeft:"auto"}},be.createElement("option",{value:""},"All pages"),l.availablePages.map(B=>be.createElement("option",{key:B,value:B},B)))),l.filterSuggestion&&be.createElement(gk,null,be.createElement(mk,null,"AI suggests:"),be.createElement(hk,null,Object.entries(l.filterSuggestion.suggestedFilters).map(([B,m])=>`${B}=${m}`).join(", ")),be.createElement(xk,{onClick:l.applySuggestedFilters},"Apply"),be.createElement(yk,{onClick:l.dismissFilterSuggestion},"Dismiss")),l.filterSuggestionLoading&&be.createElement(bk,null,"Matching story args to Figma filters..."),l.availableFilters.length>0&&be.createElement(Hl,null,be.createElement(Xs,null,"Filters:"),l.availableFilters.map(({property:B,values:m})=>{let x=l.variantFilters.find(b=>b.property===B);return be.createElement(Pi,{key:B,isActive:!!x?.value,value:x?.value||"",onChange:b=>l.handleFilterChange(B,b.target.value)},be.createElement("option",{value:""},B),m.map(b=>be.createElement("option",{key:b,value:b},B,"=",b)))}),l.variantFilters.some(B=>B.value)&&be.createElement(Wl,{onClick:l.clearFilters},"Clear All")),be.createElement(qv,{type:"text",placeholder:"Search frames...",value:l.search,onChange:B=>l.setSearch(B.target.value),autoFocus:!0}),a&&C.length>0&&be.createElement(Sk,null,be.createElement(wk,{onClick:k},f.size===C.length?"Deselect All":"Select All Visible"),be.createElement(vk,null,f.size>0?`${f.size} selected of `:"Showing ",C.length," frames")),l.isLoading&&be.createElement(Sm,null,Array.from({length:6}).map((B,m)=>be.createElement(ck,{key:m},be.createElement("div",{style:{width:"100%",aspectRatio:"4 / 3"}},be.createElement(jl,{width:"100%",height:"100%"})),be.createElement("div",{style:{padding:"12px",display:"flex",flexDirection:"column",gap:"8px"}},be.createElement(jl,{width:"80%",height:"16px"}),be.createElement(jl,{width:"50%",height:"12px"}))))),!l.isLoading&&l.filteredFrames.length===0&&be.createElement(Jv,null,l.search?"No frames match your search":"No frames found in this Figma file"),!l.isLoading&&l.filteredFrames.length>0&&be.createElement(Sm,null,l.filteredFrames.map(B=>be.createElement(Qs,{key:B.id,frame:B,thumbnail:l.thumbnails[B.id],thumbnails:l.thumbnails,variantThumbnails:l.variantThumbnails[B.id],variantChildren:l.variantChildren[B.id],isLoadingVariants:l.loadingVariants.has(B.id),isExpanded:l.expandedSets.has(B.id),isNew:l.recentlyAdded.has(B.name),onToggleExpand:l.toggleExpanded,onSelect:F,multiSelect:a,selectedFrames:f,variantFilters:l.variantFilters}))))),a&&be.createElement(kk,null,be.createElement(Ck,{disabled:f.size===0,onClick:R},"Link ",f.size," Selected")))):null};ve();pt();var k_=Zt.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}),C_=Zt.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"})),T_=Zt.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app})),I_=Zt.div({display:"flex",alignItems:"center",gap:"20px"}),F_=Zt.h2(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,margin:0,display:"flex",alignItems:"center",gap:"8px"})),E_=Zt.div({display:"flex",gap:"4px"}),iC=Zt(io)(({theme:e,active:t})=>({padding:"8px 16px",borderBottom:"none",borderRadius:"6px",backgroundColor:t?e.background.hoverable:"transparent","&:hover":{backgroundColor:e.background.hoverable}})),A_=Zt(wn)({width:"32px",height:"32px",fontSize:"20px",borderRadius:"6px"}),P_=Zt.div({flex:1,overflow:"hidden",display:"flex",flexDirection:"column"}),L_=Zt.div(({theme:e})=>({padding:"12px 20px",borderTop:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.app,display:"flex",alignItems:"center",justifyContent:"space-between"})),M_=Zt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,display:"flex",gap:"16px"})),B_=Zt.div({display:"flex",flexDirection:"column",flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255, 255, 255, 0.95)",padding:"40px"}),D_=Zt.div({display:"flex",flexDirection:"column",alignItems:"center",gap:"20px",maxWidth:"400px"}),R_=Zt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText,textAlign:"center"})),z_=Zt.div(({theme:e})=>({fontFamily:e.typography.fonts.base,fontSize:e.typography.size.s2,color:e.color.mediumdark,textAlign:"center"})),N_=Zt.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden"})),O_=Zt.div(({theme:e})=>({width:"100%",height:"100%",backgroundColor:e.color.secondary,borderRadius:"4px",opacity:.6})),__=Zt.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"}})),sC=Zt.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"}})),aC=({isOpen:e,onClose:t,projectId:n})=>{let[r,o]=Bi("map"),[i,s]=Bi([]),[a,u]=Bi(!0),[c,l]=Bi(null),[d,f]=Bi(!1),[p,g]=Bi(null),S=eC({projectId:n}),{refreshMappings:C}=rt(),{featureFlags:F}=ie(),k=Je.useMemo(()=>S.results?.mappings.map(v=>v.storyId)||[],[S.results]),R=rC(k),z=Co(async()=>{u(!0);try{let v=await fetch("/index.json");if(!v.ok)throw new Error("Failed to fetch index.json");let A=await v.json(),P=A.entries||A.stories||{},D=Object.entries(P).filter(([,w])=>w.type==="story").map(([w,j])=>({id:w,name:j.name||w.split("--").pop()||w,title:j.title||"",importPath:j.importPath,componentTitle:j.title?.split("/").slice(0,-1).join("/")||j.title,figmaMapping:null}));try{let w=q(),j=localStorage.getItem("uicopilot_session_token"),G=await oe(`${w}/api/mappings?projectId=${n}&_t=${Date.now()}`,{headers:{Authorization:`Bearer ${j}`}});if(G.ok){let L=await G.json(),K=new Map((L.mappings||[]).map(ee=>[ee.storyId,ee]));D.forEach(ee=>{let re=K.get(ee.id);re&&re.figmaNodeId&&(ee.figmaMapping={figmaNodeId:re.figmaNodeId,figmaFrameName:re.name||re.figmaFrameName||""})})}}catch(w){console.warn("[StoryMappingAssistant] Failed to fetch mappings (stories still loaded):",w)}s(D);let N=D.find(w=>!w.figmaMapping);N?l(N.id):D.length>0&&l(D[0].id)}catch(v){console.error("[StoryMappingAssistant] Error fetching stories:",v)}finally{u(!1)}},[n]);v_(()=>{e&&z()},[e,z]);let _=Co((v,A,P)=>{s(w=>w.map(j=>j.id===v?{...j,figmaMapping:{figmaNodeId:A,figmaFrameName:P}}:j));let D=i.findIndex(w=>w.id===v),N=i.find((w,j)=>j>D&&!w.figmaMapping);N&&l(N.id)},[i]),M=Co(v=>{s(A=>A.map(P=>P.id===v?{...P,figmaMapping:null}:P))},[]),B=Co(v=>{l(v),o("map")},[]),m=Co(()=>{let v=i.filter(A=>A.figmaMapping).map(A=>A.id);S.collectAndMap(v)},[i,S]),x=Co(()=>{let v=i.filter(A=>A.figmaMapping).map(A=>A.id);f(!1),S.rerun(v)},[i,S]),b=Co(async v=>{await S.applyMappings(v),f(!1),S.reset(),z(),C()},[S,z,C]),E=Co(()=>{f(!1),S.reset()},[S]);Je.useEffect(()=>{S.results&&f(!0)},[S.results]);let h=v=>{v.target===v.currentTarget&&t()};if(!e)return null;let T=i.filter(v=>v.figmaMapping).length,I=i.length;return Je.createElement(Je.Fragment,null,Je.createElement(k_,{onClick:h},Je.createElement(C_,{onClick:v=>v.stopPropagation()},Je.createElement(T_,null,Je.createElement(I_,null,Je.createElement(F_,null,Je.createElement("span",null,"\u{1F517}"),"Link Stories to Figma"),Je.createElement(E_,null,Je.createElement(iC,{active:r==="map",onClick:()=>o("map")},"Map Stories"),Je.createElement(iC,{active:r==="view",onClick:()=>o("view")},"View All Mappings"))),Je.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px"}},F.enableAutoMap&&!d&&!S.isCollecting&&!S.isMapping&&Je.createElement(__,{onClick:m,disabled:a||i.length===0},Je.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2"},Je.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),Je.createElement("path",{d:"M2 17l10 5 10-5"}),Je.createElement("path",{d:"M2 12l10 5 10-5"})),"Auto-Map All"),Je.createElement(A_,{onClick:t},"\xD7"))),Je.createElement(P_,null,(S.isCollecting||S.isMapping)&&Je.createElement(B_,null,Je.createElement(D_,null,Je.createElement(N_,null,Je.createElement(O_,null)),Je.createElement(R_,null,"Auto-mapping stories to Figma"),Je.createElement(z_,null,S.progress),Je.createElement(Br,{onClick:S.cancel,variant:"ghost"},"Cancel"))),d&&S.results&&Je.createElement(Zk,{results:S.results,stories:i,onApply:b,onCancel:E,onRerun:x,isApplying:S.isApplying,isRerunning:S.isCollecting||S.isMapping,source:S.source,resolveThumbnail:v=>S.results?.thumbnailUrls?.[v],resolveStoryScreenshot:v=>R.screenshots[v],isCapturingScreenshots:R.isCapturing,onBrowse:v=>g(v)}),!d&&!S.isCollecting&&!S.isMapping&&(r==="map"?Je.createElement(Rk,{stories:i,loading:a,selectedStoryId:c,onSelectStory:l,onStoryMapped:_,projectId:n}):Je.createElement(_k,{stories:i,loading:a,onLink:B,onUnlink:M,projectId:n}))),Je.createElement(L_,null,Je.createElement(M_,null,Je.createElement("span",null,"Total: ",I," stories"),Je.createElement(sC,{type:"mapped"},Je.createElement("span",{className:"dot"}),T," mapped"),Je.createElement(sC,{type:"unmapped"},Je.createElement("span",{className:"dot"}),I-T," unmapped"))))),Je.createElement(Mi,{isOpen:!!p,onClose:()=>g(null),onSelect:()=>g(null),projectId:n,initialSearch:p||void 0}))};import Xr,{useEffect as $_,useCallback as U_}from"react";import{styled as qo,keyframes as lC}from"storybook/theming";var j_=lC({from:{opacity:0},to:{opacity:1}}),H_=lC({from:{opacity:0,transform:"translate(-50%, -50%) scale(0.95)"},to:{opacity:1,transform:"translate(-50%, -50%) scale(1)"}}),W_=qo.div({position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4,animation:`${j_} 150ms ease-out`}),V_=qo.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:`${H_} 150ms ease-out`})),G_=qo.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,fontFamily:e.typography.fonts.base,color:e.color.defaultText})),q_=qo.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})),Y_=qo.div(({theme:e})=>({display:"flex",justifyContent:"flex-end",gap:`${e.layoutMargin*.8}px`})),K_=qo.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}})),X_=qo.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":{opacity:.9}})),Di=({isOpen:e,title:t,message:n,confirmLabel:r="OK",cancelLabel:o="Cancel",variant:i="default",onConfirm:s,onCancel:a})=>{let u=U_(c=>{c.key==="Escape"&&a()},[a]);return $_(()=>{if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,u]),e?Xr.createElement(Xr.Fragment,null,Xr.createElement(W_,{onClick:a}),Xr.createElement(V_,{role:"dialog","aria-modal":"true","aria-label":t},Xr.createElement(G_,null,t),Xr.createElement(q_,null,n),Xr.createElement(Y_,null,Xr.createElement(K_,{onClick:a},o),Xr.createElement(X_,{variant:i,onClick:s},r)))):null};pt();var cC=Yn.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}})),J_=Yn.div(({theme:e})=>({width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{width:"16px",height:"16px"}})),Z_=Yn.div({display:"flex",alignItems:"center",gap:"12px",flex:1}),e$=Yn.div({display:"flex",alignItems:"center",gap:"8px"}),t$=Yn.div(({theme:e})=>({width:"60px",height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),n$=Yn.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"})),r$=Yn.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"})),o$=Yn.span(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText})),i$=Yn(Kc)({padding:"4px 10px",fontSize:"12px",fontWeight:600,marginLeft:"auto"}),s$=Yn(Kc)(({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)"}})),a$=Yn.span(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontStyle:"italic"})),l$=Yn.div(({theme:e})=>({width:"14px",height:"14px",border:`2px solid ${e.appBorderColor}`,borderTopColor:le,borderRadius:"50%",animation:"figma-mapping-spin 0.8s linear infinite","@keyframes figma-mapping-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),c$=Yn.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),uC=()=>{let[e,t]=tc(!1),[n,r]=tc({totalStories:0,mappedStories:0,loading:!0}),{selectedProjectId:o}=Ze(),{sessionToken:i}=we();Q_(()=>{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 M=await _.json(),B=M.entries||M.stories||{},m=Object.keys(B).filter(T=>B[T].type==="story").length,x=Object.keys(B).filter(T=>B[T].type==="story"),b=q(),E=await oe(`${b}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}}),h=0;if(E.ok){let T=await E.json(),I=T.mappings||T||[];if(Array.isArray(I)){let v=new Set(I.map(A=>A.storyId).filter(Boolean));h=x.filter(A=>v.has(A)).length}else{let v=await oe(`${b}/api/mappings/stats?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(v.ok){let A=await v.json();h=Math.min(A.mappedStoriesCount||0,m)}}}r({totalStories:m,mappedStories:h,loading:!1})}catch(_){console.error("[FigmaMappingsSection] Error fetching stats:",_),r(M=>({...M,loading:!1}))}},[a,u]=tc(!1),[c,l]=tc(!1),d=async()=>{!o||!i||l(!0)},f=async()=>{l(!1),u(!0);try{let _=q(),M=await oe(`${_}/api/mappings?projectId=${o}`,{headers:{Authorization:`Bearer ${i}`}});if(!M.ok)throw new Error("Failed to fetch mappings");let m=(await M.json()).mappings||[];await Promise.all(m.map(x=>oe(`${_}/api/mappings?id=${encodeURIComponent(x.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(cC,null,kt.createElement(a$,null,"Select a project to link Figma designs"));let{totalStories:S,loading:C}=n,F=Math.min(n.mappedStories,S),k=F===0?"none":F>=S?"complete":"partial",R=S>0?Math.min(100,Math.round(F/S*100)):0,z=k==="none"?"Link designs":"Manage";return kt.createElement(kt.Fragment,null,kt.createElement(cC,null,kt.createElement(J_,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(Z_,null,kt.createElement(o$,null,"Figma Mappings"),kt.createElement(e$,null,C?kt.createElement(kt.Fragment,null,kt.createElement(l$,null),kt.createElement(c$,null,"Loading...")):kt.createElement(kt.Fragment,null,kt.createElement(t$,null,kt.createElement(n$,{percent:R,state:k})),kt.createElement(r$,{state:k},`${F}/${S}`)))),F>0&&kt.createElement(s$,{onClick:d,disabled:C||a},a?"Unlinking...":"Unlink All"),kt.createElement(i$,{onClick:p,disabled:C},z)),e&&kt.createElement(aC,{isOpen:e,onClose:g,projectId:o}),kt.createElement(Di,{isOpen:c,title:"Unlink All Mappings",message:`Unlink all ${n.mappedStories} Figma mappings?`,confirmLabel:"Unlink All",variant:"danger",onConfirm:f,onCancel:()=>l(!1)}))};import ce,{useState as Zs,useEffect as Um,useCallback as u$}from"react";import{styled as Kn}from"storybook/theming";ve();je();pt();var jm=Kn.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.content,borderRadius:"8px",border:`1px solid ${e.appBorderColor}`,marginBottom:"16px",fontSize:"12px"})),Hm=Kn.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),Wm=Kn.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),Pte=Kn(Er)({padding:"5px 12px",fontSize:"12px"}),Vm=Kn.div(({theme:e})=>({display:"flex",gap:"16px",color:e.color.mediumdark,marginBottom:"4px"})),nc=Kn.span(({theme:e})=>({whiteSpace:"nowrap","& strong":{color:e.color.defaultText,fontWeight:600}})),p$=Kn.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})),d$=Kn.div(({theme:e})=>({marginTop:"6px",padding:"6px 8px",backgroundColor:e.background.hoverable,borderRadius:"4px",color:e.color.mediumdark,lineHeight:"1.4"})),Gm=Kn.span(({theme:e,type:t})=>({fontWeight:500,color:t==="added"?e.color.positive:t==="removed"?e.color.negative:e.color.warning})),f$=Kn.span(({theme:e})=>({color:e.color.mediumdark,fontSize:"12px"})),rc=Kn.div(({theme:e})=>({width:"100%",height:"8px",backgroundColor:e.appBorderColor,borderRadius:"4px",overflow:"hidden",marginTop:"10px"})),oc=Kn.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"3px",transition:"width 0.5s ease"})),Yo=Kn.div(({theme:e})=>({display:"flex",justifyContent:"space-between",marginTop:"6px",fontSize:"12px",fontWeight:500,color:e.color.defaultText})),pC=new Set,dC=()=>{let{userRole:e,featureFlags:t}=ie(),[n,r]=Zs(null),[o,i]=Zs(!0),[s,a]=Zs(!1),[u,c]=Zs(!1),[l,d]=Zs(!1),{selectedProjectId:f,projects:p}=Ze(),{sessionToken:g}=we(),S=u$(async()=>{if(!(!f||!g))try{let M=q(),B=await oe(`${M}/api/figma/cache-status?projectId=${f}`,{headers:{Authorization:`Bearer ${g}`}});if(B.ok){let m=await B.json();r(m)}}catch(M){console.error("[FigmaCacheSection] Error:",M)}finally{i(!1)}},[f,g]);Um(()=>{S()},[S]),Um(()=>{if(o||s||!n||n.structureStatus!=="none"||!f||pC.has(f))return;let M=p.find(m=>m.id===f);(M?.figmaFileUrl||M?.figmaFileId)&&(pC.add(f),C())},[o,s,n?.structureStatus,f,p]),Um(()=>{let M=n?.thumbnailProgress?.status,B=n?.enrichmentProgress?.status,m=n?.thumbnailProgress?.cached??0,x=n?.thumbnailProgress?.total??0,b=M==="in-progress"||M==="pending"||x>0&&m<x,E=B==="in-progress"||B==="pending",h=!n?.thumbnailProgress&&n?.structureStatus==="cached";if(!(b||E||h)||!n||n.structureStatus==="none")return;let I=setInterval(()=>{S()},3e3);return()=>{clearInterval(I)}},[n?.thumbnailProgress?.status,n?.thumbnailProgress?.cached,n?.thumbnailProgress?.total,n?.enrichmentProgress?.status,n?.structureStatus,S]);let C=async()=>{if(!(!f||!g)){a(!0);try{let M=q();await oe(`${M}/api/figma/frames?projectId=${f}&type=COMPONENT_SET&page=1&limit=1&refresh=true`,{headers:{Authorization:`Bearer ${g}`}},6e4),await new Promise(B=>setTimeout(B,1e3)),await S(),setTimeout(async()=>{await S()},3e3)}catch(M){console.error("[FigmaCacheSection] Reload error:",M)}finally{a(!1)}}},F=async()=>{if(!(!f||!g)){c(!0);try{let M=q(),B=await oe(`${M}/api/figma/cache/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({projectId:f})});console.log("[FigmaCacheSection] Cache invalidate response:",B.status),await oe(`${M}/api/figma/frames/invalidate`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},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(M){console.error("[FigmaCacheSection] Clear cache error:",M)}finally{c(!1)}}},k=async()=>{if(!(!f||!g)){d(!0);try{let M=q();await oe(`${M}/api/figma/enrich`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`},body:JSON.stringify({projectId:f})});let B=setInterval(async()=>{await S()},3e3),m=setInterval(()=>{(n?.enrichmentProgress?.status==="complete"||n?.enrichmentProgress?.status==="error")&&(clearInterval(B),clearInterval(m),d(!1),S())},3e3);setTimeout(()=>{clearInterval(B),clearInterval(m),d(!1)},6e5)}catch(M){console.error("[FigmaCacheSection] Enrich error:",M),d(!1)}}};if(!f)return null;if(o)return ce.createElement(jm,null,ce.createElement(Hm,null,ce.createElement(Wm,null,"Figma Cache")),ce.createElement(Vm,null,ce.createElement(nc,null,"Loading cache status\u2026")),ce.createElement(rc,null,ce.createElement(oc,{percent:100,style:{opacity:.3}})));if(!n||n.structureStatus==="none")return ce.createElement(jm,null,ce.createElement(Hm,null,ce.createElement(Wm,null,"Figma Cache"),ce.createElement(Br,{loading:s,onClick:C,loadingText:"Loading..."},"\u21BB Load")),s?ce.createElement(ce.Fragment,null,ce.createElement(rc,null,ce.createElement(oc,{percent:30,style:{animation:"none",width:"100%",opacity:.3}})),ce.createElement(Yo,null,ce.createElement("span",null,"Downloading structure from Figma... this may take 30-60 seconds"))):ce.createElement(Vm,null,ce.createElement(nc,null,"No cache \u2014 click Load to fetch from Figma")));let R=M=>{let B=Date.now()-new Date(M).getTime(),m=Math.floor(B/6e4);if(m<1)return"just now";if(m<60)return`${m}m ago`;let x=Math.floor(m/60);return x<24?`${x}h ago`:`${Math.floor(x/24)}d ago`},z=n.cacheDiff,_=z&&(z.added.length>0||z.removed.length>0||z.renamed.length>0);return ce.createElement(jm,null,ce.createElement(Hm,null,ce.createElement(Wm,null,"Figma Cache"," ",ce.createElement(p$,{status:n.structureStatus},n.structureStatus)),ce.createElement("div",{style:{display:"flex",gap:"6px"}},e==="admin"&&ce.createElement(Br,{loading:l,onClick:k,loadingText:"Enriching..."},"Enrich"),ce.createElement(Br,{loading:u,onClick:F,variant:"ghost",loadingText:"Clearing..."},"Clear"),ce.createElement(Br,{loading:s,onClick:C,loadingText:"Reloading..."},"\u21BB Reload"))),s&&ce.createElement(Yo,null,ce.createElement("span",null,"Downloading structure from Figma...")),ce.createElement(Vm,null,ce.createElement(nc,null,ce.createElement("strong",null,n.componentSetCount)," component sets"),ce.createElement(nc,null,ce.createElement("strong",null,n.pageCount)," pages"),n.structureCachedAt&&ce.createElement(f$,null,"Updated ",R(n.structureCachedAt))),_&&ce.createElement(d$,null,"Since last reload:"," ",z.added.length>0&&ce.createElement(Gm,{type:"added"},"+",z.added.length," added"),z.added.length>0&&z.removed.length>0&&" \xB7 ",z.removed.length>0&&ce.createElement(Gm,{type:"removed"},"\u2212",z.removed.length," removed"),(z.added.length>0||z.removed.length>0)&&z.renamed.length>0&&" \xB7 ",z.renamed.length>0&&ce.createElement(Gm,{type:"renamed"},z.renamed.length," renamed")),n.thumbnailProgress&&n.thumbnailProgress.status==="in-progress"&&ce.createElement(ce.Fragment,null,ce.createElement(rc,null,ce.createElement(oc,{percent:n.thumbnailProgress.total>0?Math.round(n.thumbnailProgress.cached/n.thumbnailProgress.total*100):0})),ce.createElement(Yo,null,ce.createElement("span",null,"Caching component set thumbnails to CDN...",n.thumbnailProgress.currentName&&ce.createElement(ce.Fragment,null," ",n.thumbnailProgress.currentName)),ce.createElement("span",null,n.thumbnailProgress.cached," / ",n.thumbnailProgress.total))),n.thumbnailProgress&&n.thumbnailProgress.status==="complete"&&ce.createElement(Yo,null,ce.createElement("span",null,"Thumbnails: ",n.thumbnailProgress.cached," / ",n.thumbnailProgress.total," cached to CDN \u2713")),(!n.thumbnailProgress||n.thumbnailProgress.status==="pending")&&ce.createElement(Yo,null,ce.createElement("span",null,"Thumbnails: not pre-cached")),n.enrichmentProgress&&n.enrichmentProgress.status==="in-progress"&&ce.createElement(ce.Fragment,null,ce.createElement(rc,null,ce.createElement(oc,{percent:n.enrichmentProgress.total>0?Math.round(n.enrichmentProgress.enriched/n.enrichmentProgress.total*100):0})),ce.createElement(Yo,null,ce.createElement("span",null,"Enriching components with AI...",n.enrichmentProgress.currentName&&ce.createElement(ce.Fragment,null," ",n.enrichmentProgress.currentName)),ce.createElement("span",null,n.enrichmentProgress.enriched," / ",n.enrichmentProgress.total))),n.enrichmentProgress&&n.enrichmentProgress.status==="complete"&&ce.createElement(ce.Fragment,null,ce.createElement(Yo,null,ce.createElement("span",null,"AI enrichment: ",n.enrichmentProgress.enriched," / ",n.enrichmentProgress.total," component sets \u2713"))),n.enrichmentProgress&&n.enrichmentProgress.status==="processing"&&t.showCosts&&n.enrichmentProgress.costUsd!=null&&n.enrichmentProgress.costUsd>0&&ce.createElement("div",{style:{marginTop:"6px"}},ce.createElement(Xl,{inputTokens:n.enrichmentProgress.inputTokens||0,outputTokens:n.enrichmentProgress.outputTokens||0,costUsd:n.enrichmentProgress.costUsd,compact:!0})))};import xt,{useState as Ri}from"react";import{styled as Dr}from"storybook/theming";ve();je();pt();var qm=Dr.div({padding:"12px 16px"}),g$=Dr.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"}),fC=Dr.label(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),gC=Dr.button(({theme:e})=>({background:"none",border:"none",fontSize:"12px",color:le,cursor:"pointer",padding:0,"&:hover":{textDecoration:"underline"}})),m$=Dr.div({display:"flex",gap:"8px",alignItems:"center"}),h$=Dr.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:le,boxShadow:`0 0 0 1px ${le}`},"&::placeholder":{color:e.color.mediumlight,fontFamily:"inherit"}})),mC=Dr.span(({variant:e})=>({fontSize:"12px",color:e==="success"?"#16a34a":e==="error"?"#dc2626":"#6b7280",marginTop:"6px",display:"block",lineHeight:1.4})),x$=Dr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",lineHeight:1.5,"& a":{color:le,textDecoration:"none","&:hover":{textDecoration:"underline"}},"& ol":{margin:"4px 0 0 16px",padding:0},"& li":{marginBottom:"2px"}})),y$=Dr.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})),b$=Dr.button(({theme:e})=>({background:"none",border:"none",fontSize:"11px",color:"#dc2626",cursor:"pointer",marginLeft:"auto","&:hover":{textDecoration:"underline"}})),hC=({onConnected:e})=>{let{sessionToken:t}=we(),[n,r]=Ri(!1),[o,i]=Ri(""),[s,a]=Ri(!1),[u,c]=Ri(null),[l,d]=Ri(null),[f,p]=Ri(!1),g=async()=>{if(!(!o.trim()||!t)){a(!0),c(null);try{let S=q(),C=await oe(`${S}/api/figma/pat`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify({token:o.trim()})}),F=await C.json();if(!C.ok){c({type:"error",message:F.error||"Failed to save token"});return}d(F.figmaUser?.handle||F.figmaUser?.email||"Connected"),c({type:"success",message:`Connected as ${F.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(qm,null,xt.createElement(fC,null,"Figma Personal Access Token"),xt.createElement(y$,null,xt.createElement("span",null,"\u2713 Connected as ",xt.createElement("strong",null,l)),xt.createElement(b$,{onClick:()=>{d(null),c(null)}},"Change token"))):n?xt.createElement(qm,null,xt.createElement(g$,null,xt.createElement(fC,null,"Figma Personal Access Token"),xt.createElement(gC,{onClick:()=>p(!f)},f?"Hide instructions":"How to generate")),f&&xt.createElement(x$,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(m$,null,xt.createElement(h$,{type:"password",value:o,onChange:S=>i(S.target.value),placeholder:"figd_...",onKeyDown:S=>{S.key==="Enter"&&o.trim()&&g()}}),xt.createElement(qt,{onClick:g,disabled:!o.trim()||s},s?"Verifying...":"Save & Verify")),u&&xt.createElement(mC,{variant:u.type},u.message),xt.createElement(mC,{variant:"info"},"Read-only access. Your token is stored securely and never shared.")):xt.createElement(qm,null,xt.createElement(gC,{onClick:()=>r(!0)},"Or use a Personal Access Token \u2192"))};ve();je();pt();var w$=St.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},St.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"}),St.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"}),St.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),St.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"}),St.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"})),Km=vr.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",marginBottom:"16px",backgroundColor:e.background.content})),v$=vr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",backgroundColor:e.background.hoverable,borderBottom:`1px solid ${e.appBorderColor}`})),k$=vr.div({width:"16px",height:"16px",display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}),C$=vr.span(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText,flex:1})),Xm=vr.div({"& > *":{border:"none",borderRadius:0,marginBottom:0,borderBottom:"1px solid rgba(0,0,0,0.06)","&:last-child":{borderBottom:"none"}}}),T$=vr.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"})),I$=vr.div({display:"flex",alignItems:"center",gap:"8px"}),F$=vr(er)(({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"})),E$=vr.div({padding:"20px 16px",display:"flex",flexDirection:"column",gap:"12px"}),Xte=vr.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"}}),A$=vr.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}})),yC=({hideHeader:e=!1})=>{let{sessionToken:t}=we(),[n,r]=Ym(!1),[o,i]=Ym(null),[s,a]=Ym(!1);S$(()=>{if(!t)return;let d=q();oe(`${d}/api/figma/connection-status`,{headers:{Authorization:`Bearer ${t}`}}).then(f=>f.json()).then(f=>i(!!f.connected)).catch(()=>i(!1))},[t]);let u=xC(()=>{let f=`${q()}/addon/auth`;window.open(f,"figma-oauth","width=600,height=700,left=200,top=100")},[]),c=xC(async()=>{try{r(!0);let d=q(),f=await oe(`${d}/api/figma/disconnect`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});(f.ok||f.status===404)&&i(!1)}catch{}finally{r(!1)}},[t]),l=e?null:St.createElement(v$,null,St.createElement(k$,null,w$),St.createElement(C$,null,"Figma Integration"));return o===null?St.createElement(Km,null,l,St.createElement(Xm,null,St.createElement("div",{style:{padding:"16px",fontSize:"13px",color:"#9ca3af"}},"Checking Figma connection..."))):o===!1?St.createElement(Km,null,l,St.createElement(Xm,null,St.createElement(E$,null,St.createElement(qt,{onClick:u,style:{width:"100%"}},"Connect with Figma"),St.createElement(A$,null,"or"),St.createElement(hC,{onConnected:()=>i(!0)})))):St.createElement(Km,null,l,St.createElement(T$,null,St.createElement(I$,null,St.createElement("span",{style:{fontSize:"18px"}},"\u2713"),St.createElement("span",{style:{fontSize:"13px",fontWeight:600,color:"#00cc66"}},"Connected to Figma")),St.createElement(F$,{onClick:()=>a(!0),disabled:n},n?"Disconnecting...":"Disconnect")),St.createElement(Di,{isOpen:s,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:()=>{a(!1),c()},onCancel:()=>a(!1)}),St.createElement(Xm,null,St.createElement($v,null),St.createElement(uC,null),St.createElement(dC,null)))};ve();var P$=cr.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"}),L$=cr.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"})),M$=cr.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})),B$=cr.h2(({theme:e})=>({margin:0,fontSize:"16px",fontWeight:600,color:e.color.defaultText})),D$=cr(wn)({fontSize:"18px",padding:"2px 8px",lineHeight:1,background:"transparent",border:"none"}),R$=cr.div({display:"flex",flexDirection:"column",gap:"16px",padding:"0 20px 20px"}),bC=cr.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"14px",padding:"16px",borderRadius:"12px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content})),SC=cr.div({display:"flex",alignItems:"center",gap:"10px"}),wC=cr.h3(({theme:e})=>({margin:0,fontSize:"14px",fontWeight:600,color:e.color.defaultText,flex:1})),z$=cr.div({width:"28px",height:"28px",borderRadius:"7px",backgroundColor:le,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"11px",fontWeight:700,letterSpacing:"0.3px",flexShrink:0}),N$=cr.div({width:"22px",height:"22px",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center","& svg":{width:"22px",height:"22px"}}),vC=cr.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"}})),kC=({onClose:e})=>{let{isConnected:t}=we(),{selectedProjectId:n}=Ze();return Et.createElement(P$,{onClick:e},Et.createElement(L$,{onClick:r=>r.stopPropagation()},Et.createElement(M$,null,Et.createElement(B$,null,"Settings"),Et.createElement(D$,{onClick:e,title:"Close settings"},"\xD7")),Et.createElement(R$,null,Et.createElement(bC,null,Et.createElement(SC,null,Et.createElement(z$,null,"UI"),Et.createElement(wC,null,"UI Copilot")),Et.createElement(vC,null,Et.createElement(Rv,null),t&&Et.createElement(Nv,null))),t&&n&&Et.createElement(bC,null,Et.createElement(SC,null,Et.createElement(N$,null,Et.createElement("svg",{viewBox:"0 0 38 57",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Et.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"}),Et.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"}),Et.createElement("path",{d:"M19 0V19H28.5C33.7467 19 38 14.7467 38 9.5C38 4.25329 33.7467 0 28.5 0H19Z",fill:"#FF7262"}),Et.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"}),Et.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"}))),Et.createElement(wC,null,"Figma Integration")),Et.createElement(vC,null,Et.createElement(yC,{hideHeader:!0}))))))};import ft,{useEffect as BC,useMemo as d4,useState as f4,useRef as g4}from"react";import{styled as Cn,keyframes as m4}from"storybook/theming";ve();ve();import Xt,{useState as O$}from"react";import{styled as On}from"storybook/theming";var Qr=[{id:"claude-sonnet-4-5-20250929",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 _$=On.div({display:"flex",alignItems:"center",gap:"8px",width:"100%"}),$$=On.div({display:"inline-flex",flexWrap:"nowrap",gap:"4px",alignItems:"center"}),U$=On.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"}}),j$=On.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}})),H$=On.div({position:"relative",display:"inline-block"}),W$=On.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}})),V$=On.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"})),Qm=On.div(({theme:e})=>({borderBottom:`1px solid ${e.appBorderColor}`,"&:last-child":{borderBottom:"none"}})),Jm=On.div(({theme:e})=>({padding:"8px 12px",fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px",backgroundColor:e.background.app})),G$=On.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}})),q$=On.input({cursor:"pointer",flexShrink:0,"&:disabled":{cursor:"not-allowed"}}),Y$=On.div({flex:1,minWidth:0}),K$=On.div({fontSize:"12px",fontWeight:500,marginBottom:"2px"}),X$=On.div(({theme:e})=>({fontSize:"10px",color:e.textMutedColor,lineHeight:"1.2"})),Q$=5,CC=()=>{let{selectedModels:e,toggleModel:t,isReviewing:n}=ie(),[r,o]=O$(!1),i=Qr.filter(p=>p.provider==="anthropic"&&!e.includes(p.id)),s=Qr.filter(p=>p.provider==="openai"&&!e.includes(p.id)),a=Qr.filter(p=>p.provider==="google"&&!e.includes(p.id)),u=Qr.filter(p=>e.includes(p.id)),c=e.length<Q$,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),S=g&&e.length===1,C=n||S||!g&&!c;return Xt.createElement(G$,{key:p.id,disabled:C,onClick:()=>d(p.id)},Xt.createElement(q$,{type:"checkbox",checked:g,disabled:C,onChange:()=>{},onClick:F=>F.stopPropagation()}),Xt.createElement(Y$,null,Xt.createElement(K$,null,p.name),p.description&&Xt.createElement(X$,null,p.description)))};return Xt.createElement(_$,null,Xt.createElement(H$,null,Xt.createElement(W$,{disabled:n,isOpen:r,onClick:()=>o(!r)},Xt.createElement("span",null,"Select model"),Xt.createElement("span",null,r?"\u25B2":"\u25BC")),r&&Xt.createElement(V$,null,Xt.createElement(Qm,null,Xt.createElement(Jm,null,"Anthropic"),i.map(f)),Xt.createElement(Qm,null,Xt.createElement(Jm,null,"OpenAI"),s.map(f)),Xt.createElement(Qm,null,Xt.createElement(Jm,null,"Google"),a.map(f)))),Xt.createElement($$,null,u.map(p=>Xt.createElement(U$,{key:p.id,disabled:n,provider:p.provider},p.name,e.length>1&&Xt.createElement(j$,{disabled:n,onClick:g=>l(p.id,g),title:"Remove model"},"\xD7")))))};import Ce,{useState as J$,useEffect as Z$}from"react";import{styled as jt,keyframes as Ni}from"storybook/theming";ve();var e4=Ni`
|
|
34
45
|
0%, 100% {
|
|
35
46
|
opacity: 1;
|
|
36
47
|
transform: scale(1);
|
|
@@ -39,20 +50,20 @@ ${Ze}`).join(`
|
|
|
39
50
|
opacity: 0.4;
|
|
40
51
|
transform: scale(0.8);
|
|
41
52
|
}
|
|
42
|
-
`,
|
|
53
|
+
`,t4=Ni`
|
|
43
54
|
0% { transform: rotate(0deg); }
|
|
44
55
|
100% { transform: rotate(360deg); }
|
|
45
|
-
`,
|
|
56
|
+
`,FC=Ni`
|
|
46
57
|
0% { opacity: 0; transform: translateY(2px); }
|
|
47
58
|
100% { opacity: 1; transform: translateY(0); }
|
|
48
|
-
`,
|
|
59
|
+
`,n4=Ni`
|
|
49
60
|
0%, 100% {
|
|
50
61
|
opacity: 1;
|
|
51
62
|
}
|
|
52
63
|
50% {
|
|
53
64
|
opacity: 0.6;
|
|
54
65
|
}
|
|
55
|
-
`,
|
|
66
|
+
`,r4=Ni`
|
|
56
67
|
0% {
|
|
57
68
|
transform: translateY(0) rotate(0deg) scale(1);
|
|
58
69
|
opacity: 1;
|
|
@@ -64,48 +75,59 @@ ${Ze}`).join(`
|
|
|
64
75
|
transform: translateY(60px) rotate(720deg) scale(0.5);
|
|
65
76
|
opacity: 0;
|
|
66
77
|
}
|
|
67
|
-
`;var iJ=Jt.div({display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}),hg=Jt.div({display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}),Iw=Jt.span({display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 12px",borderRadius:"16px",backgroundColor:"#fee2e2",fontSize:"12px",fontWeight:700,color:"#dc2626",whiteSpace:"nowrap"}),cN=Jt.span({display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 12px",borderRadius:"16px",backgroundColor:"#dcfce7",fontSize:"12px",fontWeight:700,color:"#16a34a",whiteSpace:"nowrap",position:"relative",overflow:"visible"}),sJ=Jt.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:`${lN} 2.5s ease-out ${e}s forwards`,pointerEvents:"none",zIndex:1e3}));var mo=Jt.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"14px",fontWeight:300})),ho=Jt.span(({color:e="#6b7280"})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",fontWeight:500,color:e,whiteSpace:"nowrap"})),xg=Jt.span(({color:e="#6b7280"})=>({fontSize:"12px",color:e})),Pi=Jt.span(({color:e})=>({fontWeight:700,color:e})),aJ=Jt.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"12px"})),lJ=Jt.span(({color:e=ae})=>({display:"inline-block",fontSize:"12px",color:e,animation:`${oN} 1.2s ease-in-out infinite`,marginRight:"4px"})),cJ=Jt.span(({theme:e,variant:t="muted"})=>({fontSize:"12px",fontWeight:700,color:(()=>{switch(t){case"issues":return ae;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 ae;case"verifying":return"#7c3aed";default:return e.color.mediumdark}})(),whiteSpace:"nowrap",...t==="analyzing"||t==="verifying"?{animation:`${aN} 1.5s ease-in-out infinite`}:{}})),uJ=Jt.span(({theme:e})=>({fontSize:"12px",fontWeight:400,color:e.color.mediumdark})),pJ=Jt.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark,fontWeight:400})),uN=Jt.button(({theme:e,isExporting:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",fontSize:"11px",fontWeight:600,color:t?e.color.mediumdark:"#7c3aed",backgroundColor:t?e.background.hoverable:"#ede9fe",border:"none",borderRadius:"12px",cursor:t?"not-allowed":"pointer",transition:"all 0.2s",whiteSpace:"nowrap","&:hover":{backgroundColor:t?e.background.hoverable:"#ddd6fe"}})),pN=Jt.span({display:"inline-block",width:"10px",height:"10px",border:"2px solid #c4b5fd",borderTopColor:"#7c3aed",borderRadius:"50%",animation:"export-spin 0.8s linear infinite","@keyframes export-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),dN=Jt.span({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",animation:`${iN} 1.2s linear infinite`,flexShrink:0}),Fw=({color:e=ae})=>ge.createElement(dN,null,ge.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 ge.createElement("line",{key:n,x1:i,y1:s,x2:a,y2:u,stroke:e,strokeWidth:2,strokeLinecap:"round",opacity:.3+n/8*.7})}))),fN=Jt.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:`${sN} 0.3s ease-out`}));function gN(e){let[t,n]=nN(0);return rN(()=>{if(!e){n(0);return}let r=setInterval(()=>{n(o=>o+1)},1e3);return()=>clearInterval(r)},[e]),t}var Ew=({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:p,durationSeconds:f})=>{let d=gN(e||t),{exportPDF:m,isExporting:S}=Tf(),{featureFlags:T}=se(),F=T.showCosts,k=3.65,z=g=>g<.01?`$${g.toFixed(4)}`:g<.1?`$${g.toFixed(3)}`:`$${g.toFixed(2)}`,R=g=>{let w=g*k;return w<.01?`\u20AA${w.toFixed(4)}`:w<.1?`\u20AA${w.toFixed(3)}`:`\u20AA${w.toFixed(2)}`},O=g=>g>=1e3?`${(g/1e3).toFixed(1)}K`:g.toString(),E=g=>g>=80?"score-high":g>=50?"score-medium":"score-low",D=g=>g>=80?"high":g>=50?"medium":"low";if(e)return ge.createElement(hg,null,ge.createElement(ho,null,ge.createElement(Fw,{color:ae}),ge.createElement(fN,{key:n,color:"#6b7280"},n||"Analyzing\u2026")),c&&ge.createElement(ge.Fragment,null,ge.createElement(mo,null,"|"),ge.createElement(ho,null,ge.createElement("span",{style:{color:"#6b7280"}},d,"s \xB7 Esc to stop"))));if(t)return ge.createElement(hg,null,ge.createElement(Iw,null,ge.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ge.createElement(mo,null,"|"),ge.createElement(ho,null,ge.createElement(Fw,{color:"#7c3aed"}),ge.createElement(Pi,{color:"#7c3aed"},"Verifying...")),c&&ge.createElement(ge.Fragment,null,ge.createElement(mo,null,"|"),ge.createElement(ho,null,ge.createElement("span",{style:{color:"#6b7280"}},d,"s"))));if(r>0||o!==void 0){let g=(a||0)+(u||0),w=(p||0)>0,v=w&&a?Math.round(p/a*100):0,A=Math.max(o??0,i??0),h=I=>I>=80?"#16a34a":I>=50?"#ca8a04":"#dc2626",C=I=>I>=100?"\u25CF":I>=50?"\u25D0":"\u25CB";return ge.createElement(hg,null,r===0?ge.createElement(cN,null,ge.createElement("span",null,"\u2713"),"Perfect!"):ge.createElement(Iw,null,ge.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),ge.createElement(mo,null,"|"),ge.createElement(ho,{title:`MQM compliance: ${o??0}% | Visual similarity: ${i??0}%`},ge.createElement(xg,{color:h(A)},C(A)),ge.createElement("span",null,"score"),ge.createElement(Pi,{color:h(A)},A)),F&&s!==void 0&&s>0&&ge.createElement(ge.Fragment,null,ge.createElement(mo,null,"|"),ge.createElement(ho,null,ge.createElement(Pi,{color:"#16a34a"},z(s)),ge.createElement("span",{style:{color:"#6b7280"}},"/"),ge.createElement(Pi,{color:"#16a34a"},R(s)))),F&&g>0&&ge.createElement(ge.Fragment,null,ge.createElement(mo,null,"|"),ge.createElement(ho,{title:`Input: ${a?.toLocaleString()||0} \xB7 Output: ${u?.toLocaleString()||0}${w?` \xB7 Cached: ${p?.toLocaleString()}`:""}`},ge.createElement(xg,{color:"#7c3aed"},"#"),ge.createElement(Pi,{color:"#7c3aed"},O(g)),ge.createElement("span",{style:{color:"#6b7280"}},"tokens"),w&&ge.createElement("span",{style:{color:"#16a34a",marginLeft:"4px"}},"\u26A1",v,"%"))),f!==void 0&&f>0&&ge.createElement(ge.Fragment,null,ge.createElement(mo,null,"|"),ge.createElement(ho,null,ge.createElement(xg,{color:"#6b7280"},"\u23F1"),ge.createElement(Pi,{color:"#6b7280"},f,"s"))),ge.createElement(mo,null,"|"),ge.createElement(uN,{onClick:m,disabled:S,isExporting:S,title:"Download design review report as PDF"},S?ge.createElement(ge.Fragment,null,ge.createElement(pN,null),"Exporting..."):ge.createElement(ge.Fragment,null,"\u2193 Report")))}return null};var xN=Zn.div({display:"flex",flexDirection:"column",gap:"12px",marginBottom:"16px"}),yN=Zn.div({display:"flex",gap:"8px",alignItems:"center"}),bN=Zn.button(({theme:e,variant:t="orange",disabled:n})=>({width:"auto",backgroundColor:{green:n?e.textMutedColor:e.color.positive||"#10b981",purple:n?e.textMutedColor:e.color.secondary,yellow:n?e.textMutedColor:e.color.warning||"#fbbf24",orange:n?e.textMutedColor:ma}[t],color:e.color.inverseText,border:"none",padding:"8px 16px",fontSize:"13px",fontWeight:600,borderRadius:"5px",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,whiteSpace:"nowrap",transition:"all 0.2s",boxShadow:n?"none":"0 2px 4px rgba(255, 107, 53, 0.3)","&:hover":{opacity:n?.6:.9,transform:n?"none":"translateY(-1px)",boxShadow:n?"none":"0 4px 8px rgba(255, 107, 53, 0.4)"}})),SN=Zn.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",color:e.color.warning||"#f59e0b",display:"flex",alignItems:"center",gap:"6px"})),wN=Zn.div({marginLeft:"auto",display:"flex",flexDirection:"column",gap:"4px"}),vN=Zn.label(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px"})),kN=Zn(wn)({width:"auto",minWidth:"200px"}),CN=Zn.div({display:"flex",gap:"16px",alignItems:"center",marginTop:"4px"}),Aw=Zn.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.defaultText,cursor:"pointer",userSelect:"none"})),Pw=Zn.div(({theme:e,checked:t})=>({width:"32px",height:"18px",borderRadius:"9px",backgroundColor:t?ma:e.appBorderColor||"#d1d5db",position:"relative",transition:"background-color 0.2s ease",flexShrink:0})),Lw=Zn.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)"})),Mw=Zn.input({position:"absolute",opacity:0,width:0,height:0}),yg=()=>{let{sessionToken:e}=Ki(),{selectedProjectId:t}=ir(),{currentMapping:n,hasMapping:r}=No(),{loadingMapping:o,currentStoryId:i}=Ye(),{startReview:s,cancelReview:a,isReviewing:u}=gf(),{isLoadingScreenshots:c}=Eo(),{storybookImageUrl:l,figmaImageUrl:p,currentReviewId:f,reviewHistory:d,setReviewDetailTab:m,setReviewResults:S,setFigmaImageUrl:T,setStorybookImageUrl:F,setFullPrompt:k,setFullResponse:z,includeTextComparison:R,setIncludeTextComparison:O,usePromptCache:E,setUsePromptCache:D,isValidating:g,validationUsage:w,isGenerating:v,isApplying:A,streamingStatus:h,featureFlags:C}=se(),I=d.find(Y=>Y.id===f),P=(I?.issues||[]).filter(Y=>!Y.dismissed).length,L=I?.complianceScore,B=I?.visualSimilarity,N=(I?.costUsd||0)+(w?.costUsd||0),x=(I?.inputTokens||0)+(w?.inputTokens||0),U=(I?.outputTokens||0)+(w?.outputTokens||0),H=hN(()=>{let Y=i?d.filter(Ge=>Ge.storyId===i):d,ce=Y.filter(Ge=>!Ge.parentReviewId).sort((Ge,xt)=>new Date(xt.createdAt).getTime()-new Date(Ge.createdAt).getTime()),ie=Y.filter(Ge=>Ge.parentReviewId),ue=[];for(let Ge of ce){ue.push(Ge);let xt=ie.filter(yn=>yn.parentReviewId===Ge.id).sort((yn,qe)=>(yn.iterationNumber||0)-(qe.iterationNumber||0));ue.push(...xt)}let ct=ie.filter(Ge=>!ce.some(xt=>xt.id===Ge.parentReviewId));return ue.push(...ct),ue},[d,i]);mN(()=>{if(!u)return;let Y=ce=>{ce.key==="Escape"&&(ce.preventDefault(),a())};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[u,a]);let M=r&&n?.figmaNodeId,Q=v||A,ee=!!(e&&t&&!u&&!c&&!Q&&i&&l&&M&&p),J=async(Y=!1)=>{if(!i){console.error("[ReviewActions] No story selected");return}try{m("chat"),await s({isIteration:Y,parentReviewId:Y?f:void 0})}catch(ce){console.error("[ReviewActions] Review error:",ce)}},Le=()=>J(!1),Ee=Y=>{let ce=Y.target.value;if(ce){let ie=d.find(ue=>ue.id===ce);ie&&(S({id:ie.id,componentId:ie.componentId,storyId:ie.storyId,modelId:ie.modelId,complianceScore:ie.complianceScore,issuesCount:ie.issuesCount,issues:ie.issues,createdAt:new Date(ie.createdAt),visualSimilarity:ie.visualSimilarity,timestamp:new Date(ie.createdAt).toISOString()}),ie.figmaImageData&&T(ie.figmaImageData),ie.storybookImageData&&F(ie.storybookImageData),k(ie.aiPrompt||""),z(ie.aiResponse||""),m("issues"))}},We=Y=>{let ce=new Date(Y),ue=new Date().getTime()-ce.getTime(),ct=Math.floor(ue/6e4),Ge=Math.floor(ue/36e5),xt=Math.floor(ue/864e5);return ct<1?"Just now":ct<60?`${ct}m ago`:Ge<24?`${Ge}h ago`:xt<7?`${xt}d ago`:ce.toLocaleDateString()},st=Y=>Y?Y.includes("haiku")?"Haiku":Y.includes("sonnet")?"Sonnet":Y.includes("opus")?"Opus":Y.includes("gpt-4o-mini")?"GPT-4o mini":Y.includes("gpt-4o")?"GPT-4o":Y.includes("gpt-4")?"GPT-4":Y.includes("o3")?"o3":Y.includes("o1")?"o1":Y.split("-")[0]||"":"",te=Y=>{let ce=Y.split("--"),ie=ce[ce.length-1]||Y;return ie.charAt(0).toUpperCase()+ie.slice(1)};return Dt.createElement("div",null,Dt.createElement(xN,null,C.enableModelSelection&&Dt.createElement(Tw,null),Dt.createElement(CN,null,Dt.createElement(Aw,{title:"Compare text content between Figma design and Storybook component"},Dt.createElement(Mw,{type:"checkbox",checked:R,onChange:Y=>O(Y.target.checked)}),Dt.createElement(Pw,{checked:R},Dt.createElement(Lw,{checked:R})),"Compare text"),C.showCosts&&Dt.createElement(Aw,{title:"Cache prompt for 5 min to reduce costs on repeat reviews (dev optimization)"},Dt.createElement(Mw,{type:"checkbox",checked:E,onChange:Y=>D(Y.target.checked)}),Dt.createElement(Pw,{checked:E},Dt.createElement(Lw,{checked:E})),"Cache prompt")),Dt.createElement(yN,null,Dt.createElement(bN,{variant:u?"yellow":"orange",disabled:u?!1:!ee,onClick:u?a:Le,title:u?"Click to stop review":e?t?i?M?c?"Loading screenshots...":Q?"Wait for fixes to complete...":l?p?"Review this component implementation":"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 UI Copilot first"},u?"\u{1F6D1} Stop":"\u{1F441}\uFE0F Review"),(u||g||I)&&Dt.createElement(Ew,{isReviewing:u,isValidating:g,streamingStatus:h,issueCount:P,score:L,visualSimilarity:B,costUsd:N||I?.costUsd,inputTokens:x||I?.inputTokens,outputTokens:U||I?.outputTokens,cacheCreationTokens:I?.cacheCreationTokens,cacheReadTokens:I?.cacheReadTokens,durationSeconds:I?.reviewDurationMs?Math.round(I.reviewDurationMs/1e3):void 0}),H.length>0&&Dt.createElement(wN,null,Dt.createElement(vN,null,"Review History"),Dt.createElement(kN,{value:f||"",onChange:Ee},Dt.createElement("option",{value:""},"Select a review..."),H.map(Y=>{let ce=!!Y.parentReviewId,ie=ce?" \u21B3 ":"\u25CF ",ue=ce&&Y.iterationNumber?`Iter ${Y.iterationNumber} - `:"",ct=Y.issuesCount??Y.issues?.length??0,Ge=Y.complianceScore??"--",xt=st(Y.modelId);return Dt.createElement("option",{key:Y.id,value:Y.id},ie,ue,We(Y.createdAt)," - ",ct," issues (",Ge,"%)",xt?` \xB7 ${xt}`:"",Y.storyId?` \xB7 ${te(Y.storyId)}`:"")}))))),!M&&!o&&Dt.createElement(SN,null,'\u26A0\uFE0F Figma mapping required. Use "Map to Figma" button to link this story to a Figma frame before reviewing.'))};import vJ,{useState as kJ}from"react";import{styled as Bw}from"storybook/theming";var IJ=Bw.div(({theme:e})=>({display:"flex",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"12px",gap:"4px"})),FJ=Bw(Xr)({padding:"8px 12px",fontSize:"12px"});import mt,{useState as Dl}from"react";import{styled as Zt,keyframes as TN}from"storybook/theming";Re();nt();var IN=Zt.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"}),FN=Zt.div({position:"relative",display:"inline-flex"}),EN=TN`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
`,AN=Zt.button(({score:e,isLoading:t,theme:n})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:t?"#7c3aed":e?e>=80?n.color.positive||"#10b981":e>=50?n.color.warning||"#f59e0b":n.color.negative||"#ef4444":n.color.mediumdark||"#6b7280",color:"#fff",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}})),PN=Zt.span`
|
|
71
|
-
display: inline-block;
|
|
72
|
-
width: 10px;
|
|
73
|
-
height: 10px;
|
|
74
|
-
border: 2px solid rgba(255,255,255,0.3);
|
|
75
|
-
border-top-color: #fff;
|
|
76
|
-
border-radius: 50%;
|
|
77
|
-
animation: ${EN} 0.8s linear infinite;
|
|
78
|
-
`,LN=Zt.div(({theme:e})=>({position:"absolute",top:"100%",left:"0",marginTop:"6px",padding:"12px",backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.2)",zIndex:1e3,minWidth:"220px",fontSize:"11px"})),MN=Zt.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"10px",paddingBottom:"8px",borderBottom:`1px solid ${e.appBorderColor}`})),BN=Zt.div(({theme:e})=>({fontWeight:600,color:e.color.defaultText,fontSize:"12px"})),DN=Zt.span(({score:e,theme:t})=>({fontWeight:700,fontSize:"14px",color:e>=80?t.color.positive||"#10b981":e>=50?t.color.warning||"#f59e0b":t.color.negative||"#ef4444"})),RN=Zt.div({display:"flex",flexDirection:"column",gap:"6px",marginBottom:"10px"}),zN=Zt.div(({theme:e})=>({display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"11px",color:e.color.defaultText})),NN=Zt.span({display:"flex",alignItems:"center",gap:"4px"}),ON=Zt.span(({status:e,theme:t})=>({color:e==="pass"?t.color.positive||"#10b981":e==="warn"?t.color.warning||"#f59e0b":t.color.negative||"#ef4444",fontSize:"10px"})),_N=Zt.span(({theme:e})=>({fontWeight:500,color:e.color.mediumdark})),$N=Zt.div(({theme:e})=>({fontSize:"10px",color:e.color.mediumdark,lineHeight:1.4,fontStyle:"italic"})),UN=Zt.ul(({theme:e})=>({margin:"8px 0 0 0",padding:"0 0 0 14px",fontSize:"10px",color:e.color.defaultText,"& li":{marginBottom:"2px"}})),jN=Zt.div({display:"flex",gap:"8px",alignItems:"flex-start"}),HN=Zt.div({flex:1}),WN=Zt(_t)({height:"36px",whiteSpace:"nowrap"}),VN={autoLayout:"Auto Layout",componentStructure:"Structure",naming:"Naming",constraints:"Constraints",spacing:"Spacing",styles:"Styles",variants:"Variants"},GN=e=>e==="pass"?"\u2713":e==="warn"?"\u26A0":"\u2717",bg=()=>{let{figmaFileUrl:e,setFigmaFileUrl:t,openComponentBrowser:n}=Qi(),{hasMapping:r}=No(),{selectedProjectId:o}=ir(),[i,s]=Dl(!1),[a,u]=Dl(!1),[c,l]=Dl(null),[p,f]=Dl(null),d=async()=>{if(!(!e||!o||a)){u(!0),f(null);try{let S=G(),T=localStorage.getItem("uicopilot_session_token"),F=await ne(`${S}/api/figma/quality-check`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${T}`},body:JSON.stringify({projectId:o,figmaFileUrl:e,figmaMetadata:{}})});if(!F.ok)throw new Error("Failed to check quality");let k=await F.json();l(k),s(!0)}catch(S){console.error("[FigmaUrlInput] Quality check error:",S),f("Failed to check quality")}finally{u(!1)}}};return mt.createElement(To,null,mt.createElement(IN,null,mt.createElement(Io,{style:{marginBottom:0}},"Figma File URL"),!!e&&mt.createElement(FN,{onMouseEnter:()=>c&&s(!0),onMouseLeave:()=>s(!1)},mt.createElement(AN,{score:c?.score,isLoading:a,onClick:d,disabled:a||!o,title:c?"Click to refresh quality check":"Click to check Figma design quality"},a?mt.createElement(mt.Fragment,null,mt.createElement(PN,null)," Checking..."):c?mt.createElement(mt.Fragment,null,"\u{1F3A8} ",Math.round(c.score),"%"):mt.createElement(mt.Fragment,null,"\u{1F3A8} Check Quality")),i&&c&&mt.createElement(LN,null,mt.createElement(MN,null,mt.createElement(BN,null,"Figma Design Quality"),mt.createElement(DN,{score:c.score},Math.round(c.score),"%")),mt.createElement(RN,null,Object.entries(c.categories).map(([S,T])=>mt.createElement(zN,{key:S},mt.createElement(NN,null,mt.createElement(ON,{status:T.status},GN(T.status)),VN[S]||S),mt.createElement(_N,null,T.score)))),c.summary&&mt.createElement($N,null,c.summary),c.recommendations?.length>0&&mt.createElement(UN,null,c.recommendations.slice(0,2).map((S,T)=>mt.createElement("li",{key:T},S)))))),mt.createElement(jN,null,mt.createElement(HN,null,mt.createElement(Fo,{type:"text",placeholder:"https://www.figma.com/file/...",value:e,onChange:S=>t(S.target.value)})),mt.createElement(WN,{onClick:n,disabled:!e&&!o,title:!e&&!o?"Enter a Figma URL or select a project first":r?"Change Figma mapping":"Map this component to a Figma design"},r?"\u{1F50D} Browse Figma":"\u26A0\uFE0F Map Component")))};import NJ,{useState as OJ}from"react";import{styled as Sg}from"storybook/theming";ke();Re();Me();nt();var VJ=Sg.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px",backgroundColor:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",fontSize:"13px"})),GJ=Sg(Wn)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),qJ=Sg.span(({theme:e})=>({color:e.textMutedColor,fontSize:"12px",flex:1}));import XJ from"react";import{styled as qN}from"storybook/theming";var ZJ=qN.div(({theme:e})=>({border:`2px dashed ${e.appBorderColor}`,borderRadius:"8px",padding:"40px",textAlign:"center",marginBottom:"20px",backgroundColor:e.background.app}));ke();import nZ from"react";import{styled as Er}from"storybook/theming";var iZ=Er.div(({theme:e})=>({marginBottom:"16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content})),sZ=Er.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`})),aZ=Er.div({display:"flex",alignItems:"center",gap:"8px",flex:1}),lZ=Er.div(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),cZ=Er.div(({theme:e})=>({flex:1,height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden",marginLeft:"12px"})),uZ=Er.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"})),pZ=Er.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontWeight:500,minWidth:"40px",textAlign:"right"})),dZ=Er.div(({theme:e})=>({padding:"16px",backgroundColor:e.background.app,textAlign:"center"})),fZ=Er.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)"}}})),gZ=Er.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"}));ke();import xZ,{useState as yZ}from"react";import{styled as Ar}from"storybook/theming";var wZ=Ar.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)`}}),vZ=Ar.div({display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",userSelect:"none"}),kZ=Ar.div({display:"flex",alignItems:"center",gap:"8px"}),CZ=Ar.span({fontSize:"12px",opacity:.7}),TZ=Ar.span({fontSize:"13px",fontWeight:500}),IZ=Ar.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})),FZ=Ar.div({marginTop:"12px",fontSize:"11px"}),EZ=Ar.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px",marginBottom:"8px"}),AZ=Ar.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"})),PZ=Ar.span({fontSize:"12px"});import vt,{useState as I6}from"react";import{styled as Xo}from"storybook/theming";Me();Re();import xr from"react";import{styled as ra}from"storybook/theming";ke();import Ko,{useState as cU}from"react";import{styled as Ni}from"storybook/theming";var Rl={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 Dw(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var YN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,KN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XN={};function zl(e,t){return((t||XN).jsx?KN:YN).test(e)}var QN=/[ \t\n\f\r]/g;function wg(e){return typeof e=="object"?e.type==="text"?Rw(e.value):!1:Rw(e)}function Rw(e){return e.replace(QN,"")===""}var Wr=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Wr.prototype.normal={};Wr.prototype.property={};Wr.prototype.space=void 0;function vg(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Wr(n,r,t)}function js(e){return e.toLowerCase()}var en=class{constructor(t,n){this.attribute=n,this.property=t}};en.prototype.attribute="";en.prototype.booleanish=!1;en.prototype.boolean=!1;en.prototype.commaOrSpaceSeparated=!1;en.prototype.commaSeparated=!1;en.prototype.defined=!1;en.prototype.mustUseProperty=!1;en.prototype.number=!1;en.prototype.overloadedBoolean=!1;en.prototype.property="";en.prototype.spaceSeparated=!1;en.prototype.space=void 0;var Hs={};be(Hs,{boolean:()=>Ne,booleanish:()=>Pt,commaOrSpaceSeparated:()=>Ln,commaSeparated:()=>xo,number:()=>q,overloadedBoolean:()=>Nl,spaceSeparated:()=>ft});var JN=0,Ne=jo(),Pt=jo(),Nl=jo(),q=jo(),ft=jo(),xo=jo(),Ln=jo();function jo(){return 2**++JN}var kg=Object.keys(Hs),Ho=class extends en{constructor(t,n,r,o){let i=-1;if(super(t,n),zw(this,"space",o),typeof r=="number")for(;++i<kg.length;){let s=kg[i];zw(this,kg[i],(r&Hs[s])===Hs[s])}}};Ho.prototype.defined=!0;function zw(e,t,n){n&&(e[t]=n)}function er(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let i=new Ho(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[js(r)]=r,n[js(i.attribute)]=r}return new Wr(t,n,e.space)}var Cg=er({properties:{ariaActiveDescendant:null,ariaAtomic:Pt,ariaAutoComplete:null,ariaBusy:Pt,ariaChecked:Pt,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:ft,ariaCurrent:null,ariaDescribedBy:ft,ariaDetails:null,ariaDisabled:Pt,ariaDropEffect:ft,ariaErrorMessage:null,ariaExpanded:Pt,ariaFlowTo:ft,ariaGrabbed:Pt,ariaHasPopup:null,ariaHidden:Pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ft,ariaLevel:q,ariaLive:null,ariaModal:Pt,ariaMultiLine:Pt,ariaMultiSelectable:Pt,ariaOrientation:null,ariaOwns:ft,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:Pt,ariaReadOnly:Pt,ariaRelevant:null,ariaRequired:Pt,ariaRoleDescription:ft,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:Pt,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ol(e,t){return t in e?e[t]:t}function _l(e,t){return Ol(e,t.toLowerCase())}var Nw=er({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xo,acceptCharset:ft,accessKey:ft,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:ft,autoFocus:Ne,autoPlay:Ne,blocking:ft,capture:null,charSet:null,checked:Ne,cite:null,className:ft,cols:q,colSpan:null,content:null,contentEditable:Pt,controls:Ne,controlsList:ft,coords:q|xo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:Nl,draggable:Pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:ft,height:q,hidden:Nl,high:q,href:null,hrefLang:null,htmlFor:ft,httpEquiv:ft,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:ft,itemRef:ft,itemScope:Ne,itemType:ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,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:Ne,optimum:q,pattern:null,ping:ft,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:ft,required:Ne,reversed:Ne,rows:q,rowSpan:q,sandbox:ft,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:Pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:Pt,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ft,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:Pt,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:_l});var Ow=er({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:Ln,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:ft,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:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,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:xo,g2:xo,glyphName:xo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:Ln,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,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:q,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:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ln,rev:Ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ln,requiredFeatures:Ln,requiredFonts:Ln,requiredFormats:Ln,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:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:Ln,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ln,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ln,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ol});var Tg=er({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 Ig=er({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_l});var Fg=er({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Eg={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 ZN=/[A-Z]/g,_w=/-[a-z]/g,eO=/^data[-\w.:]+$/i;function Ag(e,t){let n=js(t),r=t,o=en;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&eO.test(t)){if(t.charAt(4)==="-"){let i=t.slice(5).replace(_w,nO);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=t.slice(4);if(!_w.test(i)){let s=i.replace(ZN,tO);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=Ho}return new o(r,t)}function tO(e){return"-"+e.toLowerCase()}function nO(e){return e.charAt(1).toUpperCase()}var $w=vg([Cg,Nw,Tg,Ig,Fg],"html"),$l=vg([Cg,Ow,Tg,Ig,Fg],"svg");function Uw(e){return e.join(" ").trim()}var nv=ga(Jw(),1);var jl=Zw("end"),Li=Zw("start");function Zw(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 Mg(e){let t=Li(e),n=jl(e);if(t&&n)return{start:t,end:n}}function yo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ev(e.position):"start"in e||"end"in e?ev(e):"line"in e||"column"in e?Bg(e):""}function Bg(e){return tv(e&&e.line)+":"+tv(e&&e.column)}function ev(e){return Bg(e&&e.start)+"-"+Bg(e&&e.end)}function tv(e){return e&&typeof e=="number"?e:1}var Rt=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=yo(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}};Rt.prototype.file="";Rt.prototype.name="";Rt.prototype.reason="";Rt.prototype.message="";Rt.prototype.stack="";Rt.prototype.column=void 0;Rt.prototype.line=void 0;Rt.prototype.ancestors=void 0;Rt.prototype.cause=void 0;Rt.prototype.fatal=void 0;Rt.prototype.place=void 0;Rt.prototype.ruleId=void 0;Rt.prototype.source=void 0;var Dg={}.hasOwnProperty,EO=new Map,AO=/[A-Z]/g,PO=new Set(["table","tbody","thead","tfoot","tr"]),LO=new Set(["td","th"]),rv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Rg(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=_O(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=OO(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"?$l:$w,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=ov(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function ov(e,t,n){if(t.type==="element")return MO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return BO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return RO(e,t,n);if(t.type==="mdxjsEsm")return DO(e,t);if(t.type==="root")return zO(e,t,n);if(t.type==="text")return NO(e,t)}function MO(e,t,n){let r=e.schema,o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=$l,e.schema=o),e.ancestors.push(t);let i=sv(e,t.tagName,!1),s=$O(e,t),a=Ng(e,t);return PO.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!wg(u):!0})),iv(e,s,i,t),zg(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function BO(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)}Vs(e,t.position)}function DO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Vs(e,t.position)}function RO(e,t,n){let r=e.schema,o=r;t.name==="svg"&&r.space==="html"&&(o=$l,e.schema=o),e.ancestors.push(t);let i=t.name===null?e.Fragment:sv(e,t.name,!0),s=UO(e,t),a=Ng(e,t);return iv(e,s,i,t),zg(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function zO(e,t,n){let r={};return zg(r,Ng(e,t)),e.create(t,e.Fragment,r,n)}function NO(e,t){return t.value}function iv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function zg(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function OO(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 _O(e,t){return n;function n(r,o,i,s){let a=Array.isArray(i.children),u=Li(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 $O(e,t){let n={},r,o;for(o in t.properties)if(o!=="children"&&Dg.call(t.properties,o)){let i=jO(e,o,t.properties[o]);if(i){let[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&LO.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 UO(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 Vs(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 Vs(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function Ng(e,t){let n=[],r=-1,o=e.passKeys?new Map:EO;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=ov(e,i,s);a!==void 0&&n.push(a)}return n}function jO(e,t,n){let r=Ag(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Dw(n):Uw(n)),r.property==="style"){let o=typeof n=="object"?n:HO(e,String(n));return e.stylePropertyNameCase==="css"&&(o=WO(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?Eg[r.property]||r.property:r.attribute,n]}}function HO(e,t){try{return(0,nv.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let r=n,o=new Rt("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=rv+"#cannot-parse-style-attribute",o}}function sv(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=zl(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=zl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){let o=r.value;return Dg.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Vs(e)}function Vs(e,t){let n=new Rt("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=rv+"#cannot-handle-mdx-estrees-without-createevaluater",n}function WO(e){let t={},n;for(n in e)Dg.call(e,n)&&(t[VO(n)]=e[n]);return t}function VO(e){let t=e.replace(AO,GO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function GO(e){return"-"+e.toLowerCase()}var Gs={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 eU,jsx as tU,jsxs as nU}from"react/jsx-runtime";import{useEffect as jse,useState as Hse}from"react";var qO={};function Og(e,t){let n=t||qO,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lv(e,r,o)}function lv(e,t,n){if(YO(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 av(e.children,t,n)}return Array.isArray(e)?av(e,t,n):""}function av(e,t,n){let r=[],o=-1;for(;++o<e.length;)r[o]=lv(e[o],t,n);return r.join("")}function YO(e){return!!(e&&typeof e=="object")}var cv=document.createElement("i");function Mi(e){let t="&"+e+";";cv.innerHTML=t;let n=cv.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function an(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 xn(e,t){return e.length>0?(an(e,e.length,0,t),e):t}var uv={}.hasOwnProperty;function pv(e){let t={},n=-1;for(;++n<e.length;)KO(t,e[n]);return t}function KO(e,t){let n;for(n in t){let o=(uv.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],s;if(i)for(s in i){uv.call(o,s)||(o[s]=[]);let a=i[s];XO(o[s],Array.isArray(a)?a:a?[a]:[])}}}function XO(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);an(e,0,0,r)}function Hl(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 Vr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var _n=bo(/[A-Za-z]/),tn=bo(/[\dA-Za-z]/),dv=bo(/[#-'*+\--9=?A-Z^-~]/);function qs(e){return e!==null&&(e<32||e===127)}var Ys=bo(/\d/),fv=bo(/[\dA-Fa-f]/),gv=bo(/[!-/:-@[-`{-~]/);function le(e){return e!==null&&e<-2}function zt(e){return e!==null&&(e<0||e===32)}function De(e){return e===-2||e===-1||e===32}var mv=bo(/\p{P}|\p{S}/u),hv=bo(/\s/);function bo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function tr(e){let t=[],n=-1,r=0,o=0;for(;++n<e.length;){let i=e.charCodeAt(n),s="";if(i===37&&tn(e.charCodeAt(n+1))&&tn(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 Oe(e,t,n,r){let o=r?r-1:Number.POSITIVE_INFINITY,i=0;return s;function s(u){return De(u)?(e.enter(n),a(u)):t(u)}function a(u){return De(u)&&i++<o?(e.consume(u),a):(e.exit(n),t(u))}}var xv={tokenize:QO};function QO(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"),Oe(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 le(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}var bv={tokenize:JO},yv={tokenize:ZO};function JO(e){let t=this,n=[],r=0,o,i,s;return a;function a(z){if(r<n.length){let R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,u,c)(z)}return c(z)}function u(z){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&k();let R=t.events.length,O=R,E;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){E=t.events[O][1].end;break}F(r);let D=R;for(;D<t.events.length;)t.events[D][1].end={...E},D++;return an(t.events,O+1,0,t.events.slice(R)),t.events.length=D,c(z)}return a(z)}function c(z){if(r===n.length){if(!o)return f(z);if(o.currentConstruct&&o.currentConstruct.concrete)return m(z);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yv,l,p)(z)}function l(z){return o&&k(),F(r),f(z)}function p(z){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,m(z)}function f(z){return t.containerState={},e.attempt(yv,d,m)(z)}function d(z){return r++,n.push([t.currentConstruct,t.containerState]),f(z)}function m(z){if(z===null){o&&k(),F(0),e.consume(z);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),S(z)}function S(z){if(z===null){T(e.exit("chunkFlow"),!0),F(0),e.consume(z);return}return le(z)?(e.consume(z),T(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(z),S)}function T(z,R){let O=t.sliceStream(z);if(R&&O.push(null),z.previous=i,i&&(i.next=z),i=z,o.defineSkip(z.start),o.write(O),t.parser.lazy[z.start.line]){let E=o.events.length;for(;E--;)if(o.events[E][1].start.offset<s&&(!o.events[E][1].end||o.events[E][1].end.offset>s))return;let D=t.events.length,g=D,w,v;for(;g--;)if(t.events[g][0]==="exit"&&t.events[g][1].type==="chunkFlow"){if(w){v=t.events[g][1].end;break}w=!0}for(F(r),E=D;E<t.events.length;)t.events[E][1].end={...v},E++;an(t.events,g+1,0,t.events.slice(D)),t.events.length=E}}function F(z){let R=n.length;for(;R-- >z;){let O=n[R];t.containerState=O[1],O[0].exit.call(t,e)}n.length=z}function k(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function ZO(e,t,n){return Oe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _g(e){if(e===null||zt(e)||hv(e))return 1;if(mv(e))return 2}function Bi(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 Ks={name:"attention",resolveAll:e_,tokenize:t_};function e_(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 p={...e[r][1].end},f={...e[n][1].start};Sv(p,-u),Sv(f,u),s={type:u>1?"strongSequence":"emphasisSequence",start:p,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=xn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=xn(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=xn(c,Bi(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=xn(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=xn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,an(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 t_(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=_g(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=_g(u),p=!l||l===2&&o||n.includes(u),f=!o||o===2&&l||n.includes(r);return c._open=!!(i===42?p:p&&(o||!f)),c._close=!!(i===42?f:f&&(l||!p)),t(u)}}function Sv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $g={name:"autolink",tokenize:n_};function n_(e,t,n){let r=0;return o;function o(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(d){return _n(d)?(e.consume(d),s):d===64?n(d):c(d)}function s(d){return d===43||d===45||d===46||tn(d)?(r=1,a(d)):c(d)}function a(d){return d===58?(e.consume(d),r=0,u):(d===43||d===45||d===46||tn(d))&&r++<32?(e.consume(d),a):(r=0,c(d))}function u(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||qs(d)?n(d):(e.consume(d),u)}function c(d){return d===64?(e.consume(d),l):dv(d)?(e.consume(d),c):n(d)}function l(d){return tn(d)?p(d):n(d)}function p(d){return d===46?(e.consume(d),r=0,l):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):f(d)}function f(d){if((d===45||tn(d))&&r++<63){let m=d===45?f:p;return e.consume(d),m}return n(d)}}var So={partial:!0,tokenize:r_};function r_(e,t,n){return r;function r(i){return De(i)?Oe(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||le(i)?t(i):n(i)}}var Wl={continuation:{tokenize:i_},exit:s_,name:"blockQuote",tokenize:o_};function o_(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 De(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function i_(e,t,n){let r=this;return o;function o(s){return De(s)?Oe(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Wl,t,n)(s)}}function s_(e){e.exit("blockQuote")}var Vl={name:"characterEscape",tokenize:a_};function a_(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 gv(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}var Gl={name:"characterReference",tokenize:l_};function l_(e,t,n){let r=this,o=0,i,s;return a;function a(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=tn,l(p))}function c(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=fv,l):(e.enter("characterReferenceValue"),i=7,s=Ys,l(p))}function l(p){if(p===59&&o){let f=e.exit("characterReferenceValue");return s===tn&&!Mi(r.sliceSerialize(f))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(p)&&o++<i?(e.consume(p),l):n(p)}}var wv={partial:!0,tokenize:u_},ql={concrete:!0,name:"codeFenced",tokenize:c_};function c_(e,t,n){let r=this,o={partial:!0,tokenize:O},i=0,s=0,a;return u;function u(E){return c(E)}function c(E){let D=r.events[r.events.length-1];return i=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,a=E,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(E)}function l(E){return E===a?(s++,e.consume(E),l):s<3?n(E):(e.exit("codeFencedFenceSequence"),De(E)?Oe(e,p,"whitespace")(E):p(E))}function p(E){return E===null||le(E)?(e.exit("codeFencedFence"),r.interrupt?t(E):e.check(wv,S,R)(E)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(E))}function f(E){return E===null||le(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(E)):De(E)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Oe(e,d,"whitespace")(E)):E===96&&E===a?n(E):(e.consume(E),f)}function d(E){return E===null||le(E)?p(E):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(E))}function m(E){return E===null||le(E)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(E)):E===96&&E===a?n(E):(e.consume(E),m)}function S(E){return e.attempt(o,R,T)(E)}function T(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),F}function F(E){return i>0&&De(E)?Oe(e,k,"linePrefix",i+1)(E):k(E)}function k(E){return E===null||le(E)?e.check(wv,S,R)(E):(e.enter("codeFlowValue"),z(E))}function z(E){return E===null||le(E)?(e.exit("codeFlowValue"),k(E)):(e.consume(E),z)}function R(E){return e.exit("codeFenced"),t(E)}function O(E,D,g){let w=0;return v;function v(y){return E.enter("lineEnding"),E.consume(y),E.exit("lineEnding"),A}function A(y){return E.enter("codeFencedFence"),De(y)?Oe(E,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):h(y)}function h(y){return y===a?(E.enter("codeFencedFenceSequence"),C(y)):g(y)}function C(y){return y===a?(w++,E.consume(y),C):w>=s?(E.exit("codeFencedFenceSequence"),De(y)?Oe(E,I,"whitespace")(y):I(y)):g(y)}function I(y){return y===null||le(y)?(E.exit("codeFencedFence"),D(y)):g(y)}}}function u_(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 Xs={name:"codeIndented",tokenize:d_},p_={partial:!0,tokenize:f_};function d_(e,t,n){let r=this;return o;function o(c){return e.enter("codeIndented"),Oe(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):le(c)?e.attempt(p_,s,u)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||le(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function u(c){return e.exit("codeIndented"),t(c)}}function f_(e,t,n){let r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):le(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):Oe(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):le(s)?o(s):n(s)}}var Ug={name:"codeText",previous:m_,resolve:g_,tokenize:h_};function g_(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 m_(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function h_(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,p(f)):le(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||le(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),l)}function p(f){return f===96?(e.consume(f),i++,p):i===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",l(f))}}var Yl=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&&Qs(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),Qs(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qs(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);Qs(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qs(this.left,n.reverse())}}};function Qs(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 Kl(e){let t={},n=-1,r,o,i,s,a,u,c,l=new Yl(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,x_(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 an(e,0,Number.POSITIVE_INFINITY,l.slice(0)),!c}function x_(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,p,f=-1,d=n,m=0,S=0,T=[S];for(;d;){for(;e.get(++o)[1]!==d;);i.push(o),d._tokenizer||(l=r.sliceStream(d),d.next||l.push(null),p&&s.defineSkip(d.start),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(l),d._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),p=d,d=d.next}for(d=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&&(S=f+1,T.push(S),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(s.events=[],d?(d._tokenizer=void 0,d.previous=void 0):T.pop(),f=T.length;f--;){let F=a.slice(T[f],T[f+1]),k=i.pop();u.push([k,k+F.length-1]),e.splice(k,2,F)}for(u.reverse(),f=-1;++f<u.length;)c[m+u[f][0]]=m+u[f][1],m+=u[f][1]-u[f][0]-1;return c}var jg={resolve:b_,tokenize:S_},y_={partial:!0,tokenize:w_};function b_(e){return Kl(e),e}function S_(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):le(a)?e.check(y_,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 w_(e,t,n){let r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Oe(e,i,"linePrefix")}function i(s){if(s===null||le(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 Xl(e,t,n,r,o,i,s,a,u){let c=u||Number.POSITIVE_INFINITY,l=0;return p;function p(F){return F===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(F),e.exit(i),f):F===null||F===32||F===41||qs(F)?n(F):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),S(F))}function f(F){return F===62?(e.enter(i),e.consume(F),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(F))}function d(F){return F===62?(e.exit("chunkString"),e.exit(a),f(F)):F===null||F===60||le(F)?n(F):(e.consume(F),F===92?m:d)}function m(F){return F===60||F===62||F===92?(e.consume(F),d):d(F)}function S(F){return!l&&(F===null||F===41||zt(F))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(F)):l<c&&F===40?(e.consume(F),l++,S):F===41?(e.consume(F),l--,S):F===null||F===32||F===40||qs(F)?n(F):(e.consume(F),F===92?T:S)}function T(F){return F===40||F===41||F===92?(e.consume(F),S):S(F)}}function Ql(e,t,n,r,o,i){let s=this,a=0,u;return c;function c(d){return e.enter(r),e.enter(o),e.consume(d),e.exit(o),e.enter(i),l}function l(d){return a>999||d===null||d===91||d===93&&!u||d===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):d===93?(e.exit(i),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===null||d===91||d===93||le(d)||a++>999?(e.exit("chunkString"),l(d)):(e.consume(d),u||(u=!De(d)),d===92?f:p)}function f(d){return d===91||d===92||d===93?(e.consume(d),a++,p):p(d)}}function Jl(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):le(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Oe(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),l(f))}function l(f){return f===s||f===null||le(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?p:l)}function p(f){return f===s||f===92?(e.consume(f),l):l(f)}}function Vo(e,t){let n;return r;function r(o){return le(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):De(o)?Oe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var Hg={name:"definition",tokenize:k_},v_={partial:!0,tokenize:C_};function k_(e,t,n){let r=this,o;return i;function i(d){return e.enter("definition"),s(d)}function s(d){return Ql.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return o=Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),u):n(d)}function u(d){return zt(d)?Vo(e,c)(d):c(d)}function c(d){return Xl(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function l(d){return e.attempt(v_,p,p)(d)}function p(d){return De(d)?Oe(e,f,"whitespace")(d):f(d)}function f(d){return d===null||le(d)?(e.exit("definition"),r.parser.defined.push(o),t(d)):n(d)}}function C_(e,t,n){return r;function r(a){return zt(a)?Vo(e,o)(a):n(a)}function o(a){return Jl(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return De(a)?Oe(e,s,"whitespace")(a):s(a)}function s(a){return a===null||le(a)?t(a):n(a)}}var Wg={name:"hardBreakEscape",tokenize:T_};function T_(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return le(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}var Vg={name:"headingAtx",resolve:I_,tokenize:F_};function I_(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"},an(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function F_(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||zt(l)?(e.exit("atxHeadingSequence"),a(l)):n(l)}function a(l){return l===35?(e.enter("atxHeadingSequence"),u(l)):l===null||le(l)?(e.exit("atxHeading"),t(l)):De(l)?Oe(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||zt(l)?(e.exit("atxHeadingText"),a(l)):(e.consume(l),c)}}var vv=["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"],Gg=["pre","script","style","textarea"];var qg={concrete:!0,name:"htmlFlow",resolveTo:P_,tokenize:L_},E_={partial:!0,tokenize:B_},A_={partial:!0,tokenize:M_};function P_(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 L_(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),p}function p(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),i=!0,S):M===63?(e.consume(M),o=3,r.interrupt?t:x):_n(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function f(M){return M===45?(e.consume(M),o=2,d):M===91?(e.consume(M),o=5,a=0,m):_n(M)?(e.consume(M),o=4,r.interrupt?t:x):n(M)}function d(M){return M===45?(e.consume(M),r.interrupt?t:x):n(M)}function m(M){let Q="CDATA[";return M===Q.charCodeAt(a++)?(e.consume(M),a===Q.length?r.interrupt?t:h:m):n(M)}function S(M){return _n(M)?(e.consume(M),s=String.fromCharCode(M),T):n(M)}function T(M){if(M===null||M===47||M===62||zt(M)){let Q=M===47,ee=s.toLowerCase();return!Q&&!i&&Gg.includes(ee)?(o=1,r.interrupt?t(M):h(M)):vv.includes(s.toLowerCase())?(o=6,Q?(e.consume(M),F):r.interrupt?t(M):h(M)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?k(M):z(M))}return M===45||tn(M)?(e.consume(M),s+=String.fromCharCode(M),T):n(M)}function F(M){return M===62?(e.consume(M),r.interrupt?t:h):n(M)}function k(M){return De(M)?(e.consume(M),k):v(M)}function z(M){return M===47?(e.consume(M),v):M===58||M===95||_n(M)?(e.consume(M),R):De(M)?(e.consume(M),z):v(M)}function R(M){return M===45||M===46||M===58||M===95||tn(M)?(e.consume(M),R):O(M)}function O(M){return M===61?(e.consume(M),E):De(M)?(e.consume(M),O):z(M)}function E(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),u=M,D):De(M)?(e.consume(M),E):g(M)}function D(M){return M===u?(e.consume(M),u=null,w):M===null||le(M)?n(M):(e.consume(M),D)}function g(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||zt(M)?O(M):(e.consume(M),g)}function w(M){return M===47||M===62||De(M)?z(M):n(M)}function v(M){return M===62?(e.consume(M),A):n(M)}function A(M){return M===null||le(M)?h(M):De(M)?(e.consume(M),A):n(M)}function h(M){return M===45&&o===2?(e.consume(M),P):M===60&&o===1?(e.consume(M),L):M===62&&o===4?(e.consume(M),U):M===63&&o===3?(e.consume(M),x):M===93&&o===5?(e.consume(M),N):le(M)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(E_,H,C)(M)):M===null||le(M)?(e.exit("htmlFlowData"),C(M)):(e.consume(M),h)}function C(M){return e.check(A_,I,H)(M)}function I(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),y}function y(M){return M===null||le(M)?C(M):(e.enter("htmlFlowData"),h(M))}function P(M){return M===45?(e.consume(M),x):h(M)}function L(M){return M===47?(e.consume(M),s="",B):h(M)}function B(M){if(M===62){let Q=s.toLowerCase();return Gg.includes(Q)?(e.consume(M),U):h(M)}return _n(M)&&s.length<8?(e.consume(M),s+=String.fromCharCode(M),B):h(M)}function N(M){return M===93?(e.consume(M),x):h(M)}function x(M){return M===62?(e.consume(M),U):M===45&&o===2?(e.consume(M),x):h(M)}function U(M){return M===null||le(M)?(e.exit("htmlFlowData"),H(M)):(e.consume(M),U)}function H(M){return e.exit("htmlFlow"),t(M)}}function M_(e,t,n){let r=this;return o;function o(s){return le(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 B_(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(So,t,n)}}var Yg={name:"htmlText",tokenize:D_};function D_(e,t,n){let r=this,o,i,s;return a;function a(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),u}function u(x){return x===33?(e.consume(x),c):x===47?(e.consume(x),O):x===63?(e.consume(x),z):_n(x)?(e.consume(x),g):n(x)}function c(x){return x===45?(e.consume(x),l):x===91?(e.consume(x),i=0,m):_n(x)?(e.consume(x),k):n(x)}function l(x){return x===45?(e.consume(x),d):n(x)}function p(x){return x===null?n(x):x===45?(e.consume(x),f):le(x)?(s=p,L(x)):(e.consume(x),p)}function f(x){return x===45?(e.consume(x),d):p(x)}function d(x){return x===62?P(x):x===45?f(x):p(x)}function m(x){let U="CDATA[";return x===U.charCodeAt(i++)?(e.consume(x),i===U.length?S:m):n(x)}function S(x){return x===null?n(x):x===93?(e.consume(x),T):le(x)?(s=S,L(x)):(e.consume(x),S)}function T(x){return x===93?(e.consume(x),F):S(x)}function F(x){return x===62?P(x):x===93?(e.consume(x),F):S(x)}function k(x){return x===null||x===62?P(x):le(x)?(s=k,L(x)):(e.consume(x),k)}function z(x){return x===null?n(x):x===63?(e.consume(x),R):le(x)?(s=z,L(x)):(e.consume(x),z)}function R(x){return x===62?P(x):z(x)}function O(x){return _n(x)?(e.consume(x),E):n(x)}function E(x){return x===45||tn(x)?(e.consume(x),E):D(x)}function D(x){return le(x)?(s=D,L(x)):De(x)?(e.consume(x),D):P(x)}function g(x){return x===45||tn(x)?(e.consume(x),g):x===47||x===62||zt(x)?w(x):n(x)}function w(x){return x===47?(e.consume(x),P):x===58||x===95||_n(x)?(e.consume(x),v):le(x)?(s=w,L(x)):De(x)?(e.consume(x),w):P(x)}function v(x){return x===45||x===46||x===58||x===95||tn(x)?(e.consume(x),v):A(x)}function A(x){return x===61?(e.consume(x),h):le(x)?(s=A,L(x)):De(x)?(e.consume(x),A):w(x)}function h(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),o=x,C):le(x)?(s=h,L(x)):De(x)?(e.consume(x),h):(e.consume(x),I)}function C(x){return x===o?(e.consume(x),o=void 0,y):x===null?n(x):le(x)?(s=C,L(x)):(e.consume(x),C)}function I(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||zt(x)?w(x):(e.consume(x),I)}function y(x){return x===47||x===62||zt(x)?w(x):n(x)}function P(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function L(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),B}function B(x){return De(x)?Oe(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):N(x)}function N(x){return e.enter("htmlTextData"),s(x)}}var Go={name:"labelEnd",resolveAll:O_,resolveTo:__,tokenize:$_},R_={tokenize:U_},z_={tokenize:j_},N_={tokenize:H_};function O_(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&&an(e,0,e.length,n),e}function __(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=xn(a,e.slice(i+1,i+r+3)),a=xn(a,[["enter",l,t]]),a=xn(a,Bi(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=xn(a,[["exit",l,t],e[s-2],e[s-1],["exit",c,t]]),a=xn(a,e.slice(s+1)),a=xn(a,[["exit",u,t]]),an(e,i,e.length,a),e}function $_(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?p(f):(s=r.parser.defined.includes(Vr(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(R_,l,s?l:p)(f):f===91?e.attempt(z_,l,s?c:p)(f):s?l(f):p(f)}function c(f){return e.attempt(N_,l,p)(f)}function l(f){return t(f)}function p(f){return i._balanced=!0,n(f)}}function U_(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),o}function o(p){return zt(p)?Vo(e,i)(p):i(p)}function i(p){return p===41?l(p):Xl(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function s(p){return zt(p)?Vo(e,u)(p):l(p)}function a(p){return n(p)}function u(p){return p===34||p===39||p===40?Jl(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):l(p)}function c(p){return zt(p)?Vo(e,l)(p):l(p)}function l(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function j_(e,t,n){let r=this;return o;function o(a){return Ql.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Vr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function H_(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 Kg={name:"labelStartImage",resolveAll:Go.resolveAll,tokenize:W_};function W_(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 Xg={name:"labelStartLink",resolveAll:Go.resolveAll,tokenize:V_};function V_(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 Js={name:"lineEnding",tokenize:G_};function G_(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Oe(e,t,"linePrefix")}}var qo={name:"thematicBreak",tokenize:q_};function q_(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||le(c))?(e.exit("thematicBreak"),t(c)):n(c)}function u(c){return c===o?(e.consume(c),r++,u):(e.exit("thematicBreakSequence"),De(c)?Oe(e,a,"whitespace")(c):a(c))}}var pn={continuation:{tokenize:Q_},exit:Z_,name:"list",tokenize:X_},Y_={partial:!0,tokenize:e$},K_={partial:!0,tokenize:J_};function X_(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(d){let m=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:Ys(d)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(qo,n,c)(d):c(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(d)}return n(d)}function u(d){return Ys(d)&&++s<10?(e.consume(d),u):(!r.interrupt||s<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),c(d)):n(d)}function c(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(So,r.interrupt?n:l,e.attempt(Y_,f,p))}function l(d){return r.containerState.initialBlankLine=!0,i++,f(d)}function p(d){return De(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),f):n(d)}function f(d){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function Q_(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(So,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Oe(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!De(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(K_,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Oe(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function J_(e,t,n){let r=this;return Oe(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 Z_(e){e.exit(this.containerState.type)}function e$(e,t,n){let r=this;return Oe(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!De(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}var Zl={name:"setextUnderline",resolveTo:t$,tokenize:n$};function t$(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 n$(e,t,n){let r=this,o;return i;function i(c){let l=r.events.length,p;for(;l--;)if(r.events[l][1].type!=="lineEnding"&&r.events[l][1].type!=="linePrefix"&&r.events[l][1].type!=="content"){p=r.events[l][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(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"),De(c)?Oe(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||le(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}var kv={tokenize:r$};function r$(e){let t=this,n=e.attempt(So,r,e.attempt(this.parser.constructs.flowInitial,o,Oe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(jg,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 Cv={resolveAll:Ev()},Tv=Fv("string"),Iv=Fv("text");function Fv(e){return{resolveAll:Ev(e==="text"?o$: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 p=o[l],f=-1;if(p)for(;++f<p.length;){let d=p[f];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function Ev(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 o$(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 Qg={};be(Qg,{attentionMarkers:()=>d$,contentInitial:()=>s$,disable:()=>f$,document:()=>i$,flow:()=>l$,flowInitial:()=>a$,insideSpan:()=>p$,string:()=>c$,text:()=>u$});var i$={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:Wl},s$={91:Hg},a$={[-2]:Xs,[-1]:Xs,32:Xs},l$={35:Vg,42:qo,45:[Zl,qo],60:qg,61:Zl,95:qo,96:ql,126:ql},c$={38:Gl,92:Vl},u$={[-5]:Js,[-4]:Js,[-3]:Js,33:Kg,38:Gl,42:Ks,60:[$g,Yg],91:Xg,92:[Wg,Vl],93:Go,95:Ks,96:Ug},p$={null:[Ks,Cv]},d$={null:[42,95]},f$={null:[]};function Av(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(D),check:w(g),consume:R,enter:O,exit:E,interrupt:w(g,{interrupt:!0})},l={code:null,containerState:{},defineSkip:F,events:[],now:T,parser:e,previous:null,sliceSerialize:m,sliceStream:S,write:d},p=t.tokenize.call(l,c),f;return t.resolveAll&&i.push(t),l;function d(C){return s=xn(s,C),k(),s[s.length-1]!==null?[]:(v(t,0),l.events=Bi(i,l.events,l),l.events)}function m(C,I){return m$(S(C),I)}function S(C){return g$(s,C)}function T(){let{_bufferIndex:C,_index:I,line:y,column:P,offset:L}=r;return{_bufferIndex:C,_index:I,line:y,column:P,offset:L}}function F(C){o[C.line]=C.column,h()}function k(){let C;for(;r._index<s.length;){let I=s[r._index];if(typeof I=="string")for(C=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===C&&r._bufferIndex<I.length;)z(I.charCodeAt(r._bufferIndex));else z(I)}}function z(C){u=void 0,f=C,p=p(C)}function R(C){le(C)?(r.line++,r.column=1,r.offset+=C===-3?2:1,h()):C!==-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=C,u=!0}function O(C,I){let y=I||{};return y.type=C,y.start=T(),l.events.push(["enter",y,l]),a.push(y),y}function E(C){let I=a.pop();return I.end=T(),l.events.push(["exit",I,l]),I}function D(C,I){v(C,I.from)}function g(C,I){I.restore()}function w(C,I){return y;function y(P,L,B){let N,x,U,H;return Array.isArray(P)?Q(P):"tokenize"in P?Q([P]):M(P);function M(Ee){return We;function We(st){let te=st!==null&&Ee[st],Y=st!==null&&Ee.null,ce=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return Q(ce)(st)}}function Q(Ee){return N=Ee,x=0,Ee.length===0?B:ee(Ee[x])}function ee(Ee){return We;function We(st){return H=A(),U=Ee,Ee.partial||(l.currentConstruct=Ee),Ee.name&&l.parser.constructs.disable.null.includes(Ee.name)?Le(st):Ee.tokenize.call(I?Object.assign(Object.create(l),I):l,c,J,Le)(st)}}function J(Ee){return u=!0,C(U,H),L}function Le(Ee){return u=!0,H.restore(),++x<N.length?ee(N[x]):B}}}function v(C,I){C.resolveAll&&!i.includes(C)&&i.push(C),C.resolve&&an(l.events,I,l.events.length-I,C.resolve(l.events.slice(I),l)),C.resolveTo&&(l.events=C.resolveTo(l.events,l))}function A(){let C=T(),I=l.previous,y=l.currentConstruct,P=l.events.length,L=Array.from(a);return{from:P,restore:B};function B(){r=C,l.previous=I,l.currentConstruct=y,l.events.length=P,a=L,h()}}function h(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function g$(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 m$(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=`
|
|
78
|
+
`;var Cne=jt.div({display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}),Zm=jt.div({display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"}),Tne=jt.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",borderRadius:"8px",backgroundColor:e.background.hoverable||"#f3f4f6",border:`1px solid ${e.appBorderColor}`,fontSize:"12px",fontWeight:500,color:e.textMutedColor,animation:`${FC} 0.3s ease-out`})),o4=Ni`
|
|
79
|
+
from { transform: rotate(0deg); }
|
|
80
|
+
to { transform: rotate(360deg); }
|
|
81
|
+
`,Ine=jt.div(({theme:e})=>({width:"12px",height:"12px",borderRadius:"50%",border:"2px solid transparent",borderTopColor:e.textMutedColor,animation:`${o4} 0.8s linear infinite`,flexShrink:0})),TC=jt.span({display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 12px",borderRadius:"16px",backgroundColor:"#fee2e2",fontSize:"12px",fontWeight:700,color:"#dc2626",whiteSpace:"nowrap"}),i4=jt.span({display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 12px",borderRadius:"16px",backgroundColor:"#dcfce7",fontSize:"12px",fontWeight:700,color:"#16a34a",whiteSpace:"nowrap",position:"relative",overflow:"visible"}),Fne=jt.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:`${r4} 2.5s ease-out ${e}s forwards`,pointerEvents:"none",zIndex:1e3}));var zi=jt.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"14px",fontWeight:300})),ea=jt.span(({color:e="#6b7280"})=>({display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",fontWeight:500,color:e,whiteSpace:"nowrap"})),IC=jt.span(({color:e="#6b7280"})=>({fontSize:"12px",color:e})),ta=jt.span(({color:e})=>({fontWeight:700,color:e})),s4=jt.div(({tint:e,theme:t})=>({display:"inline-flex",alignItems:"center",gap:"8px",padding:"6px 14px",borderRadius:"12px",backgroundColor:`${e}1a`,border:`1px solid ${e}33`,"& .score-label":{fontSize:"12px",color:t.textMutedColor},"& .score-value":{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',fontSize:"20px",fontWeight:700,color:e,lineHeight:1},"& .score-dot":{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:e}})),Ene=jt.span(({theme:e})=>({color:e.color.mediumlight,fontSize:"12px"})),Ane=jt.span(({color:e=le})=>({display:"inline-block",fontSize:"12px",color:e,animation:`${e4} 1.2s ease-in-out infinite`,marginRight:"4px"})),Pne=jt.span(({theme:e,variant:t="muted"})=>({fontSize:"12px",fontWeight:700,color:(()=>{switch(t){case"issues":return le;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 le;case"verifying":return"#7c3aed";default:return e.color.mediumdark}})(),whiteSpace:"nowrap",...t==="analyzing"||t==="verifying"?{animation:`${n4} 1.5s ease-in-out infinite`}:{}})),Lne=jt.span(({theme:e})=>({fontSize:"12px",fontWeight:400,color:e.color.mediumdark})),Mne=jt.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark,fontWeight:400})),a4=jt.button(({theme:e,isExporting:t})=>({display:"inline-flex",alignItems:"center",gap:"4px",padding:"4px 10px",fontSize:"11px",fontWeight:600,color:t?e.color.mediumdark:"#7c3aed",backgroundColor:t?e.background.hoverable:"#ede9fe",border:"none",borderRadius:"12px",cursor:t?"not-allowed":"pointer",transition:"all 0.2s",whiteSpace:"nowrap","&:hover":{backgroundColor:t?e.background.hoverable:"#ddd6fe"}})),l4=jt.span({display:"inline-block",width:"10px",height:"10px",border:"2px solid #c4b5fd",borderTopColor:"#7c3aed",borderRadius:"50%",animation:"export-spin 0.8s linear infinite","@keyframes export-spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}}),c4=jt.span({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",animation:`${t4} 1.2s linear infinite`,flexShrink:0}),u4=({color:e=le})=>Ce.createElement(c4,null,Ce.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 Ce.createElement("line",{key:n,x1:i,y1:s,x2:a,y2:u,stroke:e,strokeWidth:2,strokeLinecap:"round",opacity:.3+n/8*.7})}))),Bne=jt.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:`${FC} 0.3s ease-out`}));function p4(e){let[t,n]=J$(0);return Z$(()=>{if(!e){n(0);return}let r=setInterval(()=>{n(o=>o+1)},1e3);return()=>clearInterval(r)},[e]),t}var EC=({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=p4(e||t),{exportPDF:g,isExporting:S}=im(),{featureFlags:C}=ie(),F=C.showCosts,k=3.65,R=m=>m<.01?`$${m.toFixed(4)}`:m<.1?`$${m.toFixed(3)}`:`$${m.toFixed(2)}`,z=m=>{let x=m*k;return x<.01?`\u20AA${x.toFixed(4)}`:x<.1?`\u20AA${x.toFixed(3)}`:`\u20AA${x.toFixed(2)}`},_=m=>m>=1e3?`${(m/1e3).toFixed(1)}K`:m.toString(),M=m=>m>=80?"score-high":m>=50?"score-medium":"score-low",B=m=>m>=80?"high":m>=50?"medium":"low";if(e)return Ce.createElement(Zm,null,Ce.createElement("span",{style:{fontSize:"12px",color:"#9ca3af"}},p,"s \xB7 Esc to stop"));if(t)return Ce.createElement(Zm,null,Ce.createElement(TC,null,Ce.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),Ce.createElement(zi,null,"|"),Ce.createElement(ea,null,Ce.createElement(u4,{color:"#7c3aed"}),Ce.createElement(ta,{color:"#7c3aed"},"Verifying...")),c&&Ce.createElement(Ce.Fragment,null,Ce.createElement(zi,null,"|"),Ce.createElement(ea,null,Ce.createElement("span",{style:{color:"#6b7280"}},p,"s"))));if(r>0||o!==void 0){let m=(a||0)+(u||0),x=(d||0)>0,b=x&&a?Math.round(d/a*100):0,E=Math.max(o??0,i??0),h=I=>I>=80?"#16a34a":I>=50?"#ca8a04":"#dc2626",T=I=>I>=100?"\u25CF":I>=50?"\u25D0":"\u25CB";return Ce.createElement(Zm,null,r===0?Ce.createElement(i4,null,Ce.createElement("span",null,"\u2713"),"Perfect!"):Ce.createElement(TC,null,Ce.createElement("span",null,"\u2298"),r," issue",r!==1?"s":""),Ce.createElement(s4,{tint:h(E),title:`MQM compliance: ${o??0}% | Visual similarity: ${i??0}%`},Ce.createElement("span",{className:"score-dot"}),Ce.createElement("span",{className:"score-label"},"Score"),Ce.createElement("span",{className:"score-value"},E)),F&&s!==void 0&&s>0&&Ce.createElement(Ce.Fragment,null,Ce.createElement(zi,null,"|"),Ce.createElement(ea,null,Ce.createElement(ta,{color:"#16a34a"},R(s)),Ce.createElement("span",{style:{color:"#6b7280"}},"/"),Ce.createElement(ta,{color:"#16a34a"},z(s)))),F&&m>0&&Ce.createElement(Ce.Fragment,null,Ce.createElement(zi,null,"|"),Ce.createElement(ea,{title:`Input: ${a?.toLocaleString()||0} \xB7 Output: ${u?.toLocaleString()||0}${x?` \xB7 Cached: ${d?.toLocaleString()}`:""}`},Ce.createElement(IC,{color:"#7c3aed"},"#"),Ce.createElement(ta,{color:"#7c3aed"},_(m)),Ce.createElement("span",{style:{color:"#6b7280"}},"tokens"),x&&Ce.createElement("span",{style:{color:"#16a34a",marginLeft:"4px"}},"\u26A1",b,"%"))),f!==void 0&&f>0&&Ce.createElement(Ce.Fragment,null,Ce.createElement(zi,null,"|"),Ce.createElement(ea,null,Ce.createElement(IC,{color:"#6b7280"},"\u23F1"),Ce.createElement(ta,{color:"#6b7280"},f,"s"))),Ce.createElement(zi,null,"|"),Ce.createElement(a4,{onClick:g,disabled:S,isExporting:S,title:"Download design review report as PDF"},S?Ce.createElement(Ce.Fragment,null,Ce.createElement(l4,null),"Exporting..."):Ce.createElement(Ce.Fragment,null,"\u2193 Report")))}return null};var h4=Cn.div({display:"flex",flexDirection:"column",gap:"12px",marginBottom:"16px"}),jne=Cn.div({display:"flex",gap:"8px",alignItems:"center"}),x4=m4({from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}),y4=Cn.span({display:"inline-block",width:"16px",height:"16px",borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.35)",borderTopColor:"#ffffff",animation:`${x4} 0.8s linear infinite`,marginRight:"8px",verticalAlign:"middle"}),b4=Cn.span({display:"inline-flex",alignItems:"center",marginRight:"8px","& svg":{width:"16px",height:"16px"}}),S4=Cn.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"16px",padding:"14px 18px",borderRadius:"14px",border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)",flexWrap:"wrap"})),w4=Cn.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:Pa},o=t==="purple"||t==="yellow"?"124, 58, 237":"255, 107, 53";return{width:"auto",backgroundColor:r[t],color:"#ffffff",border:"none",padding:"12px 24px",fontSize:"14px",fontWeight:600,borderRadius:"10px",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)`}}}),v4=Cn.div(({theme:e})=>({marginTop:"8px",fontSize:"12px",color:e.color.warning||"#f59e0b",display:"flex",alignItems:"center",gap:"6px"})),k4=Cn.div({marginLeft:"auto",display:"flex",flexDirection:"column",gap:"4px"}),C4=Cn.label(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px"})),T4=Cn(En)({width:"auto",minWidth:"200px"}),I4=Cn.div({display:"flex",gap:"16px",alignItems:"center",marginTop:"4px"}),AC=Cn.label(({theme:e})=>({display:"flex",alignItems:"center",gap:"8px",fontSize:"12px",color:e.color.defaultText,cursor:"pointer",userSelect:"none"})),PC=Cn.div(({theme:e,checked:t})=>({width:"32px",height:"18px",borderRadius:"9px",backgroundColor:t?Pa:e.appBorderColor||"#d1d5db",position:"relative",transition:"background-color 0.2s ease",flexShrink:0})),LC=Cn.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)"})),MC=Cn.input({position:"absolute",opacity:0,width:0,height:0}),F4=()=>{let[e,t]=f4(0),n=g4();BC(()=>(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)},eh=()=>{let{sessionToken:e}=Bs(),{usageData:t}=we(),{selectedProjectId:n}=qr(),{currentMapping:r,hasMapping:o}=Ho(),{loadingMapping:i,currentStoryId:s}=rt(),{startReview:a,cancelReview:u,isReviewing:c}=Yg(),{isLoadingScreenshots:l}=Uo(),{storybookImageUrl:d,figmaImageUrl:f,currentReviewId:p,reviewHistory:g,setReviewDetailTab:S,setReviewResults:C,setFigmaImageUrl:F,setStorybookImageUrl:k,setFullPrompt:R,setFullResponse:z,includeTextComparison:_,setIncludeTextComparison:M,usePromptCache:B,setUsePromptCache:m,isValidating:x,validationUsage:b,isGenerating:E,isApplying:h,streamingStatus:T,featureFlags:I,userRole:v,roleOverride:A,isReviewing:P}=ie(),D=t?.reviewCredits??Math.floor(t?.creditBalance??0),N=g.find(he=>he.id===p),j=(N?.issues||[]).filter(he=>!he.dismissed).length,G=N?.complianceScore,L=N?.visualSimilarity,K=(N?.costUsd||0)+(b?.costUsd||0),ee=(N?.inputTokens||0)+(b?.inputTokens||0),re=(N?.outputTokens||0)+(b?.outputTokens||0),de=d4(()=>{let he=s?g.filter(ne=>ne.storyId===s):g,vt=he.filter(ne=>!ne.parentReviewId).sort((ne,W)=>new Date(W.createdAt).getTime()-new Date(ne.createdAt).getTime()),Ge=he.filter(ne=>ne.parentReviewId),lt=[];for(let ne of vt){lt.push(ne);let W=Ge.filter(Ae=>Ae.parentReviewId===ne.id).sort((Ae,ge)=>(Ae.iterationNumber||0)-(ge.iterationNumber||0));lt.push(...W)}let nt=Ge.filter(ne=>!vt.some(W=>W.id===ne.parentReviewId));return lt.push(...nt),lt},[g,s]);BC(()=>{if(!c)return;let he=vt=>{vt.key==="Escape"&&(vt.preventDefault(),u())};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[c,u]);let ae=o&&r?.figmaNodeId,qe=E||h,tt=!!(e&&n&&!c&&!l&&!qe&&s&&d&&ae&&f),se=async(he=!1)=>{if(!s){console.error("[ReviewActions] No story selected");return}try{S("chat"),await a({isIteration:he,parentReviewId:he?p:void 0})}catch(vt){console.error("[ReviewActions] Review error:",vt)}},pe=()=>se(!1),Ie=he=>{let vt=he.target.value;if(vt){let Ge=g.find(lt=>lt.id===vt);Ge&&(C({id:Ge.id,componentId:Ge.componentId,storyId:Ge.storyId,modelId:Ge.modelId,complianceScore:Ge.complianceScore,issuesCount:Ge.issuesCount,issues:Ge.issues,createdAt:new Date(Ge.createdAt),visualSimilarity:Ge.visualSimilarity,timestamp:new Date(Ge.createdAt).toISOString()}),Ge.figmaImageData&&F(Ge.figmaImageData),Ge.storybookImageData&&k(Ge.storybookImageData),(A??v)==="admin"&&(R(Ge.aiPrompt||""),z(Ge.aiResponse||"")),S("issues"))}},ze=he=>{let vt=new Date(he),lt=new Date().getTime()-vt.getTime(),nt=Math.floor(lt/6e4),ne=Math.floor(lt/36e5),W=Math.floor(lt/864e5);return nt<1?"Just now":nt<60?`${nt}m ago`:ne<24?`${ne}h ago`:W<7?`${W}d ago`:vt.toLocaleDateString()},me=he=>he?he.includes("haiku")?"Haiku":he.includes("sonnet")?"Sonnet":he.includes("opus")?"Opus":he.includes("gpt-4o-mini")?"GPT-4o mini":he.includes("gpt-4o")?"GPT-4o":he.includes("gpt-4")?"GPT-4":he.includes("o3")?"o3":he.includes("o1")?"o1":he.split("-")[0]||"":"",Nt=he=>{let vt=he.split("--"),Ge=vt[vt.length-1]||he;return Ge.charAt(0).toUpperCase()+Ge.slice(1)};return ft.createElement("div",null,ft.createElement(h4,null,I.enableModelSelection&&ft.createElement(CC,null),ft.createElement(I4,null,ft.createElement(AC,{title:"Compare text content between Figma design and Storybook component"},ft.createElement(MC,{type:"checkbox",checked:_,onChange:he=>M(he.target.checked)}),ft.createElement(PC,{checked:_},ft.createElement(LC,{checked:_})),"Compare text"),I.showCosts&&ft.createElement(AC,{title:"Cache prompt for 5 min to reduce costs on repeat reviews (dev optimization)"},ft.createElement(MC,{type:"checkbox",checked:B,onChange:he=>m(he.target.checked)}),ft.createElement(PC,{checked:B},ft.createElement(LC,{checked:B})),"Cache prompt")),ft.createElement(S4,null,ft.createElement(w4,{variant:c?"yellow":"purple",disabled:c?!1:!tt,onClick:c?u:pe,title:c?"Click to stop review":e?n?s?ae?l?"Loading screenshots...":qe?"Wait for fixes to complete...":d?f?"Review this component implementation":"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 UI Copilot first"},c?ft.createElement(ft.Fragment,null,ft.createElement(y4,null),"Reviewing",ft.createElement(F4,null)):ft.createElement(ft.Fragment,null,ft.createElement(b4,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")),P?null:x||N?ft.createElement(EC,{isReviewing:!1,isValidating:x,streamingStatus:T,issueCount:j,score:G,visualSimilarity:L,costUsd:K||N?.costUsd,inputTokens:ee||N?.inputTokens,outputTokens:re||N?.outputTokens,cacheCreationTokens:N?.cacheCreationTokens,cacheReadTokens:N?.cacheReadTokens,durationSeconds:N?.reviewDurationMs?Math.round(N.reviewDurationMs/1e3):void 0}):null,de.length>0&&ft.createElement(k4,null,ft.createElement(C4,null,"Review History"),ft.createElement(T4,{value:p||"",onChange:Ie},ft.createElement("option",{value:""},"Select a review..."),de.map(he=>{let vt=!!he.parentReviewId,Ge=vt?" \u21B3 ":"\u25CF ",lt=vt&&he.iterationNumber?`Iter ${he.iterationNumber} - `:"",nt=he.issuesCount??he.issues?.length??0,ne=he.complianceScore??"--",W=me(he.modelId);return ft.createElement("option",{key:he.id,value:he.id},Ge,lt,ze(he.createdAt)," - ",nt," issues (",ne,"%)",W?` \xB7 ${W}`:"",he.storyId?` \xB7 ${Nt(he.storyId)}`:"")}))))),!ae&&!i&&ft.createElement(v4,null,'\u26A0\uFE0F Figma mapping required. Use "Map to Figma" button to link this story to a Figma frame before reviewing.'))};import Vne,{useState as Gne}from"react";import{styled as DC}from"storybook/theming";var Kne=DC.div(({theme:e})=>({display:"flex",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"12px",gap:"4px"})),Xne=DC(io)({padding:"8px 12px",fontSize:"12px"});import Zne,{useState as ere}from"react";import{styled as th}from"storybook/theming";ve();je();De();pt();var are=th.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"12px",padding:"12px",backgroundColor:e.background.app,border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",fontSize:"13px"})),lre=th(Er)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),cre=th.span(({theme:e})=>({color:e.textMutedColor,fontSize:"12px",flex:1}));import dre from"react";import{styled as E4}from"storybook/theming";var mre=E4.div(({theme:e})=>({border:`2px dashed ${e.appBorderColor}`,borderRadius:"8px",padding:"40px",textAlign:"center",marginBottom:"20px",backgroundColor:e.background.app}));ve();import yre from"react";import{styled as Rr}from"storybook/theming";var wre=Rr.div(({theme:e})=>({marginBottom:"16px",border:`1px solid ${e.appBorderColor}`,borderRadius:"8px",overflow:"hidden",backgroundColor:e.background.content})),vre=Rr.div(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:e.background.app,borderBottom:`1px solid ${e.appBorderColor}`})),kre=Rr.div({display:"flex",alignItems:"center",gap:"8px",flex:1}),Cre=Rr.div(({theme:e})=>({fontSize:"14px",fontWeight:600,color:e.color.defaultText})),Tre=Rr.div(({theme:e})=>({flex:1,height:"4px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden",marginLeft:"12px"})),Ire=Rr.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"})),Fre=Rr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontWeight:500,minWidth:"40px",textAlign:"right"})),Ere=Rr.div(({theme:e})=>({padding:"16px",backgroundColor:e.background.app,textAlign:"center"})),Are=Rr.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)"}}})),Pre=Rr.span(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"}));ve();import Bre,{useState as Dre}from"react";import{styled as zr}from"storybook/theming";var Nre=zr.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)`}}),Ore=zr.div({display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",userSelect:"none"}),_re=zr.div({display:"flex",alignItems:"center",gap:"8px"}),$re=zr.span({fontSize:"12px",opacity:.7}),Ure=zr.span({fontSize:"13px",fontWeight:500}),jre=zr.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})),Hre=zr.div({marginTop:"12px",fontSize:"11px"}),Wre=zr.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"6px",marginBottom:"8px"}),Vre=zr.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"})),Gre=zr.span({fontSize:"12px"});De();je();import Qt from"react";import{styled as Qi}from"storybook/theming";import Tr,{useEffect as mW}from"react";import{styled as ya}from"storybook/theming";ve();import ni,{useState as W5}from"react";import{styled as Wi}from"storybook/theming";var RC={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 zC(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var A4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L4={};function ic(e,t){return((t||L4).jsx?P4:A4).test(e)}var M4=/[ \t\n\f\r]/g;function nh(e){return typeof e=="object"?e.type==="text"?NC(e.value):!1:NC(e)}function NC(e){return e.replace(M4,"")===""}var Jr=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Jr.prototype.normal={};Jr.prototype.property={};Jr.prototype.space=void 0;function rh(e,t){let n={},r={};for(let o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Jr(n,r,t)}function na(e){return e.toLowerCase()}var sn=class{constructor(t,n){this.attribute=n,this.property=t}};sn.prototype.attribute="";sn.prototype.booleanish=!1;sn.prototype.boolean=!1;sn.prototype.commaOrSpaceSeparated=!1;sn.prototype.commaSeparated=!1;sn.prototype.defined=!1;sn.prototype.mustUseProperty=!1;sn.prototype.number=!1;sn.prototype.overloadedBoolean=!1;sn.prototype.property="";sn.prototype.spaceSeparated=!1;sn.prototype.space=void 0;var ra={};ye(ra,{boolean:()=>We,booleanish:()=>zt,commaOrSpaceSeparated:()=>_n,commaSeparated:()=>To,number:()=>Y,overloadedBoolean:()=>sc,spaceSeparated:()=>wt});var B4=0,We=Ko(),zt=Ko(),sc=Ko(),Y=Ko(),wt=Ko(),To=Ko(),_n=Ko();function Ko(){return 2**++B4}var oh=Object.keys(ra),Xo=class extends sn{constructor(t,n,r,o){let i=-1;if(super(t,n),OC(this,"space",o),typeof r=="number")for(;++i<oh.length;){let s=oh[i];OC(this,oh[i],(r&ra[s])===ra[s])}}};Xo.prototype.defined=!0;function OC(e,t,n){n&&(e[t]=n)}function ur(e){let t={},n={};for(let[r,o]of Object.entries(e.properties)){let i=new Xo(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[na(r)]=r,n[na(i.attribute)]=r}return new Jr(t,n,e.space)}var ih=ur({properties:{ariaActiveDescendant:null,ariaAtomic:zt,ariaAutoComplete:null,ariaBusy:zt,ariaChecked:zt,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:zt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:zt,ariaFlowTo:wt,ariaGrabbed:zt,ariaHasPopup:null,ariaHidden:zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:Y,ariaLive:null,ariaModal:zt,ariaMultiLine:zt,ariaMultiSelectable:zt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:zt,ariaReadOnly:zt,ariaRelevant:null,ariaRequired:zt,ariaRoleDescription:wt,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:zt,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ac(e,t){return t in e?e[t]:t}function lc(e,t){return ac(e,t.toLowerCase())}var _C=ur({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:To,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:We,allowPaymentRequest:We,allowUserMedia:We,alt:null,as:null,async:We,autoCapitalize:null,autoComplete:wt,autoFocus:We,autoPlay:We,blocking:wt,capture:null,charSet:null,checked:We,cite:null,className:wt,cols:Y,colSpan:null,content:null,contentEditable:zt,controls:We,controlsList:wt,coords:Y|To,crossOrigin:null,data:null,dateTime:null,decoding:null,default:We,defer:We,dir:null,dirName:null,disabled:We,download:sc,draggable:zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:We,formTarget:null,headers:wt,height:Y,hidden:sc,high:Y,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:We,inputMode:null,integrity:null,is:null,isMap:We,itemId:null,itemProp:wt,itemRef:wt,itemScope:We,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:We,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:We,muted:We,name:null,nonce:null,noModule:We,noValidate:We,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:We,optimum:Y,pattern:null,ping:wt,placeholder:null,playsInline:We,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:We,referrerPolicy:null,rel:wt,required:We,reversed:We,rows:Y,rowSpan:Y,sandbox:wt,scope:null,scoped:We,seamless:We,selected:We,shadowRootClonable:We,shadowRootDelegatesFocus:We,shadowRootMode:null,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:We,useMap:null,value:zt,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:We,declare:We,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:We,noHref:We,noShade:We,noWrap:We,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:zt,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:We,disableRemotePlayback:We,prefix:null,property:null,results:Y,security:null,unselectable:null},space:"html",transform:lc});var $C=ur({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:_n,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,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:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:We,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,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:To,g2:To,glyphName:To,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:_n,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,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:Y,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:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:_n,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:_n,rev:_n,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:_n,requiredFeatures:_n,requiredFonts:_n,requiredFormats:_n,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:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:_n,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:_n,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:_n,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ac});var sh=ur({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 ah=ur({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:lc});var lh=ur({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var ch={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 D4=/[A-Z]/g,UC=/-[a-z]/g,R4=/^data[-\w.:]+$/i;function uh(e,t){let n=na(t),r=t,o=sn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&R4.test(t)){if(t.charAt(4)==="-"){let i=t.slice(5).replace(UC,N4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=t.slice(4);if(!UC.test(i)){let s=i.replace(D4,z4);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=Xo}return new o(r,t)}function z4(e){return"-"+e.toLowerCase()}function N4(e){return e.charAt(1).toUpperCase()}var jC=rh([ih,_C,sh,ah,lh],"html"),cc=rh([ih,$C,sh,ah,lh],"svg");function HC(e){return e.join(" ").trim()}var o1=Aa(e1(),1);var pc=t1("end"),Oi=t1("start");function t1(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 fh(e){let t=Oi(e),n=pc(e);if(t&&n)return{start:t,end:n}}function Io(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?n1(e.position):"start"in e||"end"in e?n1(e):"line"in e||"column"in e?gh(e):""}function gh(e){return r1(e&&e.line)+":"+r1(e&&e.column)}function n1(e){return gh(e&&e.start)+"-"+gh(e&&e.end)}function r1(e){return e&&typeof e=="number"?e:1}var Ht=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=Io(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}};Ht.prototype.file="";Ht.prototype.name="";Ht.prototype.reason="";Ht.prototype.message="";Ht.prototype.stack="";Ht.prototype.column=void 0;Ht.prototype.line=void 0;Ht.prototype.ancestors=void 0;Ht.prototype.cause=void 0;Ht.prototype.fatal=void 0;Ht.prototype.place=void 0;Ht.prototype.ruleId=void 0;Ht.prototype.source=void 0;var mh={}.hasOwnProperty,cU=new Map,uU=/[A-Z]/g,pU=new Set(["table","tbody","thead","tfoot","tr"]),dU=new Set(["td","th"]),i1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hh(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=bU(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"?cc:jC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=s1(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function s1(e,t,n){if(t.type==="element")return fU(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return hU(e,t,n);if(t.type==="mdxjsEsm")return mU(e,t);if(t.type==="root")return xU(e,t,n);if(t.type==="text")return yU(e,t)}function fU(e,t,n){let r=e.schema,o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=cc,e.schema=o),e.ancestors.push(t);let i=l1(e,t.tagName,!1),s=wU(e,t),a=yh(e,t);return pU.has(t.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!nh(u):!0})),a1(e,s,i,t),xh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function gU(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)}ia(e,t.position)}function mU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ia(e,t.position)}function hU(e,t,n){let r=e.schema,o=r;t.name==="svg"&&r.space==="html"&&(o=cc,e.schema=o),e.ancestors.push(t);let i=t.name===null?e.Fragment:l1(e,t.name,!0),s=vU(e,t),a=yh(e,t);return a1(e,s,i,t),xh(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function xU(e,t,n){let r={};return xh(r,yh(e,t)),e.create(t,e.Fragment,r,n)}function yU(e,t){return t.value}function a1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function xh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function bU(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=Oi(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 wU(e,t){let n={},r,o;for(o in t.properties)if(o!=="children"&&mh.call(t.properties,o)){let i=kU(e,o,t.properties[o]);if(i){let[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&dU.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 vU(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 ia(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 ia(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function yh(e,t){let n=[],r=-1,o=e.passKeys?new Map:cU;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=s1(e,i,s);a!==void 0&&n.push(a)}return n}function kU(e,t,n){let r=uh(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?zC(n):HC(n)),r.property==="style"){let o=typeof n=="object"?n:CU(e,String(n));return e.stylePropertyNameCase==="css"&&(o=TU(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?ch[r.property]||r.property:r.attribute,n]}}function CU(e,t){try{return(0,o1.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let r=n,o=new Ht("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=i1+"#cannot-parse-style-attribute",o}}function l1(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=ic(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=ic(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){let o=r.value;return mh.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);ia(e)}function ia(e,t){let n=new Ht("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=i1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function TU(e){let t={},n;for(n in e)mh.call(e,n)&&(t[IU(n)]=e[n]);return t}function IU(e){let t=e.replace(uU,FU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function FU(e){return"-"+e.toLowerCase()}var sa={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 R5,jsx as z5,jsxs as N5}from"react/jsx-runtime";import{useEffect as ope,useState as ipe}from"react";var EU={};function bh(e,t){let n=t||EU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return u1(e,r,o)}function u1(e,t,n){if(AU(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 c1(e.children,t,n)}return Array.isArray(e)?c1(e,t,n):""}function c1(e,t,n){let r=[],o=-1;for(;++o<e.length;)r[o]=u1(e[o],t,n);return r.join("")}function AU(e){return!!(e&&typeof e=="object")}var p1=document.createElement("i");function _i(e){let t="&"+e+";";p1.innerHTML=t;let n=p1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function dn(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 Tn(e,t){return e.length>0?(dn(e,e.length,0,t),e):t}var d1={}.hasOwnProperty;function f1(e){let t={},n=-1;for(;++n<e.length;)PU(t,e[n]);return t}function PU(e,t){let n;for(n in t){let o=(d1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],s;if(i)for(s in i){d1.call(o,s)||(o[s]=[]);let a=i[s];LU(o[s],Array.isArray(a)?a:a?[a]:[])}}}function LU(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);dn(e,0,0,r)}function dc(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 Zr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Xn=Fo(/[A-Za-z]/),an=Fo(/[\dA-Za-z]/),g1=Fo(/[#-'*+\--9=?A-Z^-~]/);function aa(e){return e!==null&&(e<32||e===127)}var la=Fo(/\d/),m1=Fo(/[\dA-Fa-f]/),h1=Fo(/[!-/:-@[-`{-~]/);function ue(e){return e!==null&&e<-2}function Wt(e){return e!==null&&(e<0||e===32)}function $e(e){return e===-2||e===-1||e===32}var x1=Fo(/\p{P}|\p{S}/u),y1=Fo(/\s/);function Fo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pr(e){let t=[],n=-1,r=0,o=0;for(;++n<e.length;){let i=e.charCodeAt(n),s="";if(i===37&&an(e.charCodeAt(n+1))&&an(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 Ve(e,t,n,r){let o=r?r-1:Number.POSITIVE_INFINITY,i=0;return s;function s(u){return $e(u)?(e.enter(n),a(u)):t(u)}function a(u){return $e(u)&&i++<o?(e.consume(u),a):(e.exit(n),t(u))}}var b1={tokenize:MU};function MU(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"),Ve(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 w1={tokenize:BU},S1={tokenize:DU};function BU(e){let t=this,n=[],r=0,o,i,s;return a;function a(R){if(r<n.length){let z=n[r];return t.containerState=z[1],e.attempt(z[0].continuation,u,c)(R)}return c(R)}function u(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&k();let z=t.events.length,_=z,M;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){M=t.events[_][1].end;break}F(r);let B=z;for(;B<t.events.length;)t.events[B][1].end={...M},B++;return dn(t.events,_+1,0,t.events.slice(z)),t.events.length=B,c(R)}return a(R)}function c(R){if(r===n.length){if(!o)return f(R);if(o.currentConstruct&&o.currentConstruct.concrete)return g(R);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(S1,l,d)(R)}function l(R){return o&&k(),F(r),f(R)}function d(R){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(R)}function f(R){return t.containerState={},e.attempt(S1,p,g)(R)}function p(R){return r++,n.push([t.currentConstruct,t.containerState]),f(R)}function g(R){if(R===null){o&&k(),F(0),e.consume(R);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),S(R)}function S(R){if(R===null){C(e.exit("chunkFlow"),!0),F(0),e.consume(R);return}return ue(R)?(e.consume(R),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(R),S)}function C(R,z){let _=t.sliceStream(R);if(z&&_.push(null),R.previous=i,i&&(i.next=R),i=R,o.defineSkip(R.start),o.write(_),t.parser.lazy[R.start.line]){let M=o.events.length;for(;M--;)if(o.events[M][1].start.offset<s&&(!o.events[M][1].end||o.events[M][1].end.offset>s))return;let B=t.events.length,m=B,x,b;for(;m--;)if(t.events[m][0]==="exit"&&t.events[m][1].type==="chunkFlow"){if(x){b=t.events[m][1].end;break}x=!0}for(F(r),M=B;M<t.events.length;)t.events[M][1].end={...b},M++;dn(t.events,m+1,0,t.events.slice(B)),t.events.length=M}}function F(R){let z=n.length;for(;z-- >R;){let _=n[z];t.containerState=_[1],_[0].exit.call(t,e)}n.length=R}function k(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function DU(e,t,n){return Ve(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Sh(e){if(e===null||Wt(e)||y1(e))return 1;if(x1(e))return 2}function $i(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 ca={name:"attention",resolveAll:RU,tokenize:zU};function RU(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};v1(d,-u),v1(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=Tn(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Tn(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=Tn(c,$i(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Tn(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=Tn(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):l=0,dn(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 zU(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Sh(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=Sh(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 v1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var wh={name:"autolink",tokenize:NU};function NU(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 Xn(p)?(e.consume(p),s):p===64?n(p):c(p)}function s(p){return p===43||p===45||p===46||an(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||an(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||aa(p)?n(p):(e.consume(p),u)}function c(p){return p===64?(e.consume(p),l):g1(p)?(e.consume(p),c):n(p)}function l(p){return an(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||an(p))&&r++<63){let g=p===45?f:d;return e.consume(p),g}return n(p)}}var Eo={partial:!0,tokenize:OU};function OU(e,t,n){return r;function r(i){return $e(i)?Ve(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ue(i)?t(i):n(i)}}var fc={continuation:{tokenize:$U},exit:UU,name:"blockQuote",tokenize:_U};function _U(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 $e(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function $U(e,t,n){let r=this;return o;function o(s){return $e(s)?Ve(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(fc,t,n)(s)}}function UU(e){e.exit("blockQuote")}var gc={name:"characterEscape",tokenize:jU};function jU(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 h1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}var mc={name:"characterReference",tokenize:HU};function HU(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=an,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=m1,l):(e.enter("characterReferenceValue"),i=7,s=la,l(d))}function l(d){if(d===59&&o){let f=e.exit("characterReferenceValue");return s===an&&!_i(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 k1={partial:!0,tokenize:VU},hc={concrete:!0,name:"codeFenced",tokenize:WU};function WU(e,t,n){let r=this,o={partial:!0,tokenize:_},i=0,s=0,a;return u;function u(M){return c(M)}function c(M){let B=r.events[r.events.length-1];return i=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,a=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(M)}function l(M){return M===a?(s++,e.consume(M),l):s<3?n(M):(e.exit("codeFencedFenceSequence"),$e(M)?Ve(e,d,"whitespace")(M):d(M))}function d(M){return M===null||ue(M)?(e.exit("codeFencedFence"),r.interrupt?t(M):e.check(k1,S,z)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(M))}function f(M){return M===null||ue(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(M)):$e(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ve(e,p,"whitespace")(M)):M===96&&M===a?n(M):(e.consume(M),f)}function p(M){return M===null||ue(M)?d(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(M))}function g(M){return M===null||ue(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(M)):M===96&&M===a?n(M):(e.consume(M),g)}function S(M){return e.attempt(o,z,C)(M)}function C(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),F}function F(M){return i>0&&$e(M)?Ve(e,k,"linePrefix",i+1)(M):k(M)}function k(M){return M===null||ue(M)?e.check(k1,S,z)(M):(e.enter("codeFlowValue"),R(M))}function R(M){return M===null||ue(M)?(e.exit("codeFlowValue"),k(M)):(e.consume(M),R)}function z(M){return e.exit("codeFenced"),t(M)}function _(M,B,m){let x=0;return b;function b(v){return M.enter("lineEnding"),M.consume(v),M.exit("lineEnding"),E}function E(v){return M.enter("codeFencedFence"),$e(v)?Ve(M,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):h(v)}function h(v){return v===a?(M.enter("codeFencedFenceSequence"),T(v)):m(v)}function T(v){return v===a?(x++,M.consume(v),T):x>=s?(M.exit("codeFencedFenceSequence"),$e(v)?Ve(M,I,"whitespace")(v):I(v)):m(v)}function I(v){return v===null||ue(v)?(M.exit("codeFencedFence"),B(v)):m(v)}}}function VU(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 ua={name:"codeIndented",tokenize:qU},GU={partial:!0,tokenize:YU};function qU(e,t,n){let r=this;return o;function o(c){return e.enter("codeIndented"),Ve(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(GU,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 YU(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):Ve(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 vh={name:"codeText",previous:XU,resolve:KU,tokenize:QU};function KU(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 XU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function QU(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 xc=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&&pa(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),pa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pa(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);pa(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pa(this.left,n.reverse())}}};function pa(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 yc(e){let t={},n=-1,r,o,i,s,a,u,c,l=new xc(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 dn(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,f=-1,p=n,g=0,S=0,C=[S];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&&(S=f+1,C.push(S),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):C.pop(),f=C.length;f--;){let F=a.slice(C[f],C[f+1]),k=i.pop();u.push([k,k+F.length-1]),e.splice(k,2,F)}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 kh={resolve:e3,tokenize:t3},ZU={partial:!0,tokenize:n3};function e3(e){return yc(e),e}function t3(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(ZU,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 n3(e,t,n){let r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ve(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 bc(e,t,n,r,o,i,s,a,u){let c=u||Number.POSITIVE_INFINITY,l=0;return d;function d(F){return F===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(F),e.exit(i),f):F===null||F===32||F===41||aa(F)?n(F):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),S(F))}function f(F){return F===62?(e.enter(i),e.consume(F),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(F))}function p(F){return F===62?(e.exit("chunkString"),e.exit(a),f(F)):F===null||F===60||ue(F)?n(F):(e.consume(F),F===92?g:p)}function g(F){return F===60||F===62||F===92?(e.consume(F),p):p(F)}function S(F){return!l&&(F===null||F===41||Wt(F))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(F)):l<c&&F===40?(e.consume(F),l++,S):F===41?(e.consume(F),l--,S):F===null||F===32||F===40||aa(F)?n(F):(e.consume(F),F===92?C:S)}function C(F){return F===40||F===41||F===92?(e.consume(F),S):S(F)}}function Sc(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=!$e(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function wc(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"),Ve(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 Jo(e,t){let n;return r;function r(o){return ue(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):$e(o)?Ve(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var Ch={name:"definition",tokenize:o3},r3={partial:!0,tokenize:i3};function o3(e,t,n){let r=this,o;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Sc.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=Zr(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 Wt(p)?Jo(e,c)(p):c(p)}function c(p){return bc(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function l(p){return e.attempt(r3,d,d)(p)}function d(p){return $e(p)?Ve(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 i3(e,t,n){return r;function r(a){return Wt(a)?Jo(e,o)(a):n(a)}function o(a){return wc(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return $e(a)?Ve(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ue(a)?t(a):n(a)}}var Th={name:"hardBreakEscape",tokenize:s3};function s3(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 Ih={name:"headingAtx",resolve:a3,tokenize:l3};function a3(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"},dn(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function l3(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||Wt(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)):$e(l)?Ve(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||Wt(l)?(e.exit("atxHeadingText"),a(l)):(e.consume(l),c)}}var C1=["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"],Fh=["pre","script","style","textarea"];var Eh={concrete:!0,name:"htmlFlow",resolveTo:p3,tokenize:d3},c3={partial:!0,tokenize:g3},u3={partial:!0,tokenize:f3};function p3(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 d3(e,t,n){let r=this,o,i,s,a,u;return c;function c(L){return l(L)}function l(L){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),i=!0,S):L===63?(e.consume(L),o=3,r.interrupt?t:w):Xn(L)?(e.consume(L),s=String.fromCharCode(L),C):n(L)}function f(L){return L===45?(e.consume(L),o=2,p):L===91?(e.consume(L),o=5,a=0,g):Xn(L)?(e.consume(L),o=4,r.interrupt?t:w):n(L)}function p(L){return L===45?(e.consume(L),r.interrupt?t:w):n(L)}function g(L){let K="CDATA[";return L===K.charCodeAt(a++)?(e.consume(L),a===K.length?r.interrupt?t:h:g):n(L)}function S(L){return Xn(L)?(e.consume(L),s=String.fromCharCode(L),C):n(L)}function C(L){if(L===null||L===47||L===62||Wt(L)){let K=L===47,ee=s.toLowerCase();return!K&&!i&&Fh.includes(ee)?(o=1,r.interrupt?t(L):h(L)):C1.includes(s.toLowerCase())?(o=6,K?(e.consume(L),F):r.interrupt?t(L):h(L)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(L):i?k(L):R(L))}return L===45||an(L)?(e.consume(L),s+=String.fromCharCode(L),C):n(L)}function F(L){return L===62?(e.consume(L),r.interrupt?t:h):n(L)}function k(L){return $e(L)?(e.consume(L),k):b(L)}function R(L){return L===47?(e.consume(L),b):L===58||L===95||Xn(L)?(e.consume(L),z):$e(L)?(e.consume(L),R):b(L)}function z(L){return L===45||L===46||L===58||L===95||an(L)?(e.consume(L),z):_(L)}function _(L){return L===61?(e.consume(L),M):$e(L)?(e.consume(L),_):R(L)}function M(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),u=L,B):$e(L)?(e.consume(L),M):m(L)}function B(L){return L===u?(e.consume(L),u=null,x):L===null||ue(L)?n(L):(e.consume(L),B)}function m(L){return L===null||L===34||L===39||L===47||L===60||L===61||L===62||L===96||Wt(L)?_(L):(e.consume(L),m)}function x(L){return L===47||L===62||$e(L)?R(L):n(L)}function b(L){return L===62?(e.consume(L),E):n(L)}function E(L){return L===null||ue(L)?h(L):$e(L)?(e.consume(L),E):n(L)}function h(L){return L===45&&o===2?(e.consume(L),A):L===60&&o===1?(e.consume(L),P):L===62&&o===4?(e.consume(L),j):L===63&&o===3?(e.consume(L),w):L===93&&o===5?(e.consume(L),N):ue(L)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(c3,G,T)(L)):L===null||ue(L)?(e.exit("htmlFlowData"),T(L)):(e.consume(L),h)}function T(L){return e.check(u3,I,G)(L)}function I(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),v}function v(L){return L===null||ue(L)?T(L):(e.enter("htmlFlowData"),h(L))}function A(L){return L===45?(e.consume(L),w):h(L)}function P(L){return L===47?(e.consume(L),s="",D):h(L)}function D(L){if(L===62){let K=s.toLowerCase();return Fh.includes(K)?(e.consume(L),j):h(L)}return Xn(L)&&s.length<8?(e.consume(L),s+=String.fromCharCode(L),D):h(L)}function N(L){return L===93?(e.consume(L),w):h(L)}function w(L){return L===62?(e.consume(L),j):L===45&&o===2?(e.consume(L),w):h(L)}function j(L){return L===null||ue(L)?(e.exit("htmlFlowData"),G(L)):(e.consume(L),j)}function G(L){return e.exit("htmlFlow"),t(L)}}function f3(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 g3(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Eo,t,n)}}var Ah={name:"htmlText",tokenize:m3};function m3(e,t,n){let r=this,o,i,s;return a;function a(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),u}function u(w){return w===33?(e.consume(w),c):w===47?(e.consume(w),_):w===63?(e.consume(w),R):Xn(w)?(e.consume(w),m):n(w)}function c(w){return w===45?(e.consume(w),l):w===91?(e.consume(w),i=0,g):Xn(w)?(e.consume(w),k):n(w)}function l(w){return w===45?(e.consume(w),p):n(w)}function d(w){return w===null?n(w):w===45?(e.consume(w),f):ue(w)?(s=d,P(w)):(e.consume(w),d)}function f(w){return w===45?(e.consume(w),p):d(w)}function p(w){return w===62?A(w):w===45?f(w):d(w)}function g(w){let j="CDATA[";return w===j.charCodeAt(i++)?(e.consume(w),i===j.length?S:g):n(w)}function S(w){return w===null?n(w):w===93?(e.consume(w),C):ue(w)?(s=S,P(w)):(e.consume(w),S)}function C(w){return w===93?(e.consume(w),F):S(w)}function F(w){return w===62?A(w):w===93?(e.consume(w),F):S(w)}function k(w){return w===null||w===62?A(w):ue(w)?(s=k,P(w)):(e.consume(w),k)}function R(w){return w===null?n(w):w===63?(e.consume(w),z):ue(w)?(s=R,P(w)):(e.consume(w),R)}function z(w){return w===62?A(w):R(w)}function _(w){return Xn(w)?(e.consume(w),M):n(w)}function M(w){return w===45||an(w)?(e.consume(w),M):B(w)}function B(w){return ue(w)?(s=B,P(w)):$e(w)?(e.consume(w),B):A(w)}function m(w){return w===45||an(w)?(e.consume(w),m):w===47||w===62||Wt(w)?x(w):n(w)}function x(w){return w===47?(e.consume(w),A):w===58||w===95||Xn(w)?(e.consume(w),b):ue(w)?(s=x,P(w)):$e(w)?(e.consume(w),x):A(w)}function b(w){return w===45||w===46||w===58||w===95||an(w)?(e.consume(w),b):E(w)}function E(w){return w===61?(e.consume(w),h):ue(w)?(s=E,P(w)):$e(w)?(e.consume(w),E):x(w)}function h(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),o=w,T):ue(w)?(s=h,P(w)):$e(w)?(e.consume(w),h):(e.consume(w),I)}function T(w){return w===o?(e.consume(w),o=void 0,v):w===null?n(w):ue(w)?(s=T,P(w)):(e.consume(w),T)}function I(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||Wt(w)?x(w):(e.consume(w),I)}function v(w){return w===47||w===62||Wt(w)?x(w):n(w)}function A(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function P(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),D}function D(w){return $e(w)?Ve(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):N(w)}function N(w){return e.enter("htmlTextData"),s(w)}}var Zo={name:"labelEnd",resolveAll:b3,resolveTo:S3,tokenize:w3},h3={tokenize:v3},x3={tokenize:k3},y3={tokenize:C3};function b3(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&&dn(e,0,e.length,n),e}function S3(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=Tn(a,e.slice(i+1,i+r+3)),a=Tn(a,[["enter",l,t]]),a=Tn(a,$i(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=Tn(a,[["exit",l,t],e[s-2],e[s-1],["exit",c,t]]),a=Tn(a,e.slice(s+1)),a=Tn(a,[["exit",u,t]]),dn(e,i,e.length,a),e}function w3(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(Zr(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(h3,l,s?l:d)(f):f===91?e.attempt(x3,l,s?c:d)(f):s?l(f):d(f)}function c(f){return e.attempt(y3,l,d)(f)}function l(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function v3(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 Wt(d)?Jo(e,i)(d):i(d)}function i(d){return d===41?l(d):bc(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function s(d){return Wt(d)?Jo(e,u)(d):l(d)}function a(d){return n(d)}function u(d){return d===34||d===39||d===40?wc(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):l(d)}function c(d){return Wt(d)?Jo(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 k3(e,t,n){let r=this;return o;function o(a){return Sc.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Zr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function C3(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 Ph={name:"labelStartImage",resolveAll:Zo.resolveAll,tokenize:T3};function T3(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 Lh={name:"labelStartLink",resolveAll:Zo.resolveAll,tokenize:I3};function I3(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 da={name:"lineEnding",tokenize:F3};function F3(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ve(e,t,"linePrefix")}}var ei={name:"thematicBreak",tokenize:E3};function E3(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"),$e(c)?Ve(e,a,"whitespace")(c):a(c))}}var yn={continuation:{tokenize:M3},exit:D3,name:"list",tokenize:L3},A3={partial:!0,tokenize:R3},P3={partial:!0,tokenize:B3};function L3(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:la(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(ei,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 la(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(Eo,r.interrupt?n:l,e.attempt(A3,f,d))}function l(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function d(p){return $e(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 M3(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Eo,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ve(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!$e(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(P3,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ve(e,e.attempt(yn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function B3(e,t,n){let r=this;return Ve(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 D3(e){e.exit(this.containerState.type)}function R3(e,t,n){let r=this;return Ve(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!$e(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}var vc={name:"setextUnderline",resolveTo:z3,tokenize:N3};function z3(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 N3(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"),$e(c)?Ve(e,u,"lineSuffix")(c):u(c))}function u(c){return c===null||ue(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}var T1={tokenize:O3};function O3(e){let t=this,n=e.attempt(Eo,r,e.attempt(this.parser.constructs.flowInitial,o,Ve(e,e.attempt(this.parser.constructs.flow,o,e.attempt(kh,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 I1={resolveAll:P1()},F1=A1("string"),E1=A1("text");function A1(e){return{resolveAll:P1(e==="text"?_3: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 P1(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 _3(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 Mh={};ye(Mh,{attentionMarkers:()=>q3,contentInitial:()=>U3,disable:()=>Y3,document:()=>$3,flow:()=>H3,flowInitial:()=>j3,insideSpan:()=>G3,string:()=>W3,text:()=>V3});var $3={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:fc},U3={91:Ch},j3={[-2]:ua,[-1]:ua,32:ua},H3={35:Ih,42:ei,45:[vc,ei],60:Eh,61:vc,95:ei,96:hc,126:hc},W3={38:mc,92:gc},V3={[-5]:da,[-4]:da,[-3]:da,33:Ph,38:mc,42:ca,60:[wh,Ah],91:Lh,92:[Th,gc],93:Zo,95:ca,96:vh},G3={null:[ca,I1]},q3={null:[42,95]},Y3={null:[]};function L1(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:x(B),check:x(m),consume:z,enter:_,exit:M,interrupt:x(m,{interrupt:!0})},l={code:null,containerState:{},defineSkip:F,events:[],now:C,parser:e,previous:null,sliceSerialize:g,sliceStream:S,write:p},d=t.tokenize.call(l,c),f;return t.resolveAll&&i.push(t),l;function p(T){return s=Tn(s,T),k(),s[s.length-1]!==null?[]:(b(t,0),l.events=$i(i,l.events,l),l.events)}function g(T,I){return X3(S(T),I)}function S(T){return K3(s,T)}function C(){let{_bufferIndex:T,_index:I,line:v,column:A,offset:P}=r;return{_bufferIndex:T,_index:I,line:v,column:A,offset:P}}function F(T){o[T.line]=T.column,h()}function k(){let T;for(;r._index<s.length;){let I=s[r._index];if(typeof I=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<I.length;)R(I.charCodeAt(r._bufferIndex));else R(I)}}function R(T){u=void 0,f=T,d=d(T)}function z(T){ue(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,h()):T!==-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=T,u=!0}function _(T,I){let v=I||{};return v.type=T,v.start=C(),l.events.push(["enter",v,l]),a.push(v),v}function M(T){let I=a.pop();return I.end=C(),l.events.push(["exit",I,l]),I}function B(T,I){b(T,I.from)}function m(T,I){I.restore()}function x(T,I){return v;function v(A,P,D){let N,w,j,G;return Array.isArray(A)?K(A):"tokenize"in A?K([A]):L(A);function L(ae){return qe;function qe(tt){let se=tt!==null&&ae[tt],pe=tt!==null&&ae.null,Ie=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return K(Ie)(tt)}}function K(ae){return N=ae,w=0,ae.length===0?D:ee(ae[w])}function ee(ae){return qe;function qe(tt){return G=E(),j=ae,ae.partial||(l.currentConstruct=ae),ae.name&&l.parser.constructs.disable.null.includes(ae.name)?de(tt):ae.tokenize.call(I?Object.assign(Object.create(l),I):l,c,re,de)(tt)}}function re(ae){return u=!0,T(j,G),P}function de(ae){return u=!0,G.restore(),++w<N.length?ee(N[w]):D}}}function b(T,I){T.resolveAll&&!i.includes(T)&&i.push(T),T.resolve&&dn(l.events,I,l.events.length-I,T.resolve(l.events.slice(I),l)),T.resolveTo&&(l.events=T.resolveTo(l.events,l))}function E(){let T=C(),I=l.previous,v=l.currentConstruct,A=l.events.length,P=Array.from(a);return{from:A,restore:D};function D(){r=T,l.previous=I,l.currentConstruct=v,l.events.length=A,a=P,h()}}function h(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function K3(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 X3(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=`
|
|
79
82
|
`;break}case-3:{s=`\r
|
|
80
|
-
`;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 Jg(e){let r={constructs:pv([Qg,...(e||{}).extensions||[]]),content:o(xv),defined:[],document:o(bv),flow:o(kv),lazy:{},string:o(Tv),text:o(Iv)};return r;function o(i){return s;function s(a){return Av(r,i,a)}}}function Zg(e){for(;!Kl(e););return e}var Pv=/[\0\t\n\r]/g;function em(){let e=1,t="",n=!0,r;return o;function o(i,s,a){let u=[],c,l,p,f,d;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),p=0,t="",n&&(i.charCodeAt(0)===65279&&p++,n=void 0);p<i.length;){if(Pv.lastIndex=p,c=Pv.exec(i),f=c&&c.index!==void 0?c.index:i.length,d=i.charCodeAt(f),!c){t=i.slice(p);break}if(d===10&&p===f&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),p<f&&(u.push(i.slice(p,f)),e+=f-p),d){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}p=f+1}return a&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}var h$=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Lv(e){return e.replace(h$,x$)}function x$(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return Hl(n.slice(i?2:1),i?16:10)}return Mi(n)||e}var Bv={}.hasOwnProperty;function tm(e,t,n){return typeof t!="string"&&(n=t,t=void 0),y$(n)(Zg(Jg(n).document().write(em()(e,t,!0))))}function y$(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(yn),autolinkProtocol:w,autolinkEmail:w,atxHeading:i(ue),blockQuote:i(st),characterEscape:w,characterReference:w,codeFenced:i(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(te,s),codeText:i(Y,s),codeTextData:w,data:w,codeFlowValue:w,definition:i(ce),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ie),hardBreakEscape:i(ct),hardBreakTrailing:i(ct),htmlFlow:i(Ge,s),htmlFlowData:w,htmlText:i(Ge,s),htmlTextData:w,image:i(xt),label:s,link:i(yn),listItem:i(fe),listItemValue:f,listOrdered:i(qe,p),listUnordered:i(qe),paragraph:i(kt),reference:M,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ue),strong:i(yr),thematicBreak:i(Xe)},exit:{atxHeading:u(),atxHeadingSequence:O,autolink:u(),autolinkEmail:We,autolinkProtocol:Ee,blockQuote:u(),characterEscapeValue:v,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:J,characterReference:Le,codeFenced:u(T),codeFencedFence:S,codeFencedFenceInfo:d,codeFencedFenceMeta:m,codeFlowValue:v,codeIndented:u(F),codeText:u(y),codeTextData:v,data:v,definition:u(),definitionDestinationString:R,definitionLabelString:k,definitionTitleString:z,emphasis:u(),hardBreakEscape:u(h),hardBreakTrailing:u(h),htmlFlow:u(C),htmlFlowData:v,htmlText:u(I),htmlTextData:v,image:u(L),label:N,labelText:B,lineEnding:A,link:u(P),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Q,resourceDestinationString:x,resourceTitleString:U,resource:H,setextHeading:u(g),setextHeadingLineSequence:D,setextHeadingText:E,strong:u(),thematicBreak:u()}};Dv(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(_){let $={type:"root",children:[]},W={stack:[$],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:l,data:n},Z=[],et=-1;for(;++et<_.length;)if(_[et][1].type==="listOrdered"||_[et][1].type==="listUnordered")if(_[et][0]==="enter")Z.push(et);else{let qt=Z.pop();et=o(_,qt,et)}for(et=-1;++et<_.length;){let qt=t[_[et][0]];Bv.call(qt,_[et][1].type)&&qt[_[et][1].type].call(Object.assign({sliceSerialize:_[et][2].sliceSerialize},W),_[et][1])}if(W.tokenStack.length>0){let qt=W.tokenStack[W.tokenStack.length-1];(qt[1]||Mv).call(W,void 0,qt[0])}for($.position={start:wo(_.length>0?_[0][1].start:{line:1,column:1,offset:0}),end:wo(_.length>0?_[_.length-2][1].end:{line:1,column:1,offset:0})},et=-1;++et<t.transforms.length;)$=t.transforms[et]($)||$;return $}function o(_,$,W){let Z=$-1,et=-1,qt=!1,br,or,Pr,bn;for(;++Z<=W;){let xe=_[Z];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?et++:et--,bn=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(br&&!bn&&!et&&!Pr&&(Pr=Z),bn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:bn=void 0}if(!et&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||et===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(br){let Sr=Z;for(or=void 0;Sr--;){let $n=_[Sr];if($n[1].type==="lineEnding"||$n[1].type==="lineEndingBlank"){if($n[0]==="exit")continue;or&&(_[or][1].type="lineEndingBlank",qt=!0),$n[1].type="lineEnding",or=Sr}else if(!($n[1].type==="linePrefix"||$n[1].type==="blockQuotePrefix"||$n[1].type==="blockQuotePrefixWhitespace"||$n[1].type==="blockQuoteMarker"||$n[1].type==="listItemIndent"))break}Pr&&(!or||Pr<or)&&(br._spread=!0),br.end=Object.assign({},or?_[or][1].start:xe[1].end),_.splice(or||Z,0,["exit",br,xe[2]]),Z++,W++}if(xe[1].type==="listItemPrefix"){let Sr={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};br=Sr,_.splice(Z,0,["enter",Sr,xe[2]]),Z++,W++,Pr=void 0,bn=!0}}}return _[$][1]._spread=qt,W}function i(_,$){return W;function W(Z){a.call(this,_(Z),Z),$&&$.call(this,Z)}}function s(){this.stack.push({type:"fragment",children:[]})}function a(_,$,W){this.stack[this.stack.length-1].children.push(_),this.stack.push(_),this.tokenStack.push([$,W||void 0]),_.position={start:wo($.start),end:void 0}}function u(_){return $;function $(W){_&&_.call(this,W),c.call(this,W)}}function c(_,$){let W=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==_.type&&($?$.call(this,_,Z[0]):(Z[1]||Mv).call(this,_,Z[0]));else throw new Error("Cannot close `"+_.type+"` ("+yo({start:_.start,end:_.end})+"): it\u2019s not open");W.position.end=wo(_.end)}function l(){return Og(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function f(_){if(this.data.expectingFirstListItemValue){let $=this.stack[this.stack.length-2];$.start=Number.parseInt(this.sliceSerialize(_),10),this.data.expectingFirstListItemValue=void 0}}function d(){let _=this.resume(),$=this.stack[this.stack.length-1];$.lang=_}function m(){let _=this.resume(),$=this.stack[this.stack.length-1];$.meta=_}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){let _=this.resume(),$=this.stack[this.stack.length-1];$.value=_.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function F(){let _=this.resume(),$=this.stack[this.stack.length-1];$.value=_.replace(/(\r?\n|\r)$/g,"")}function k(_){let $=this.resume(),W=this.stack[this.stack.length-1];W.label=$,W.identifier=Vr(this.sliceSerialize(_)).toLowerCase()}function z(){let _=this.resume(),$=this.stack[this.stack.length-1];$.title=_}function R(){let _=this.resume(),$=this.stack[this.stack.length-1];$.url=_}function O(_){let $=this.stack[this.stack.length-1];if(!$.depth){let W=this.sliceSerialize(_).length;$.depth=W}}function E(){this.data.setextHeadingSlurpLineEnding=!0}function D(_){let $=this.stack[this.stack.length-1];$.depth=this.sliceSerialize(_).codePointAt(0)===61?1:2}function g(){this.data.setextHeadingSlurpLineEnding=void 0}function w(_){let W=this.stack[this.stack.length-1].children,Z=W[W.length-1];(!Z||Z.type!=="text")&&(Z=pe(),Z.position={start:wo(_.start),end:void 0},W.push(Z)),this.stack.push(Z)}function v(_){let $=this.stack.pop();$.value+=this.sliceSerialize(_),$.position.end=wo(_.end)}function A(_){let $=this.stack[this.stack.length-1];if(this.data.atHardBreak){let W=$.children[$.children.length-1];W.position.end=wo(_.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes($.type)&&(w.call(this,_),v.call(this,_))}function h(){this.data.atHardBreak=!0}function C(){let _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function I(){let _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function y(){let _=this.resume(),$=this.stack[this.stack.length-1];$.value=_}function P(){let _=this.stack[this.stack.length-1];if(this.data.inReference){let $=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=$,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function L(){let _=this.stack[this.stack.length-1];if(this.data.inReference){let $=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=$,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function B(_){let $=this.sliceSerialize(_),W=this.stack[this.stack.length-2];W.label=Lv($),W.identifier=Vr($).toLowerCase()}function N(){let _=this.stack[this.stack.length-1],$=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){let Z=_.children;W.children=Z}else W.alt=$}function x(){let _=this.resume(),$=this.stack[this.stack.length-1];$.url=_}function U(){let _=this.resume(),$=this.stack[this.stack.length-1];$.title=_}function H(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function Q(_){let $=this.resume(),W=this.stack[this.stack.length-1];W.label=$,W.identifier=Vr(this.sliceSerialize(_)).toLowerCase(),this.data.referenceType="full"}function ee(_){this.data.characterReferenceType=_.type}function J(_){let $=this.sliceSerialize(_),W=this.data.characterReferenceType,Z;W?(Z=Hl($,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=Mi($);let et=this.stack[this.stack.length-1];et.value+=Z}function Le(_){let $=this.stack.pop();$.position.end=wo(_.end)}function Ee(_){v.call(this,_);let $=this.stack[this.stack.length-1];$.url=this.sliceSerialize(_)}function We(_){v.call(this,_);let $=this.stack[this.stack.length-1];$.url="mailto:"+this.sliceSerialize(_)}function st(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function Y(){return{type:"inlineCode",value:""}}function ce(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ie(){return{type:"emphasis",children:[]}}function ue(){return{type:"heading",depth:0,children:[]}}function ct(){return{type:"break"}}function Ge(){return{type:"html",value:""}}function xt(){return{type:"image",title:null,url:"",alt:null}}function yn(){return{type:"link",title:null,url:"",children:[]}}function qe(_){return{type:"list",ordered:_.type==="listOrdered",start:null,spread:_._spread,children:[]}}function fe(_){return{type:"listItem",spread:_._spread,checked:null,children:[]}}function kt(){return{type:"paragraph",children:[]}}function yr(){return{type:"strong",children:[]}}function pe(){return{type:"text",value:""}}function Xe(){return{type:"thematicBreak"}}}function wo(e){return{line:e.line,column:e.column,offset:e.offset}}function Dv(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Dv(e,r):b$(e,r)}}function b$(e,t){let n;for(n in t)if(Bv.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 Mv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yo({start:t.start,end:t.end})+") is still open")}function ec(e){let t=this;t.parser=n;function n(r){return tm(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Rv(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 zv(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
81
|
-
`}]}function
|
|
82
|
-
`:"",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 Bh(e){let r={constructs:f1([Mh,...(e||{}).extensions||[]]),content:o(b1),defined:[],document:o(w1),flow:o(T1),lazy:{},string:o(F1),text:o(E1)};return r;function o(i){return s;function s(a){return L1(r,i,a)}}}function Dh(e){for(;!yc(e););return e}var M1=/[\0\t\n\r]/g;function Rh(){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(M1.lastIndex=d,c=M1.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 Q3=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function B1(e){return e.replace(Q3,J3)}function J3(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return dc(n.slice(i?2:1),i?16:10)}return _i(n)||e}var R1={}.hasOwnProperty;function zh(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Z3(n)(Dh(Bh(n).document().write(Rh()(e,t,!0))))}function Z3(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:x,autolinkEmail:x,atxHeading:i(me),blockQuote:i(tt),characterEscape:x,characterReference:x,codeFenced:i(se),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(se,s),codeText:i(pe,s),codeTextData:x,data:x,codeFlowValue:x,definition:i(Ie),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ze),hardBreakEscape:i(Nt),hardBreakTrailing:i(Nt),htmlFlow:i(he,s),htmlFlowData:x,htmlText:i(he,s),htmlTextData:x,image:i(vt),label:s,link:i(Ge),listItem:i(nt),listItemValue:f,listOrdered:i(lt,d),listUnordered:i(lt),paragraph:i(ne),reference:L,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(W),thematicBreak:i(ge)},exit:{atxHeading:u(),atxHeadingSequence:_,autolink:u(),autolinkEmail:qe,autolinkProtocol:ae,blockQuote:u(),characterEscapeValue:b,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:re,characterReference:de,codeFenced:u(C),codeFencedFence:S,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:b,codeIndented:u(F),codeText:u(v),codeTextData:b,data:b,definition:u(),definitionDestinationString:z,definitionLabelString:k,definitionTitleString:R,emphasis:u(),hardBreakEscape:u(h),hardBreakTrailing:u(h),htmlFlow:u(T),htmlFlowData:b,htmlText:u(I),htmlTextData:b,image:u(P),label:N,labelText:D,lineEnding:E,link:u(A),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:K,resourceDestinationString:w,resourceTitleString:j,resource:G,setextHeading:u(m),setextHeadingLineSequence:B,setextHeadingText:M,strong:u(),thematicBreak:u()}};z1(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},Pe=[],Ne=-1;for(;++Ne<O.length;)if(O[Ne][1].type==="listOrdered"||O[Ne][1].type==="listUnordered")if(O[Ne][0]==="enter")Pe.push(Ne);else{let yt=Pe.pop();Ne=o(O,yt,Ne)}for(Ne=-1;++Ne<O.length;){let yt=t[O[Ne][0]];R1.call(yt,O[Ne][1].type)&&yt[O[Ne][1].type].call(Object.assign({sliceSerialize:O[Ne][2].sliceSerialize},H),O[Ne][1])}if(H.tokenStack.length>0){let yt=H.tokenStack[H.tokenStack.length-1];(yt[1]||D1).call(H,void 0,yt[0])}for(U.position={start:Ao(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:Ao(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)U=t.transforms[Ne](U)||U;return U}function o(O,U,H){let Pe=U-1,Ne=-1,yt=!1,Un,Qn,In,oo;for(;++Pe<=H;){let bn=O[Pe];switch(bn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{bn[0]==="enter"?Ne++:Ne--,oo=void 0;break}case"lineEndingBlank":{bn[0]==="enter"&&(Un&&!oo&&!Ne&&!In&&(In=Pe),oo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:oo=void 0}if(!Ne&&bn[0]==="enter"&&bn[1].type==="listItemPrefix"||Ne===-1&&bn[0]==="exit"&&(bn[1].type==="listUnordered"||bn[1].type==="listOrdered")){if(Un){let Ir=Pe;for(Qn=void 0;Ir--;){let en=O[Ir];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;Qn&&(O[Qn][1].type="lineEndingBlank",yt=!0),en[1].type="lineEnding",Qn=Ir}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}In&&(!Qn||In<Qn)&&(Un._spread=!0),Un.end=Object.assign({},Qn?O[Qn][1].start:bn[1].end),O.splice(Qn||Pe,0,["exit",Un,bn[2]]),Pe++,H++}if(bn[1].type==="listItemPrefix"){let Ir={type:"listItem",_spread:!1,start:Object.assign({},bn[1].start),end:void 0};Un=Ir,O.splice(Pe,0,["enter",Ir,bn[2]]),Pe++,H++,In=void 0,oo=!0}}}return O[U][1]._spread=yt,H}function i(O,U){return H;function H(Pe){a.call(this,O(Pe),Pe),U&&U.call(this,Pe)}}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:Ao(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(),Pe=this.tokenStack.pop();if(Pe)Pe[0].type!==O.type&&(U?U.call(this,O,Pe[0]):(Pe[1]||D1).call(this,O,Pe[0]));else throw new Error("Cannot close `"+O.type+"` ("+Io({start:O.start,end:O.end})+"): it\u2019s not open");H.position.end=Ao(O.end)}function l(){return bh(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 S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){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 F(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O.replace(/(\r?\n|\r)$/g,"")}function k(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=Zr(this.sliceSerialize(O)).toLowerCase()}function R(){let O=this.resume(),U=this.stack[this.stack.length-1];U.title=O}function z(){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 M(){this.data.setextHeadingSlurpLineEnding=!0}function B(O){let U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(O).codePointAt(0)===61?1:2}function m(){this.data.setextHeadingSlurpLineEnding=void 0}function x(O){let H=this.stack[this.stack.length-1].children,Pe=H[H.length-1];(!Pe||Pe.type!=="text")&&(Pe=Ae(),Pe.position={start:Ao(O.start),end:void 0},H.push(Pe)),this.stack.push(Pe)}function b(O){let U=this.stack.pop();U.value+=this.sliceSerialize(O),U.position.end=Ao(O.end)}function E(O){let U=this.stack[this.stack.length-1];if(this.data.atHardBreak){let H=U.children[U.children.length-1];H.position.end=Ao(O.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(U.type)&&(x.call(this,O),b.call(this,O))}function h(){this.data.atHardBreak=!0}function T(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function I(){let O=this.resume(),U=this.stack[this.stack.length-1];U.value=O}function v(){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 P(){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 D(O){let U=this.sliceSerialize(O),H=this.stack[this.stack.length-2];H.label=B1(U),H.identifier=Zr(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 Pe=O.children;H.children=Pe}else H.alt=U}function w(){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 G(){this.data.inReference=void 0}function L(){this.data.referenceType="collapsed"}function K(O){let U=this.resume(),H=this.stack[this.stack.length-1];H.label=U,H.identifier=Zr(this.sliceSerialize(O)).toLowerCase(),this.data.referenceType="full"}function ee(O){this.data.characterReferenceType=O.type}function re(O){let U=this.sliceSerialize(O),H=this.data.characterReferenceType,Pe;H?(Pe=dc(U,H==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Pe=_i(U);let Ne=this.stack[this.stack.length-1];Ne.value+=Pe}function de(O){let U=this.stack.pop();U.position.end=Ao(O.end)}function ae(O){b.call(this,O);let U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(O)}function qe(O){b.call(this,O);let U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(O)}function tt(){return{type:"blockquote",children:[]}}function se(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ze(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function Nt(){return{type:"break"}}function he(){return{type:"html",value:""}}function vt(){return{type:"image",title:null,url:"",alt:null}}function Ge(){return{type:"link",title:null,url:"",children:[]}}function lt(O){return{type:"list",ordered:O.type==="listOrdered",start:null,spread:O._spread,children:[]}}function nt(O){return{type:"listItem",spread:O._spread,checked:null,children:[]}}function ne(){return{type:"paragraph",children:[]}}function W(){return{type:"strong",children:[]}}function Ae(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function Ao(e){return{line:e.line,column:e.column,offset:e.offset}}function z1(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?z1(e,r):e5(e,r)}}function e5(e,t){let n;for(n in t)if(R1.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 D1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Io({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Io({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Io({start:t.start,end:t.end})+") is still open")}function kc(e){let t=this;t.parser=n;function n(r){return zh(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function N1(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 O1(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
84
|
+
`}]}function _1(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 $1(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U1(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j1(e,t){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=pr(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 H1(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 W1(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Cc(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 V1(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cc(e,t);let o={src:pr(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 G1(e,t){let n={src:pr(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 q1(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 Y1(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cc(e,t);let o={href:pr(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 K1(e,t){let n={href:pr(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 X1(e,t,n){let r=e.all(t),o=n?t5(n):Q1(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:`
|
|
83
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:`
|
|
84
|
-
`});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 t5(e){let t=!1;if(e.type==="list"){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Q1(n[r])}return t}function Q1(e){let t=e.spread;return t??e.children.length>1}function J1(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 Z1(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eT(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function tT(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nT(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=Oi(t.children[1]),u=pc(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 rT(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],f={},p=s?s[u]:void 0;p&&(f.align=p);let g={type:"element",tagName:i,properties:f,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),c.push(g)}let l={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function oT(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sT(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),o=0,i=[];for(;r;)i.push(iT(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(iT(t.slice(o),o>0,!1)),i.join("")}function iT(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 aT(e,t){let n={type:"text",value:sT(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function lT(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var cT={blockquote:N1,break:O1,code:_1,delete:$1,emphasis:U1,footnoteReference:j1,heading:H1,html:W1,imageReference:V1,image:G1,inlineCode:q1,linkReference:Y1,link:K1,listItem:X1,list:J1,paragraph:Z1,root:eT,strong:tT,table:nT,tableCell:oT,tableRow:rT,text:aT,thematicBreak:lT,toml:Tc,yaml:Tc,definition:Tc,footnoteDefinition:Tc};function Tc(){}var uT=typeof self=="object"?self:globalThis,i5=(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 uT[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 uT[i](s),o)};return r},_h=e=>i5(new Map,e)(0);var Ui="",{toString:s5}={},{keys:a5}=Object,fa=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let n=s5.call(e).slice(8,-1);switch(n){case"Array":return[1,Ui];case"Object":return[2,Ui];case"Date":return[3,Ui];case"RegExp":return[4,Ui];case"Map":return[5,Ui];case"Set":return[6,Ui];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Fc=([e,t])=>e===0&&(t==="function"||t==="symbol"),l5=(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]=fa(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 f=s;return u==="DataView"?f=new Uint8Array(s.buffer):u==="ArrayBuffer"&&(f=new Uint8Array(s)),o([u,[...f]],s)}let l=[],d=o([a,l],s);for(let f of s)l.push(i(f));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 f of a5(s))(e||!Fc(fa(s[f])))&&l.push([i(f),i(s[f])]);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[f,p]of s)(e||!(Fc(fa(f))||Fc(fa(p))))&&l.push([i(f),i(p)]);return d}case 6:{let l=[],d=o([a,l],s);for(let f of s)(e||!Fc(fa(f)))&&l.push(i(f));return d}}let{message:c}=s;return o([a,{name:u,message:c}],s)};return i},$h=(e,{json:t,lossy:n}={})=>{let r=[];return l5(!(t||n),!!t,new Map,r)(e),r};var ji=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?_h($h(e,t)):structuredClone(e):(e,t)=>_h($h(e,t));function c5(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 u5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mT(e){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||c5,r=e.options.footnoteBackLabel||u5,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(),f=pr(d.toLowerCase()),p=0,g=[],S=e.footnoteCounts.get(d);for(;S!==void 0&&++p<=S;){g.length>0&&g.push({type:"text",value:" "});let k=typeof n=="string"?n:n(u,p);typeof k=="string"&&(k={type:"text",value:k}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,p),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}let C=l[l.length-1];if(C&&C.type==="element"&&C.tagName==="p"){let k=C.children[C.children.length-1];k&&k.type==="text"?k.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...g)}else l.push(...g);let F={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(l,!0)};e.patch(c,F),a.push(F)}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:`
|
|
85
88
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
86
|
-
`}]}}var
|
|
89
|
+
`}]}}var Ec=(function(e){if(e==null)return g5;if(typeof e=="function")return Ac(e);if(typeof e=="object")return Array.isArray(e)?p5(e):d5(e);if(typeof e=="string")return f5(e);throw new Error("Expected function, string, or object as test")});function p5(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ec(e[n]);return Ac(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function d5(e){let t=e;return Ac(n);function n(r){let o=r,i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function f5(e){return Ac(t);function t(n){return n&&n.type===e}}function Ac(e){return t;function t(n,r,o){return!!(m5(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function g5(){return!0}function m5(e){return e!==null&&typeof e=="object"&&"type"in e}var hT=[],Uh=!0,Pc=!1,jh="skip";function Hh(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;let i=Ec(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(f,"name",{value:"node ("+(u.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=hT,g,S,C;if((!t||i(u,c,l[l.length-1]||void 0))&&(p=h5(n(u,l)),p[0]===Pc))return p;if("children"in u&&u.children){let F=u;if(F.children&&p[0]!==jh)for(S=(r?F.children.length:-1)+s,C=l.concat(F);S>-1&&S<F.children.length;){let k=F.children[S];if(g=a(k,S,C)(),g[0]===Pc)return g;S=typeof g[1]=="number"?g[1]:S+s}}return p}}}function h5(e){return Array.isArray(e)?e:typeof e=="number"?[Uh,e]:e==null?hT:[e]}function ga(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),Hh(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 Wh={}.hasOwnProperty,x5={};function yT(e,t){let n=t||x5,r=new Map,o=new Map,i=new Map,s={...cT,...n.handlers},a={all:c,applyData:b5,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:u,options:n,patch:y5,wrap:w5};return ga(e,function(l){if(l.type==="definition"||l.type==="footnoteDefinition"){let d=l.type==="definition"?r:o,f=String(l.identifier).toUpperCase();d.has(f)||d.set(f,l)}}),a;function u(l,d){let f=l.type,p=a.handlers[f];if(Wh.call(a.handlers,f)&&p)return p(a,l,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in l){let{children:S,...C}=l,F=ji(C);return F.children=a.all(l),F}return ji(l)}return(a.options.unknownHandler||S5)(a,l,d)}function c(l){let d=[];if("children"in l){let f=l.children,p=-1;for(;++p<f.length;){let g=a.one(f[p],l);if(g){if(p&&f[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=xT(g.value)),!Array.isArray(g)&&g.type==="element")){let S=g.children[0];S&&S.type==="text"&&(S.value=xT(S.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function y5(e,t){e.position&&(t.position=fh(e))}function b5(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 S5(e,t){let n=t.data||{},r="value"in t&&!(Wh.call(n,"hProperties")||Wh.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 w5(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:`
|
|
87
90
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
88
91
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
89
|
-
`}),n}function
|
|
90
|
-
`},o)),i}function cc(e,t){return e&&"run"in e?async function(n,r){let o=lc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return lc(n,{file:r,...e||t})}}function um(e){if(e)throw e}var dc=ga(Tk(),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 pm(){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],p=-1;if(u){s(u);return}for(;++p<o.length;)(c[p]===null||c[p]===void 0)&&(c[p]=o[p]);o=c,l?Ik(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 Ik(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 mr={basename:U$,dirname:j$,extname:H$,join:W$,sep:"/"};function U$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');na(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 j$(e){if(na(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 H$(e){na(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 W$(...e){let t=-1,n;for(;++t<e.length;)na(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":V$(n)}function V$(e){na(e);let t=e.codePointAt(0)===47,n=G$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function G$(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 na(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var Fk={cwd:q$};function q$(){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 Ek(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 Y$(e)}function Y$(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 dm=["history","path","basename","stem","extname","dirname"],Yo=class{constructor(t){let n;t?zi(t)?n={path:t}:typeof t=="string"||K$(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Fk.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<dm.length;){let i=dm[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)dm.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?mr.basename(this.path):void 0}set basename(t){gm(t,"basename"),fm(t,"basename"),this.path=mr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?mr.dirname(this.path):void 0}set dirname(t){Ak(this.basename,"dirname"),this.path=mr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?mr.extname(this.path):void 0}set extname(t){if(fm(t,"extname"),Ak(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=mr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){zi(t)&&(t=Ek(t)),gm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?mr.basename(this.path,this.extname):void 0}set stem(t){gm(t,"stem"),fm(t,"stem"),this.path=mr.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 Rt(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 fm(e,t){if(e&&e.includes(mr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+mr.sep+"`")}function gm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ak(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function K$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var Pk=(function(e){let r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i});var X$={}.hasOwnProperty,ym=class e extends Pk{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=pm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];t.use(...r)}return t.data((0,dc.default)(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(xm("data",this.frozen),this.namespace[t]=n,this):X$.call(this.namespace,t)&&this.namespace[t]||void 0:t?(xm("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=pc(t),r=this.parser||this.Parser;return mm("parse",r),r(String(n),n)}process(t,n){let r=this;return this.freeze(),mm("process",this.parser||this.Parser),hm("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){let a=pc(t),u=r.parse(a);r.run(u,a,function(l,p,f){if(l||!p||!f)return c(l);let d=p,m=r.stringify(d,f);J$(m)?f.value=m:f.result=m,c(l,f)});function c(l,p){l||!p?s(l):i?i(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),mm("processSync",this.parser||this.Parser),hm("processSync",this.compiler||this.Compiler),this.process(t,o),Mk("processSync","process",n),r;function o(i,s){n=!0,um(i),r=s}}run(t,n,r){Lk(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=pc(n);o.run(t,u,c);function c(l,p,f){let d=p||t;l?a(l):s?s(d):r(void 0,d,f)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),Mk("runSync","run",r),o;function i(s,a){um(s),o=a,r=!0}}stringify(t,n){this.freeze();let r=pc(n),o=this.compiler||this.Compiler;return hm("stringify",o),Lk(t),o(t,r)}use(t,...n){let r=this.attachers,o=this.namespace;if(xm("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,...p]=c;u(l,p)}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,dc.default)(!0,o.settings,c.settings))}function a(c){let l=-1;if(c!=null)if(Array.isArray(c))for(;++l<c.length;){let p=c[l];i(p)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function u(c,l){let p=-1,f=-1;for(;++p<r.length;)if(r[p][0]===c){f=p;break}if(f===-1)r.push([c,...l]);else if(l.length>0){let[d,...m]=l,S=r[f][1];ta(S)&&ta(d)&&(d=(0,dc.default)(!0,S,d)),r[f]=[c,d,...m]}}}},bm=new ym().freeze();function mm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function hm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function xm(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 Lk(e){if(!ta(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Mk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pc(e){return Q$(e)?e:new Yo(e)}function Q$(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function J$(e){return typeof e=="string"||Z$(e)}function Z$(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var rU="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Bk=[],Dk={allowDangerousHtml:!0},oU=/^(https?|ircs?|mailto|xmpp)$/i,iU=[{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 Sm(e){let t=sU(e),n=aU(e);return lU(t.runSync(t.parse(n),n),e)}function sU(e){let t=e.rehypePlugins||Bk,n=e.remarkPlugins||Bk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Dk}:Dk;return bm().use(ec).use(n).use(cc,r).use(t)}function aU(e){let t=e.children||"",n=new Yo;return typeof t=="string"?n.value=t:(""+t,void 0),n}function lU(e,t){let n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||Rk;for(let l of iU)Object.hasOwn(t,l.from)&&(""+l.from+(l.to?"use `"+l.to+"` instead":"remove it")+rU+l.id,void 0);return n&&i&&void 0,ea(e,c),Rg(e,{Fragment:eU,components:o,ignoreInvalidStyle:!0,jsx:tU,jsxs:nU,passKeys:!0,passNode:!0});function c(l,p,f){if(l.type==="raw"&&f&&typeof p=="number")return s?f.children.splice(p,1):f.children[p]={type:"text",value:l.value},p;if(l.type==="element"){let d;for(d in Gs)if(Object.hasOwn(Gs,d)&&Object.hasOwn(l.properties,d)){let m=l.properties[d],S=Gs[d];(S===null||S.includes(l.tagName))&&(l.properties[d]=u(String(m||""),d,l))}}if(l.type==="element"){let d=n?!n.includes(l.tagName):i?i.includes(l.tagName):!1;if(!d&&r&&typeof p=="number"&&(d=!r(l,p,f)),d&&f&&typeof p=="number")return a&&l.children?f.children.splice(p,1,...l.children):f.children.splice(p,1),p}}}function Rk(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||oU.test(e.slice(0,t))?e:""}ke();var uU=Ni.div({display:"flex",flexDirection:"column",gap:"12px"}),pU=Ni.div({display:"flex",justifyContent:"space-between",alignItems:"center"}),dU=Ni.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),fU=Ni(Hn)({padding:"6px 12px",fontSize:"12px"}),gU=Ni.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:Rl.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}})),mU=Ni.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),wm=()=>{let{fullPrompt:e}=se(),[t,n]=cU(!1),r=async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch(o){console.error("Failed to copy:",o)}};return e?Ko.createElement(uU,null,Ko.createElement(pU,null,Ko.createElement(dU,null,"Full Prompt"),Ko.createElement(fU,{onClick:r,disabled:t},t?"\u2713 Copied!":"\u{1F4CB} Copy")),Ko.createElement(gU,null,Ko.createElement(Sm,null,e))):Ko.createElement(mU,null,"No prompt available. Generate a prompt or run a review to see the full prompt here.")};import Gr,{useRef as hU}from"react";import{styled as hr}from"storybook/theming";ke();var xU=hr.div({display:"flex",flexDirection:"column",gap:"8px"}),pae=hr.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"}}),yU=hr.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})),bU=hr.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})),dae=hr.div(({theme:e})=>({fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:e.color.mediumdark,marginBottom:"6px",letterSpacing:"0.5px"})),zk=hr.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||ae,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||ae,backgroundColor:e.background.warning||"#ffedd5"}})),SU=hr.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),wU=hr.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"})),vU=hr.div({fontWeight:700,fontSize:"14px",marginBottom:"4px",display:"flex",alignItems:"center",gap:"6px"}),kU=hr.div(({theme:e})=>({fontSize:"12px",opacity:.9,color:e.color.positive||"#166534"})),fae=hr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",textAlign:"right"}));function CU(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 vm=()=>{let{streamingMessages:e,fullResponse:t,reviewHistory:n,currentReviewId:r}=se(),o=hU(null),i=r?n.find(p=>p.id===r):null,s=i?i.issues.length>0&&i.issues.every(p=>p.dismissed):!1,a=i&&(i.complianceScore===100||s),u=e.filter(p=>p.role==="assistant"||p.role==="system"&&p.content.includes("auto-dismissed")),c=u.length===0&&!!t;if(u.length===0&&!c)return Gr.createElement(SU,null,"No AI response yet. The AI's analysis will appear here as it streams.");let l=u.length>0?u:[{role:"assistant",content:t}];return Gr.createElement(xU,null,a&&Gr.createElement(wU,null,Gr.createElement(vU,null,"Component Matches Design"),Gr.createElement(kU,null,s&&i?.issues.length?`All ${i.issues.length} issue${i.issues.length===1?"":"s"} identified by the AI ${i.issues.length===1?"was":"were"} validated as false positive${i.issues.length===1?"":"s"} and auto-dismissed.`:"No design discrepancies found. The implementation matches the Figma design.")),Gr.createElement(yU,{ref:o},l.map((p,f)=>Gr.createElement(bU,{key:f,role:p.role},p.role==="system"?Gr.createElement(zk,null,p.content):Gr.createElement(zk,{dangerouslySetInnerHTML:{__html:CU(p.content)}})))))};import nr from"react";import{styled as vo}from"storybook/theming";ke();Me();var TU=vo.div({display:"flex",flexDirection:"column",gap:"12px"}),IU=vo.div(({theme:e})=>({display:"flex",gap:"6px",borderBottom:`2px solid ${e.appBorderColor}`,overflowX:"auto",paddingBottom:"2px"})),FU=vo.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}}}),Nk=vo.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"}}),EU=vo.div(({theme:e})=>({padding:"12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app,minHeight:"200px",maxHeight:"400px",overflowY:"auto",scrollBehavior:"smooth"})),Ok=vo.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||ae,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||ae,backgroundColor:e.background.warning||"#ffedd5"}})),_k=vo.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),AU=vo.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 $k(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 PU(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 Uk=()=>{let{multiModelResults:e,isReviewing:t,setActiveModelId:n,selectedModels:r}=se();nr.useEffect(()=>{e&&(b.debug("[ModelResultsTabs] multiModelResults:",e),Object.entries(e.byModel).forEach(([a,u])=>{b.debug(`[ModelResultsTabs] ${a}:`,{hasStreamingMessages:!!u.streamingMessages,streamingMessagesLength:u.streamingMessages?.length||0,streamingMessagesPreview:u.streamingMessages?.[0]?.content?.substring(0,100),hasFullResponse:!!u.fullResponse,fullResponsePreview:u.fullResponse?.substring(0,100)})}))},[e]);let o=e&&Object.keys(e.byModel).length>0?Object.keys(e.byModel):r,i=e?.activeModelId||(o.length>0?o[0]:""),s=e?.byModel||{};return o.length===0?nr.createElement(_k,null,"No models selected. Select multiple models to compare results."):nr.createElement(TU,null,nr.createElement(IU,null,o.map(a=>{let u=Hr.find(m=>m.id===a),c=s[a],p=PU(t&&c?.streamingMessages&&c.streamingMessages.length>0?c.streamingMessages[0].content||"":c?.fullResponse?c.fullResponse:""),f=a===i;if(!u)return null;let d=t&&!c?.completed;return nr.createElement(FU,{key:a,isActive:f,provider:u.provider,onClick:()=>n(a)},u.name,c&&p.issueCount>0&&nr.createElement(Nk,{variant:"issues",value:p.issueCount},p.issueCount," issues"),c&&p.score!==null&&nr.createElement(Nk,{variant:"score",value:p.score},"Score: ",p.score),d&&nr.createElement(AU,null))})),nr.createElement(EU,null,s[i]?.streamingMessages&&s[i].streamingMessages.length>0?s[i].streamingMessages.map((a,u)=>nr.createElement(Ok,{key:u,dangerouslySetInnerHTML:{__html:$k(a.content)}})):s[i]?.fullResponse?nr.createElement(Ok,{dangerouslySetInnerHTML:{__html:$k(s[i].fullResponse)}}):nr.createElement(_k,null,t?`Waiting for ${Hr.find(a=>a.id===i)?.name}...`:`No response yet for ${Hr.find(a=>a.id===i)?.name}`)))};import _e from"react";import{styled as wt}from"storybook/theming";ke();import V,{useMemo as f3,useState as g3,useEffect as m3}from"react";import{styled as Je,keyframes as h3}from"storybook/theming";import j,{useState as Cm,useRef as d4,useCallback as Zk,memo as f4}from"react";import{styled as me}from"storybook/theming";import qr,{useState as LU}from"react";import{styled as Yr}from"storybook/theming";var MU=Yr.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}),BU=Yr.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}`})),DU=Yr.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,marginTop:0,marginBottom:"12px"})),RU=Yr.p(({theme:e})=>({fontSize:"13px",color:e.textMutedColor,marginBottom:"16px",lineHeight:"1.5"})),zU=Yr.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px"})),NU=Yr.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:ae,boxShadow:`0 0 0 3px ${e.base==="dark"?"rgba(124, 58, 237, 0.2)":"rgba(124, 58, 237, 0.1)"}`},"&::placeholder":{color:e.textMutedColor}})),OU=Yr.div({display:"flex",justifyContent:"flex-end",gap:"10px"}),_U=Yr(_t)({}),$U=Yr(Wn)({}),jk=({isOpen:e,issueTitle:t,onConfirm:n,onCancel:r})=>{let[o,i]=LU("");if(!e)return null;let s=()=>{n(o.trim()||void 0),i("")},a=()=>{i(""),r()};return qr.createElement(MU,{onClick:c=>{c.target===c.currentTarget&&a()}},qr.createElement(BU,null,qr.createElement(DU,null,"Dismiss as False Positive"),qr.createElement(RU,null,'Mark "',t,'" as a false positive. You can optionally provide a reason for dismissing this issue.'),qr.createElement(zU,{htmlFor:"dismiss-reason"},"Reason (optional)"),qr.createElement(NU,{id:"dismiss-reason",value:o,onChange:c=>i(c.target.value),placeholder:"e.g., This is intentional design, not an issue..."}),qr.createElement(OU,null,qr.createElement($U,{onClick:a},"Cancel"),qr.createElement(_U,{onClick:s},"Dismiss Issue"))))};ke();import Te from"react";import{styled as Ke}from"storybook/theming";var Pe={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"},UU=Ke.div(({theme:e})=>({marginTop:6,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,overflow:"hidden",maxWidth:340})),jU=Ke.div(({theme:e})=>({padding:"6px 10px",fontSize:11,fontWeight:500,color:e.color.defaultText,borderBottom:`1px solid ${e.appBorderColor}`})),HU=Ke.div({position:"relative",backgroundColor:Pe.outerBg,padding:"8px 12px 24px",fontFamily:"monospace",fontSize:11}),Aae=Ke.div({display:"flex",justifyContent:"space-between",alignItems:"center",color:Pe.dash,padding:"0 8px",height:18,fontSize:11}),Pae=Ke.div({position:"absolute",color:Pe.dash,fontSize:11,top:"50%",transform:"translateY(-50%)"},e=>({...e.side==="left"&&{left:8},...e.side==="right"&&{right:8}})),Lae=Ke.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%)"}})),Mae=Ke.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}})),WU=Ke.div(e=>({position:"relative",backgroundColor:e.isErr?Pe.errBg:Pe.borderBoxBg,border:`1px solid ${e.isErr?Pe.err:Pe.borderBoxStroke}`,borderRadius:6,padding:0})),VU=Ke.div({display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 10px",fontSize:11,color:Pe.text}),GU=Ke.span({fontWeight:500,fontSize:11}),Bae=Ke.span({color:Pe.dash}),qU=Ke.div(e=>({position:"relative",backgroundColor:e.isErr?Pe.errBg:Pe.paddingBg,border:`1px solid ${e.isErr?Pe.err:Pe.paddingStroke}`,margin:"0 8px 8px",padding:"18px 28px"})),YU=Ke.span({position:"absolute",top:3,left:8,fontSize:10,fontWeight:500,color:Pe.text,fontStyle:"italic"}),fc=Ke.span(e=>({position:"absolute",fontSize:11,fontFamily:"monospace",color:e.isErr?Pe.err:Pe.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%)"}})),KU=Ke.div(e=>({backgroundColor:e.isErr?Pe.errBg:"#fff",border:`1.5px dashed ${e.isErr?Pe.err:Pe.contentStroke}`,display:"flex",alignItems:"center",justifyContent:"center",padding:"10px 20px",fontSize:11,fontFamily:"monospace",color:e.isErr?Pe.err:Pe.text,fontWeight:e.isErr?600:400})),XU=Ke.span({position:"absolute",bottom:4,right:8,fontSize:9,color:Pe.dim,fontFamily:"monospace"}),QU=Ke.div({display:"flex",alignItems:"center",gap:4,fontSize:10,fontWeight:600,color:Pe.ok,padding:"4px 8px 6px"}),Dae=Ke.div({fontSize:11,fontWeight:600,color:Pe.text,padding:"4px 12px 2px",display:"flex",alignItems:"center",gap:6}),Rae=Ke.span({fontSize:12,color:Pe.dim}),JU=Ke.img({maxWidth:"100%",maxHeight:40,objectFit:"contain",borderRadius:2}),ZU=Ke.div({fontSize:9,color:Pe.dim,marginTop:2}),e4=({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}=se(),p=r||{},d=!(!!r&&Object.keys(r).length>0)&&s?l4(n):null,m=p.padding||d||{top:0,right:0,bottom:0,left:0},S=p.strokeWeight??(a?Oi(n)??0:0),T=p.width??(u?c4(n)??"\u2014":"\u2014"),F=p.height??(u?u4(n)??"\u2014":"\u2014");return Te.createElement(Te.Fragment,null,Te.createElement(HU,null,Te.createElement(WU,{isErr:a},Te.createElement(VU,null,Te.createElement(GU,null,"Border"),Te.createElement("span",{style:{fontSize:11,fontFamily:"monospace",color:a?Pe.err:Pe.dim}},S)),Te.createElement(qU,{isErr:s},Te.createElement(YU,null,"Padding"),Te.createElement(fc,{side:"top",isErr:s},m.top),Te.createElement(fc,{side:"right",isErr:s},m.right),Te.createElement(fc,{side:"bottom",isErr:s},m.bottom),Te.createElement(fc,{side:"left",isErr:s},m.left),Te.createElement(KU,{isErr:u,style:{flexDirection:"column",gap:4}},l&&Te.createElement(JU,{src:l,alt:"Figma element"}),Te.createElement(ZU,null,T," \xD7 ",F)))),Te.createElement(XU,null,"border-box")),Te.createElement(QU,null,"\u2192 ",n))},Hk=Ke.div({backgroundColor:Pe.outerBg,padding:"24px 16px 16px",display:"flex",flexDirection:"column",alignItems:"center",gap:8}),t4=Ke.div({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"12px 20px"}),km=Ke.span(e=>({fontSize:e.fSize||"42px",fontWeight:e.fWeight||"600",color:Pe.text,lineHeight:1,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif',position:"relative",zIndex:1})),n4=Ke.div({position:"absolute",border:`1.5px dashed ${Pe.err}`,pointerEvents:"none",zIndex:0}),r4=Ke.div({position:"absolute",border:`1.5px dashed ${Pe.blue}`,pointerEvents:"none",zIndex:0}),Wk=Ke.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%)"}})),zae=Ke.div({fontSize:12,color:Pe.text,fontWeight:500,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif'}),o4=Ke.div({display:"flex",alignItems:"center",gap:6,fontSize:10,fontFamily:"monospace"}),Vk=Ke.span(e=>({padding:"1px 6px",borderRadius:3,fontWeight:600,fontSize:10,color:"#fff",backgroundColor:e.variant==="err"?Pe.err:Pe.ok})),i4=Ke.div({display:"flex",alignItems:"flex-end",justifyContent:"center",gap:16,padding:"4px 0"}),Gk=Ke.div({display:"flex",flexDirection:"column",alignItems:"center",gap:4}),qk=Ke.div(e=>({fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.3px",color:e.variant==="err"?Pe.err:Pe.ok})),Yk=Ke.div(e=>({fontSize:10,fontFamily:"monospace",fontWeight:600,color:e.variant==="err"?Pe.err:Pe.ok,textDecoration:e.variant==="err"?"line-through":"none"})),s4=Ke.span({fontSize:16,color:Pe.dim,paddingBottom:20}),Kk=Ke.div(e=>({fontSize:9,color:e.color,fontFamily:"monospace",textAlign:"center",marginTop:2}));function Xk(e){return e>=800?"ExtraBold":e>=700?"Bold":e>=600?"Semibold":e>=500?"Medium":e>=400?"Regular":e>=300?"Light":"Thin"}var a4=({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"),p=s||u,f=o.fontSize??(s?Oi(n):14),d=o.fontWeight??(a?Oi(n):600),S=(o.lineHeight??(u?Oi(n):null))||Math.round((f||14)*1.43),T=`${Math.min(Math.max(f||14,24),48)}px`;if(p)return Te.createElement(Te.Fragment,null,Te.createElement(Hk,null,Te.createElement(t4,null,Te.createElement(r4,{style:{top:-6,left:0,right:0,bottom:-6}}),Te.createElement(n4,{style:{top:2,left:8,right:8,bottom:2}}),Te.createElement(Wk,{color:s?Pe.err:"#7b3030",side:"left"},s?t:`${f}px`),Te.createElement(Wk,{color:u?Pe.err:"#7b3030",side:"right"},u?t:`${S}px`),Te.createElement(km,{fSize:T,fWeight:String(d||600)},"Ag")),Te.createElement("div",{style:{display:"flex",gap:16,justifyContent:"center"}},Te.createElement(Kk,{color:Pe.err},"\u2508\u2508 font-size",s?" \u2717":""),Te.createElement(Kk,{color:Pe.blue},"\u2508\u2508 line-height",u?" \u2717":"")),Te.createElement(o4,null,Te.createElement(Vk,{variant:"err"},t),Te.createElement("span",{style:{color:Pe.dim}},"\u2192"),Te.createElement(Vk,{variant:"ok"},n))));let F=a?t:String(d||600),k=a?n:F,z=Oi(t),R=Oi(n);return Te.createElement(Te.Fragment,null,Te.createElement(Hk,null,Te.createElement(i4,null,Te.createElement(Gk,null,Te.createElement(qk,{variant:"err"},"Current"),Te.createElement(km,{fSize:T,fWeight:a?F:String(d||600),style:{color:Pe.err}},c?t:"Ag"),Te.createElement(Yk,{variant:"err"},a&&z?`${t} (${Xk(z)})`:t)),Te.createElement(s4,null,"\u2192"),Te.createElement(Gk,null,Te.createElement(qk,{variant:"ok"},"Figma"),Te.createElement(km,{fSize:T,fWeight:a?k:String(d||600),style:{color:Pe.ok}},c?n:"Ag"),Te.createElement(Yk,{variant:"ok"},a&&R?`${n} (${Xk(R)})`:n)))))};function l4(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 Oi(e){let t=e.match(/(\d+(?:\.\d+)?)\s*(?:px)?/);return t?parseFloat(t[1]):null}function c4(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):null}function u4(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[2]):null}var Qk=new Set(["fontSize","font-size","fontWeight","font-weight","lineHeight","line-height","letterSpacing","letter-spacing","fontFamily","font-family","textContent","text-content"]);function p4(e){if(Qk.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return Qk.has(t)}var Jk=e=>{let t=!!e.figmaContext&&Object.keys(e.figmaContext).length>0,n=p4(e.property);return Te.createElement(UU,null,Te.createElement(jU,null,"\u25BE Layer properties",t?"":" (from review)"),n?Te.createElement(a4,{...e}):Te.createElement(e4,{...e}))};ke();var eC=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 g4(e){if(eC.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return eC.has(t)}var m4=me.div(({theme:e,dismissed:t,fixApplied:n})=>({padding:"12px",borderRadius:"8px",border:t?`1px solid ${e.color.negative}`:n?`1px solid ${e.color.positive}`:`1px solid ${e.appBorderColor}`,backgroundColor:t?e.background.negative:n?e.background.positive:e.background.content,opacity:t?.7:n?.6:1,position:"relative"})),h4=me.div({display:"flex",alignItems:"flex-start",gap:"8px"}),x4=me.input(({theme:e})=>({marginTop:"1px",width:"14px",height:"14px",cursor:"pointer",accentColor:ae,flexShrink:0})),y4=me.span(({theme:e,severity:t})=>({flexShrink:0,marginTop:"1px",display:"flex",alignItems:"center",color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.textMutedColor,"& svg":{width:"14px",height:"14px"}})),b4=me.div({flex:1,minWidth:0,paddingRight:"60px"}),S4=me.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,marginBottom:"4px",lineHeight:"1.4"})),w4=me.div({display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap"}),v4=me.div(({theme:e,severity:t})=>{let r=(()=>{switch(t){case"critical":return{bg:e.background.negative,text:e.color.negative,border:e.color.negative};case"major":return{bg:e.background.warning,text:e.color.warning,border:e.color.warning};case"minor":return{bg:e.color.tertiary,text:ae,border:ae};default:return{bg:e.background.app,text:e.textMutedColor,border:e.appBorderColor}}})();return{fontSize:"10px",fontWeight:700,color:r.text,backgroundColor:r.bg,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${r.border}`,textTransform:"uppercase",letterSpacing:"0.5px"}}),k4=me.div(({theme:e,status:t})=>{let r=(()=>{switch(t){case"pending":return{bg:e.background.app,text:e.textMutedColor,icon:"\u23F3"};case"applied":return{bg:e.color.tertiary,text:ae,icon:"\u{1F527}"};case"verified":return{bg:e.background.positive,text:e.color.positive,icon:"\u2705"};case"failed":return{bg:e.background.negative,text:e.color.negative,icon:"\u274C"};default:return{bg:e.background.app,text:e.textMutedColor,icon:"\u2753"}}})();return{fontSize:"10px",fontWeight:600,color:r.text,backgroundColor:r.bg,padding:"2px 8px",borderRadius:"10px",display:"flex",alignItems:"center",gap:"4px","&::before":{content:`"${r.icon}"`,fontSize:"10px"}}}),C4=me.div(({theme:e})=>({fontSize:"10px",fontWeight:600,color:ae,backgroundColor:e.color.tertiary,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${ae}`})),T4=me.div(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.color.positive,backgroundColor:e.background.positive,padding:"2px 8px",borderRadius:"10px",border:`1px solid ${e.color.positive}`,display:"flex",alignItems:"center",gap:"3px","&::before":{content:'"\u{1F916}"',fontSize:"9px"}})),I4=me.div(({theme:e})=>({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"}})),F4=me.div(({theme:e})=>({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"}})),E4=me.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginLeft:"12px",paddingLeft:"12px",borderLeft:`1px solid ${e.appBorderColor}`})),A4=me.div(({theme:e})=>({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"}})),Wae=me.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,lineHeight:"1.5",marginBottom:"10px"})),P4=me.div(({theme:e})=>({display:"flex",flexDirection:"column",gap:"2px",fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"8px",marginLeft:"36px",padding:"8px 10px",backgroundColor:e.background.app,borderRadius:"4px"})),Tm=me.div({display:"flex",gap:"8px",alignItems:"baseline"}),Im=me.span(({theme:e})=>({color:e.textMutedColor,fontWeight:500,width:"60px",flexShrink:0,fontSize:"11px"})),Em=me.span(({theme:e})=>({color:e.color.defaultText,fontFamily:"inherit",fontSize:"11px",fontWeight:500})),L4=me(Em)(({theme:e})=>({color:e.color.negative,textDecoration:"line-through",opacity:.7})),M4=me(Em)(({theme:e})=>({color:e.color.positive,fontWeight:600})),tC=me.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"})),B4=me.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"4px"})),D4=me.span(({theme:e,color:t})=>({display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundColor:t,border:`1px solid ${e.appBorderColor}`,marginRight:"6px",verticalAlign:"middle",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.1)"})),R4=me.span({display:"flex",alignItems:"center"}),z4=me.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginTop:"6px",marginLeft:"36px",fontStyle:"italic",display:"flex",alignItems:"baseline",gap:"4px","& strong":{fontStyle:"normal",fontWeight:600,color:"#7c3aed",fontSize:"10px"}})),N4=me.div(({theme:e})=>({marginTop:"8px",padding:"10px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${ae}`})),O4=me.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:ae,marginBottom:"8px",display:"flex",alignItems:"center",gap:"6px"})),_4=me.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"}})),$4=me.span(({theme:e})=>({fontFamily:"monospace",fontWeight:600,color:e.color.defaultText})),nC=me.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"})),U4=me.div({position:"absolute",top:"10px",right:"10px",display:"flex",alignItems:"center",gap:"2px"}),Fm=me(fn)({width:"24px",height:"24px",padding:0,fontSize:"12px"}),j4=me(Fm)(({theme:e})=>({"&:hover":{backgroundColor:e.background.negative,color:e.color.negative}})),H4=me.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}`})),W4=me.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}`})),rC=me.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"})),V4=me.div(({theme:e,compact:t})=>({marginTop:"12px",padding:t?"8px 12px":"12px",backgroundColor:e.background.positive,borderRadius:"6px",border:`1px solid ${e.color.positive}`})),G4=me.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}),q4=me.div(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,display:"flex",alignItems:"center",gap:"6px","&::before":{content:'"\u{1F916}"',fontSize:"14px"}})),Y4=me.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})),oC=me.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginBottom:"8px"})),iC=me.details({marginBottom:"8px"}),sC=me.summary(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,cursor:"pointer",userSelect:"none",marginBottom:"8px","&:hover":{opacity:.8}})),K4=me.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"})),X4=me.div({display:"flex",gap:"8px",marginTop:"8px"}),Q4=me(Hn)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),J4=me(Wn)({padding:"6px 12px",fontSize:"12px"}),Vae=me(_t)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"90px",...t?{backgroundColor:e.color.positive}:{}})),Gae=me.div({display:"flex",flexDirection:"column",gap:"10px",padding:"8px 0"}),Z4=me.div({display:"flex",alignItems:"center",gap:"12px"}),e3=me.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:ae,borderRadius:"50%",animation:"spin 0.8s linear infinite","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),t3=me.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"})),qae=me.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}}})),n3=me.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"})),aC=me.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"})),lC=me.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}`})),cC=me.div({display:"flex",flexDirection:"column",overflowX:"auto",maxHeight:"300px",overflowY:"auto"}),uC=me.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)"}}),pC=me.div(({theme:e,status:t})=>({fontSize:"12px",color:e.color.positive,fontStyle:t==="applying"?"italic":"normal",fontWeight:t==="applied"?600:400})),dC=e=>{let t=e.split(`
|
|
91
|
-
|
|
92
|
+
`}),n}function xT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Lc(e,t){let n=yT(e,t),r=n.one(e,void 0),o=mT(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 Mc(e,t){return e&&"run"in e?async function(n,r){let o=Lc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Lc(n,{file:r,...e||t})}}function Vh(e){if(e)throw e}var Rc=Aa(FT(),1);function ma(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 Gh(){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?ET(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 ET(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 kr={basename:v5,dirname:k5,extname:C5,join:T5,sep:"/"};function v5(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ha(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 k5(e){if(ha(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 C5(e){ha(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 T5(...e){let t=-1,n;for(;++t<e.length;)ha(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":I5(n)}function I5(e){ha(e);let t=e.codePointAt(0)===47,n=F5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function F5(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 ha(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var AT={cwd:E5};function E5(){return"/"}function Hi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PT(e){if(typeof e=="string")e=new URL(e);else if(!Hi(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 A5(e)}function A5(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 qh=["history","path","basename","stem","extname","dirname"],ti=class{constructor(t){let n;t?Hi(t)?n={path:t}:typeof t=="string"||P5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":AT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qh.length;){let i=qh[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)qh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?kr.basename(this.path):void 0}set basename(t){Kh(t,"basename"),Yh(t,"basename"),this.path=kr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?kr.dirname(this.path):void 0}set dirname(t){LT(this.basename,"dirname"),this.path=kr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?kr.extname(this.path):void 0}set extname(t){if(Yh(t,"extname"),LT(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=kr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Hi(t)&&(t=PT(t)),Kh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?kr.basename(this.path,this.extname):void 0}set stem(t){Kh(t,"stem"),Yh(t,"stem"),this.path=kr.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 Ht(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 Yh(e,t){if(e&&e.includes(kr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+kr.sep+"`")}function Kh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function LT(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function P5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var MT=(function(e){let r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i});var L5={}.hasOwnProperty,Zh=class e extends MT{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=Gh()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let r=this.attachers[n];t.use(...r)}return t.data((0,Rc.default)(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Jh("data",this.frozen),this.namespace[t]=n,this):L5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Jh("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=Dc(t),r=this.parser||this.Parser;return Xh("parse",r),r(String(n),n)}process(t,n){let r=this;return this.freeze(),Xh("process",this.parser||this.Parser),Qh("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){let a=Dc(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);B5(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(),Xh("processSync",this.parser||this.Parser),Qh("processSync",this.compiler||this.Compiler),this.process(t,o),DT("processSync","process",n),r;function o(i,s){n=!0,Vh(i),r=s}}run(t,n,r){BT(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=Dc(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),DT("runSync","run",r),o;function i(s,a){Vh(s),o=a,r=!0}}stringify(t,n){this.freeze();let r=Dc(n),o=this.compiler||this.Compiler;return Qh("stringify",o),BT(t),o(t,r)}use(t,...n){let r=this.attachers,o=this.namespace;if(Jh("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,Rc.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,S=r[f][1];ma(S)&&ma(p)&&(p=(0,Rc.default)(!0,S,p)),r[f]=[c,p,...g]}}}},ex=new Zh().freeze();function Xh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Jh(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 BT(e){if(!ma(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function DT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dc(e){return M5(e)?e:new ti(e)}function M5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function B5(e){return typeof e=="string"||D5(e)}function D5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var O5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",RT=[],zT={allowDangerousHtml:!0},_5=/^(https?|ircs?|mailto|xmpp)$/i,$5=[{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 tx(e){let t=U5(e),n=j5(e);return H5(t.runSync(t.parse(n),n),e)}function U5(e){let t=e.rehypePlugins||RT,n=e.remarkPlugins||RT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zT}:zT;return ex().use(kc).use(n).use(Mc,r).use(t)}function j5(e){let t=e.children||"",n=new ti;return typeof t=="string"?n.value=t:(""+t,void 0),n}function H5(e,t){let n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,u=t.urlTransform||NT;for(let l of $5)Object.hasOwn(t,l.from)&&(""+l.from+(l.to?"use `"+l.to+"` instead":"remove it")+O5+l.id,void 0);return n&&i&&void 0,ga(e,c),hh(e,{Fragment:R5,components:o,ignoreInvalidStyle:!0,jsx:z5,jsxs:N5,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 sa)if(Object.hasOwn(sa,p)&&Object.hasOwn(l.properties,p)){let g=l.properties[p],S=sa[p];(S===null||S.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 NT(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||_5.test(e.slice(0,t))?e:""}ve();var V5=Wi.div({display:"flex",flexDirection:"column",gap:"12px"}),G5=Wi.div({display:"flex",justifyContent:"space-between",alignItems:"center"}),q5=Wi.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),Y5=Wi(er)({padding:"6px 12px",fontSize:"12px"}),K5=Wi.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:RC.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}})),X5=Wi.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),nx=()=>{let{fullPrompt:e,userRole:t,roleOverride:n}=ie(),[r,o]=W5(!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?ni.createElement(V5,null,ni.createElement(G5,null,ni.createElement(q5,null,"Full Prompt"),ni.createElement(Y5,{onClick:s,disabled:r},r?"\u2713 Copied!":"\u{1F4CB} Copy")),ni.createElement(K5,null,ni.createElement(tx,null,e))):ni.createElement(X5,null,"No prompt available. Generate a prompt or run a review to see the full prompt here.")};import eo,{useRef as Q5}from"react";import{styled as Cr}from"storybook/theming";ve();var J5=Cr.div({display:"flex",flexDirection:"column",gap:"8px"}),Fpe=Cr.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"}}),Z5=Cr.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})),e6=Cr.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})),Epe=Cr.div(({theme:e})=>({fontSize:"11px",fontWeight:600,textTransform:"uppercase",color:e.color.mediumdark,marginBottom:"6px",letterSpacing:"0.5px"})),OT=Cr.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||le,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||le,backgroundColor:e.background.warning||"#ffedd5"}})),t6=Cr.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),n6=Cr.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"})),r6=Cr.div({fontWeight:700,fontSize:"14px",marginBottom:"4px",display:"flex",alignItems:"center",gap:"6px"}),o6=Cr.div(({theme:e})=>({fontSize:"12px",opacity:.9,color:e.color.positive||"#166534"})),Ape=Cr.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,marginTop:"8px",textAlign:"right"}));function i6(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 rx=()=>{let{streamingMessages:e,fullResponse:t,reviewHistory:n,currentReviewId:r,userRole:o,roleOverride:i}=ie(),s=Q5(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 eo.createElement(t6,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 eo.createElement(J5,null,l&&eo.createElement(n6,null,eo.createElement(r6,null,"Component Matches Design"),eo.createElement(o6,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.")),eo.createElement(Z5,{ref:s},p.map((g,S)=>eo.createElement(e6,{key:S,role:g.role},g.role==="system"?eo.createElement(OT,null,g.content):eo.createElement(OT,{dangerouslySetInnerHTML:{__html:i6(g.content)}})))))};import dr from"react";import{styled as Po}from"storybook/theming";ve();De();var s6=Po.div({display:"flex",flexDirection:"column",gap:"12px"}),a6=Po.div(({theme:e})=>({display:"flex",gap:"6px",borderBottom:`2px solid ${e.appBorderColor}`,overflowX:"auto",paddingBottom:"2px"})),l6=Po.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}}}),_T=Po.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"}}),c6=Po.div(({theme:e})=>({padding:"12px",border:`1px solid ${e.appBorderColor}`,borderRadius:"6px",backgroundColor:e.background.app,minHeight:"200px",maxHeight:"400px",overflowY:"auto",scrollBehavior:"smooth"})),$T=Po.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||le,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||le,backgroundColor:e.background.warning||"#ffedd5"}})),UT=Po.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),u6=Po.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 jT(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 p6(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 HT=()=>{let{multiModelResults:e,isReviewing:t,setActiveModelId:n,selectedModels:r,userRole:o,roleOverride:i}=ie();if((i??o)!=="admin")return null;dr.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?dr.createElement(UT,null,"No models selected. Select multiple models to compare results."):dr.createElement(s6,null,dr.createElement(a6,null,a.map(l=>{let d=Qr.find(F=>F.id===l),f=c[l],g=p6(t&&f?.streamingMessages&&f.streamingMessages.length>0?f.streamingMessages[0].content||"":f?.fullResponse?f.fullResponse:""),S=l===u;if(!d)return null;let C=t&&!f?.completed;return dr.createElement(l6,{key:l,isActive:S,provider:d.provider,onClick:()=>n(l)},d.name,f&&g.issueCount>0&&dr.createElement(_T,{variant:"issues",value:g.issueCount},g.issueCount," issues"),f&&g.score!==null&&dr.createElement(_T,{variant:"score",value:g.score},"Score: ",g.score),C&&dr.createElement(u6,null))})),dr.createElement(c6,null,c[u]?.streamingMessages&&c[u].streamingMessages.length>0?c[u].streamingMessages.map((l,d)=>dr.createElement($T,{key:d,dangerouslySetInnerHTML:{__html:jT(l.content)}})):c[u]?.fullResponse?dr.createElement($T,{dangerouslySetInnerHTML:{__html:jT(c[u].fullResponse)}}):dr.createElement(UT,null,t?`Waiting for ${Qr.find(l=>l.id===u)?.name}...`:`No response yet for ${Qr.find(l=>l.id===u)?.name}`)))};import Ue from"react";import{styled as Ct}from"storybook/theming";ve();Ls();ve();import{useCallback as ox}from"react";De();function WT(){let{dismissIssue:e,undismissIssue:t,reviewHistory:n}=ie(),{sessionToken:r}=we(),o=ox(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=ox((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}zl(c,!0,u,"user",r).then(l=>{l.success||y.warn("[useIssuePersistence] Dismiss server sync failed:",l.error)})},[e,o,r]),s=ox(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}zl(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 V,{useMemo as wH,useState as vH,useEffect as kH}from"react";import{styled as it,keyframes as CH}from"storybook/theming";import J,{useState as cx,useRef as dj,useCallback as iI,memo as fj}from"react";import{styled as Ee}from"storybook/theming";import to,{useState as d6}from"react";import{styled as no}from"storybook/theming";var f6=no.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}),g6=no.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}`})),m6=no.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.defaultText,marginTop:0,marginBottom:"12px"})),h6=no.p(({theme:e})=>({fontSize:"13px",color:e.textMutedColor,marginBottom:"16px",lineHeight:"1.5"})),x6=no.label(({theme:e})=>({display:"block",fontSize:"12px",fontWeight:600,color:e.color.defaultText,marginBottom:"6px"})),y6=no.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:le,boxShadow:`0 0 0 3px ${e.base==="dark"?"rgba(124, 58, 237, 0.2)":"rgba(124, 58, 237, 0.1)"}`},"&::placeholder":{color:e.textMutedColor}})),b6=no.div({display:"flex",justifyContent:"flex-end",gap:"10px"}),S6=no(qt)({}),w6=no(Er)({}),VT=({isOpen:e,issueTitle:t,onConfirm:n,onCancel:r})=>{let[o,i]=d6("");if(!e)return null;let s=()=>{n(o.trim()||void 0),i("")},a=()=>{i(""),r()};return to.createElement(f6,{onClick:c=>{c.target===c.currentTarget&&a()}},to.createElement(g6,null,to.createElement(m6,null,"Dismiss as False Positive"),to.createElement(h6,null,'Mark "',t,'" as a false positive. You can optionally provide a reason for dismissing this issue.'),to.createElement(x6,{htmlFor:"dismiss-reason"},"Reason (optional)"),to.createElement(y6,{id:"dismiss-reason",value:o,onChange:c=>i(c.target.value),placeholder:"e.g., This is intentional design, not an issue..."}),to.createElement(b6,null,to.createElement(w6,{onClick:a},"Cancel"),to.createElement(S6,{onClick:s},"Dismiss Issue"))))};ve();import Fe from"react";import{styled as ot}from"storybook/theming";var Be={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"},v6=ot.div(({theme:e})=>({marginTop:6,borderRadius:e.appBorderRadius,border:`1px solid ${e.appBorderColor}`,backgroundColor:e.background.content,overflow:"hidden",maxWidth:340})),k6=ot.div(({theme:e})=>({padding:"6px 10px",fontSize:11,fontWeight:500,color:e.color.defaultText,borderBottom:`1px solid ${e.appBorderColor}`})),C6=ot.div({position:"relative",backgroundColor:Be.outerBg,padding:"8px 12px 24px",fontFamily:"monospace",fontSize:11}),Xpe=ot.div({display:"flex",justifyContent:"space-between",alignItems:"center",color:Be.dash,padding:"0 8px",height:18,fontSize:11}),Qpe=ot.div({position:"absolute",color:Be.dash,fontSize:11,top:"50%",transform:"translateY(-50%)"},e=>({...e.side==="left"&&{left:8},...e.side==="right"&&{right:8}})),Jpe=ot.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%)"}})),Zpe=ot.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}})),T6=ot.div(e=>({position:"relative",backgroundColor:e.isErr?Be.errBg:Be.borderBoxBg,border:`1px solid ${e.isErr?Be.err:Be.borderBoxStroke}`,borderRadius:6,padding:0})),I6=ot.div({display:"flex",justifyContent:"space-between",alignItems:"center",padding:"4px 10px",fontSize:11,color:Be.text}),F6=ot.span({fontWeight:500,fontSize:11}),ede=ot.span({color:Be.dash}),E6=ot.div(e=>({position:"relative",backgroundColor:e.isErr?Be.errBg:Be.paddingBg,border:`1px solid ${e.isErr?Be.err:Be.paddingStroke}`,margin:"0 8px 8px",padding:"18px 28px"})),A6=ot.span({position:"absolute",top:3,left:8,fontSize:10,fontWeight:500,color:Be.text,fontStyle:"italic"}),zc=ot.span(e=>({position:"absolute",fontSize:11,fontFamily:"monospace",color:e.isErr?Be.err:Be.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%)"}})),P6=ot.div(e=>({backgroundColor:e.isErr?Be.errBg:"#fff",border:`1.5px dashed ${e.isErr?Be.err:Be.contentStroke}`,display:"flex",alignItems:"center",justifyContent:"center",padding:"10px 20px",fontSize:11,fontFamily:"monospace",color:e.isErr?Be.err:Be.text,fontWeight:e.isErr?600:400})),L6=ot.span({position:"absolute",bottom:4,right:8,fontSize:9,color:Be.dim,fontFamily:"monospace"}),M6=ot.div({display:"flex",alignItems:"center",gap:4,fontSize:10,fontWeight:600,color:Be.ok,padding:"4px 8px 6px"}),tde=ot.div({fontSize:11,fontWeight:600,color:Be.text,padding:"4px 12px 2px",display:"flex",alignItems:"center",gap:6}),nde=ot.span({fontSize:12,color:Be.dim}),B6=ot.img({maxWidth:"100%",maxHeight:40,objectFit:"contain",borderRadius:2}),D6=ot.div({fontSize:9,color:Be.dim,marginTop:2}),R6=({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}=ie(),d=r||{},p=!(!!r&&Object.keys(r).length>0)&&s?H6(n):null,g=d.padding||p||{top:0,right:0,bottom:0,left:0},S=d.strokeWeight??(a?Vi(n)??0:0),C=d.width??(u?W6(n)??"\u2014":"\u2014"),F=d.height??(u?V6(n)??"\u2014":"\u2014");return Fe.createElement(Fe.Fragment,null,Fe.createElement(C6,null,Fe.createElement(T6,{isErr:a},Fe.createElement(I6,null,Fe.createElement(F6,null,"Border"),Fe.createElement("span",{style:{fontSize:11,fontFamily:"monospace",color:a?Be.err:Be.dim}},S)),Fe.createElement(E6,{isErr:s},Fe.createElement(A6,null,"Padding"),Fe.createElement(zc,{side:"top",isErr:s},g.top),Fe.createElement(zc,{side:"right",isErr:s},g.right),Fe.createElement(zc,{side:"bottom",isErr:s},g.bottom),Fe.createElement(zc,{side:"left",isErr:s},g.left),Fe.createElement(P6,{isErr:u,style:{flexDirection:"column",gap:4}},l&&Fe.createElement(B6,{src:l,alt:"Figma element"}),Fe.createElement(D6,null,C," \xD7 ",F)))),Fe.createElement(L6,null,"border-box")),Fe.createElement(M6,null,"\u2192 ",n))},GT=ot.div({backgroundColor:Be.outerBg,padding:"24px 16px 16px",display:"flex",flexDirection:"column",alignItems:"center",gap:8}),z6=ot.div({position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"12px 20px"}),ix=ot.span(e=>({fontSize:e.fSize||"42px",fontWeight:e.fWeight||"600",color:Be.text,lineHeight:1,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif',position:"relative",zIndex:1})),N6=ot.div({position:"absolute",border:`1.5px dashed ${Be.err}`,pointerEvents:"none",zIndex:0}),O6=ot.div({position:"absolute",border:`1.5px dashed ${Be.blue}`,pointerEvents:"none",zIndex:0}),qT=ot.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%)"}})),rde=ot.div({fontSize:12,color:Be.text,fontWeight:500,fontFamily:'-apple-system, BlinkMacSystemFont, "Inter", sans-serif'}),_6=ot.div({display:"flex",alignItems:"center",gap:6,fontSize:10,fontFamily:"monospace"}),YT=ot.span(e=>({padding:"1px 6px",borderRadius:3,fontWeight:600,fontSize:10,color:"#fff",backgroundColor:e.variant==="err"?Be.err:Be.ok})),$6=ot.div({display:"flex",alignItems:"flex-end",justifyContent:"center",gap:16,padding:"4px 0"}),KT=ot.div({display:"flex",flexDirection:"column",alignItems:"center",gap:4}),XT=ot.div(e=>({fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.3px",color:e.variant==="err"?Be.err:Be.ok})),QT=ot.div(e=>({fontSize:10,fontFamily:"monospace",fontWeight:600,color:e.variant==="err"?Be.err:Be.ok,textDecoration:e.variant==="err"?"line-through":"none"})),U6=ot.span({fontSize:16,color:Be.dim,paddingBottom:20}),JT=ot.div(e=>({fontSize:9,color:e.color,fontFamily:"monospace",textAlign:"center",marginTop:2}));function ZT(e){return e>=800?"ExtraBold":e>=700?"Bold":e>=600?"Semibold":e>=500?"Medium":e>=400?"Regular":e>=300?"Light":"Thin"}var j6=({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?Vi(n):14),p=o.fontWeight??(a?Vi(n):600),S=(o.lineHeight??(u?Vi(n):null))||Math.round((f||14)*1.43),C=`${Math.min(Math.max(f||14,24),48)}px`;if(d)return Fe.createElement(Fe.Fragment,null,Fe.createElement(GT,null,Fe.createElement(z6,null,Fe.createElement(O6,{style:{top:-6,left:0,right:0,bottom:-6}}),Fe.createElement(N6,{style:{top:2,left:8,right:8,bottom:2}}),Fe.createElement(qT,{color:s?Be.err:"#7b3030",side:"left"},s?t:`${f}px`),Fe.createElement(qT,{color:u?Be.err:"#7b3030",side:"right"},u?t:`${S}px`),Fe.createElement(ix,{fSize:C,fWeight:String(p||600)},"Ag")),Fe.createElement("div",{style:{display:"flex",gap:16,justifyContent:"center"}},Fe.createElement(JT,{color:Be.err},"\u2508\u2508 font-size",s?" \u2717":""),Fe.createElement(JT,{color:Be.blue},"\u2508\u2508 line-height",u?" \u2717":"")),Fe.createElement(_6,null,Fe.createElement(YT,{variant:"err"},t),Fe.createElement("span",{style:{color:Be.dim}},"\u2192"),Fe.createElement(YT,{variant:"ok"},n))));let F=a?t:String(p||600),k=a?n:F,R=Vi(t),z=Vi(n);return Fe.createElement(Fe.Fragment,null,Fe.createElement(GT,null,Fe.createElement($6,null,Fe.createElement(KT,null,Fe.createElement(XT,{variant:"err"},"Current"),Fe.createElement(ix,{fSize:C,fWeight:a?F:String(p||600),style:{color:Be.err}},c?t:"Ag"),Fe.createElement(QT,{variant:"err"},a&&R?`${t} (${ZT(R)})`:t)),Fe.createElement(U6,null,"\u2192"),Fe.createElement(KT,null,Fe.createElement(XT,{variant:"ok"},"Figma"),Fe.createElement(ix,{fSize:C,fWeight:a?k:String(p||600),style:{color:Be.ok}},c?n:"Ag"),Fe.createElement(QT,{variant:"ok"},a&&z?`${n} (${ZT(z)})`:n)))))};function H6(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 Vi(e){let t=e.match(/(\d+(?:\.\d+)?)\s*(?:px)?/);return t?parseFloat(t[1]):null}function W6(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):null}function V6(e){let t=e.match(/(\d+(?:\.\d+)?)\s*[×x]\s*(\d+(?:\.\d+)?)/);return t?parseFloat(t[2]):null}var eI=new Set(["fontSize","font-size","fontWeight","font-weight","lineHeight","line-height","letterSpacing","letter-spacing","fontFamily","font-family","textContent","text-content"]);function G6(e){if(eI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return eI.has(t)}var tI=e=>{let t=!!e.figmaContext&&Object.keys(e.figmaContext).length>0,n=G6(e.property);return Fe.createElement(v6,null,Fe.createElement(k6,null,"\u25BE Layer properties",t?"":" (from review)"),n?Fe.createElement(j6,{...e}):Fe.createElement(R6,{...e}))};import Nr from"react";import{styled as Or}from"storybook/theming";var q6={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)"}},Y6=Or.div({display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap",marginBottom:"12px"}),K6=Or.div(({theme:e,category:t})=>{let n=q6[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}`}}),X6=Or.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}}}),Q6=Or.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"}}),J6=Or.div(({theme:e})=>({display:"flex",alignItems:"center",gap:"6px",marginLeft:"12px",paddingLeft:"12px",borderLeft:`1px solid ${e.appBorderColor}`})),Z6=Or.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"}}),ej=Or.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"}}),tj=Or.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"}}),nj=Or.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}`})),rj=Or.span(({theme:e})=>({fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.textMutedColor,marginLeft:"auto"})),oj=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},nI=({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=oj(e.detectedBy),l=o&&c.ai===o,d=r&&!l&&(c.ai||c.programmatic),f=e.generatedFix?.filePath||e.file;return Nr.createElement(Y6,null,Nr.createElement(K6,{category:e.type},e.type),e.status!=="pending"&&Nr.createElement(X6,{status:e.status},e.status),n&&t&&Nr.createElement(Q6,null,t),d&&Nr.createElement(J6,null,c.ai&&!l&&Nr.createElement(Z6,null,c.ai),c.programmatic&&Nr.createElement(ej,null,"Pre-filter: ",c.programmatic)),a&&Nr.createElement(tj,{title:u},"Unreliable"),e.dismissed&&Nr.createElement(nj,null,"Dismissed"),i&&s&&f&&Nr.createElement(rj,null,f))};import $n from"react";import{styled as Lo}from"storybook/theming";var ij=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},sj=e=>e?typeof e=="string"?e:typeof e=="object"?JSON.stringify(e):String(e):"",aj=Lo.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"})),sx=Lo.div({display:"flex",gap:"8px",alignItems:"baseline"}),ax=Lo.span(({theme:e})=>({color:e.textMutedColor,fontWeight:500,width:"60px",flexShrink:0,fontSize:"11px"})),lx=Lo.span(({theme:e})=>({color:e.color.defaultText,fontFamily:"inherit",fontSize:"11px",fontWeight:500})),lj=Lo(lx)(({theme:e})=>({color:e.color.negative,textDecoration:"line-through",opacity:.7})),cj=Lo(lx)(({theme:e})=>({color:e.color.positive,fontWeight:600})),uj=Lo.span(({color:e})=>({display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundImage:`
|
|
94
|
+
linear-gradient(${e}, ${e}),
|
|
95
|
+
linear-gradient(45deg, rgba(0,0,0,0.08) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.08) 75%),
|
|
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)"})),pj=Lo.span({display:"flex",alignItems:"center"}),rI=({value:e,isStrikethrough:t=!1})=>{let n=ij(e),r=sj(e),o=t?lj:cj;return n?$n.createElement(pj,null,$n.createElement(uj,{color:n,title:`Color: ${n}`}),$n.createElement(o,null,r)):$n.createElement(o,null,r)},oI=({property:e,currentValue:t,suggestedValue:n})=>$n.createElement(aj,null,$n.createElement(sx,null,$n.createElement(ax,null,"Property"),$n.createElement(lx,{style:{fontWeight:600}},e)),t!=null&&t!==""&&$n.createElement(sx,null,$n.createElement(ax,null,"Current"),$n.createElement(rI,{value:t,isStrikethrough:!0})),n!=null&&n!==""&&$n.createElement(sx,null,$n.createElement(ax,null,"Expected"),$n.createElement(rI,{value:n,isStrikethrough:!1})));ve();var sI=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 gj(e){if(sI.has(e))return!0;let t=e.toLowerCase().replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return sI.has(t)}var mj=Ee.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"}})),bde=Ee.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),hj=Ee.div({display:"flex",alignItems:"flex-start",gap:"8px",marginBottom:"12px"}),xj=Ee.p(({theme:e})=>({flex:1,minWidth:0,margin:0,fontSize:"14px",fontWeight:400,lineHeight:"1.5",color:e.color.defaultText})),yj=Ee.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:le},"&:checked":{backgroundColor:le,borderColor:le},"&: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"}})),bj=Ee.span(({theme:e,severity:t})=>({flexShrink:0,marginTop:"2px",display:"flex",alignItems:"center",color:"#94a3b8","& svg":{width:"16px",height:"16px"}})),Sde=Ee.div({flex:1,minWidth:0}),wde=Ee.div({display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"8px",marginBottom:"6px"}),Sj=Ee.div({display:"flex",alignItems:"center",gap:"12px",flexShrink:0}),ux=Ee.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"}})),wj=Ee(ux)(({theme:e})=>({"&:hover":{color:e.color.negative}})),vde=Ee.div(({theme:e})=>({fontSize:"14px",fontWeight:500,color:e.color.defaultText,marginBottom:"4px",lineHeight:"1.5"})),kde=Ee.div({display:"flex",gap:"6px",alignItems:"center",flexWrap:"wrap"}),vj=Ee.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,lineHeight:"1.5",marginBottom:"10px"})),Cde=Ee.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"})),Tde=Ee.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',marginTop:"4px"})),kj=Ee.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"}})),Cj=Ee.div(({theme:e})=>({marginTop:"8px",padding:"10px",backgroundColor:e.background.app,borderRadius:"4px",borderLeft:`3px solid ${le}`})),Tj=Ee.div(({theme:e})=>({fontSize:"11px",fontWeight:600,color:le,marginBottom:"8px",display:"flex",alignItems:"center",gap:"6px"})),Ij=Ee.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"}})),Fj=Ee.span(({theme:e})=>({fontFamily:"monospace",fontWeight:600,color:e.color.defaultText})),aI=Ee.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"})),Ide=Ee.div({position:"absolute",top:"10px",right:"10px",display:"flex",alignItems:"center",gap:"2px"}),Ej=Ee(wn)({width:"24px",height:"24px",padding:0,fontSize:"12px"}),Fde=Ee(Ej)(({theme:e})=>({"&:hover":{backgroundColor:e.background.negative,color:e.color.negative}})),Aj=Ee.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}`})),lI=Ee.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"})),Pj=Ee.div(({theme:e,compact:t})=>({marginTop:"12px",padding:t?"8px 12px":"12px",backgroundColor:e.background.positive,borderRadius:"6px",border:`1px solid ${e.color.positive}`})),Lj=Ee.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}),Mj=Ee.div(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,display:"flex",alignItems:"center",gap:"6px","&::before":{content:'"\u{1F916}"',fontSize:"14px"}})),Bj=Ee.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})),cI=Ee.div(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginBottom:"8px"})),uI=Ee.details({marginBottom:"8px"}),pI=Ee.summary(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive,cursor:"pointer",userSelect:"none",marginBottom:"8px","&:hover":{opacity:.8}})),Dj=Ee.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"})),Rj=Ee.div({display:"flex",gap:"8px",marginTop:"8px"}),zj=Ee(er)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),Nj=Ee(Er)({padding:"6px 12px",fontSize:"12px"}),Ede=Ee(qt)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"90px",...t?{backgroundColor:e.color.positive}:{}})),Ade=Ee.div({display:"flex",flexDirection:"column",gap:"10px",padding:"8px 0"}),Oj=Ee.div({display:"flex",alignItems:"center",gap:"12px"}),_j=Ee.div(({theme:e})=>({width:"16px",height:"16px",border:`2px solid ${e.appBorderColor}`,borderTopColor:le,borderRadius:"50%",animation:"spin 0.8s linear infinite","@keyframes spin":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}})),$j=Ee.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,fontStyle:"italic"})),Pde=Ee.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}}})),Uj=Ee.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"})),dI=Ee.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"})),fI=Ee.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}`})),gI=Ee.div({display:"flex",flexDirection:"column",overflowX:"auto",maxHeight:"300px",overflowY:"auto"}),mI=Ee.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)"}}),hI=Ee.div(({theme:e,status:t})=>({fontSize:"12px",color:e.color.positive,fontStyle:t==="applying"?"italic":"normal",fontWeight:t==="applied"?600:400})),xI=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},jj=e=>{switch(e){case"post-ai-validation":return"Pre-filter (programmatic)";case"ai-validation":return"Haiku AI";case"user":return"Manual";default:return"Unknown"}},Hj=e=>({"claude-sonnet-4-5-20250929":"Sonnet 4.5","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,yI=fj(({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}=ie(),[f,p]=cx(!1),[g,S]=cx(!1),[C,F]=cx(!1),k=dj(null),R=iI(()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{d(e.id),F(!0)},100)},[e.id,d]),z=iI(()=>{k.current&&clearTimeout(k.current),k.current=null,d(null),F(!1)},[d]),_=()=>{e.dismissed?s(e.id):p(!0)},M=x=>{i(e.id,x),p(!1)},B=async()=>{let x=[`**${e.title}**`,`Type: ${e.type} | Severity: ${e.severity} | Status: ${e.status}`,e.description];if(e.property&&x.push(`Property: ${e.property}`),e.currentValue&&x.push(`Current: ${e.currentValue}`),e.suggestedValue&&x.push(`Expected: ${e.suggestedValue}`),e.file&&x.push(`File: ${e.file}${e.lineNumber!==void 0?`:${e.lineNumber}`:""}`),e.relatedTo&&e.relatedTo.length>0&&x.push(`Caused by: ${e.relatedTo.join(", ")}`),e.suggestedCode&&x.push(`
|
|
92
99
|
Suggested code:
|
|
93
100
|
\`\`\`
|
|
94
101
|
${e.suggestedCode}
|
|
95
|
-
\`\`\``),e.generatedFix){let
|
|
96
|
-
--- AI-Generated Fix ---`),
|
|
102
|
+
\`\`\``),e.generatedFix){let E=e.generatedFix;if(x.push(`
|
|
103
|
+
--- AI-Generated Fix ---`),x.push(`Status: ${E.status}`),E.confidence!==void 0){let h=E.confidence>1?E.confidence:Math.round(E.confidence*100);x.push(`Confidence: ${h}%`)}E.strategy&&x.push(`Strategy: ${E.strategy}`),E.filePath&&x.push(`Target file: ${E.filePath}`),E.code&&x.push(`
|
|
97
104
|
Generated code:
|
|
98
105
|
\`\`\`
|
|
99
|
-
${
|
|
100
|
-
\`\`\``),
|
|
106
|
+
${E.code}
|
|
107
|
+
\`\`\``),E.diffPreview&&x.push(`
|
|
101
108
|
Diff:
|
|
102
109
|
\`\`\`diff
|
|
103
|
-
${
|
|
104
|
-
\`\`\``),
|
|
105
|
-
`);try{await navigator.clipboard.writeText(
|
|
110
|
+
${E.diffPreview}
|
|
111
|
+
\`\`\``),E.error&&x.push(`Error: ${E.error}`)}let b=x.filter(Boolean).join(`
|
|
112
|
+
`);try{await navigator.clipboard.writeText(b),S(!0),setTimeout(()=>S(!1),2e3)}catch(E){console.error("Failed to copy:",E)}},m=e.generatedFix?.status==="applied";return J.createElement(J.Fragment,null,J.createElement(mj,{dismissed:!!e.dismissed,fixApplied:m,onMouseEnter:R,onMouseLeave:z},J.createElement(hj,null,J.createElement(yj,{type:"checkbox",checked:e.selectedForFix,onChange:()=>o(e.id),disabled:e.dismissed||e.generatedFix?.status==="failed"}),J.createElement(bj,{severity:e.severity},e.severity==="critical"?J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("circle",{cx:"12",cy:"12",r:"10"}),J.createElement("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),J.createElement("line",{x1:"9",y1:"9",x2:"15",y2:"15"})):e.severity==="major"?J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.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"}),J.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),J.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})):J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("circle",{cx:"12",cy:"12",r:"10"}),J.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),J.createElement("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"}))),J.createElement(xj,null,e.title),J.createElement(Sj,null,J.createElement(ux,{onClick:B,title:"Copy issue details"},g?J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("polyline",{points:"20 6 9 17 4 12"})):J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),J.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?J.createElement(ux,{onClick:_,title:"Restore issue"},J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("polyline",{points:"1 4 1 10 7 10"}),J.createElement("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})),"Restore"):J.createElement(wj,{onClick:_,title:"Dismiss issue"},J.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},J.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),J.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),"Dismiss"))),J.createElement(nI,{issue:e,modelDisplayName:Hj(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&&J.createElement(vj,null,e.description),e.property&&J.createElement(oI,{property:e.property,currentValue:e.currentValue,suggestedValue:e.suggestedValue}),l==="admin"&&C&&e.property&&e.currentValue&&e.suggestedValue&&gj(e.property)&&J.createElement(tI,{property:e.property,currentValue:e.currentValue,expectedValue:e.suggestedValue,figmaContext:e.figmaContext}),e.relatedTo&&e.relatedTo.length>0&&J.createElement(kj,null,J.createElement("strong",null,"Caused by:")," ",e.relatedTo.join(", ")),e.relatedProperties&&e.relatedProperties.length>0&&J.createElement(Cj,null,J.createElement(Tj,null,"Affected Properties (",e.relatedProperties.length,")"),e.relatedProperties.map((x,b)=>J.createElement(Ij,{key:`${x.property}-${b}`},J.createElement(Fj,null,x.property),J.createElement(aI,{type:"current"},x.currentValue),J.createElement(aI,{type:"suggested"},x.suggestedValue)))),e.dismissed&&J.createElement(Aj,null,J.createElement("strong",null,"Filtered by:")," ",jj(e.dismissedBy),e.dismissReason&&J.createElement(J.Fragment,null,J.createElement("br",null),"Reason: ",e.dismissReason)),e.status==="failed"&&e.error&&J.createElement(lI,null,J.createElement("strong",null,"Error:")," ",e.error),e.generatedFix&&J.createElement(Pj,{compact:e.generatedFix.status==="generating"},e.generatedFix.status==="generating"?J.createElement(Oj,{style:{margin:0}},J.createElement(_j,null),J.createElement($j,{style:{margin:0}},"Generating fix...")):J.createElement(J.Fragment,null,J.createElement(Lj,null,J.createElement(Mj,null,"AI-Generated Fix"),J.createElement(Bj,{confidence:e.generatedFix.confidence},Math.round(e.generatedFix.confidence>1?e.generatedFix.confidence:e.generatedFix.confidence*100),"% confidence")),e.generatedFix.strategy&&J.createElement(cI,null,"Strategy: ",e.generatedFix.strategy),e.generatedFix.noChangesExplanation&&J.createElement(cI,{style:{color:"#6b7280",fontStyle:"italic"}},"Reason: ",e.generatedFix.noChangesExplanation),e.generatedFix.diffPreview?J.createElement(uI,null,J.createElement(pI,null,"View Diff"),J.createElement(Uj,null,J.createElement(dI,{side:"old"},J.createElement(fI,{side:"old"},"Old"),J.createElement(gI,null,xI(e.generatedFix.diffPreview).map((x,b)=>J.createElement(mI,{key:`old-${b}`,type:x.oldLine.type},x.oldLine.content||"\xA0")))),J.createElement(dI,{side:"new"},J.createElement(fI,{side:"new"},"New"),J.createElement(gI,null,xI(e.generatedFix.diffPreview).map((x,b)=>J.createElement(mI,{key:`new-${b}`,type:x.newLine.type},x.newLine.content||"\xA0")))))):e.generatedFix.code&&J.createElement(uI,null,J.createElement(pI,null,"View Generated Code"),J.createElement(Dj,null,e.generatedFix.code)),e.generatedFix.status==="failed"&&e.generatedFix.error&&J.createElement(lI,null,J.createElement("strong",null,"Fix generation failed:")," ",e.generatedFix.error),e.generatedFix.status==="ready"&&c.enableFixApply&&a&&J.createElement(Rj,null,J.createElement(zj,{onClick:()=>a(e.id)},"Apply Fix"),u&&J.createElement(Nj,{onClick:()=>u(e.id)},"Regenerate")),e.generatedFix.status==="applying"&&J.createElement(hI,{status:"applying"},"Applying fix..."),e.generatedFix.status==="applied"&&J.createElement(hI,{status:"applied"},"\u2713 Fix applied successfully")))),J.createElement(VT,{isOpen:f,issueTitle:e.title,onConfirm:M,onCancel:()=>p(!1)}))});import px from"react";import{styled as dx,keyframes as Wj}from"storybook/theming";var Vj=Wj`
|
|
106
113
|
0% { transform: rotate(0deg); }
|
|
107
114
|
100% { transform: rotate(360deg); }
|
|
108
|
-
`,
|
|
115
|
+
`,Gj=dx.div({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"32px",gap:"12px"}),qj=dx.div(({theme:e})=>({width:"24px",height:"24px",border:`3px solid ${e.appBorderColor}`,borderTopColor:"#7c3aed",borderRadius:"50%",animation:`${Vj} 0.8s linear infinite`})),Yj=dx.span(({theme:e})=>({fontSize:"12px",color:e.color.mediumdark})),Nc=({label:e="Loading..."})=>px.createElement(Gj,null,px.createElement(qj,null),px.createElement(Yj,null,e));ve();import gt,{useState as Kj,useEffect as Xj,useRef as Qj}from"react";import{styled as fn,keyframes as xa}from"storybook/theming";var Gi="#8b6cc1",Jj="rgba(139, 108, 193, 0.2)",wI="rgba(139, 108, 193, 0.15)",Zj="rgba(139, 108, 193, 0.1)",eH="rgba(139, 108, 193, 0.5)",vI=xa`
|
|
116
|
+
from { transform: rotate(0deg); }
|
|
117
|
+
to { transform: rotate(360deg); }
|
|
118
|
+
`,tH=xa`
|
|
119
|
+
from { transform: rotate(0deg); }
|
|
120
|
+
to { transform: rotate(-360deg); }
|
|
121
|
+
`,nH=xa`
|
|
122
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
123
|
+
50% { opacity: 0.6; transform: scale(1.05); }
|
|
124
|
+
`,rH=xa`
|
|
125
|
+
from { opacity: 0; transform: translateY(8px); }
|
|
126
|
+
to { opacity: 1; transform: translateY(0); }
|
|
127
|
+
`,oH=xa`
|
|
128
|
+
0%, 100% { opacity: 1; }
|
|
129
|
+
50% { opacity: 0.4; }
|
|
130
|
+
`,iH=fn.div({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"60px 20px",textAlign:"center",animation:`${rH} 0.4s ease-out`}),sH=fn.div({position:"relative",width:"80px",height:"80px",marginBottom:"32px"}),aH=fn.div({position:"absolute",inset:0,borderRadius:"50%",background:`radial-gradient(circle, ${wI} 0%, transparent 70%)`,animation:`${nH} 2s ease-in-out infinite`}),lH=fn.div({position:"absolute",inset:0,borderRadius:"50%",border:`2px solid ${Jj}`}),cH=fn.div({position:"absolute",inset:0,borderRadius:"50%",border:"2px solid transparent",borderTopColor:Gi,borderRightColor:Gi,animation:`${vI} 1.2s linear infinite`}),uH=fn.div({position:"absolute",inset:"12px",borderRadius:"50%",border:`1px solid ${wI}`}),pH=fn.div({position:"absolute",inset:"12px",borderRadius:"50%",border:"1px solid transparent",borderBottomColor:eH,animation:`${tH} 1.8s linear infinite`}),dH=fn.div({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}),fH=fn.div({position:"absolute",inset:0,animation:`${vI} 3s linear infinite`}),gH=fn.div({position:"absolute",top:0,left:"50%",transform:"translate(-50%, -50%)",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:Gi}),mH=()=>gt.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:Gi,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},gt.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"}),gt.createElement("path",{d:"M5 3v4"}),gt.createElement("path",{d:"M3 5h4"}),gt.createElement("path",{d:"M19 17v4"}),gt.createElement("path",{d:"M17 19h4"})),hH=fn.div(({theme:e})=>({fontSize:"15px",fontWeight:600,color:e.color.defaultText,letterSpacing:"-0.01em"})),xH=fn.div(({theme:e})=>({fontSize:e.typography.size.s1,color:e.textMutedColor,marginTop:"6px",maxWidth:"220px"})),yH=fn.div({display:"flex",alignItems:"center",gap:"8px",marginTop:"24px"}),fx=fn.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:Zj,color:Gi},...t==="pending"&&{backgroundColor:e.background.hoverable||"#f3f4f6",color:e.textMutedColor}})),bI=fn.div(({theme:e})=>({width:"16px",height:"1px",backgroundColor:e.appBorderColor})),SI=fn.div({width:"6px",height:"6px",borderRadius:"50%",backgroundColor:Gi,animation:`${oH} 1.5s ease-in-out infinite`}),bH=fn.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"16px"})),SH=()=>gt.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},gt.createElement("polyline",{points:"20 6 9 17 4 12"})),kI=()=>{let{streamingProgress:e}=ie(),t=(e||0)>25,[n,r]=Kj(0),o=Qj();return Xj(()=>(o.current=setInterval(()=>r(i=>i+1),1e3),()=>clearInterval(o.current)),[]),gt.createElement(iH,null,gt.createElement(sH,null,gt.createElement(aH,null),gt.createElement(lH,null),gt.createElement(cH,null),gt.createElement(uH,null),gt.createElement(pH,null),gt.createElement(dH,null,gt.createElement(mH,null)),gt.createElement(fH,null,gt.createElement(gH,null))),gt.createElement(hH,null,"Analyzing designs"),gt.createElement(xH,null,"AI is comparing screenshots and detecting issues"),gt.createElement(yH,null,gt.createElement(fx,{variant:t?"done":"active"},t?gt.createElement(SH,null):gt.createElement(SI,null),"Screenshots"),gt.createElement(bI,null),gt.createElement(fx,{variant:t?"active":"pending"},t?gt.createElement(SI,null):null,"Analysis"),gt.createElement(bI,null),gt.createElement(fx,{variant:"pending"},"Report")),gt.createElement(bH,null,n,"s \xB7 Esc to stop"))};ve();var Yde=it.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}})),Kde=it.input(({theme:e})=>({width:"14px",height:"14px",cursor:"pointer",accentColor:le})),TH=it.div({display:"flex",flexDirection:"column",gap:"12px",padding:"12px"}),IH=it.div({display:"flex",gap:"8px"}),CI=it(En)({flex:1}),FH=it.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}})),EH=it.div({display:"flex",alignItems:"center",gap:"10px",fontSize:"12px"}),AH=it.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"}})),PH=it.div(({theme:e})=>({border:`1px solid ${e.appBorderColor}`,borderTop:"none",borderRadius:"0 0 8px 8px",display:"flex",flexDirection:"column"})),LH=it.div({display:"flex",alignItems:"center",gap:"2px"}),Oc=it(wn)({padding:"4px 8px",fontSize:"11px",fontWeight:500}),gx=it.span(({theme:e,variant:t})=>({fontSize:"11px",fontWeight:500,color:t==="critical"?e.color.negative:t==="major"?e.color.warning:e.textMutedColor})),MH=it.span(({theme:e})=>({fontWeight:600,color:e.color.defaultText})),Xde=it.div(({theme:e})=>({display:"flex",gap:"12px",alignItems:"center",fontSize:"12px",color:e.textMutedColor})),Mo=it.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:le};case"selected":return{bg:e.color.tertiary,text:le};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:le};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"}}),BH=it.div({display:"flex",flexDirection:"column"}),DH=it.span(({theme:e})=>({fontSize:"11px",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',color:e.textMutedColor,marginLeft:"4px"})),TI=it.div(({theme:e})=>({textAlign:"center",padding:"40px 20px",color:e.textMutedColor})),II=it.div({fontSize:"36px",marginBottom:"12px"}),FI=it.div(({theme:e})=>({fontSize:"14px",fontWeight:600,marginBottom:"6px",color:e.textMutedColor})),EI=it.div({fontSize:"12px"}),RH=CH`
|
|
109
131
|
0% {
|
|
110
132
|
transform: translateY(0) rotate(0deg) scale(1);
|
|
111
133
|
opacity: 1;
|
|
@@ -117,35 +139,35 @@ ${g.diffPreview}
|
|
|
117
139
|
transform: translateY(120px) rotate(720deg) scale(0.3);
|
|
118
140
|
opacity: 0;
|
|
119
141
|
}
|
|
120
|
-
`;var
|
|
121
|
-
${
|
|
122
|
-
${
|
|
142
|
+
`;var Qde=it.div({position:"relative",width:"100%",height:"60px",marginBottom:"10px",overflow:"visible"}),Jde=it.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:`${RH} 3s ease-out ${e}s forwards`,pointerEvents:"none"}));var zH=it.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}}})),NH=it(wn)(({theme:e})=>({marginLeft:"auto",padding:"2px 6px",fontSize:"10px",backgroundColor:e.background.hoverable,color:e.color.defaultText})),AI=it.div({display:"flex",gap:"8px",alignItems:"center",justifyContent:"flex-end"}),PI=it(er)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",backgroundColor:e.color.positive})),LI=it(qt)(({theme:e,copied:t})=>({padding:"6px 12px",fontSize:"12px",minWidth:"120px",...t?{backgroundColor:e.color.positive}:{}})),MI=it(qt)({padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"}),OH=it.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}}),_H=it.div({display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"}),$H=it.span(({confidence:e})=>{let t=e>=90?"#16a34a":e>=70?"#ca8a04":"#dc2626";return{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"10px",backgroundColor:e>=90?"#dcfce7":e>=70?"#fef9c3":"#fee2e2",color:t,fontSize:"11px",fontWeight:700}}),UH=it.span(({theme:e})=>({fontSize:"11px",fontWeight:600,color:e.textMutedColor,textTransform:"uppercase",letterSpacing:"0.5px"})),jH=it.div(({theme:e})=>({color:e.color.defaultText,fontSize:"12px","& ul":{margin:"4px 0",paddingLeft:"16px"},"& li":{marginBottom:"2px"}})),_c=it.div(({theme:e})=>({marginTop:"6px","&:first-of-type":{marginTop:0}})),$c=it.span(({theme:e})=>({fontWeight:600,color:e.textMutedColor,fontSize:"11px"})),HH=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},BI=({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:f,onSelectAllFixes:p,onApplyFixes:g,onApplyFix:S,onCopyAllFixes:C,onGenerateFixes:F,onDismiss:k,onUndismiss:R,isGenerating:z=!1,isApplying:_=!1,isCopying:M=!1,applyFixesResult:B,onDismissResult:m,generationTiming:x,generationUsage:b,generationProgress:E,autoApplySupported:h=!0,hasReviewBeenRun:T=!1,isLoadingReview:I=!1,isReviewing:v=!1,selfReview:A})=>{let[P,D]=V.useState("all"),[N,w]=V.useState("all"),[j,G]=V.useState(!1),[L,K]=V.useState(!0),{includeComponentIssues:ee,setIncludeComponentIssues:re,featureFlags:de}=ie(),ae=V.useRef(null),[qe,tt]=vH(0);kH(()=>{if(!z){tt(0);return}let ne=setInterval(()=>tt(W=>W+1),1e3);return()=>clearInterval(ne)},[z]);let se=async()=>{let ne=pe.map(H=>{let Pe=[`[${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 Ne=H.generatedFix;if(Pe.push(""),Pe.push("--- AI-Generated Fix ---"),Pe.push(`Fix Status: ${Ne.status}`),Ne.confidence!==void 0){let yt=Ne.confidence>1?Ne.confidence:Math.round(Ne.confidence*100);Pe.push(`Confidence: ${yt}%`)}Ne.strategy&&Pe.push(`Strategy: ${Ne.strategy}`),Ne.filePath&&Pe.push(`Target file: ${Ne.filePath}`),Ne.code&&Pe.push(`Generated code:
|
|
143
|
+
${Ne.code}`),Ne.diffPreview&&Pe.push(`Diff:
|
|
144
|
+
${Ne.diffPreview}`),Ne.error&&Pe.push(`Error: ${Ne.error}`)}return Pe.push(""),Pe.filter(Boolean).join(`
|
|
123
145
|
`)}).join(`
|
|
124
146
|
---
|
|
125
147
|
|
|
126
|
-
`),
|
|
148
|
+
`),W=pe.filter(H=>H.generatedFix?.status==="applied").length,Ae=pe.filter(H=>H.generatedFix?.status==="ready").length,ge=W>0||Ae>0?` | Fixes: ${W} applied, ${Ae} ready`:"",O=r!==void 0?` | Similarity: ${r}%`:"",U=`Score: ${n}/100${O} | ${pe.length} issues${ge}
|
|
127
149
|
|
|
128
|
-
`;try{await navigator.clipboard.writeText(_+fe),U(!0),setTimeout(()=>U(!1),2e3)}catch($){console.error("Failed to copy:",$)}};V.useEffect(()=>{D&&Le.current&&Le.current.scrollIntoView({behavior:"smooth",block:"start"})},[D]);let te=f3(()=>e.filter(fe=>{let kt=P==="all"||fe.severity===P,yr=B==="all"||fe.status===B,pe=Q||!z3(fe);return kt&&yr&&pe}),[e,P,B,Q]),Y=()=>{te.forEach(fe=>{fe.selectedForFix||l(fe.id)})},ce=()=>{te.forEach(fe=>{fe.selectedForFix&&l(fe.id)})},ie=()=>{te.forEach(fe=>{fe.generatedFix&&fe.generatedFix.status==="ready"&&!fe.selectedForFix&&l(fe.id)})},ue=te.filter(fe=>fe.selectedForFix).length,ct=te.filter(fe=>fe.severity==="critical").length,Ge=te.filter(fe=>fe.severity==="major").length,xt=te.filter(fe=>fe.severity==="minor").length,yn=te.filter(fe=>fe.generatedFix&&fe.generatedFix.status==="ready").length,qe=te.filter(fe=>fe.selectedForFix&&fe.generatedFix&&fe.generatedFix.status==="ready").length;return e.length===0?I?V.createElement(gc,{label:"Loading review..."}):V.createElement(hC,null,V.createElement(xC,null,C?"\u2728":"\u{1F441}\uFE0F"),V.createElement(yC,null,C?"No issues found":"No review yet"),V.createElement(bC,null,C?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):V.createElement(b3,{"data-testid":"issues-panel"},V.createElement(S3,null,V.createElement(mC,{value:P,onChange:fe=>L(fe.target.value)},V.createElement("option",{value:"all"},"All Severities"),V.createElement("option",{value:"critical"},"Critical Only"),V.createElement("option",{value:"major"},"Major Only"),V.createElement("option",{value:"minor"},"Minor Only")),V.createElement(mC,{value:B,onChange:fe=>N(fe.target.value)},V.createElement("option",{value:"all"},"All Statuses"),V.createElement("option",{value:"pending"},"Pending"),V.createElement("option",{value:"applied"},"Applied"),V.createElement("option",{value:"verified"},"Verified"),V.createElement("option",{value:"failed"},"Failed"))),V.createElement("div",null,V.createElement(w3,{isOpen:H,onClick:()=>M(!H)},V.createElement(v3,null,V.createElement(k3,{isOpen:H},V.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},V.createElement("polyline",{points:"6 9 12 15 18 9"}))),V.createElement(I3,null,te.length," issues"),V.createElement(x3,{onClick:fe=>fe.stopPropagation()},V.createElement(y3,{type:"checkbox",checked:Q,onChange:fe=>ee(fe.target.checked)}),"+ TSX"),V.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},ct>0&&V.createElement(Lm,{variant:"critical"},ct," critical"),Ge>0&&V.createElement(Lm,{variant:"major"},Ge," major"),xt>0&&V.createElement(Lm,{variant:"minor"},xt," minor"))),V.createElement(T3,{onClick:fe=>fe.stopPropagation()},V.createElement(mc,{onClick:Y},"All"),V.createElement(mc,{onClick:ce},"None"),V.createElement(mc,{onClick:st},x?"\u2713":"\u2398"," Copy"),yn>0&&V.createElement(mc,{onClick:ie},"Fixes (",yn,")"))),D&&V.createElement(A3,{ref:Le,variant:D.error||D.failed>0?"warning":"success"},D.error?V.createElement(V.Fragment,null,D.error):D.failed>0?V.createElement(V.Fragment,null,"Applied ",D.succeeded,"/",D.total," fixes. ",D.failed," failed. Run a new review to verify."):V.createElement(V.Fragment,null,"Applied ",D.total," fix",D.total!==1?"es":"","! Run a new review to verify changes."),g&&V.createElement(P3,{onClick:g},"\u2715")),ue>0&&V.createElement(SC,null,w&&V.createElement(ko,{variant:"timing"},w.durationSec,"s (",w.issueCount," fixes)"),v&&V.createElement(V.Fragment,null,V.createElement(ko,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),V.createElement(ko,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"# ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),V.createElement(ko,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),J.enableFixGeneration&&F&&V.createElement(kC,{disabled:R||O||E,onClick:F},V.createElement("span",null,"\u{1F916}"),R&&A?`Generating ${A.completed}/${A.total}... (${Ee}s)`:R?`Generating... (${Ee}s)`:`Generate Fixes for ${ue} Issue${ue>1?"s":""}`),J.enableFixApply&&h&&m&&V.createElement(wC,{disabled:R||O||qe===0,onClick:m},O?"Applying...":R?"Generating...":qe>0?`Apply ${qe} Ready Fix${qe>1?"es":""}`:"Apply Fixes (generate first)"),J.enableFixApply&&!h&&T&&V.createElement(vC,{disabled:R||E||qe===0,copied:E,onClick:T},E?"Copied!":qe>0?`Copy ${qe} Fix${qe>1?"es":""}`:"Copy Fixes (generate first)")),y&&!R&&V.createElement(L3,{confidence:y.overallConfidence},V.createElement(M3,null,V.createElement(D3,null,"AI Self-Review"),V.createElement(B3,{confidence:y.overallConfidence},y.wouldReachPerfect?"\u2713":"\u25B3"," ",y.overallConfidence,"% confidence")),V.createElement(R3,null,y.variantSafety&&V.createElement(hc,null,V.createElement(xc,null,"Variant safety: "),y.variantSafety),y.gaps.length>0&&V.createElement(hc,null,V.createElement(xc,null,"Gaps: "),V.createElement("ul",null,y.gaps.map((fe,kt)=>V.createElement("li",{key:kt},fe)))),!y.wouldReachPerfect&&y.reasonsNotPerfect.length>0&&V.createElement(hc,null,V.createElement(xc,null,"Why not 100%: "),V.createElement("ul",null,y.reasonsNotPerfect.map((fe,kt)=>V.createElement("li",{key:kt},fe)))),y.suggestions&&y.suggestions.length>0&&V.createElement(hc,null,V.createElement(xc,null,"Suggestions: "),V.createElement("ul",null,y.suggestions.map((fe,kt)=>V.createElement("li",{key:kt},fe)))))),H&&V.createElement(C3,null,te.length===0?V.createElement(hC,null,V.createElement(xC,null,"\u{1F50D}"),V.createElement(yC,null,"No issues match current filters"),V.createElement(bC,null,"Try adjusting your severity or status filters")):V.createElement(F3,null,te.map(fe=>V.createElement(gC,{key:fe.id,issue:fe,modelId:t,onToggleSelection:l,onDismiss:k,onUndismiss:z,onApplyFix:S}))))),ue>0&&V.createElement(SC,null,w&&V.createElement(ko,{variant:"timing"},w.durationSec,"s (",w.issueCount," fixes)"),v&&V.createElement(V.Fragment,null,V.createElement(ko,{variant:"cost"},"$",v.costUsd.toFixed(3)," / \u20AA",(v.costUsd*3.65).toFixed(2)),V.createElement(ko,{variant:"tokens",title:`Input: ${v.inputTokens.toLocaleString()} \xB7 Output: ${v.outputTokens.toLocaleString()}`},"# ",((v.inputTokens+v.outputTokens)/1e3).toFixed(1),"K"),V.createElement(ko,{variant:"model",title:v.modelId},v.modelId.replace("claude-","").replace(/-\d{8}$/,""))),J.enableFixGeneration&&F&&V.createElement(kC,{disabled:R||O||E,onClick:F},V.createElement("span",null,"\u{1F916}"),R&&A?`Generating ${A.completed}/${A.total}... (${Ee}s)`:R?`Generating... (${Ee}s)`:`Generate Fixes for ${ue} Issue${ue>1?"s":""}`),J.enableFixApply&&h&&m&&V.createElement(wC,{disabled:R||O||qe===0,onClick:m},O?"Applying...":R?"Generating...":qe>0?`Apply ${qe} Ready Fix${qe>1?"es":""}`:"Apply Fixes (generate first)"),J.enableFixApply&&!h&&T&&V.createElement(vC,{disabled:R||E||qe===0,copied:E,onClick:T},E?"Copied!":qe>0?`Copy ${qe} Fix${qe>1?"es":""}`:"Copy Fixes (generate first)")))};Me();var N3=wt.div({display:"flex",flexDirection:"column"}),O3=wt.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),_3=wt.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),Mm=wt.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:ae}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),$3=wt.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),xle=wt.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),yle=wt.div({fontSize:"48px",marginBottom:"16px"}),ble=wt.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),Sle=wt.div({fontSize:"14px",opacity:.8}),U3=wt.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),j3=wt.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),H3=wt(fn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),W3=wt(Wn)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),V3=wt.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),G3=wt.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),q3=wt.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),Y3=wt.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),K3=wt.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),X3=wt.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}})),Q3=wt.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),J3=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"},TC=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},Z3=wt.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"}}),e6=wt.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"}})),Dm=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"},t6=(e,t)=>{switch(e||Dm(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},IC=(e,t)=>{switch(e||Dm(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Haiku";case"user":return"Manual";default:return"Auto"}},n6=wt.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),r6=wt.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),o6=wt.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"})),i6=wt(oh)({marginTop:"12px"}),Bm=class extends _e.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){b.error("[IssuesPanel ErrorBoundary] Caught error:",n,r)}render(){return this.state.hasError?_e.createElement(n6,null,_e.createElement(r6,null,"\u26A0\uFE0F Issues Panel Error"),_e.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),_e.createElement(o6,null,this.state.error?.message||"Unknown error",`
|
|
150
|
+
`;try{await navigator.clipboard.writeText(U+ne),G(!0),setTimeout(()=>G(!1),2e3)}catch(H){console.error("Failed to copy:",H)}};V.useEffect(()=>{B&&ae.current&&ae.current.scrollIntoView({behavior:"smooth",block:"start"})},[B]);let pe=wH(()=>e.filter(ne=>{let W=P==="all"||ne.severity===P,Ae=N==="all"||ne.status===N,ge=ee||!HH(ne);return W&&Ae&&ge}),[e,P,N,ee]),Ie=()=>{pe.forEach(ne=>{ne.selectedForFix||l(ne.id)})},ze=()=>{pe.forEach(ne=>{ne.selectedForFix&&l(ne.id)})},me=()=>{pe.forEach(ne=>{ne.generatedFix&&ne.generatedFix.status==="ready"&&!ne.selectedForFix&&l(ne.id)})},Nt=pe.filter(ne=>ne.selectedForFix).length,he=pe.filter(ne=>ne.severity==="critical").length,vt=pe.filter(ne=>ne.severity==="major").length,Ge=pe.filter(ne=>ne.severity==="minor").length,lt=pe.filter(ne=>ne.generatedFix&&ne.generatedFix.status==="ready").length,nt=pe.filter(ne=>ne.selectedForFix&&ne.generatedFix&&ne.generatedFix.status==="ready").length;return e.length===0?I?V.createElement(Nc,{label:"Loading review..."}):v?V.createElement(kI,null):V.createElement(TI,null,V.createElement(II,null,T?"\u2728":"\u{1F441}\uFE0F"),V.createElement(FI,null,T?"No issues found":"No review yet"),V.createElement(EI,null,T?"This review didn't detect any issues. Great work!":'Click the "Review" button to analyze your component.')):V.createElement(TH,{"data-testid":"issues-panel"},V.createElement(IH,null,V.createElement(CI,{value:P,onChange:ne=>D(ne.target.value)},V.createElement("option",{value:"all"},"All Severities"),V.createElement("option",{value:"critical"},"Critical Only"),V.createElement("option",{value:"major"},"Major Only"),V.createElement("option",{value:"minor"},"Minor Only")),V.createElement(CI,{value:N,onChange:ne=>w(ne.target.value)},V.createElement("option",{value:"all"},"All Statuses"),V.createElement("option",{value:"pending"},"Pending"),V.createElement("option",{value:"applied"},"Applied"),V.createElement("option",{value:"verified"},"Verified"),V.createElement("option",{value:"failed"},"Failed"))),V.createElement("div",null,V.createElement(FH,{isOpen:L,onClick:()=>K(!L)},V.createElement(EH,null,V.createElement(AH,{isOpen:L},V.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},V.createElement("polyline",{points:"6 9 12 15 18 9"}))),V.createElement(MH,null,pe.length," issues"),(()=>{if(pe.length===0)return null;let ne=pe.map(ge=>ge.generatedFix?.filePath||ge.file).filter(Boolean);if(ne.length===0)return null;let W=ne[0];return ne.every(ge=>ge===W)?V.createElement(DH,null,"in ",W):null})(),V.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},he>0&&V.createElement(gx,{variant:"critical"},he," critical"),vt>0&&V.createElement(gx,{variant:"major"},vt," major"),Ge>0&&V.createElement(gx,{variant:"minor"},Ge," minor"))),V.createElement(LH,{onClick:ne=>ne.stopPropagation()},V.createElement(Oc,{onClick:Ie},"All"),V.createElement(Oc,{onClick:ze},"None"),V.createElement(Oc,{onClick:se},j?"\u2713":"\u2398"," Copy"),lt>0&&V.createElement(Oc,{onClick:me},"Fixes (",lt,")"))),B&&V.createElement(zH,{ref:ae,variant:B.error||B.failed>0?"warning":"success"},B.error?V.createElement(V.Fragment,null,B.error):B.failed>0?V.createElement(V.Fragment,null,"Applied ",B.succeeded,"/",B.total," fixes. ",B.failed," failed. Run a new review to verify."):V.createElement(V.Fragment,null,"Applied ",B.total," fix",B.total!==1?"es":"","! Run a new review to verify changes."),m&&V.createElement(NH,{onClick:m},"\u2715")),Nt>0&&V.createElement(AI,null,x&&V.createElement(Mo,{variant:"timing"},x.durationSec,"s (",x.issueCount," fixes)"),b&&V.createElement(V.Fragment,null,V.createElement(Mo,{variant:"cost"},"$",b.costUsd.toFixed(3)," / \u20AA",(b.costUsd*3.65).toFixed(2)),V.createElement(Mo,{variant:"tokens",title:`Input: ${b.inputTokens.toLocaleString()} \xB7 Output: ${b.outputTokens.toLocaleString()}`},"# ",((b.inputTokens+b.outputTokens)/1e3).toFixed(1),"K"),V.createElement(Mo,{variant:"model",title:b.modelId},b.modelId.replace("claude-","").replace(/-\d{8}$/,""))),de.enableFixGeneration&&F&&V.createElement(MI,{disabled:z||_||M,onClick:F},V.createElement("span",null,"\u{1F916}"),z&&E?`Generating ${E.completed}/${E.total}... (${qe}s)`:z?`Generating... (${qe}s)`:`Generate Fixes for ${Nt} Issue${Nt>1?"s":""}`),de.enableFixApply&&h&&g&&V.createElement(PI,{disabled:z||_||nt===0,onClick:g},_?"Applying...":z?"Generating...":nt>0?`Apply ${nt} Ready Fix${nt>1?"es":""}`:"Apply Fixes (generate first)"),de.enableFixApply&&!h&&C&&V.createElement(LI,{disabled:z||M||nt===0,copied:M,onClick:C},M?"Copied!":nt>0?`Copy ${nt} Fix${nt>1?"es":""}`:"Copy Fixes (generate first)")),A&&!z&&V.createElement(OH,{confidence:A.overallConfidence},V.createElement(_H,null,V.createElement(UH,null,"AI Self-Review"),V.createElement($H,{confidence:A.overallConfidence},A.wouldReachPerfect?"\u2713":"\u25B3"," ",A.overallConfidence,"% confidence")),V.createElement(jH,null,A.variantSafety&&V.createElement(_c,null,V.createElement($c,null,"Variant safety: "),A.variantSafety),A.gaps.length>0&&V.createElement(_c,null,V.createElement($c,null,"Gaps: "),V.createElement("ul",null,A.gaps.map((ne,W)=>V.createElement("li",{key:W},ne)))),!A.wouldReachPerfect&&A.reasonsNotPerfect.length>0&&V.createElement(_c,null,V.createElement($c,null,"Why not 100%: "),V.createElement("ul",null,A.reasonsNotPerfect.map((ne,W)=>V.createElement("li",{key:W},ne)))),A.suggestions&&A.suggestions.length>0&&V.createElement(_c,null,V.createElement($c,null,"Suggestions: "),V.createElement("ul",null,A.suggestions.map((ne,W)=>V.createElement("li",{key:W},ne)))))),L&&V.createElement(PH,null,pe.length===0?V.createElement(TI,null,V.createElement(II,null,"\u{1F50D}"),V.createElement(FI,null,"No issues match current filters"),V.createElement(EI,null,"Try adjusting your severity or status filters")):V.createElement(BH,null,(()=>{let ne={};pe.forEach(U=>{let H=U.detectedBy;H&&(ne[H]=(ne[H]||0)+1)});let W=Object.entries(ne).sort((U,H)=>H[1]-U[1])[0],Ae=W&&W[1]>pe.length/2?W[0]:void 0,ge=pe.map(U=>U.generatedFix?.filePath||U.file).filter(Boolean),O=ge.length>0&&ge.every(U=>U===ge[0]);return pe.map(U=>V.createElement(yI,{key:U.id,issue:U,modelId:t,dominantDetector:Ae,showFilePath:!O,onToggleSelection:l,onDismiss:k,onUndismiss:R,onApplyFix:S}))})()))),Nt>0&&V.createElement(AI,null,x&&V.createElement(Mo,{variant:"timing"},x.durationSec,"s (",x.issueCount," fixes)"),b&&V.createElement(V.Fragment,null,V.createElement(Mo,{variant:"cost"},"$",b.costUsd.toFixed(3)," / \u20AA",(b.costUsd*3.65).toFixed(2)),V.createElement(Mo,{variant:"tokens",title:`Input: ${b.inputTokens.toLocaleString()} \xB7 Output: ${b.outputTokens.toLocaleString()}`},"# ",((b.inputTokens+b.outputTokens)/1e3).toFixed(1),"K"),V.createElement(Mo,{variant:"model",title:b.modelId},b.modelId.replace("claude-","").replace(/-\d{8}$/,""))),de.enableFixGeneration&&F&&V.createElement(MI,{disabled:z||_||M,onClick:F},V.createElement("span",null,"\u{1F916}"),z&&E?`Generating ${E.completed}/${E.total}... (${qe}s)`:z?`Generating... (${qe}s)`:`Generate Fixes for ${Nt} Issue${Nt>1?"s":""}`),de.enableFixApply&&h&&g&&V.createElement(PI,{disabled:z||_||nt===0,onClick:g},_?"Applying...":z?"Generating...":nt>0?`Apply ${nt} Ready Fix${nt>1?"es":""}`:"Apply Fixes (generate first)"),de.enableFixApply&&!h&&C&&V.createElement(LI,{disabled:z||M||nt===0,copied:M,onClick:C},M?"Copied!":nt>0?`Copy ${nt} Fix${nt>1?"es":""}`:"Copy Fixes (generate first)")))};De();var WH=Ct.div({display:"flex",flexDirection:"column"}),VH=Ct.div(({theme:e})=>({padding:"12px 16px",backgroundColor:e.background.positive,borderBottom:`1px solid ${e.appBorderColor}`,display:"flex",alignItems:"center",gap:"12px",flexWrap:"wrap"})),GH=Ct.span(({theme:e})=>({fontSize:"12px",fontWeight:600,color:e.color.positive})),mx=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:le}};return{padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,backgroundColor:n[t].bg,color:n[t].text}}),qH=Ct.span(({theme:e})=>({fontSize:"11px",color:e.textMutedColor,marginLeft:"auto"})),cfe=Ct.div(({theme:e})=>({textAlign:"center",padding:"60px 20px",color:e.textMutedColor})),ufe=Ct.div({fontSize:"48px",marginBottom:"16px"}),pfe=Ct.div(({theme:e})=>({fontSize:"16px",fontWeight:600,marginBottom:"8px",color:e.color.defaultText})),dfe=Ct.div({fontSize:"14px",opacity:.8}),YH=Ct.div(({theme:e})=>({borderTop:`1px solid ${e.appBorderColor}`,marginTop:"8px"})),KH=Ct.div(({theme:e})=>({width:"100%",display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",backgroundColor:e.background.app,fontSize:"12px",color:e.textMutedColor})),XH=Ct(wn)({display:"flex",gap:"8px",padding:"0",fontSize:"12px"}),QH=Ct(Er)(({theme:e})=>({marginLeft:"auto",padding:"4px 10px",fontSize:"11px",color:e.color.secondary})),JH=Ct.span(({theme:e})=>({backgroundColor:e.color.medium,color:e.textMutedColor,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600})),ZH=Ct.div(({theme:e})=>({padding:"8px 16px",backgroundColor:e.background.app})),eW=Ct.div(({theme:e})=>({padding:"12px 14px",marginBottom:"8px",backgroundColor:e.background.content,borderRadius:"6px",border:`1px solid ${e.appBorderColor}`})),tW=Ct.div({display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"}),nW=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}})),rW=Ct.div(({theme:e})=>({fontSize:"13px",fontWeight:500,color:e.color.defaultText,lineHeight:"1.4"})),oW=Ct.div(({theme:e})=>({fontSize:"12px",color:e.textMutedColor,marginTop:"8px",paddingTop:"8px",borderTop:`1px solid ${e.appBorderColor}`,lineHeight:"1.4"})),iW=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}})),sW=Ct.span(({theme:e})=>({fontSize:"10px",fontWeight:600,color:e.textMutedColor,backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"8px"})),aW=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"},DI=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},lW=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"}}),cW=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"}})),xx=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"},uW=(e,t)=>{switch(e||xx(t)){case"post-ai-validation":return"\u2699\uFE0F";case"ai-validation":return"\u2726";case"user":return"\u{1F464}";default:return"\u2699\uFE0F"}},RI=(e,t)=>{switch(e||xx(t)){case"post-ai-validation":return"Pre-filter";case"ai-validation":return"Haiku";case"user":return"Manual";default:return"Auto"}},pW=Ct.div(({theme:e})=>({padding:"20px",margin:"20px",backgroundColor:e.background.negative,borderRadius:"8px",borderLeft:`4px solid ${e.color.negative}`})),dW=Ct.h3(({theme:e})=>({fontSize:"16px",fontWeight:600,color:e.color.negative,marginTop:0,marginBottom:"8px"})),fW=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"})),gW=Ct(Vx)({marginTop:"12px"}),hx=class extends Ue.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?Ue.createElement(pW,null,Ue.createElement(dW,null,"\u26A0\uFE0F Issues Panel Error"),Ue.createElement("p",null,"Something went wrong displaying the issues. This might happen if a fix failed or there's invalid data."),Ue.createElement(fW,null,this.state.error?.message||"Unknown error",`
|
|
129
151
|
|
|
130
|
-
`,this.state.error?.stack),
|
|
131
|
-
`).forEach(
|
|
152
|
+
`,this.state.error?.stack),Ue.createElement(gW,{onClick:this.handleReset},"Try Again")):this.props.children}},zI=()=>{let{currentStoryId:e}=rt(),{currentReviewId:t,isReviewing:n,reviewHistory:r,toggleIssueSelection:o,applyFixesResult:i,setApplyFixesResult:s}=ie(),{dismissAndSync:a,undismissAndSync:u}=WT(),{loadingMapping:c}=rt(),l=!!e&&!t&&!n&&c,[d,f]=Ue.useState(!1),[p,g]=Ue.useState(!1),[S,C]=Ue.useState(!1),{isSupported:F,isDetecting:k}=nm(),{refreshStorybookOnly:R}=Uo(),{generateBatchFixes:z,isGenerating:_,error:M,timing:B,progress:m,usage:x,selfReview:b,lastStorybookRoot:E}=Jg(),{applyFixes:h,isApplying:T}=Qg({onComplete:R,storybookRoot:E}),I=r.find(W=>W.id===t),v=I?.issues||[],A=Ue.useMemo(()=>v.filter(W=>!W.dismissed),[v]),P=Ue.useMemo(()=>v.filter(W=>W.dismissed),[v]),D=Ue.useMemo(()=>{let W={postAiValidation:0,aiValidation:0,user:0};for(let Ae of P)switch(Ae.dismissedBy){case"post-ai-validation":W.postAiValidation++;break;case"ai-validation":W.aiValidation++;break;default:W.user++;break}return W},[P]),N=A,w=I?.modelId||"unknown",j=A.filter(W=>W.severity==="critical").length,G=A.filter(W=>W.severity==="major").length,L=A.filter(W=>W.severity==="minor").length,K=I?Si(j,G,L):void 0,ee=I?.visualSimilarity,re=I?.costUsd,de=I?.reviewDurationMs,ae=I?.inputTokens,qe=I?.outputTokens,tt=I?.cacheCreationTokens,se=I?.cacheReadTokens,pe=I?.parentReviewId?r.find(W=>W.id===I.parentReviewId):null,Ie=Ue.useMemo(()=>{if(!pe||!I)return null;let W=new Set(pe.issues.map(H=>`${H.type}:${H.property||""}:${H.description}`)),Ae=new Set(N.map(H=>`${H.type}:${H.property||""}:${H.description}`)),ge=pe.issues.filter(H=>!Ae.has(`${H.type}:${H.property||""}:${H.description}`)).length,O=N.filter(H=>W.has(`${H.type}:${H.property||""}:${H.description}`)).length,U=N.filter(H=>!W.has(`${H.type}:${H.property||""}:${H.description}`)).length;return{resolved:ge,remaining:O,newIssues:U}},[pe,I,N]),ze=()=>{N.forEach(W=>{W.selectedForFix||o(W.id)})},me=()=>{N.forEach(W=>{W.selectedForFix&&o(W.id)})},Nt=()=>{N.forEach(W=>{W.generatedFix&&W.generatedFix.status==="ready"&&!W.selectedForFix&&o(W.id)})},{featureFlags:he}=ie(),vt=()=>{if(!he.enableFixGeneration){y.warn("[IssuesPanel] Fix generation is disabled by feature flag");return}let W=N.filter(Ae=>Ae.selectedForFix);if(W.length===0){y.warn("[IssuesPanel] No issues selected for fix generation");return}y.debug(`[IssuesPanel] Generating fixes for ${W.length} issue(s)`,W),z(W)},Ge=()=>{if(!he.enableFixApply){y.warn("[IssuesPanel] Fix apply is disabled by feature flag");return}let W=N.filter(ge=>ge.selectedForFix&&ge.generatedFix&&ge.generatedFix.status==="ready"&&ge.generatedFix.code&&ge.generatedFix.filePath);if(W.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let Ae=W.map(ge=>({id:ge.id,reviewId:ge.reviewId,type:ge.type,severity:ge.severity,title:ge.title,description:ge.description,generatedFix:ge.generatedFix,storyId:I?.storyId||""}));y.debug(`[IssuesPanel] Applying AI-generated fixes for ${Ae.length} issue(s)`,Ae),h(Ae)},lt=W=>{let Ae=N.find(O=>O.id===W);if(!Ae){y.warn("[IssuesPanel] Issue not found:",W);return}if(!Ae.generatedFix||Ae.generatedFix.status!=="ready"||!Ae.generatedFix.code||!Ae.generatedFix.filePath){y.warn("[IssuesPanel] Issue does not have a ready AI-generated fix:",W);return}let ge={id:Ae.id,reviewId:Ae.reviewId,type:Ae.type,severity:Ae.severity,title:Ae.title,description:Ae.description,generatedFix:Ae.generatedFix,storyId:I?.storyId||""};y.debug("[IssuesPanel] Applying single AI-generated fix for issue:",ge),h([ge])},nt=async()=>{let W=N.filter(ge=>ge.selectedForFix&&ge.generatedFix&&ge.generatedFix.status==="ready"&&ge.generatedFix.code&&ge.generatedFix.filePath);if(W.length===0){y.warn("[IssuesPanel] No issues with ready AI-generated fixes selected");return}let Ae=W.map(ge=>{let O=ge.generatedFix,U=[];return U.push(`// File: ${O.filePath}`),U.push(`// Issue: ${ge.title||ge.description}`),ge.currentValue&&U.push(`// Actual: ${ge.currentValue}`),ge.suggestedValue&&U.push(`// Expected (Figma): ${ge.suggestedValue}`),O.diffPreview&&(U.push("//"),U.push("// Diff:"),O.diffPreview.split(`
|
|
153
|
+
`).forEach(H=>{U.push(`// ${H}`)})),U.push("//"),U.push("// Full Fixed Code:"),U.push(O.code),U.join(`
|
|
132
154
|
`)}).join(`
|
|
133
155
|
|
|
134
156
|
`+"=".repeat(60)+`
|
|
135
157
|
|
|
136
|
-
`);
|
|
158
|
+
`);g(!0);try{await rm(Ae)?y.debug(`[IssuesPanel] Copied ${W.length} fix(es) to clipboard`):y.error("[IssuesPanel] Failed to copy fixes to clipboard"),setTimeout(()=>g(!1),1500)}catch(ge){y.error("[IssuesPanel] Error copying fixes:",ge),g(!1)}},ne=async W=>{W.stopPropagation();let Ae=P.map(O=>[`[${O.severity.toUpperCase()}] ${O.title||O.description}`,`Phase: ${RI(O.dismissedBy,O.dismissReason)}`,O.dismissReason?`Reason: ${DI(O.dismissReason)}`:"",O.property?`Property: ${O.property}`:"",O.currentValue?`Current: ${O.currentValue}`:"",O.suggestedValue?`Expected: ${O.suggestedValue}`:""].filter(Boolean).join(`
|
|
137
159
|
`)).join(`
|
|
138
160
|
|
|
139
161
|
---
|
|
140
162
|
|
|
141
|
-
`),
|
|
163
|
+
`),ge=`Filtered Issues (${P.length})
|
|
142
164
|
${"=".repeat(40)}
|
|
143
165
|
|
|
144
|
-
`;try{await navigator.clipboard.writeText(_+Xe),F(!0),setTimeout(()=>F(!1),2e3)}catch($){b.error("Failed to copy dismissed issues:",$)}};return _e.createElement(N3,null,ie&&_e.createElement(O3,null,_e.createElement(_3,null,"\u{1F4CA} Progress:"),_e.createElement(Mm,{variant:"resolved"},"\u2705 ",ie.resolved," resolved"),_e.createElement(Mm,{variant:"remaining"},"\u23F3 ",ie.remaining," remaining"),ie.newIssues>0&&_e.createElement(Mm,{variant:"new"},"\u{1F195} ",ie.newIssues," new"),_e.createElement($3,null,"Iteration ",y?.iterationNumber||1)),_e.createElement(Bm,null,_e.createElement(CC,{issues:x,modelId:U,complianceScore:ee,visualSimilarity:J,costUsd:Le,reviewDurationMs:Ee,inputTokens:We,outputTokens:st,cacheCreationTokens:te,cacheReadTokens:Y,onToggleSelection:o,onSelectAll:ue,onSelectNone:ct,onSelectAllFixes:Ge,onGenerateFixes:yn,onApplyFixes:qe,onApplyFix:fe,onCopyAllFixes:kt,onDismiss:i,onUndismiss:s,isGenerating:E,isApplying:I,isCopying:m,applyFixesResult:a,onDismissResult:()=>u(null),generationTiming:g,generationUsage:v,hasReviewBeenRun:!!y,isLoadingReview:p,generationProgress:w,autoApplySupported:k,selfReview:A})),B.length>0&&_e.createElement(U3,null,_e.createElement(j3,null,_e.createElement(H3,{onClick:()=>d(!f)},_e.createElement("span",null,f?"\u25BC":"\u25B6"),_e.createElement("span",null,"Filtered out"),_e.createElement(V3,null,B.length),_e.createElement(e6,null,N.postAiValidation>0&&_e.createElement("span",null,"\u2699\uFE0F ",N.postAiValidation),N.aiValidation>0&&_e.createElement("span",null,"\u2726 ",N.aiValidation),N.user>0&&_e.createElement("span",null,"\u{1F464} ",N.user))),_e.createElement(W3,{onClick:yr},T?"\u2713 Copied!":"Copy")),f&&_e.createElement(G3,null,(()=>{let pe=B.reduce(($,W)=>{let Z=J3(W.dismissReason);return $[Z]||($[Z]=[]),$[Z].push(W),$},{}),Xe=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(pe).sort(($,W)=>Xe.indexOf($)-Xe.indexOf(W)).map($=>_e.createElement(_e.Fragment,{key:$},_e.createElement(X3,null,$,_e.createElement(Q3,null,pe[$].length)),pe[$].map(W=>_e.createElement(q3,{key:W.id},_e.createElement(Z3,{phase:W.dismissedBy||Dm(W.dismissReason)||"post-ai-validation"},t6(W.dismissedBy,W.dismissReason)," ",IC(W.dismissedBy,W.dismissReason)),_e.createElement(Y3,null,"[",W.severity.toUpperCase(),"] ",W.title||W.description),W.dismissReason&&_e.createElement(K3,null,TC(W.dismissReason))))))})())))};var s6=ra.div({marginTop:"20px"}),a6=ra.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),l6=ra.div({display:"flex",alignItems:"center"}),Rm=ra(Xr)({padding:"10px 16px"}),c6=ra.div({minHeight:"200px"}),zm=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r}=se(),o=r.length>1||n&&Object.keys(n.byModel).length>1;return xr.createElement(s6,null,xr.createElement(a6,null,xr.createElement(l6,null,xr.createElement(Rm,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),xr.createElement(Rm,{active:e==="chat",onClick:()=>t("chat")},o?"Models":"Chat"),xr.createElement(Rm,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),xr.createElement(c6,null,e==="chat"&&(o?xr.createElement(Uk,null):xr.createElement(vm,null)),e==="issues"&&xr.createElement(FC,null),e==="prompt"&&xr.createElement(wm,null)))};ke();Re();import re,{useState as _i,useRef as _m,useEffect as f6,useMemo as g6}from"react";import{styled as ht}from"storybook/theming";Me();var yc={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},oa="uicopilot_feature_flags";function Nm(){try{let e=localStorage.getItem(oa);if(e){let t=JSON.parse(e);return{...yc,...t}}}catch(e){b.warn("[FeatureFlags] Failed to load from localStorage:",e)}return yc}function u6(e,t){try{let r={...Nm(),[e]:t},o={};for(let i in r){let s=i;r[s]!==yc[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(oa,JSON.stringify(o)):localStorage.removeItem(oa),b.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){b.error("[FeatureFlags] Failed to set flag:",n)}}function p6(){try{localStorage.removeItem(oa),b.debug("[FeatureFlags] Reset to defaults")}catch(e){b.error("[FeatureFlags] Failed to reset:",e)}}function Om(e){return Nm()[e]}function d6(){let e=Object.keys(yc).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(oa,JSON.stringify(e)),b.debug("[FeatureFlags] All features enabled! Reload to apply.")}catch(t){b.error("[FeatureFlags] Failed to enable all features:",t)}}typeof window<"u"&&(window.uicopilot={...window.uicopilot,featureFlags:{get:Nm,set:u6,reset:p6,enableAll:d6,isEnabled:Om}});Me();nt();var ia=ht.div({marginTop:"20px"}),$m=ht.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Um=ht.div({display:"flex",alignItems:"center",gap:"12px"}),sa=ht.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),m6=ht.div({display:"flex",gap:"8px"}),EC=ht.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}})),AC=ht.div(({layout:e})=>({display:e==="side-by-side"?"grid":"flex",gridTemplateColumns:e==="side-by-side"?"1fr 1fr":void 0,gap:e==="side-by-side"?"12px":0,position:"relative",width:"100%",justifyContent:e==="overlay"?"center":void 0})),jm=ht.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:e.background.app,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center"})),Hm=ht.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.7)",color:e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),h6=ht.button(({theme:e})=>({position:"absolute",top:"6px",right:"6px",width:"24px",height:"24px",padding:"0",backgroundColor:e.base==="dark"?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.7)",border:"none",borderRadius:"3px",color:e.color.inverseText,cursor:"pointer",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,transition:"all 0.2s","&:hover":{backgroundColor:e.color.secondary},"&:disabled":{opacity:.5,cursor:"not-allowed"}})),x6=ht.img(({opacity:e=1})=>({maxWidth:"100%",maxHeight:"120px",height:"auto",display:"block",objectFit:"contain",opacity:e})),y6=ht.img({display:"block",objectFit:"contain",maxHeight:"120px",maxWidth:"100%"}),b6=ht.div({position:"relative",display:"inline-block"}),$le=ht.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"}})),S6=ht.div({position:"relative",display:"inline-block"}),Ule=ht.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})),w6=ht.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),v6=ht.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),k6=ht.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),C6=ht.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),T6=ht.input({flex:1}),Wm=ht.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),jle=ht.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),PC=ht.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),$i=ht.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%"}}})),Ui=ht.div({textAlign:"center",zIndex:1}),ji=ht.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)"}}})),Hi=ht.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Vm=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let{currentMapping:r,loadingMapping:o}=Ye(),{figmaImageUrl:i,storybookImageUrl:s,figmaDimensions:a,setFigmaImageUrl:u,hoveredIssueId:c,reviewHistory:l,currentReviewId:p}=se(),{selectedProjectId:f}=Qe(),{sessionToken:d}=Ie(),m=Om("enableHoverHighlight"),[S,T]=_i("side-by-side"),[F,k]=_i(.5),[z,R]=_i(!1),[O,E]=_i(!1);f6(()=>{E(!1)},[i]);let[D,g]=_i(null),[w,v]=_i(null),A=_m(null),h=_m(null),C=_m(null),I=g6(()=>{if(!m||!c||!p)return null;let B=l.find(N=>N.id===p);return B?.issues&&B.issues.find(N=>N.id===c)||null},[c,p,l]),y=B=>{let N=B.currentTarget;E(!0),!at.getState().figmaDimensions&&N.naturalWidth&&N.naturalHeight&&at.getState().setFigmaDimensions({width:N.naturalWidth,height:N.naturalHeight}),requestAnimationFrame(()=>{if(h.current){let{clientWidth:U,clientHeight:H}=h.current;U&&H&&v({width:U,height:H})}})},P=()=>{requestAnimationFrame(()=>{if(A.current){let{clientWidth:B,clientHeight:N}=A.current;B&&N&&g({width:B,height:N})}})},L=async()=>{if(!(!f||!d)){R(!0);try{let B=G();await ne(`${B}/api/figma/frames/invalidate?projectId=${f}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},credentials:"include"}),u(null),b.debug("Figma cache cleared, image will reload on next review")}catch(B){b.error("Failed to refresh Figma:",B)}finally{R(!1)}}};return e?re.createElement(ia,null,re.createElement($m,null,re.createElement(Um,null,re.createElement(sa,null,"Screenshot Comparison"))),re.createElement(PC,null,re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,"Loading Figma..."))),re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,"Loading Storybook..."))))):!i&&!s&&!r?o?re.createElement(ia,null,re.createElement($m,null,re.createElement(Um,null,re.createElement(sa,null,"Screenshot Comparison"))),re.createElement(PC,null,re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,"Loading..."))))):re.createElement(ia,null,re.createElement(sa,null,"Screenshot Comparison"),re.createElement(Wm,null,"No Figma mapping. Link this story to a Figma frame to compare designs.")):!i&&!s?re.createElement(ia,null,re.createElement(sa,null,"Screenshot Comparison"),re.createElement(Wm,null,"No screenshots available. Run a review to capture Figma and Storybook screenshots.")):re.createElement(ia,{ref:C},re.createElement($m,null,re.createElement(Um,null,re.createElement(sa,null,"Screenshot Comparison")),re.createElement(m6,null,re.createElement(EC,{active:S==="side-by-side",onClick:()=>T("side-by-side")},"Side by Side"),re.createElement(EC,{active:S==="overlay",onClick:()=>T("overlay")},"Overlay"))),S==="side-by-side"?re.createElement(AC,{layout:"side-by-side"},i&&!t?re.createElement(jm,null,re.createElement(Hm,null,"Figma Design"),re.createElement(h6,{onClick:L,disabled:z,title:"Refresh Figma cache and reload image"},z?"\u23F3":"\u{1F504}"),re.createElement(b6,null,re.createElement(y6,{ref:h,src:i,alt:"Figma design",onLoad:y,style:D?{width:D.width,height:D.height}:{maxWidth:"100%",maxHeight:"120px"}}))):!r&&!o?re.createElement(jm,null,re.createElement(Hm,null,"Figma Design"),re.createElement(Wm,{style:{border:"none",padding:"20px"}},"No Figma mapping. Link this story to a Figma frame to compare designs.")):re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,t?"Refreshing Figma...":"Loading Figma..."))),s&&!n?re.createElement(jm,null,re.createElement(Hm,null,"Storybook Component"),re.createElement(x6,{ref:A,src:s,alt:"Storybook component",onLoad:P})):re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,n?"Refreshing Storybook...":"Loading Storybook...")))):re.createElement(re.Fragment,null,re.createElement(AC,{layout:"overlay"},re.createElement(S6,null,i&&s?re.createElement(re.Fragment,null,re.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},re.createElement(w6,{ref:A,src:s,alt:"Storybook component",onLoad:P,style:{maxHeight:"200px"}}),D&&re.createElement(v6,{src:i,alt:"Figma design overlay",style:{opacity:F,width:D.width,height:D.height,objectFit:"fill"}})),re.createElement("div",{style:{fontSize:"10px",color:"#888",marginTop:"8px",textAlign:"center"}},re.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",re.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),D&&` \u2022 ${D.width}\xD7${D.height}px`)):re.createElement($i,null,re.createElement(Ui,null,re.createElement(ji,null),re.createElement(Hi,null,"Loading Images..."))))),s&&i&&re.createElement(k6,null,re.createElement(C6,null,"Figma Opacity:"),re.createElement(T6,{type:"range",min:"0",max:"1",step:"0.01",value:F,onChange:B=>k(parseFloat(B.target.value))}),re.createElement("span",null,Math.round(F*100),"%"))))};ke();nt();var F6=Xo.div({padding:"20px",height:"100%",overflowY:"auto"}),bc=Xo.div({marginBottom:"20px"}),LC=Xo.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"})),MC=Xo.span({fontSize:"16px",flexShrink:0}),E6=Xo.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})),BC=Xo.div({flex:1}),A6=Xo(Wn)(({theme:e})=>({padding:"6px 12px",fontSize:"12px",color:e.color.negative||"#dc2626",borderColor:e.color.negative||"#fca5a5","&:hover:not(:disabled)":{backgroundColor:e.background.negative||"#fee2e2"}})),Gm=()=>{let{reviewError:e,getCurrentReview:t}=se(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Qi(),{selectedProjectId:s}=ir(),{setCurrentMapping:a,deleteMapping:u,currentMapping:c,hasMapping:l}=No(),[p,f]=I6(!1),{currentStoryId:d,currentStoryName:m}=Ye(),{isLoadingScreenshots:S,isLoadingFigma:T,isLoadingStorybook:F,screenshotError:k,setFigmaImageDirect:z}=Eo(),R=async O=>{b.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",O),b.debug("[ReviewPanel] frame.id:",O?.id);let E=at.getState(),D=E.selectedProjectId,g=E.currentStoryId,w=E.currentStoryName,v=E.figmaFileUrl;b.debug("[ReviewPanel] selectedProjectId (from store):",D),b.debug("[ReviewPanel] currentStoryId (from store):",g),b.debug("[ReviewPanel] currentStoryName (from store):",w),O.thumbnail&&g&&(b.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),z(g,O.id,O.thumbnail));try{let A=G(),h=localStorage.getItem("uicopilot_session_token");if(b.debug("[ReviewPanel] sessionToken exists:",!!h),b.debug("[ReviewPanel] dashboardUrl:",A),!h||!D||!g){b.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!h,selectedProjectId:D,currentStoryId:g});return}let C=v?.match(/\/file\/([^\/]+)/)?.[1]||void 0;b.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:D,storyId:g,name:w,figmaNodeId:O.id,figmaFileKey:C});let I=await ne(`${A}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h}`},body:JSON.stringify({projectId:D,storyId:g,name:w,figmaNodeId:O.id,figmaFileKey:C})});if(I.ok){let y=await I.json();y.mapping&&(a(y.mapping),O.thumbnail||(b.debug("[ReviewPanel] No thumbnail available, triggering fetch"),at.getState().triggerScreenshotRefresh()),b.debug("[ReviewPanel] Mapping saved successfully:",y.mapping))}else{let y=await I.text();b.error("[ReviewPanel] Failed to save mapping:",y)}}catch(A){b.error("[ReviewPanel] Error saving mapping:",A)}};return vt.createElement(F6,null,vt.createElement(bc,null,vt.createElement(yg,null)),e&&vt.createElement(LC,null,vt.createElement(MC,null,"\u26A0\uFE0F"),vt.createElement(BC,null,e)),k&&vt.createElement(LC,null,vt.createElement(MC,null,"\u26A0\uFE0F"),vt.createElement(BC,null,"Screenshot loading error: ",k)),n?.variantMismatch&&vt.createElement(E6,null,vt.createElement("span",{style:{fontSize:16,flexShrink:0}},"\u26A0"),vt.createElement("span",null,vt.createElement("strong",null,"Variant mismatch:")," Storybook is showing ",vt.createElement("strong",null,n.storybookVariant)," but Figma frame is ",vt.createElement("strong",null,n.figmaVariant),". Some differences may be expected.")),vt.createElement(bc,null,vt.createElement(zm,null)),vt.createElement(bc,null,vt.createElement(Vm,{isLoading:S,isLoadingFigma:T,isLoadingStorybook:F})),vt.createElement(bc,null,vt.createElement(bg,null),l&&vt.createElement("div",{style:{marginTop:"8px"}},vt.createElement(A6,{onClick:()=>f(!0)},"Unlink Figma Mapping"),vt.createElement(Fi,{isOpen:p,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:async()=>{f(!1);try{let O=c?.id;O&&await u(O),a(null)}catch(O){console.error("[ReviewPanel] Failed to unlink:",O)}},onCancel:()=>f(!1)}))),vt.createElement(Ti,{isOpen:r,onClose:o,onSelect:R,figmaFileUrl:i||"",projectId:s||void 0}))};import sce from"react";import{styled as Sc}from"storybook/theming";ke();var uce=Sc.div({display:"flex",flexDirection:"column",gap:"12px"}),pce=Sc.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),dce=Sc.div(({theme:e})=>({backgroundColor:e.background.content,border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"16px",fontSize:"13px",color:e.color.defaultText,overflowY:"auto",maxHeight:"500px",lineHeight:"1.6","& h1, & h2, & h3, & h4, & h5, & h6":{marginTop:"16px",marginBottom:"8px",fontWeight:600},"& h1":{fontSize:"20px"},"& h2":{fontSize:"18px"},"& h3":{fontSize:"16px"},"& h4":{fontSize:"14px"},"& p":{marginBottom:"12px"},"& ul, & ol":{marginLeft:"20px",marginBottom:"12px"},"& li":{marginBottom:"4px"},"& code":{backgroundColor:e.background.hoverable,padding:"2px 6px",borderRadius:"3px",fontSize:"12px",fontFamily:Rl.fontMono},"& pre":{backgroundColor:e.background.hoverable,border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",padding:"12px",overflowX:"auto",marginBottom:"12px"},"& pre code":{backgroundColor:"transparent",padding:0},"& blockquote":{borderLeft:`3px solid ${e.color.secondary}`,paddingLeft:"12px",marginLeft:"0",marginBottom:"12px",color:e.color.mediumdark},"& table":{width:"100%",borderCollapse:"collapse",marginBottom:"12px"},"& th, & td":{border:`1px solid ${e.appBorderColor}`,padding:"8px",textAlign:"left"},"& th":{backgroundColor:e.background.hoverable,fontWeight:600}})),fce=Sc.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"}));ke();Me();Re();nt();import{useEffect as DC,useState as P6,useRef as qm,useCallback as L6}from"react";var M6=G(),B6=2e3;function RC(){let{sessionToken:e,usageData:t,setUsageData:n}=Ie(),[r,o]=P6(null),i=qm(null),s=qm(!1),a=qm(0);DC(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=L6(()=>{o(null)},[]);return DC(()=>{if(!e)return;let c=async()=>{let p=Date.now();if(s.current||p-a.current<B6){b.debug("[useBalanceRefresh] Skipping refresh (debounced or in progress)");return}s.current=!0,a.current=p;try{b.debug("[useBalanceRefresh] Refreshing balance...");let f=await ne(`${M6}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(f.ok){let d=await f.json(),m=d.creditBalance,S=i.current;if(S!==null&&m>S){let T=m-S;o({message:`Credits added! +$${T.toFixed(2)}`,previousBalance:S,newBalance:m}),b.debug("[useBalanceRefresh] Credits added:",T)}i.current=m,n(d),b.debug("[useBalanceRefresh] Balance updated:",m)}}catch(f){b.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}}ke();ke();Re();Me();nt();import{useEffect as D6,useRef as R6}from"react";var z6={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 zC(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=se(),{sessionToken:r}=Ie(),o=R6(null);D6(()=>{if(!r||r===o.current)return;o.current=r;let i=`${G()}/api/addon/flags`;ne(i,{headers:{Authorization:`Bearer ${r}`}}).then(s=>{if(!s.ok)throw new Error(`flags endpoint returned ${s.status}`);return s.json()}).then(s=>{b.debug("[useFeatureFlags] Received flags:",s);let a={enableFixGeneration:!!s.enableFixGeneration,enableFixApply:!!s.enableFixApply,enableAutoMap:!!s.enableAutoMap,enableReviewBadges:!!s.enableReviewBadges,showCosts:!!s.showCosts,enableParallelReview:!!s.enableParallelReview,enableModelSelection:!!s.enableModelSelection};s.role&&t(s.role);let u=s.role==="admin"&&n?z6[n]:a;e(u);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(u)),s.role&&localStorage.setItem("uicopilot_user_role",s.role)}catch{}}).catch(s=>{b.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",s.message)})},[r,e,t])}ke();Re();var _6=rr.div`
|
|
166
|
+
`;try{await navigator.clipboard.writeText(ge+Ae),C(!0),setTimeout(()=>C(!1),2e3)}catch(O){y.error("Failed to copy dismissed issues:",O)}};return Ue.createElement(WH,null,Ie&&Ue.createElement(VH,null,Ue.createElement(GH,null,"\u{1F4CA} Progress:"),Ue.createElement(mx,{variant:"resolved"},"\u2705 ",Ie.resolved," resolved"),Ue.createElement(mx,{variant:"remaining"},"\u23F3 ",Ie.remaining," remaining"),Ie.newIssues>0&&Ue.createElement(mx,{variant:"new"},"\u{1F195} ",Ie.newIssues," new"),Ue.createElement(qH,null,"Iteration ",I?.iterationNumber||1)),Ue.createElement(hx,null,Ue.createElement(BI,{issues:N,modelId:w,complianceScore:K,visualSimilarity:ee,costUsd:re,reviewDurationMs:de,inputTokens:ae,outputTokens:qe,cacheCreationTokens:tt,cacheReadTokens:se,onToggleSelection:o,onSelectAll:ze,onSelectNone:me,onSelectAllFixes:Nt,onGenerateFixes:vt,onApplyFixes:Ge,onApplyFix:lt,onCopyAllFixes:nt,onDismiss:a,onUndismiss:u,isGenerating:_,isApplying:T,isCopying:p,applyFixesResult:i,onDismissResult:()=>s(null),generationTiming:B,generationUsage:x,hasReviewBeenRun:!!I,isLoadingReview:l,isReviewing:n,generationProgress:m,autoApplySupported:F,selfReview:b})),P.length>0&&Ue.createElement(YH,null,Ue.createElement(KH,null,Ue.createElement(XH,{onClick:()=>f(!d)},Ue.createElement("span",null,d?"\u25BC":"\u25B6"),Ue.createElement("span",null,"Filtered out"),Ue.createElement(JH,null,P.length),Ue.createElement(cW,null,D.postAiValidation>0&&Ue.createElement("span",null,"\u2699\uFE0F ",D.postAiValidation),D.aiValidation>0&&Ue.createElement("span",null,"\u2726 ",D.aiValidation),D.user>0&&Ue.createElement("span",null,"\u{1F464} ",D.user))),Ue.createElement(QH,{onClick:ne},S?"\u2713 Copied!":"Copy")),d&&Ue.createElement(ZH,null,(()=>{let W=P.reduce((O,U)=>{let H=aW(U.dismissReason);return O[H]||(O[H]=[]),O[H].push(U),O},{}),Ae=["HUG/FILL Sizing","Sub-pixel Differences","Values Match","No Fix Needed","Other"];return Object.keys(W).sort((O,U)=>Ae.indexOf(O)-Ae.indexOf(U)).map(O=>Ue.createElement(Ue.Fragment,{key:O},Ue.createElement(iW,null,O,Ue.createElement(sW,null,W[O].length)),W[O].map(U=>Ue.createElement(eW,{key:U.id},Ue.createElement(tW,null,Ue.createElement(lW,{phase:U.dismissedBy||xx(U.dismissReason)||"post-ai-validation"},uW(U.dismissedBy,U.dismissReason)," ",RI(U.dismissedBy,U.dismissReason)),Ue.createElement(nW,{onClick:()=>u(U.id),title:"Restore to active issues"},"\u21A9 Restore")),Ue.createElement(rW,null,"[",U.severity.toUpperCase(),"] ",U.title||U.description),U.dismissReason&&Ue.createElement(oW,null,DI(U.dismissReason))))))})())))};var hW=ya.div({marginTop:"20px"}),xW=ya.div(({theme:e})=>({display:"flex",alignItems:"center",borderBottom:`1px solid ${e.appBorderColor}`,marginBottom:"16px"})),yW=ya.div({display:"flex",alignItems:"center"}),yx=ya(io)({padding:"10px 16px"}),bW=ya.div({minHeight:"200px"}),bx=()=>{let{reviewDetailTab:e,setReviewDetailTab:t,multiModelResults:n,selectedModels:r,userRole:o,roleOverride:i}=ie(),a=(i??o)==="admin",u=r.length>1||n&&Object.keys(n.byModel).length>1;return mW(()=>{!a&&(e==="chat"||e==="prompt")&&t("issues")},[a,e,t]),Tr.createElement(hW,null,Tr.createElement(xW,null,Tr.createElement(yW,null,a&&Tr.createElement(yx,{active:e==="prompt",onClick:()=>t("prompt")},"Prompt"),a&&Tr.createElement(yx,{active:e==="chat",onClick:()=>t("chat")},u?"Models":"Chat"),Tr.createElement(yx,{active:e==="issues",onClick:()=>t("issues")},"Issues"))),Tr.createElement(bW,null,a&&e==="chat"&&(u?Tr.createElement(HT,null):Tr.createElement(rx,null)),e==="issues"&&Tr.createElement(zI,null),a&&e==="prompt"&&Tr.createElement(nx,null)))};ve();import Z,{useState as ri,useRef as kx,useEffect as kW,useMemo as CW}from"react";import{styled as mt,useTheme as TW}from"storybook/theming";je();De();var Uc={enableIssueTracking:!1,enableAutoFix:!1,enableFileModification:!1,enableMultiModelComparison:!0,enableBulkFixApplication:!1,enableFixUndo:!1,enableHoverHighlight:!0,enableEvaluationFixtures:!1,enableDebugMode:!1},ba="uicopilot_feature_flags";function Sx(){try{let e=localStorage.getItem(ba);if(e){let t=JSON.parse(e);return{...Uc,...t}}}catch(e){y.warn("[FeatureFlags] Failed to load from localStorage:",e)}return Uc}function SW(e,t){try{let r={...Sx(),[e]:t},o={};for(let i in r){let s=i;r[s]!==Uc[s]&&(o[s]=r[s])}Object.keys(o).length>0?localStorage.setItem(ba,JSON.stringify(o)):localStorage.removeItem(ba),y.debug(`[FeatureFlags] Set ${e} = ${t}`)}catch(n){y.error("[FeatureFlags] Failed to set flag:",n)}}function wW(){try{localStorage.removeItem(ba),y.debug("[FeatureFlags] Reset to defaults")}catch(e){y.error("[FeatureFlags] Failed to reset:",e)}}function wx(e){return Sx()[e]}function vW(){let e=Object.keys(Uc).reduce((t,n)=>({...t,[n]:!0}),{});try{localStorage.setItem(ba,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:Sx,set:SW,reset:wW,enableAll:vW,isEnabled:wx}});De();pt();import gn from"react";var NI=()=>gn.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"},gn.createElement("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),gn.createElement("circle",{cx:"12",cy:"12",r:"3"}));var vx={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"},OI=()=>gn.createElement("svg",{...vx},gn.createElement("circle",{cx:"11",cy:"11",r:"8"}),gn.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),_I=()=>gn.createElement("svg",{...vx},gn.createElement("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.71 1.71"}),gn.createElement("path",{d:"M5.17 11.75l-1.71 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),gn.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"5"}),gn.createElement("line",{x1:"2",y1:"8",x2:"5",y2:"8"}),gn.createElement("line",{x1:"16",y1:"22",x2:"16",y2:"19"}),gn.createElement("line",{x1:"22",y1:"16",x2:"19",y2:"16"})),$I=()=>gn.createElement("svg",{...vx},gn.createElement("polyline",{points:"23 4 23 10 17 10"}),gn.createElement("polyline",{points:"1 20 1 14 7 14"}),gn.createElement("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"}));var Sa=mt.div({marginTop:"20px"}),Cx=mt.div({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px",flexWrap:"wrap",gap:"8px"}),Tx=mt.div({display:"flex",alignItems:"center",gap:"12px"}),wa=mt.div(({theme:e})=>({fontSize:"13px",fontWeight:600,color:e.color.defaultText})),Ofe=mt.div({display:"flex",gap:"8px"}),_fe=mt.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}})),UI=mt.div(({layout:e})=>({display:e==="side-by-side"?"grid":"flex",gridTemplateColumns:e==="side-by-side"?"1fr 1fr":void 0,gap:e==="side-by-side"?"12px":0,position:"relative",width:"100%",justifyContent:e==="overlay"?"center":void 0})),Ix=mt.div(({theme:e})=>({position:"relative",border:`1px solid ${e.appBorderColor}`,borderRadius:"4px",overflow:"hidden",backgroundColor:e.background.app,minHeight:"80px",maxHeight:"120px",display:"flex",alignItems:"center",justifyContent:"center"})),Fx=mt.div(({theme:e})=>({position:"absolute",top:"6px",left:"6px",backgroundColor:e.base==="dark"?"rgba(0, 0, 0, 0.8)":"rgba(0, 0, 0, 0.7)",color:e.color.inverseText,padding:"3px 6px",borderRadius:"3px",fontSize:"10px",fontWeight:600,zIndex:10})),IW=mt.div({position:"absolute",top:"6px",right:"6px",display:"flex",gap:"4px",zIndex:10}),Ex=mt.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"}})),jI=mt.div({marginTop:"12px",display:"flex",justifyContent:"center"}),HI=mt(qt)({fontSize:"12px",padding:"6px 14px",height:"auto"}),FW=mt.img(({opacity:e=1})=>({maxWidth:"100%",maxHeight:"120px",height:"auto",display:"block",objectFit:"contain",opacity:e})),EW=mt.img({display:"block",objectFit:"contain",maxHeight:"120px",maxWidth:"100%"}),AW=mt.div({position:"relative",display:"inline-block"}),$fe=mt.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"}})),PW=mt.div({position:"relative",display:"inline-block"}),Ufe=mt.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})),LW=mt.img({display:"block",maxWidth:"100%",height:"auto",objectFit:"contain"}),MW=mt.img({position:"absolute",top:"0",left:"0",pointerEvents:"none"}),BW=mt.div({marginTop:"12px",display:"flex",alignItems:"center",gap:"12px"}),DW=mt.div(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark,minWidth:"80px"})),RW=mt.input({flex:1}),Ax=mt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px",border:`1px dashed ${e.appBorderColor}`,borderRadius:"4px"})),jfe=mt.div(({theme:e})=>({padding:"40px",textAlign:"center",color:e.color.mediumdark,fontSize:"13px"})),WI=mt.div({display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"}),qi=mt.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%"}}})),Yi=mt.div({textAlign:"center",zIndex:1}),Ki=mt.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)"}}})),Xi=mt.div(({theme:e})=>({fontSize:"13px",color:e.color.mediumdark,fontWeight:500})),Px=({isLoading:e=!1,isLoadingFigma:t=!1,isLoadingStorybook:n=!1})=>{let r=TW(),{currentMapping:o,loadingMapping:i}=rt(),{figmaImageUrl:s,storybookImageUrl:a,figmaDimensions:u,setFigmaImageUrl:c,hoveredIssueId:l,reviewHistory:d,currentReviewId:f}=ie(),{selectedProjectId:p}=Ze(),{sessionToken:g}=we(),{openComponentBrowser:S}=Rs(),{hasMapping:C,deleteMapping:F,setCurrentMapping:k}=Ho(),R=wx("enableHoverHighlight"),[z,_]=ri("side-by-side"),[M,B]=ri(.5),[m,x]=ri(!1),[b,E]=ri(!1),[h,T]=ri(!1),I=async()=>{T(!1);try{let re=o?.id;re&&await F(re),k(null)}catch(re){y.error("[ScreenshotComparison] Failed to unlink:",re)}};kW(()=>{E(!1)},[s]);let[v,A]=ri(null),[P,D]=ri(null),N=kx(null),w=kx(null),j=kx(null),G=CW(()=>{if(!R||!l||!f)return null;let re=d.find(de=>de.id===f);return re?.issues&&re.issues.find(de=>de.id===l)||null},[l,f,d]),L=re=>{let de=re.currentTarget;E(!0),!ht.getState().figmaDimensions&&de.naturalWidth&&de.naturalHeight&&ht.getState().setFigmaDimensions({width:de.naturalWidth,height:de.naturalHeight}),requestAnimationFrame(()=>{if(w.current){let{clientWidth:qe,clientHeight:tt}=w.current;qe&&tt&&D({width:qe,height:tt})}})},K=()=>{requestAnimationFrame(()=>{if(N.current){let{clientWidth:re,clientHeight:de}=N.current;re&&de&&A({width:re,height:de})}})},ee=async()=>{if(!(!p||!g)){x(!0);try{let re=q();await oe(`${re}/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(re){y.error("Failed to refresh Figma:",re)}finally{x(!1)}}};return e?Z.createElement(Sa,null,Z.createElement(Cx,null,Z.createElement(Tx,null,Z.createElement(wa,null,"Screenshot Comparison"))),Z.createElement(WI,null,Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,"Loading Figma..."))),Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,"Loading Storybook..."))))):!s&&!a&&!o?i?Z.createElement(Sa,null,Z.createElement(Cx,null,Z.createElement(Tx,null,Z.createElement(wa,null,"Screenshot Comparison"))),Z.createElement(WI,null,Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,"Loading..."))))):Z.createElement(Sa,null,Z.createElement(wa,null,"Screenshot Comparison"),Z.createElement(Ax,null,"No Figma mapping. Link this story to a Figma frame to compare designs.",Z.createElement(jI,null,Z.createElement(HI,{onClick:S,disabled:!p},"\u{1F517} Map Component")))):!s&&!a?Z.createElement(Sa,null,Z.createElement(wa,null,"Screenshot Comparison"),Z.createElement(Ax,null,"No screenshots available. Run a review to capture Figma and Storybook screenshots.")):Z.createElement(Sa,{ref:j},Z.createElement(Cx,null,Z.createElement(Tx,null,Z.createElement(wa,null,"Screenshot Comparison"))),z==="side-by-side"?Z.createElement(UI,{layout:"side-by-side"},s&&!t?Z.createElement(Ix,null,Z.createElement(Fx,null,"Figma Design"),Z.createElement(IW,null,C&&Z.createElement(Ex,{accent:r.color.secondary,onClick:S,title:"Browse Figma \u2014 change mapping","aria-label":"Browse Figma"},Z.createElement(OI,null)),Z.createElement(Ex,{accent:r.color.positive,onClick:ee,disabled:m,title:"Refresh Figma cache and reload image","aria-label":"Refresh Figma cache"},Z.createElement($I,null)),C&&Z.createElement(Ex,{accent:r.color.negative,onClick:()=>T(!0),title:"Unlink Figma mapping","aria-label":"Unlink Figma mapping"},Z.createElement(_I,null))),Z.createElement(AW,null,Z.createElement(EW,{ref:w,src:s,alt:"Figma design",onLoad:L,style:{...v?{width:v.width,height:v.height}:{maxWidth:"100%",maxHeight:"120px"},opacity:b?1:0,transition:"opacity 150ms ease-in"}}))):!o&&!i?Z.createElement(Ix,null,Z.createElement(Fx,null,"Figma Design"),Z.createElement(Ax,{style:{border:"none",padding:"16px"}},"No Figma mapping.",Z.createElement(jI,null,Z.createElement(HI,{onClick:S,disabled:!p},"\u{1F517} Map Component")))):Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,t?"Refreshing Figma...":"Loading Figma..."))),a&&!n?Z.createElement(Ix,null,Z.createElement(Fx,null,"Storybook Component"),Z.createElement(FW,{ref:N,src:a,alt:"Storybook component",onLoad:K})):Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,n?"Refreshing Storybook...":"Loading Storybook...")))):Z.createElement(Z.Fragment,null,Z.createElement(UI,{layout:"overlay"},Z.createElement(PW,null,s&&a?Z.createElement(Z.Fragment,null,Z.createElement("div",{style:{position:"relative",display:"inline-block",border:"1px solid #ccc",borderRadius:"4px",overflow:"hidden"}},Z.createElement(LW,{ref:N,src:a,alt:"Storybook component",onLoad:K,style:{maxHeight:"200px"}}),v&&Z.createElement(MW,{src:s,alt:"Figma design overlay",style:{opacity:M,width:v.width,height:v.height,objectFit:"fill"}})),Z.createElement("div",{style:{fontSize:"10px",color:"#888",marginTop:"8px",textAlign:"center"}},Z.createElement("span",{style:{color:"#1ea7fd"}},"Storybook (base)")," + ",Z.createElement("span",{style:{color:"#667eea"}},"Figma (overlay)"),v&&` \u2022 ${v.width}\xD7${v.height}px`)):Z.createElement(qi,null,Z.createElement(Yi,null,Z.createElement(Ki,null),Z.createElement(Xi,null,"Loading Images..."))))),a&&s&&Z.createElement(BW,null,Z.createElement(DW,null,"Figma Opacity:"),Z.createElement(RW,{type:"range",min:"0",max:"1",step:"0.01",value:M,onChange:re=>B(parseFloat(re.target.value))}),Z.createElement("span",null,Math.round(M*100),"%"))),Z.createElement(Di,{isOpen:h,title:"Unlink Figma Mapping",message:"Unlink this story from its Figma mapping?",confirmLabel:"Unlink",variant:"danger",onConfirm:I,onCancel:()=>T(!1)}))};ve();pt();var zW=Qi.div({height:"100%"}),Lx=Qi.div({marginBottom:"20px"}),VI=Qi.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"})),GI=Qi.span({fontSize:"16px",flexShrink:0}),NW=Qi.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})),qI=Qi.div({flex:1}),Mx=()=>{let{reviewError:e,getCurrentReview:t}=ie(),n=t(),{showComponentBrowser:r,closeComponentBrowser:o,figmaFileUrl:i}=Rs(),{selectedProjectId:s}=qr(),{setCurrentMapping:a}=Ho(),{currentStoryId:u,currentStoryName:c}=rt(),{isLoadingScreenshots:l,isLoadingFigma:d,isLoadingStorybook:f,screenshotError:p,setFigmaImageDirect:g}=Uo(),S=async C=>{y.debug("[ReviewPanel] handleSelectFrame CALLED with frame:",C),y.debug("[ReviewPanel] frame.id:",C?.id);let F=ht.getState(),k=F.selectedProjectId,R=F.currentStoryId,z=F.currentStoryName,_=F.figmaFileUrl;y.debug("[ReviewPanel] selectedProjectId (from store):",k),y.debug("[ReviewPanel] currentStoryId (from store):",R),y.debug("[ReviewPanel] currentStoryName (from store):",z),C.thumbnail&&R&&(y.debug("[ReviewPanel] Setting Figma image directly BEFORE mapping save (instant display)"),g(R,C.id,C.thumbnail));try{let M=q(),B=localStorage.getItem("uicopilot_session_token");if(y.debug("[ReviewPanel] sessionToken exists:",!!B),y.debug("[ReviewPanel] dashboardUrl:",M),!B||!k||!R){y.error("[ReviewPanel] Missing required data for saving mapping:",{hasSessionToken:!!B,selectedProjectId:k,currentStoryId:R});return}let m=_?.match(/\/file\/([^\/]+)/)?.[1]||void 0;y.debug("[ReviewPanel] Making POST to /api/mappings with:",{projectId:k,storyId:R,name:z,figmaNodeId:C.id,figmaFileKey:m});let x=await oe(`${M}/api/mappings`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${B}`},body:JSON.stringify({projectId:k,storyId:R,name:z,figmaNodeId:C.id,figmaFileKey:m})});if(x.ok){let b=await x.json();b.mapping&&(a(b.mapping),C.thumbnail||(y.debug("[ReviewPanel] No thumbnail available, triggering fetch"),ht.getState().triggerScreenshotRefresh()),y.debug("[ReviewPanel] Mapping saved successfully:",b.mapping))}else{let b=await x.text();y.error("[ReviewPanel] Failed to save mapping:",b)}}catch(M){y.error("[ReviewPanel] Error saving mapping:",M)}};return Qt.createElement(zW,null,Qt.createElement(Lx,null,Qt.createElement(eh,null)),e&&Qt.createElement(VI,null,Qt.createElement(GI,null,"\u26A0\uFE0F"),Qt.createElement(qI,null,e)),p&&Qt.createElement(VI,null,Qt.createElement(GI,null,"\u26A0\uFE0F"),Qt.createElement(qI,null,"Screenshot loading error: ",p)),n?.variantMismatch&&Qt.createElement(NW,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(Lx,null,Qt.createElement(Px,{isLoading:l,isLoadingFigma:d,isLoadingStorybook:f})),Qt.createElement(Lx,null,Qt.createElement(bx,null)),Qt.createElement(Mi,{isOpen:r,onClose:o,onSelect:S,figmaFileUrl:i||"",projectId:s||void 0}))};ve();De();je();pt();import{useEffect as YI,useState as OW,useRef as Bx,useCallback as _W}from"react";var $W=q(),UW=2e3;function KI(){let{sessionToken:e,usageData:t,setUsageData:n}=we(),[r,o]=OW(null),i=Bx(null),s=Bx(!1),a=Bx(0);YI(()=>{t?.creditBalance!==void 0&&i.current===null&&(i.current=t.creditBalance)},[t?.creditBalance]);let u=_W(()=>{o(null)},[]);return YI(()=>{if(!e)return;let c=async()=>{let d=Date.now();if(s.current||d-a.current<UW){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 oe(`${$W}/api/addon/account`,{headers:{Authorization:`Bearer ${e}`}});if(f.ok){let p=await f.json(),g=p.creditBalance,S=i.current;if(S!==null&&g>S){let C=g-S;o({message:`Credits added! +${Math.floor(C)} credit(s)`,previousBalance:S,newBalance:g}),y.debug("[useBalanceRefresh] Credits added:",C)}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}}ve();ve();je();De();pt();fg();import{useEffect as jW,useRef as HW}from"react";var WW=300*1e3,XI="uicopilot_feature_flags_fetched_at";function VW(){if(typeof localStorage>"u")return!1;try{let e=localStorage.getItem(XI);if(!e)return!1;let t=parseInt(e,10);return Number.isNaN(t)?!1:Date.now()-t<WW}catch{return!1}}var Dx=null,GW={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 QI(){let{setFeatureFlags:e,setUserRole:t,roleOverride:n}=ie(),{sessionToken:r,resetAuth:o}=we(),i=HW(null);jW(()=>{if(!r||r===i.current)return;if(i.current=r,VW()){y.debug("[useFeatureFlags] Cache fresh, skipping fetch");return}if(Dx){y.debug("[useFeatureFlags] Reusing in-flight fetch");return}let s=`${q()}/api/addon/flags`;Dx=oe(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"&&ew());let c=a.role==="admin"&&n?GW[n]:u;e(c);try{localStorage.setItem("uicopilot_feature_flags",JSON.stringify(c)),a.role&&localStorage.setItem("uicopilot_user_role",a.role),localStorage.setItem(XI,Date.now().toString())}catch{}}).catch(a=>{y.warn("[useFeatureFlags] Failed to fetch flags, using defaults:",a.message)}).finally(()=>{Dx=null})},[r,e,t])}ve();je();var KW={success:"linear-gradient(135deg, #10b981 0%, #059669 100%)",warning:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",error:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)"},XW=fr.div`
|
|
145
167
|
position: fixed;
|
|
146
168
|
top: 16px;
|
|
147
169
|
right: 16px;
|
|
148
|
-
background:
|
|
170
|
+
background: ${({variant:e})=>KW[e||"success"]};
|
|
149
171
|
color: white;
|
|
150
172
|
padding: 12px 20px;
|
|
151
173
|
border-radius: 8px;
|
|
@@ -159,22 +181,22 @@ ${"=".repeat(40)}
|
|
|
159
181
|
from { transform: translateX(100%); opacity: 0; }
|
|
160
182
|
to { transform: translateX(0); opacity: 1; }
|
|
161
183
|
}
|
|
162
|
-
|
|
184
|
+
`,QW=fr.span`font-size: 20px;`,JW=fr.span`font-weight: 500; font-size: 14px;`,ZW=fr.button`
|
|
163
185
|
background: rgba(255, 255, 255, 0.2);
|
|
164
186
|
border: none; color: white;
|
|
165
187
|
width: 24px; height: 24px; border-radius: 50%;
|
|
166
188
|
cursor: pointer; display: flex; align-items: center; justify-content: center;
|
|
167
189
|
font-size: 14px; margin-left: 8px;
|
|
168
190
|
&:hover { background: rgba(255, 255, 255, 0.3); }
|
|
169
|
-
`,
|
|
191
|
+
`,e8=fr.div`
|
|
170
192
|
padding: 8px 16px;
|
|
171
193
|
border-top: 1px solid ${({theme:e})=>e.appBorderColor};
|
|
172
194
|
font-size: 11px;
|
|
173
195
|
color: ${({theme:e})=>e.color.mediumdark};
|
|
174
196
|
text-align: center;
|
|
175
197
|
opacity: 0.7;
|
|
176
|
-
`,
|
|
177
|
-
`);r=d.pop()||"";for(let m of d)if(m.startsWith("data: "))try{let S=JSON.parse(m.slice(6));if(S.type==="complete"){o=S.complianceScore??S.validation?.complianceScore??null;let F=(S.issues||[]).filter(k=>!k.dismissed);i=F.filter(k=>k.severity==="critical").length,s=F.filter(k=>k.severity==="major").length,a=F.filter(k=>k.severity==="minor").length,u=S.costUsd||0,c=S.inputTokens||0,l=S.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:s,minorCount:a,costUsd:u,inputTokens:c,outputTokens:l}}function wc(e,t,n,r,o){e&&e.set([{value:n,typeId:ej,storyId:t,title:r,description:o}])}async function rj(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 VC(e,t,n,r,o,i){wc(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{console.warn(`[reviewAll] Capturing for: ${e.storyName} (${e.storyId})`);let s=await rj(e.storyId);console.warn(`[reviewAll] Captured: screenshot=${!!s.screenshot} domTree=${!!s.domTree} styles=${!!s.computedStyles} for: ${e.storyName}`);let a=await tj(`${Z6}/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 nj(u,i),{score:l,criticalCount:p,majorCount:f,minorCount:d,costUsd:m,inputTokens:S,outputTokens:T}=c;if(l!==null){let F=p>0||l<70?"status-value:error":f>0||l<90?"status-value:warning":"status-value:success",k=[`Score: ${l}`];p>0&&k.push(`${p} critical`),f>0&&k.push(`${f} major`),d>0&&k.push(`${d} minor`);let z=l>=90?`\u2713 Score ${l}`:l>=70?`\u26A0 Score ${l}`:`\u2717 Score ${l}`;return wc(o,e.storyId,F,z,k.join(" \xB7 ")),{passed:l>=70,score:l,costUsd:m,inputTokens:S,outputTokens:T}}return wc(o,e.storyId,"status-value:error","Review Failed","No score received"),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}catch(s){b.error(`[reviewAll] Failed to review ${e.storyName}:`,s);let a=s instanceof Error?s.message:"Unknown error";return wc(o,e.storyId,"status-value:error","Review Failed",a),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var ij=G(),aa="uireview/badge";function GC(){let e=!1,t=!1;try{let n=oj.getChannel();n.on(Xm,async()=>{if(!t){t=!0,e=!1;try{await lj(n,()=>e)}finally{t=!1}}}),n.on(Qm,()=>{e=!0})}catch{}}async function Km(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let n=await fetch(`${ij}/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 sj(i),i}catch(e){return b.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function sj(e){try{if(typeof vc!="function")return;let t=vc(aa);if(!t)return;let n=t.getAll?.()||{},r=new Set(e.map(s=>s.storyId)),o=Object.keys(n).filter(s=>n[s]?.[aa]&&!r.has(s));o.length>0&&t.unset(o);let i=e.filter(s=>{let a=n[s.storyId]?.[aa];return!(a?.value==="status-value:success"||a?.value==="status-value:warning"||a?.value==="status-value:error")}).map(s=>({value:"status-value:pending",typeId:aa,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 aj(){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 lj(e,t){let n=await Km();if(n.length===0){e.emit(ca,{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-5-20250929";try{let S=localStorage.getItem("uicopilot_selected_models");if(S){let T=JSON.parse(S);Array.isArray(T)&&T.length>0&&(i=T[0])}}catch{}let s=null;try{typeof vc=="function"&&(s=vc(aa))}catch{}let a=aj(),u=0,c=0,l=0,p=0,f=0,d=0;e.emit(la,{total:n.length,completed:0,currentStoryName:n[0]?.storyName||""});let m=n.map(S=>()=>VC(S,r,o,i,s,t));await WC(m,a,(S,T)=>{if(T&&typeof T=="object"&&"score"in T){let F=T;F.score!==null&&F.score>=90?u++:F.score!==null&&F.score>=70?c++:l++,p+=F.costUsd||0,f+=F.inputTokens||0,d+=F.outputTokens||0}else l++;console.warn(`[reviewAll] Story ${S+1}/${n.length} done:`,n[S].storyName,T),e.emit(la,{total:n.length,completed:u+c+l,currentStoryName:n[S].storyName})},t),e.emit(ca,{total:n.length,passed:u,failed:l,warnCount:c,costUsd:p,inputTokens:f,outputTokens:d})}var uj=Kr.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),pj=Kr.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),dj=Kr.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),YC=Kr.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),KC=Kr.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}})),fj=Kr.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),gj=Kr.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),XC=Kr.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),Wi=Kr.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),Xm="uireview/review-all-start",Qm="uireview/review-all-cancel",la="uireview/review-all-progress",ca="uireview/review-all-complete";function QC(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableParallelReview:!1}catch{return!1}}var JC=()=>{let[e,t]=ua(!1),[n,r]=ua(null),[o,i]=ua(null),[s,a]=ua(null),[u,c]=ua(QC);Jm(()=>{let m=()=>c(QC()),S=setInterval(m,2e3);return window.addEventListener("storage",m),()=>{clearInterval(S),window.removeEventListener("storage",m)}},[]),Jm(()=>{let m=()=>{Km().then(k=>{a(k.length)}).catch(()=>{})},S=setTimeout(m,3e3),T=null;try{T=kc.getChannel(),T.on("storyChanged",m),T.on("uireview/mappings-changed",m)}catch{}let F=setInterval(m,6e4);return()=>{clearTimeout(S),clearInterval(F),T&&(T.off("storyChanged",m),T.off("uireview/mappings-changed",m))}},[]),Jm(()=>{let m;try{m=kc.getChannel()}catch{return}let S=F=>{r(F),t(!0)},T=F=>{t(!1),r(null),i({total:F.total,passed:F.passed,failed:F.failed,warned:F.warnCount||0,costUsd:F.costUsd||0})};return m.on(la,S),m.on(ca,T),()=>{m.off(la,S),m.off(ca,T)}},[]);let l=qC(()=>{try{kc.getChannel().emit(Xm),t(!0),i(null)}catch{}},[]),p=qC(()=>{try{kc.getChannel().emit(Qm)}catch{}t(!1),r(null)},[]),f=n?Math.round(n.completed/n.total*100):0,d=cj();return u?Nt.createElement(uj,null,Nt.createElement(pj,null,Nt.createElement(dj,null,"UI Review"),e?Nt.createElement(KC,{running:!0,onClick:p},"Cancel"):Nt.createElement(KC,{onClick:l,disabled:!s||s===0},"Run",s?` (${s})`:"")),!e&&o?Nt.createElement(Nt.Fragment,null,Nt.createElement(XC,null,Nt.createElement(Wi,{dotColor:d.color.positive},"Pass (",o.passed,")"),Nt.createElement(Wi,{dotColor:d.color.warning},"Warn (",o.warned,")"),Nt.createElement(Wi,{dotColor:d.color.negative},"Fail (",o.failed,")")),o.costUsd>0&&Nt.createElement(YC,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:Nt.createElement(XC,null,Nt.createElement(Wi,{dotColor:d.color.positive},"Pass"),Nt.createElement(Wi,{dotColor:d.color.warning},"Warn"),Nt.createElement(Wi,{dotColor:d.color.negative},"Fail")),e&&n&&Nt.createElement(Nt.Fragment,null,Nt.createElement(fj,null,Nt.createElement(gj,{percent:f})),Nt.createElement(YC,null,"Reviewing ",Math.min(n.completed+1,n.total),"/",n.total," \u2014 ",n.currentStoryName))):null};import*as e1 from"@sentry/react";var mj="https://015e961f5f626bad5315430e02940616@o138219.ingest.us.sentry.io/4511134750539776",ZC=!1;function t1(){if(!ZC){ZC=!0;try{e1.init({dsn:mj,environment:"production",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{}}}t1();var Tc="uireview",xj=`${Tc}/panel`,yj=`${Tc}/tool`,r1=`${Tc}/test-provider`;Cc.register(Tc,()=>{if(console.log("[UI Review] Registering addon, checking for StatusStore API..."),typeof n1=="function"){console.log("[UI Review] StatusStore API available, initializing badges");let t=n1("uireview/badge");p0(t),console.log("[UI Review] Badge listener initialized")}else console.warn("[UI Review] experimental_getStatusStore not available \u2014 badges disabled");Cc.add(yj,{type:Zm.TOOL,title:"UI Review",match:({viewMode:t})=>t==="story",render:()=>pa.createElement(HC,null)}),GC(),(()=>{try{let t=localStorage.getItem("uicopilot_feature_flags");return t?!!JSON.parse(t).enableParallelReview:!1}catch{return!1}})()&&Cc.add(r1,{type:Zm.experimental_TEST_PROVIDER,id:r1,render:()=>pa.createElement(JC,null)}),Cc.add(xj,{type:Zm.PANEL,title:"UI Review",match:({viewMode:t})=>t==="story",render:({active:t})=>pa.createElement(hj,{active:t||!1},pa.createElement(Uc,null,pa.createElement($C,null)))})});
|
|
198
|
+
`,t8=fr.div(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"48px 24px",textAlign:"center",gap:"16px"})),n8=fr.div({fontSize:"32px"}),r8=fr.h3(({theme:e})=>({margin:0,fontSize:e.typography.size.s3,fontWeight:e.typography.weight.bold,color:e.color.defaultText})),o8=fr.p(({theme:e})=>({margin:0,fontSize:e.typography.size.s2,color:e.color.mediumdark,maxWidth:"320px",lineHeight:1.5})),JI=fr.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})),ZI=fr.span({flex:1}),eF=fr.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`}})),tF=()=>{let{selectedProjectId:e,projects:t,loadingProjects:n}=Ze(),{isConnected:r,sessionToken:o,authError:i}=we(),{currentStoryId:s}=rt(),{currentReviewId:a,userRole:u,roleOverride:c,setRoleOverride:l,setFeatureFlags:d}=ie(),[f,p]=qW(!1),g=()=>{l(null),o&&fetch(`${q()}/api/addon/flags`,{headers:{Authorization:`Bearer ${o}`}}).then(M=>M.json()).then(M=>{d({enableFixGeneration:!!M.enableFixGeneration,enableFixApply:!!M.enableFixApply,enableAutoMap:!!M.enableAutoMap,enableReviewBadges:!!M.enableReviewBadges,showCosts:!!M.showCosts,enableParallelReview:!!M.enableParallelReview,enableModelSelection:!!M.enableModelSelection})}).catch(()=>{})};Kg(),fm(),QI(),om(),tm();let{notification:S,dismissNotification:C}=KI();YW(()=>{if(S){let M=setTimeout(C,5e3);return()=>clearTimeout(M)}},[S,C]);let F=t.find(M=>M.id===e),k=r&&!!e&&!!F,R=!!o&&!!e&&(n||t.length===0),{loadingMapping:z}=rt(),_=k&&!!s&&!a&&z;return Mt.createElement(Qc,{header:Mt.createElement(Jc,{toolbar:Mt.createElement(bg,{onOpenSettings:()=>p(!0)})}),footer:Mt.createElement(e8,null,"UI Copilot v","0.5.3")},S&&Mt.createElement(XW,{variant:S.variant||"success"},Mt.createElement(QW,null,S.variant==="error"?"!":S.variant==="warning"?"\u26A0":"+"),Mt.createElement(JW,null,S.message),Mt.createElement(ZW,{onClick:C},"x")),i&&Mt.createElement(JI,null,Mt.createElement("span",null,"\u26A0"),Mt.createElement(ZI,null,i),Mt.createElement(eF,{onClick:()=>p(!0)},"Reconnect")),u==="admin"&&c&&Mt.createElement(JI,null,Mt.createElement("span",null,"\u{1F441}"),Mt.createElement(ZI,null,"Previewing as ",c),Mt.createElement(eF,{onClick:g},"Exit preview")),R||_?Mt.createElement(Nc,{label:R?"Loading...":"Loading review..."}):k?Mt.createElement(Mx,null):Mt.createElement(t8,null,Mt.createElement(n8,null,"\u2699"),Mt.createElement(r8,null,i?"Connection issue":"Set up UI Copilot"),Mt.createElement(o8,null,i?"Session expired or dashboard unreachable. Please reconnect.":"Connect your account and select a project to start reviewing your components against Figma designs."),Mt.createElement(qt,{onClick:()=>p(!0)},i?"Reconnect":"Open Settings")),f&&Mt.createElement(kC,{onClose:()=>p(!1)}))};import nF,{useCallback as i8}from"react";import{useStorybookApi as s8}from"storybook/manager-api";import{IconButton as a8}from"storybook/internal/components";var l8="uireview",c8=`${l8}/panel`,rF=()=>{let e=s8(),t=i8(()=>{e.togglePanel(!0),e.setSelectedPanel(c8)},[e]);return nF.createElement(a8,{key:"uireview-tool",title:"UI Review - Compare with Figma",onClick:t},nF.createElement(NI,null))};ve();import Vt,{useState as Ta,useCallback as aF,useEffect as Ox}from"react";import{styled as ro,useTheme as S8}from"storybook/theming";import{addons as Wc}from"storybook/manager-api";je();De();import{addons as m8,experimental_getStatusStore as Hc}from"storybook/manager-api";async function oF(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();De();var u8=q(),p8="uireview/badge";async function d8(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 f8(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:f}=await e.read();if(d)break;if(t()){e.cancel();break}r+=n.decode(f,{stream:!0});let p=r.split(`
|
|
199
|
+
`);r=p.pop()||"";for(let g of p)if(g.startsWith("data: "))try{let S=JSON.parse(g.slice(6));if(S.type==="complete"){o=S.complianceScore??S.validation?.complianceScore??null;let F=(S.issues||[]).filter(k=>!k.dismissed);i=F.filter(k=>k.severity==="critical").length,s=F.filter(k=>k.severity==="major").length,a=F.filter(k=>k.severity==="minor").length,u=S.costUsd||0,c=S.inputTokens||0,l=S.outputTokens||0}}catch{}}return{score:o,criticalCount:i,majorCount:s,minorCount:a,costUsd:u,inputTokens:c,outputTokens:l}}function jc(e,t,n,r,o){e&&e.set([{value:n,typeId:p8,storyId:t,title:r,description:o}])}async function g8(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 iF(e,t,n,r,o,i){jc(o,e.storyId,"status-value:pending","Reviewing...",e.storyName);try{console.warn(`[reviewAll] Capturing for: ${e.storyName} (${e.storyId})`);let s=await g8(e.storyId);console.warn(`[reviewAll] Captured: screenshot=${!!s.screenshot} domTree=${!!s.domTree} styles=${!!s.computedStyles} for: ${e.storyName}`);let a=await d8(`${u8}/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 f8(u,i),{score:l,criticalCount:d,majorCount:f,minorCount:p,costUsd:g,inputTokens:S,outputTokens:C}=c;if(l!==null){let F=d>0||l<70?"status-value:error":f>0||l<90?"status-value:warning":"status-value:success",k=[`Score: ${l}`];d>0&&k.push(`${d} critical`),f>0&&k.push(`${f} major`),p>0&&k.push(`${p} minor`);let R=l>=90?`\u2713 Score ${l}`:l>=70?`\u26A0 Score ${l}`:`\u2717 Score ${l}`;return jc(o,e.storyId,F,R,k.join(" \xB7 ")),{passed:l>=70,score:l,costUsd:g,inputTokens:S,outputTokens:C}}return jc(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 jc(o,e.storyId,"status-value:error","Review Failed",a),{passed:!1,score:null,costUsd:0,inputTokens:0,outputTokens:0}}}var h8=q(),va="uireview/badge";function sF(){let e=!1,t=!1;try{let n=m8.getChannel();n.on(zx,async()=>{if(!t){t=!0,e=!1;try{await b8(n,()=>e)}finally{t=!1}}}),n.on(Nx,()=>{e=!0})}catch{}}async function Rx(){try{let e=localStorage.getItem("uicopilot_session_token"),t=localStorage.getItem("uicopilot_selected_project_id");if(!e||!t)return[];let n=await fetch(`${h8}/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 x8(i),i}catch(e){return y.error("[useReviewAll] Failed to load mapped stories:",e),[]}}function x8(e){try{if(typeof Hc!="function")return;let t=Hc(va);if(!t)return;let n=t.getAll?.()||{},r=new Set(e.map(s=>s.storyId)),o=Object.keys(n).filter(s=>n[s]?.[va]&&!r.has(s));o.length>0&&t.unset(o);let i=e.filter(s=>{let a=n[s.storyId]?.[va];return!(a?.value==="status-value:success"||a?.value==="status-value:warning"||a?.value==="status-value:error")}).map(s=>({value:"status-value:pending",typeId:va,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 y8(){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 b8(e,t){let n=await Rx();if(n.length===0){e.emit(Ca,{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-5-20250929";try{let S=localStorage.getItem("uicopilot_selected_models");if(S){let C=JSON.parse(S);Array.isArray(C)&&C.length>0&&(i=C[0])}}catch{}let s=null;try{typeof Hc=="function"&&(s=Hc(va))}catch{}let a=y8(),u=0,c=0,l=0,d=0,f=0,p=0;e.emit(ka,{total:n.length,completed:0,currentStoryName:n[0]?.storyName||""});let g=n.map(S=>()=>iF(S,r,o,i,s,t));await oF(g,a,(S,C)=>{if(C&&typeof C=="object"&&"score"in C){let F=C;F.score!==null&&F.score>=90?u++:F.score!==null&&F.score>=70?c++:l++,d+=F.costUsd||0,f+=F.inputTokens||0,p+=F.outputTokens||0}else l++;console.warn(`[reviewAll] Story ${S+1}/${n.length} done:`,n[S].storyName,C),e.emit(ka,{total:n.length,completed:u+c+l,currentStoryName:n[S].storyName})},t),e.emit(Ca,{total:n.length,passed:u,failed:l,warnCount:c,costUsd:d,inputTokens:f,outputTokens:p})}var w8=ro.div({padding:"8px 12px",display:"flex",flexDirection:"column",gap:"6px"}),v8=ro.div({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"}),k8=ro.span(({theme:e})=>({fontSize:"12px",fontWeight:500,color:e.color.defaultText})),lF=ro.span(({theme:e})=>({fontSize:"11px",color:e.color.mediumdark})),cF=ro.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}})),C8=ro.div(({theme:e})=>({width:"100%",height:"3px",backgroundColor:e.appBorderColor,borderRadius:"2px",overflow:"hidden"})),T8=ro.div(({theme:e,percent:t})=>({width:`${t}%`,height:"100%",backgroundColor:e.color.secondary,borderRadius:"2px",transition:"width 0.3s ease"})),uF=ro.div(({theme:e})=>({display:"flex",alignItems:"center",gap:`${e.layoutMargin*.8}px`,fontSize:e.typography.size.s1,color:e.color.mediumdark})),Ji=ro.span(e=>({display:"flex",alignItems:"center",gap:"3px","&::before":{content:'""',display:"inline-block",width:"7px",height:"7px",borderRadius:"50%",backgroundColor:e.dotColor}})),zx="uireview/review-all-start",Nx="uireview/review-all-cancel",ka="uireview/review-all-progress",Ca="uireview/review-all-complete";function pF(){try{let e=localStorage.getItem("uicopilot_feature_flags");return e?!!JSON.parse(e).enableParallelReview:!1}catch{return!1}}var dF=()=>{let[e,t]=Ta(!1),[n,r]=Ta(null),[o,i]=Ta(null),[s,a]=Ta(null),[u,c]=Ta(pF);Ox(()=>{let g=()=>c(pF()),S=setInterval(g,2e3);return window.addEventListener("storage",g),()=>{clearInterval(S),window.removeEventListener("storage",g)}},[]),Ox(()=>{let g=()=>{Rx().then(k=>{a(k.length)}).catch(()=>{})},S=setTimeout(g,3e3),C=null;try{C=Wc.getChannel(),C.on("storyChanged",g),C.on("uireview/mappings-changed",g)}catch{}let F=setInterval(g,6e4);return()=>{clearTimeout(S),clearInterval(F),C&&(C.off("storyChanged",g),C.off("uireview/mappings-changed",g))}},[]),Ox(()=>{let g;try{g=Wc.getChannel()}catch{return}let S=F=>{r(F),t(!0)},C=F=>{t(!1),r(null),i({total:F.total,passed:F.passed,failed:F.failed,warned:F.warnCount||0,costUsd:F.costUsd||0})};return g.on(ka,S),g.on(Ca,C),()=>{g.off(ka,S),g.off(Ca,C)}},[]);let l=aF(()=>{try{Wc.getChannel().emit(zx),t(!0),i(null)}catch{}},[]),d=aF(()=>{try{Wc.getChannel().emit(Nx)}catch{}t(!1),r(null)},[]),f=n?Math.round(n.completed/n.total*100):0,p=S8();return u?Vt.createElement(w8,null,Vt.createElement(v8,null,Vt.createElement(k8,null,"UI Review"),e?Vt.createElement(cF,{running:!0,onClick:d},"Cancel"):Vt.createElement(cF,{onClick:l,disabled:!s||s===0},"Run",s?` (${s})`:"")),!e&&o?Vt.createElement(Vt.Fragment,null,Vt.createElement(uF,null,Vt.createElement(Ji,{dotColor:p.color.positive},"Pass (",o.passed,")"),Vt.createElement(Ji,{dotColor:p.color.warning},"Warn (",o.warned,")"),Vt.createElement(Ji,{dotColor:p.color.negative},"Fail (",o.failed,")")),o.costUsd>0&&Vt.createElement(lF,null,"$",o.costUsd.toFixed(3)," \xB7 \u20AA",(o.costUsd*3.6).toFixed(3))):e?null:Vt.createElement(uF,null,Vt.createElement(Ji,{dotColor:p.color.positive},"Pass"),Vt.createElement(Ji,{dotColor:p.color.warning},"Warn"),Vt.createElement(Ji,{dotColor:p.color.negative},"Fail")),e&&n&&Vt.createElement(Vt.Fragment,null,Vt.createElement(C8,null,Vt.createElement(T8,{percent:f})),Vt.createElement(lF,null,"Reviewing ",Math.min(n.completed+1,n.total),"/",n.total," \u2014 ",n.currentStoryName))):null};import*as gF from"@sentry/react";var I8="https://015e961f5f626bad5315430e02940616@o138219.ingest.us.sentry.io/4511134750539776",fF=!1;function F8(){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 mF(){if(!fF){fF=!0;try{gF.init({dsn:I8,environment:F8(),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{}}}mF();var Gc="uireview",A8=`${Gc}/panel`,P8=`${Gc}/tool`,xF=`${Gc}/test-provider`;Vc.register(Gc,()=>{if(console.log("[UI Review] Registering addon, checking for StatusStore API..."),typeof hF=="function"){console.log("[UI Review] StatusStore API available, initializing badges");let t=hF("uireview/badge");cv(t),console.log("[UI Review] Badge listener initialized")}else console.warn("[UI Review] experimental_getStatusStore not available \u2014 badges disabled");Vc.add(P8,{type:_x.TOOL,title:"UI Review",match:({viewMode:t})=>t==="story",render:()=>Ia.createElement(rF,null)}),sF(),(()=>{try{let t=localStorage.getItem("uicopilot_feature_flags");return t?!!JSON.parse(t).enableParallelReview:!1}catch{return!1}})()&&Vc.add(xF,{type:_x.experimental_TEST_PROVIDER,id:xF,render:()=>Ia.createElement(dF,null)}),Vc.add(A8,{type:_x.PANEL,title:"UI Review",match:({viewMode:t})=>t==="story",render:({active:t})=>Ia.createElement(E8,{active:t||!1},Ia.createElement(yg,null,Ia.createElement(tF,null)))})});
|
|
178
200
|
/*! Bundled license information:
|
|
179
201
|
|
|
180
202
|
@noble/hashes/utils.js:
|