@frontfriend/sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/cli.js +154 -154
- package/dist/lib/core/adoption.js +1 -1
- package/dist/lib/core/api-client.js +1 -1
- package/dist/lib/core/application-adoption.js +1 -1
- package/dist/lib/core/credentials.js +2 -2
- package/dist/lib/core/token-artifact-client.js +6 -6
- package/dist/lib/core/token-artifact.d.ts +12 -0
- package/dist/lib/core/token-artifact.js +1 -1
- package/dist/mcp.cjs +3 -3
- package/dist/next.js +1 -1
- package/dist/package.json +1 -1
- package/dist/vite.js +1 -1
- package/package.json +13 -15
package/dist/mcp.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var x2=Object.create;var dd=Object.defineProperty;var q2=Object.getOwnPropertyDescriptor;var D2=Object.getOwnPropertyNames;var L2=Object.getPrototypeOf,U2=Object.prototype.hasOwnProperty;var Ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var te=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mo=(e,t)=>{for(var r in t)dd(e,r,{get:t[r],enumerable:!0})},xw=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of D2(t))!U2.call(e,n)&&n!==r&&dd(e,n,{get:()=>t[n],enumerable:!(i=q2(t,n))||i.enumerable});return e};var ho=(e,t,r)=>(r=e!=null?x2(L2(e)):{},xw(t||!e||!e.__esModule?dd(r,"default",{value:e,enumerable:!0}):r,e)),hi=e=>xw(dd({},"__esModule",{value:!0}),e);var Qa=te((uye,qw)=>{var br=require("fs");function z2(e){try{let t=br.readFileSync(e,"utf8");return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null;throw t}}function V2(e){try{return br.readFileSync(e,"utf8").replace(/^\uFEFF/,"")}catch(t){if(t.code==="ENOENT")return null;throw t}}function F2(e,t,r=2){let i=JSON.stringify(t,null,r);br.writeFileSync(e,i,"utf8")}function J2(e,t){br.writeFileSync(e,t,"utf8")}function Z2(e,t){if(t==null||typeof t=="object"&&Object.keys(t).length===0||Array.isArray(t)&&t.length===0){let i=`module.exports = ${Array.isArray(t)?"[]":"{}"};`;br.writeFileSync(e,i,"utf8")}else{let r=`module.exports = ${JSON.stringify(t,null,2)};`;br.writeFileSync(e,r,"utf8")}}function H2(e){return br.existsSync(e)}function B2(e){br.mkdirSync(e,{recursive:!0})}function K2(e){br.rmSync(e,{recursive:!0,force:!0})}function W2(e){br.rmSync(e,{force:!0})}function G2(e,t){br.mkdirSync(require("path").dirname(e),{recursive:!0,mode:448});let r=`${e}.${process.pid}.${Date.now()}.tmp`;try{br.writeFileSync(r,`${JSON.stringify(t,null,2)}
|
|
3
|
-
`,{mode:384}),br.renameSync(r,e);try{br.chmodSync(e,384)}catch{}}finally{br.rmSync(r,{force:!0})}}async function Y2(e,t,r){br.mkdirSync(require("path").dirname(e),{recursive:!0,mode:448});let i=`${e}.lock`,n=Date.now()+2e4,o;for(;o===void 0;)try{o=br.openSync(i,"wx",384),br.writeFileSync(o,String(process.pid))}catch(a){if(a.code!=="EEXIST")throw a;try{let s=Number(br.readFileSync(i,"utf8"));if(Number.isInteger(s)&&s>0)try{process.kill(s,0)}catch(c){if(c.code==="ESRCH"){br.unlinkSync(i);continue}}}catch(s){if(s.code==="ENOENT")continue}if(Date.now()>=n)throw r();await new Promise(s=>setTimeout(s,50))}try{return await t()}finally{br.closeSync(o),br.unlinkSync(i)}}qw.exports={writePrivateJsonFileAtomic:G2,withPrivateFileLock:Y2,readJsonFileSafe:z2,readFileSafe:V2,writeJsonFile:F2,writeTextFile:J2,writeModuleExportsFile:Z2,fileExists:H2,ensureDirectoryExists:B2,removeDirectory:K2,removeFile:W2}});var Ma=te((lye,Dw)=>{var X2="https://app.frontfriend.dev",Q2=".cache/frontfriend",eU={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},tU={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function rU(e){if(!e)return null;try{let t=new URL(e);return t.hostname.startsWith("app.")?`${t.protocol}//${t.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}Dw.exports={DEFAULT_API_URL:X2,CACHE_DIR_NAME:Q2,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:eU,ENV_VARS:tU,deriveRegistryFromApiUrl:rU}});var xa=te((dye,Jw)=>{var{fileExists:nU,readJsonFileSafe:iU,removeFile:oU,writePrivateJsonFileAtomic:aU,withPrivateFileLock:sU}=Qa(),Lw=require("path"),cU=require("os"),uU=require("https"),lU=require("http"),{URL:Rs}=require("url"),{DEFAULT_API_URL:dc}=Ma(),dU=Lw.join(cU.homedir(),".frontfriend"),fc=Lw.join(dU,"credentials");function fU(){return fc}function fd(){try{return iU(fc)}catch{return null}}function Uw(e){try{let t=JSON.parse(Buffer.from(String(e).split(".")[1],"base64url").toString("utf8"));return typeof t.email=="string"?t.email:null}catch{return null}}function pU(){let e=fd();if(!e||!e.accessToken)return null;let t=Number(e.refreshExpiresAt)||0;return{email:Uw(e.accessToken),apiUrl:e.ffApiUrl||null,expired:t>0&&t<Date.now()}}function zw(e){aU(fc,e)}function mU(){return nU(fc)?(oU(fc),!0):!1}function dg(e,t=60*1e3){return!e?.accessToken||!e.expiresAt||Date.now()+t>=e.expiresAt}function $s(e){let t=new Error(`${e}. Run \`frontfriend login\` to re-authenticate.`);return t.code="FF_AUTH_REFRESH_FAILED",t}function Vw(e,t,r){return new Promise((i,n)=>{let o=new Rs(e);if(o.protocol!=="https:"&&!(o.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(o.hostname))){n(new Error("Frontfriend API URLs require HTTPS except on localhost"));return}let a=o.protocol==="https:"?uU:lU,s=JSON.stringify(t||{}),c=a.request({hostname:o.hostname,port:o.port,path:`${o.pathname}${o.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(s),...r?{authorization:`Bearer ${r}`}:{}}},u=>{let d="";u.on("data",f=>{d+=f}),u.on("end",()=>{if(u.statusCode>=300&&u.statusCode<400){let p=u.headers.location?` to ${u.headers.location}`:"",y=new Error(`HTTP ${u.statusCode}: redirected${p}`);y.statusCode=u.statusCode,y.body=d,n(y);return}let f=null;try{f=d?JSON.parse(d):null}catch{let y=u.headers["content-type"]||"unknown content-type",h=new Error(`Expected JSON from FrontFriend API at ${e}, but received ${y} (HTTP ${u.statusCode}). Check FF_API_URL or pass --api-url with the FrontFriend app URL.`);if(h.statusCode=u.statusCode,h.body=d,u.statusCode>=400){n(h);return}n(h);return}if(u.statusCode>=400){let p=new Error(f?.error_description||f?.error||`HTTP ${u.statusCode}`);p.statusCode=u.statusCode,p.body=f,n(p);return}i(f)})});c.setTimeout(15e3,()=>c.destroy(new Error("Frontfriend API request timed out"))),c.on("error",n),c.write(s),c.end()})}async function hU(e){return sU(fc,e,()=>$s("Another process is refreshing the session"))}async function Fw(e,t=dc){return hU(async()=>{let r=fd();if(r&&new Rs(r.ffApiUrl||dc).origin===new Rs(t).origin){if(!dg(r))return r;e=r}return gU(e,t)})}async function gU(e,t=dc){if(new Rs(t).origin!==new Rs(e.ffApiUrl||dc).origin)throw $s("The stored session belongs to a different API origin");if(!e?.refreshToken||!e?.deviceId)throw $s("FrontFriend session expired");let r;try{r=await Vw(`${t}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:e.refreshToken,device_id:e.deviceId})}catch(n){throw $s(n?.message||"Could not refresh FrontFriend session")}if(!r?.access_token||!r?.refresh_token)throw $s("Could not refresh FrontFriend session");let i={accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id||e.deviceId,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:t};return zw(i),i}async function yU(e={}){if(e.envToken)return e.envToken;if(!e.skipCredentials){let t=fd();if(t?.accessToken||t?.refreshToken){let r=e.baseURL||t.ffApiUrl||dc;if(new Rs(r).origin!==new Rs(t.ffApiUrl||dc).origin)throw $s("The stored session belongs to a different API origin");return t.accessToken&&!dg(t)?t.accessToken:(await Fw(t,r)).accessToken}}return e.configuredToken?(e.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),e.configuredToken):null}Jw.exports={accountEmail:Uw,signedInAccount:pU,getCredentialsPath:fU,readCredentials:fd,writeCredentials:zw,deleteCredentials:mU,isExpired:dg,postJson:Vw,refreshCredentials:Fw,resolveAuthToken:yU,createAuthRefreshError:$s}});var Hw=te((pd,Zw)=>{(function(e,t){typeof pd=="object"&&typeof Zw<"u"?t(pd):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.acorn={}))})(pd,function(e){"use strict";var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],r=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],i="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",n="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",o={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},a="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",s={5:a,"5module":a+" export import",6:a+" const class extends export import super"},c=/^in(stanceof)?$/,u=new RegExp("["+n+"]"),d=new RegExp("["+n+i+"]");function f(l,R){for(var k=65536,q=0;q<R.length;q+=2){if(k+=R[q],k>l)return!1;if(k+=R[q+1],k>=l)return!0}return!1}function p(l,R){return l<65?l===36:l<91?!0:l<97?l===95:l<123?!0:l<=65535?l>=170&&u.test(String.fromCharCode(l)):R===!1?!1:f(l,r)}function y(l,R){return l<48?l===36:l<58?!0:l<65?!1:l<91?!0:l<97?l===95:l<123?!0:l<=65535?l>=170&&d.test(String.fromCharCode(l)):R===!1?!1:f(l,r)||f(l,t)}var h=function(R,k){k===void 0&&(k={}),this.label=R,this.keyword=k.keyword,this.beforeExpr=!!k.beforeExpr,this.startsExpr=!!k.startsExpr,this.isLoop=!!k.isLoop,this.isAssign=!!k.isAssign,this.prefix=!!k.prefix,this.postfix=!!k.postfix,this.binop=k.binop||null,this.updateContext=null};function v(l,R){return new h(l,{beforeExpr:!0,binop:R})}var _={beforeExpr:!0},g={startsExpr:!0},$={};function w(l,R){return R===void 0&&(R={}),R.keyword=l,$[l]=new h(l,R)}var m={num:new h("num",g),regexp:new h("regexp",g),string:new h("string",g),name:new h("name",g),privateId:new h("privateId",g),eof:new h("eof"),bracketL:new h("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new h("]"),braceL:new h("{",{beforeExpr:!0,startsExpr:!0}),braceR:new h("}"),parenL:new h("(",{beforeExpr:!0,startsExpr:!0}),parenR:new h(")"),comma:new h(",",_),semi:new h(";",_),colon:new h(":",_),dot:new h("."),question:new h("?",_),questionDot:new h("?."),arrow:new h("=>",_),template:new h("template"),invalidTemplate:new h("invalidTemplate"),ellipsis:new h("...",_),backQuote:new h("`",g),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h("=",{beforeExpr:!0,isAssign:!0}),assign:new h("_=",{beforeExpr:!0,isAssign:!0}),incDec:new h("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:v("||",1),logicalAND:v("&&",2),bitwiseOR:v("|",3),bitwiseXOR:v("^",4),bitwiseAND:v("&",5),equality:v("==/!=/===/!==",6),relational:v("</>/<=/>=",7),bitShift:v("<</>>/>>>",8),plusMin:new h("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:v("%",10),star:v("*",10),slash:v("/",10),starstar:new h("**",{beforeExpr:!0}),coalesce:v("??",1),_break:w("break"),_case:w("case",_),_catch:w("catch"),_continue:w("continue"),_debugger:w("debugger"),_default:w("default",_),_do:w("do",{isLoop:!0,beforeExpr:!0}),_else:w("else",_),_finally:w("finally"),_for:w("for",{isLoop:!0}),_function:w("function",g),_if:w("if"),_return:w("return",_),_switch:w("switch"),_throw:w("throw",_),_try:w("try"),_var:w("var"),_const:w("const"),_while:w("while",{isLoop:!0}),_with:w("with"),_new:w("new",{beforeExpr:!0,startsExpr:!0}),_this:w("this",g),_super:w("super",g),_class:w("class",g),_extends:w("extends",_),_export:w("export"),_import:w("import",g),_null:w("null",g),_true:w("true",g),_false:w("false",g),_in:w("in",{beforeExpr:!0,binop:7}),_instanceof:w("instanceof",{beforeExpr:!0,binop:7}),_typeof:w("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:w("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:w("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},O=/\r\n?|\n|\u2028|\u2029/,P=new RegExp(O.source,"g");function E(l){return l===10||l===13||l===8232||l===8233}function I(l,R,k){k===void 0&&(k=l.length);for(var q=R;q<k;q++){var Z=l.charCodeAt(q);if(E(Z))return q<k-1&&Z===13&&l.charCodeAt(q+1)===10?q+2:q+1}return-1}var D=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,z=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,N=Object.prototype,U=N.hasOwnProperty,J=N.toString,W=Object.hasOwn||function(l,R){return U.call(l,R)},G=Array.isArray||function(l){return J.call(l)==="[object Array]"},ae=Object.create(null);function fe(l){return ae[l]||(ae[l]=new RegExp("^(?:"+l.replace(/ /g,"|")+")$"))}function he(l){return l<=65535?String.fromCharCode(l):(l-=65536,String.fromCharCode((l>>10)+55296,(l&1023)+56320))}var de=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,j=function(R,k){this.line=R,this.column=k};j.prototype.offset=function(R){return new j(this.line,this.column+R)};var V=function(R,k,q){this.start=k,this.end=q,R.sourceFile!==null&&(this.source=R.sourceFile)};function K(l,R){for(var k=1,q=0;;){var Z=I(l,q,R);if(Z<0)return new j(k,R-q);++k,q=Z}}var C={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},M=!1;function L(l){var R={};for(var k in C)R[k]=l&&W(l,k)?l[k]:C[k];if(R.ecmaVersion==="latest"?R.ecmaVersion=1e8:R.ecmaVersion==null?(!M&&typeof console=="object"&&console.warn&&(M=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
3
|
+
`,{mode:384}),br.renameSync(r,e);try{br.chmodSync(e,384)}catch{}}finally{br.rmSync(r,{force:!0})}}async function Y2(e,t,r){br.mkdirSync(require("path").dirname(e),{recursive:!0,mode:448});let i=`${e}.lock`,n=Date.now()+2e4,o;for(;o===void 0;)try{o=br.openSync(i,"wx",384),br.writeFileSync(o,String(process.pid))}catch(a){if(a.code!=="EEXIST")throw a;try{let s=Number(br.readFileSync(i,"utf8"));if(Number.isInteger(s)&&s>0)try{process.kill(s,0)}catch(c){if(c.code==="ESRCH"){br.unlinkSync(i);continue}}}catch(s){if(s.code==="ENOENT")continue}if(Date.now()>=n)throw r();await new Promise(s=>setTimeout(s,50))}try{return await t()}finally{br.closeSync(o),br.unlinkSync(i)}}qw.exports={writePrivateJsonFileAtomic:G2,withPrivateFileLock:Y2,readJsonFileSafe:z2,readFileSafe:V2,writeJsonFile:F2,writeTextFile:J2,writeModuleExportsFile:Z2,fileExists:H2,ensureDirectoryExists:B2,removeDirectory:K2,removeFile:W2}});var Ma=te((lye,Dw)=>{var X2="https://app.frontfriend.dev",Q2=".cache/frontfriend",eU={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","keyframes.js","animations.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","iconLibrary.json","version.json","versionMetadata.json","metadata.json","base.json","nativeTokens.json"]},tU={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN",FF_MACHINE_TOKEN:"FRONTFRIEND_MACHINE_TOKEN"};function rU(e){if(!e)return null;try{let t=new URL(e);return t.hostname.startsWith("app.")?`${t.protocol}//${t.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}Dw.exports={DEFAULT_API_URL:X2,CACHE_DIR_NAME:Q2,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:eU,ENV_VARS:tU,deriveRegistryFromApiUrl:rU}});var xa=te((dye,Jw)=>{var{fileExists:nU,readJsonFileSafe:iU,removeFile:oU,writePrivateJsonFileAtomic:aU,withPrivateFileLock:sU}=Qa(),Lw=require("path"),cU=require("os"),uU=require("https"),lU=require("http"),{URL:Rs}=require("url"),{DEFAULT_API_URL:dc}=Ma(),dU=Lw.join(cU.homedir(),".frontfriend"),fc=Lw.join(dU,"credentials");function fU(){return fc}function fd(){try{return iU(fc)}catch{return null}}function Uw(e){try{let t=JSON.parse(Buffer.from(String(e).split(".")[1],"base64url").toString("utf8"));return typeof t.email=="string"?t.email:null}catch{return null}}function pU(){let e=fd();if(!e||!e.accessToken)return null;let t=Number(e.refreshExpiresAt)||0;return{email:Uw(e.accessToken),apiUrl:e.ffApiUrl||null,expired:t>0&&t<Date.now()}}function zw(e){aU(fc,e)}function mU(){return nU(fc)?(oU(fc),!0):!1}function dg(e,t=60*1e3){return!e?.accessToken||!e.expiresAt||Date.now()+t>=e.expiresAt}function $s(e){let t=new Error(`${e}. Run \`frontfriend login\` to re-authenticate.`);return t.code="FF_AUTH_REFRESH_FAILED",t}function Vw(e,t,r){return new Promise((i,n)=>{let o=new Rs(e);if(o.protocol!=="https:"&&!(o.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(o.hostname))){n(new Error("Frontfriend API URLs require HTTPS except on localhost"));return}let a=o.protocol==="https:"?uU:lU,s=JSON.stringify(t||{}),c=a.request({hostname:o.hostname,port:o.port,path:`${o.pathname}${o.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(s),...r?{authorization:`Bearer ${r}`}:{}}},u=>{let d="";u.on("data",f=>{d+=f}),u.on("end",()=>{if(u.statusCode>=300&&u.statusCode<400){let p=u.headers.location?` to ${u.headers.location}`:"",y=new Error(`HTTP ${u.statusCode}: redirected${p}`);y.statusCode=u.statusCode,y.body=d,n(y);return}let f=null;try{f=d?JSON.parse(d):null}catch{let y=u.headers["content-type"]||"unknown content-type",h=new Error(`Expected JSON from FrontFriend API at ${e}, but received ${y} (HTTP ${u.statusCode}). Check FF_API_URL or pass --api-url with the FrontFriend app URL.`);if(h.statusCode=u.statusCode,h.body=d,u.statusCode>=400){n(h);return}n(h);return}if(u.statusCode>=400){let p=new Error(f?.error_description||f?.error||`HTTP ${u.statusCode}`);p.statusCode=u.statusCode,p.body=f,n(p);return}i(f)})});c.setTimeout(15e3,()=>c.destroy(Object.assign(new Error("Frontfriend API request timed out"),{code:"ETIMEDOUT"}))),c.on("error",n),c.write(s),c.end()})}async function hU(e){return sU(fc,e,()=>$s("Another process is refreshing the session"))}async function Fw(e,t=dc){return hU(async()=>{let r=fd();if(r&&new Rs(r.ffApiUrl||dc).origin===new Rs(t).origin){if(!dg(r))return r;e=r}return gU(e,t)})}async function gU(e,t=dc){if(new Rs(t).origin!==new Rs(e.ffApiUrl||dc).origin)throw $s("The stored session belongs to a different API origin");if(!e?.refreshToken||!e?.deviceId)throw $s("FrontFriend session expired");let r;try{r=await Vw(`${t}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:e.refreshToken,device_id:e.deviceId})}catch(n){throw Object.assign($s(n?.message||"Could not refresh FrontFriend session"),{cause:n})}if(!r?.access_token||!r?.refresh_token)throw $s("Could not refresh FrontFriend session");let i={accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id||e.deviceId,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:t};return zw(i),i}async function yU(e={}){if(e.envToken)return e.envToken;if(!e.skipCredentials){let t=fd();if(t?.accessToken||t?.refreshToken){let r=e.baseURL||t.ffApiUrl||dc;if(new Rs(r).origin!==new Rs(t.ffApiUrl||dc).origin)throw $s("The stored session belongs to a different API origin");return t.accessToken&&!dg(t)?t.accessToken:(await Fw(t,r)).accessToken}}return e.configuredToken?(e.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),e.configuredToken):null}Jw.exports={accountEmail:Uw,signedInAccount:pU,getCredentialsPath:fU,readCredentials:fd,writeCredentials:zw,deleteCredentials:mU,isExpired:dg,postJson:Vw,refreshCredentials:Fw,resolveAuthToken:yU,createAuthRefreshError:$s}});var Hw=te((pd,Zw)=>{(function(e,t){typeof pd=="object"&&typeof Zw<"u"?t(pd):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.acorn={}))})(pd,function(e){"use strict";var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],r=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],i="\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",n="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",o={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},a="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",s={5:a,"5module":a+" export import",6:a+" const class extends export import super"},c=/^in(stanceof)?$/,u=new RegExp("["+n+"]"),d=new RegExp("["+n+i+"]");function f(l,R){for(var k=65536,q=0;q<R.length;q+=2){if(k+=R[q],k>l)return!1;if(k+=R[q+1],k>=l)return!0}return!1}function p(l,R){return l<65?l===36:l<91?!0:l<97?l===95:l<123?!0:l<=65535?l>=170&&u.test(String.fromCharCode(l)):R===!1?!1:f(l,r)}function y(l,R){return l<48?l===36:l<58?!0:l<65?!1:l<91?!0:l<97?l===95:l<123?!0:l<=65535?l>=170&&d.test(String.fromCharCode(l)):R===!1?!1:f(l,r)||f(l,t)}var h=function(R,k){k===void 0&&(k={}),this.label=R,this.keyword=k.keyword,this.beforeExpr=!!k.beforeExpr,this.startsExpr=!!k.startsExpr,this.isLoop=!!k.isLoop,this.isAssign=!!k.isAssign,this.prefix=!!k.prefix,this.postfix=!!k.postfix,this.binop=k.binop||null,this.updateContext=null};function v(l,R){return new h(l,{beforeExpr:!0,binop:R})}var _={beforeExpr:!0},g={startsExpr:!0},$={};function w(l,R){return R===void 0&&(R={}),R.keyword=l,$[l]=new h(l,R)}var m={num:new h("num",g),regexp:new h("regexp",g),string:new h("string",g),name:new h("name",g),privateId:new h("privateId",g),eof:new h("eof"),bracketL:new h("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new h("]"),braceL:new h("{",{beforeExpr:!0,startsExpr:!0}),braceR:new h("}"),parenL:new h("(",{beforeExpr:!0,startsExpr:!0}),parenR:new h(")"),comma:new h(",",_),semi:new h(";",_),colon:new h(":",_),dot:new h("."),question:new h("?",_),questionDot:new h("?."),arrow:new h("=>",_),template:new h("template"),invalidTemplate:new h("invalidTemplate"),ellipsis:new h("...",_),backQuote:new h("`",g),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h("=",{beforeExpr:!0,isAssign:!0}),assign:new h("_=",{beforeExpr:!0,isAssign:!0}),incDec:new h("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:v("||",1),logicalAND:v("&&",2),bitwiseOR:v("|",3),bitwiseXOR:v("^",4),bitwiseAND:v("&",5),equality:v("==/!=/===/!==",6),relational:v("</>/<=/>=",7),bitShift:v("<</>>/>>>",8),plusMin:new h("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:v("%",10),star:v("*",10),slash:v("/",10),starstar:new h("**",{beforeExpr:!0}),coalesce:v("??",1),_break:w("break"),_case:w("case",_),_catch:w("catch"),_continue:w("continue"),_debugger:w("debugger"),_default:w("default",_),_do:w("do",{isLoop:!0,beforeExpr:!0}),_else:w("else",_),_finally:w("finally"),_for:w("for",{isLoop:!0}),_function:w("function",g),_if:w("if"),_return:w("return",_),_switch:w("switch"),_throw:w("throw",_),_try:w("try"),_var:w("var"),_const:w("const"),_while:w("while",{isLoop:!0}),_with:w("with"),_new:w("new",{beforeExpr:!0,startsExpr:!0}),_this:w("this",g),_super:w("super",g),_class:w("class",g),_extends:w("extends",_),_export:w("export"),_import:w("import",g),_null:w("null",g),_true:w("true",g),_false:w("false",g),_in:w("in",{beforeExpr:!0,binop:7}),_instanceof:w("instanceof",{beforeExpr:!0,binop:7}),_typeof:w("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:w("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:w("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},O=/\r\n?|\n|\u2028|\u2029/,P=new RegExp(O.source,"g");function E(l){return l===10||l===13||l===8232||l===8233}function I(l,R,k){k===void 0&&(k=l.length);for(var q=R;q<k;q++){var Z=l.charCodeAt(q);if(E(Z))return q<k-1&&Z===13&&l.charCodeAt(q+1)===10?q+2:q+1}return-1}var D=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,z=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,N=Object.prototype,U=N.hasOwnProperty,J=N.toString,W=Object.hasOwn||function(l,R){return U.call(l,R)},G=Array.isArray||function(l){return J.call(l)==="[object Array]"},ae=Object.create(null);function fe(l){return ae[l]||(ae[l]=new RegExp("^(?:"+l.replace(/ /g,"|")+")$"))}function he(l){return l<=65535?String.fromCharCode(l):(l-=65536,String.fromCharCode((l>>10)+55296,(l&1023)+56320))}var de=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,j=function(R,k){this.line=R,this.column=k};j.prototype.offset=function(R){return new j(this.line,this.column+R)};var V=function(R,k,q){this.start=k,this.end=q,R.sourceFile!==null&&(this.source=R.sourceFile)};function K(l,R){for(var k=1,q=0;;){var Z=I(l,q,R);if(Z<0)return new j(k,R-q);++k,q=Z}}var C={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},M=!1;function L(l){var R={};for(var k in C)R[k]=l&&W(l,k)?l[k]:C[k];if(R.ecmaVersion==="latest"?R.ecmaVersion=1e8:R.ecmaVersion==null?(!M&&typeof console=="object"&&console.warn&&(M=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
4
4
|
Defaulting to 2020, but this will stop working in the future.`)),R.ecmaVersion=11):R.ecmaVersion>=2015&&(R.ecmaVersion-=2009),R.allowReserved==null&&(R.allowReserved=R.ecmaVersion<5),(!l||l.allowHashBang==null)&&(R.allowHashBang=R.ecmaVersion>=14),G(R.onToken)){var q=R.onToken;R.onToken=function(Z){return q.push(Z)}}if(G(R.onComment)&&(R.onComment=oe(R,R.onComment)),R.sourceType==="commonjs"&&R.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return R}function oe(l,R){return function(k,q,Z,se,le,Pe){var xe={type:k?"Block":"Line",value:q,start:Z,end:se};l.locations&&(xe.loc=new V(this,le,Pe)),l.ranges&&(xe.range=[Z,se]),R.push(xe)}}var ue=1,pe=2,me=4,De=8,vt=16,x=32,F=64,X=128,be=256,Se=512,Te=1024,it=ue|pe|be;function mt(l,R){return pe|(l?me:0)|(R?De:0)}var Et=0,ut=1,Ye=2,Wt=3,St=4,hr=5,at=function(R,k,q){this.options=R=L(R),this.sourceFile=R.sourceFile,this.keywords=fe(s[R.ecmaVersion>=6?6:R.sourceType==="module"?"5module":5]);var Z="";R.allowReserved!==!0&&(Z=o[R.ecmaVersion>=6?6:R.ecmaVersion===5?5:3],R.sourceType==="module"&&(Z+=" await")),this.reservedWords=fe(Z);var se=(Z?Z+" ":"")+o.strict;this.reservedWordsStrict=fe(se),this.reservedWordsStrictBind=fe(se+" "+o.strictBind),this.input=String(k),this.containsEsc=!1,q?(this.pos=q,this.lineStart=this.input.lastIndexOf(`
|
|
5
5
|
`,q-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(O).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=m.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=R.sourceType==="module",this.strict=this.inModule||R.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&R.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(this.options.sourceType==="commonjs"?pe:ue),this.regexpState=null,this.privateNameStack=[]},Ut={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};at.prototype.parse=function(){var R=this,k=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return R.parseTopLevel(k)})},Ut.inFunction.get=function(){return(this.currentVarScope().flags&pe)>0},Ut.inGenerator.get=function(){return(this.currentVarScope().flags&De)>0},Ut.inAsync.get=function(){return(this.currentVarScope().flags&me)>0},Ut.canAwait.get=function(){for(var l=this.scopeStack.length-1;l>=0;l--){var R=this.scopeStack[l],k=R.flags;if(k&(be|Se))return!1;if(k&pe)return(k&me)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},Ut.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ue)},Ut.allowSuper.get=function(){var l=this.currentThisScope(),R=l.flags;return(R&F)>0||this.options.allowSuperOutsideMethod},Ut.allowDirectSuper.get=function(){return(this.currentThisScope().flags&X)>0},Ut.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},Ut.allowNewDotTarget.get=function(){for(var l=this.scopeStack.length-1;l>=0;l--){var R=this.scopeStack[l],k=R.flags;if(k&(be|Se)||k&pe&&!(k&vt))return!0}return!1},Ut.allowUsing.get=function(){var l=this.currentScope(),R=l.flags;return!(R&Te||!this.inModule&&R&ue)},Ut.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&be)>0},at.extend=function(){for(var R=[],k=arguments.length;k--;)R[k]=arguments[k];for(var q=this,Z=0;Z<R.length;Z++)q=R[Z](q);return q},at.parse=function(R,k){return new this(k,R).parse()},at.parseExpressionAt=function(R,k,q){var Z=new this(q,R,k);return Z.nextToken(),Z.parseExpression()},at.tokenizer=function(R,k){return new this(k,R)},Object.defineProperties(at.prototype,Ut);var xt=at.prototype,qr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;xt.strictDirective=function(l){if(this.options.ecmaVersion<5)return!1;for(;;){z.lastIndex=l,l+=z.exec(this.input)[0].length;var R=qr.exec(this.input.slice(l));if(!R)return!1;if((R[1]||R[2])==="use strict"){z.lastIndex=l+R[0].length;var k=z.exec(this.input),q=k.index+k[0].length,Z=this.input.charAt(q);return Z===";"||Z==="}"||O.test(k[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(Z)||Z==="!"&&this.input.charAt(q+1)==="=")}l+=R[0].length,z.lastIndex=l,l+=z.exec(this.input)[0].length,this.input[l]===";"&&l++}},xt.eat=function(l){return this.type===l?(this.next(),!0):!1},xt.isContextual=function(l){return this.type===m.name&&this.value===l&&!this.containsEsc},xt.eatContextual=function(l){return this.isContextual(l)?(this.next(),!0):!1},xt.catchStackOverflow=function(l){try{return l()}catch(R){if(R instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(R.message)||/\btoo much recursion\b/i.test(R.message)))this.raise(this.start,"Not enough stack space to parse input");else throw R}},xt.expectContextual=function(l){this.eatContextual(l)||this.unexpected()},xt.canInsertSemicolon=function(){return this.type===m.eof||this.type===m.braceR||O.test(this.input.slice(this.lastTokEnd,this.start))},xt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},xt.semicolon=function(){!this.eat(m.semi)&&!this.insertSemicolon()&&this.unexpected()},xt.afterTrailingComma=function(l,R){if(this.type===l)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),R||this.next(),!0},xt.expect=function(l){this.eat(l)||this.unexpected()},xt.unexpected=function(l){this.raise(l??this.start,"Unexpected token")};var Or=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};xt.checkPatternErrors=function(l,R){if(l){l.trailingComma>-1&&this.raiseRecoverable(l.trailingComma,"Comma is not permitted after the rest element");var k=R?l.parenthesizedAssign:l.parenthesizedBind;k>-1&&this.raiseRecoverable(k,R?"Assigning to rvalue":"Parenthesized pattern")}},xt.checkExpressionErrors=function(l,R){if(!l)return!1;var k=l.shorthandAssign,q=l.doubleProto;if(!R)return k>=0||q>=0;k>=0&&this.raise(k,"Shorthand property assignments are valid only in destructuring patterns"),q>=0&&this.raiseRecoverable(q,"Redefinition of __proto__ property")},xt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},xt.isSimpleAssignTarget=function(l){return l.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(l.expression):l.type==="Identifier"||l.type==="MemberExpression"};var Le=at.prototype;Le.parseTopLevel=function(l){var R=Object.create(null);for(l.body||(l.body=[]);this.type!==m.eof;){var k=this.parseStatement(null,!0,R);l.body.push(k)}if(this.inModule)for(var q=0,Z=Object.keys(this.undefinedExports);q<Z.length;q+=1){var se=Z[q];this.raiseRecoverable(this.undefinedExports[se].start,"Export '"+se+"' is not defined")}return this.adaptDirectivePrologue(l.body),this.next(),l.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(l,"Program")};var Dr={kind:"loop"},nn={kind:"switch"};Le.isLet=function(l){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;z.lastIndex=this.pos;var R=z.exec(this.input),k=this.pos+R[0].length,q=this.fullCharCodeAt(k);if(q===91||q===92)return!0;if(l)return!1;if(q===123)return!0;if(p(q)){var Z=k;do k+=q<=65535?1:2;while(y(q=this.fullCharCodeAt(k)));if(q===92)return!0;var se=this.input.slice(Z,k);if(!c.test(se))return!0}return!1},Le.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;z.lastIndex=this.pos;var l=z.exec(this.input),R=this.pos+l[0].length,k;return!O.test(this.input.slice(this.pos,R))&&this.input.slice(R,R+8)==="function"&&(R+8===this.input.length||!(y(k=this.fullCharCodeAt(R+8))||k===92))},Le.isUsingKeyword=function(l,R){if(this.options.ecmaVersion<17||!this.isContextual(l?"await":"using"))return!1;z.lastIndex=this.pos;var k=z.exec(this.input),q=this.pos+k[0].length;if(O.test(this.input.slice(this.pos,q)))return!1;if(l){var Z=q+5,se;if(this.input.slice(q,Z)!=="using"||Z===this.input.length||y(se=this.fullCharCodeAt(Z))||se===92)return!1;z.lastIndex=Z;var le=z.exec(this.input);if(q=Z+le[0].length,le&&O.test(this.input.slice(Z,q)))return!1}var Pe=this.fullCharCodeAt(q);if(!p(Pe)&&Pe!==92)return!1;var xe=q;do q+=Pe<=65535?1:2;while(y(Pe=this.fullCharCodeAt(q)));if(Pe===92)return!0;var ot=this.input.slice(xe,q);if(c.test(ot))return!1;if(R&&!l&&ot==="of"){z.lastIndex=q;var _t=z.exec(this.input);if(q=q+_t[0].length,this.input.charCodeAt(q)!==61||(Pe=this.input.charCodeAt(q+1))===61||Pe===62)return!1}return!0},Le.isAwaitUsing=function(l){return this.isUsingKeyword(!0,l)},Le.isUsing=function(l){return this.isUsingKeyword(!1,l)},Le.parseStatement=function(l,R,k){var q=this.type,Z=this.startNode(),se;switch(this.isLet(l)&&(q=m._var,se="let"),q){case m._break:case m._continue:return this.parseBreakContinueStatement(Z,q.keyword);case m._debugger:return this.parseDebuggerStatement(Z);case m._do:return this.parseDoStatement(Z);case m._for:return this.parseForStatement(Z);case m._function:return l&&(this.strict||l!=="if"&&l!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(Z,!1,!l);case m._class:return l&&this.unexpected(),this.parseClass(Z,!0);case m._if:return this.parseIfStatement(Z);case m._return:return this.parseReturnStatement(Z);case m._switch:return this.parseSwitchStatement(Z);case m._throw:return this.parseThrowStatement(Z);case m._try:return this.parseTryStatement(Z);case m._const:case m._var:return se=se||this.value,l&&se!=="var"&&this.unexpected(),this.parseVarStatement(Z,se);case m._while:return this.parseWhileStatement(Z);case m._with:return this.parseWithStatement(Z);case m.braceL:return this.parseBlock(!0,Z);case m.semi:return this.parseEmptyStatement(Z);case m._export:case m._import:if(this.options.ecmaVersion>10&&q===m._import){z.lastIndex=this.pos;var le=z.exec(this.input),Pe=this.pos+le[0].length,xe=this.input.charCodeAt(Pe);if(xe===40||xe===46)return this.parseExpressionStatement(Z,this.parseExpression())}return this.options.allowImportExportEverywhere||(R||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),q===m._import?this.parseImport(Z):this.parseExport(Z,k);default:if(this.isAsyncFunction())return l&&this.unexpected(),this.next(),this.parseFunctionStatement(Z,!0,!l);var ot=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(ot)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),l&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),ot==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(Z,!1,ot),this.semicolon(),this.finishNode(Z,"VariableDeclaration");var _t=this.value,ir=this.parseExpression();return q===m.name&&ir.type==="Identifier"&&this.eat(m.colon)?this.parseLabeledStatement(Z,_t,ir,l):this.parseExpressionStatement(Z,ir)}},Le.parseBreakContinueStatement=function(l,R){var k=R==="break";this.next(),this.eat(m.semi)||this.insertSemicolon()?l.label=null:this.type!==m.name?this.unexpected():(l.label=this.parseIdent(),this.semicolon());for(var q=0;q<this.labels.length;++q){var Z=this.labels[q];if((l.label==null||Z.name===l.label.name)&&(Z.kind!=null&&(k||Z.kind==="loop")||l.label&&k))break}return q===this.labels.length&&this.raise(l.start,"Unsyntactic "+R),this.finishNode(l,k?"BreakStatement":"ContinueStatement")},Le.parseDebuggerStatement=function(l){return this.next(),this.semicolon(),this.finishNode(l,"DebuggerStatement")},Le.parseDoStatement=function(l){return this.next(),this.labels.push(Dr),l.body=this.parseStatement("do"),this.labels.pop(),this.expect(m._while),l.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(m.semi):this.semicolon(),this.finishNode(l,"DoWhileStatement")},Le.parseForStatement=function(l){this.next();var R=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Dr),this.enterScope(0),this.expect(m.parenL),this.type===m.semi)return R>-1&&this.unexpected(R),this.parseFor(l,null);var k=this.isLet();if(this.type===m._var||this.type===m._const||k){var q=this.startNode(),Z=k?"let":this.value;return this.next(),this.parseVar(q,!0,Z),this.finishNode(q,"VariableDeclaration"),this.parseForAfterInit(l,q,R)}var se=this.isContextual("let"),le=!1,Pe=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(Pe){var xe=this.startNode();return this.next(),Pe==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(xe,!0,Pe),this.finishNode(xe,"VariableDeclaration"),this.parseForAfterInit(l,xe,R)}var ot=this.containsEsc,_t=new Or,ir=this.start,vn=R>-1?this.parseExprSubscripts(_t,"await"):this.parseExpression(!0,_t);return this.type===m._in||(le=this.options.ecmaVersion>=6&&this.isContextual("of"))?(R>-1?(this.type===m._in&&this.unexpected(R),l.await=!0):le&&this.options.ecmaVersion>=8&&(vn.start===ir&&!ot&&vn.type==="Identifier"&&vn.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(l.await=!1)),se&&le&&this.raise(vn.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(vn,!1,_t),this.checkLValPattern(vn),this.parseForIn(l,vn)):(this.checkExpressionErrors(_t,!0),R>-1&&this.unexpected(R),this.parseFor(l,vn))},Le.parseForAfterInit=function(l,R,k){return(this.type===m._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&R.declarations.length===1?(this.type===m._in?((R.kind==="using"||R.kind==="await using")&&!R.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&k>-1&&this.unexpected(k)):this.options.ecmaVersion>=9&&(l.await=k>-1),this.parseForIn(l,R)):(k>-1&&this.unexpected(k),this.parseFor(l,R))},Le.parseFunctionStatement=function(l,R,k){return this.next(),this.parseFunction(l,fr|(k?0:Pn),!1,R)},Le.parseIfStatement=function(l){return this.next(),l.test=this.parseParenExpression(),l.consequent=this.parseStatement("if"),l.alternate=this.eat(m._else)?this.parseStatement("if"):null,this.finishNode(l,"IfStatement")},Le.parseReturnStatement=function(l){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(m.semi)||this.insertSemicolon()?l.argument=null:(l.argument=this.parseExpression(),this.semicolon()),this.finishNode(l,"ReturnStatement")},Le.parseSwitchStatement=function(l){this.next(),l.discriminant=this.parseParenExpression(),l.cases=[],this.expect(m.braceL),this.labels.push(nn),this.enterScope(Te);for(var R,k=!1;this.type!==m.braceR;)if(this.type===m._case||this.type===m._default){var q=this.type===m._case;R&&this.finishNode(R,"SwitchCase"),l.cases.push(R=this.startNode()),R.consequent=[],this.next(),q?R.test=this.parseExpression():(k&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),k=!0,R.test=null),this.expect(m.colon)}else R||this.unexpected(),R.consequent.push(this.parseStatement(null));return this.exitScope(),R&&this.finishNode(R,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(l,"SwitchStatement")},Le.parseThrowStatement=function(l){return this.next(),O.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),l.argument=this.parseExpression(),this.semicolon(),this.finishNode(l,"ThrowStatement")};var si=[];Le.parseCatchClauseParam=function(){var l=this.parseBindingAtom(),R=l.type==="Identifier";return this.enterScope(R?x:0),this.checkLValPattern(l,R?St:Ye),this.expect(m.parenR),l},Le.parseTryStatement=function(l){if(this.next(),l.block=this.parseBlock(),l.handler=null,this.type===m._catch){var R=this.startNode();this.next(),this.eat(m.parenL)?R.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),R.param=null,this.enterScope(0)),R.body=this.parseBlock(!1),this.exitScope(),l.handler=this.finishNode(R,"CatchClause")}return l.finalizer=this.eat(m._finally)?this.parseBlock():null,!l.handler&&!l.finalizer&&this.raise(l.start,"Missing catch or finally clause"),this.finishNode(l,"TryStatement")},Le.parseVarStatement=function(l,R,k){return this.next(),this.parseVar(l,!1,R,k),this.semicolon(),this.finishNode(l,"VariableDeclaration")},Le.parseWhileStatement=function(l){return this.next(),l.test=this.parseParenExpression(),this.labels.push(Dr),l.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(l,"WhileStatement")},Le.parseWithStatement=function(l){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),l.object=this.parseParenExpression(),l.body=this.parseStatement("with"),this.finishNode(l,"WithStatement")},Le.parseEmptyStatement=function(l){return this.next(),this.finishNode(l,"EmptyStatement")},Le.parseLabeledStatement=function(l,R,k,q){for(var Z=0,se=this.labels;Z<se.length;Z+=1){var le=se[Z];le.name===R&&this.raise(k.start,"Label '"+R+"' is already declared")}for(var Pe=this.type.isLoop?"loop":this.type===m._switch?"switch":null,xe=this.labels.length-1;xe>=0;xe--){var ot=this.labels[xe];if(ot.statementStart===l.start)ot.statementStart=this.start,ot.kind=Pe;else break}return this.labels.push({name:R,kind:Pe,statementStart:this.start}),l.body=this.parseStatement(q?q.indexOf("label")===-1?q+"label":q:"label"),this.labels.pop(),l.label=k,this.finishNode(l,"LabeledStatement")},Le.parseExpressionStatement=function(l,R){return l.expression=R,this.semicolon(),this.finishNode(l,"ExpressionStatement")},Le.parseBlock=function(l,R,k){for(l===void 0&&(l=!0),R===void 0&&(R=this.startNode()),R.body=[],this.expect(m.braceL),l&&this.enterScope(0);this.type!==m.braceR;){var q=this.parseStatement(null);R.body.push(q)}return k&&(this.strict=!1),this.next(),l&&this.exitScope(),this.finishNode(R,"BlockStatement")},Le.parseFor=function(l,R){return l.init=R,this.expect(m.semi),l.test=this.type===m.semi?null:this.parseExpression(),this.expect(m.semi),l.update=this.type===m.parenR?null:this.parseExpression(),this.expect(m.parenR),l.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(l,"ForStatement")},Le.parseForIn=function(l,R){var k=this.type===m._in;return this.next(),R.type==="VariableDeclaration"&&R.declarations[0].init!=null&&(!k||this.options.ecmaVersion<8||this.strict||R.kind!=="var"||R.declarations[0].id.type!=="Identifier")&&this.raise(R.start,(k?"for-in":"for-of")+" loop variable declaration may not have an initializer"),l.left=R,l.right=k?this.parseExpression():this.parseMaybeAssign(),this.expect(m.parenR),l.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(l,k?"ForInStatement":"ForOfStatement")},Le.parseVar=function(l,R,k,q){for(l.declarations=[],l.kind=k;;){var Z=this.startNode();if(this.parseVarId(Z,k),this.eat(m.eq)?Z.init=this.parseMaybeAssign(R):!q&&k==="const"&&!(this.type===m._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!q&&(k==="using"||k==="await using")&&this.options.ecmaVersion>=17&&this.type!==m._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+k+" declaration"):!q&&Z.id.type!=="Identifier"&&!(R&&(this.type===m._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):Z.init=null,l.declarations.push(this.finishNode(Z,"VariableDeclarator")),!this.eat(m.comma))break}return l},Le.parseVarId=function(l,R){l.id=R==="using"||R==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(l.id,R==="var"?ut:Ye,!1)};var fr=1,Pn=2,Gt=4;Le.parseFunction=function(l,R,k,q,Z){this.initFunction(l),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!q)&&(this.type===m.star&&R&Pn&&this.unexpected(),l.generator=this.eat(m.star)),this.options.ecmaVersion>=8&&(l.async=!!q),R&fr&&(l.id=R&Gt&&this.type!==m.name?null:this.parseIdent(),l.id&&!(R&Pn)&&this.checkLValSimple(l.id,this.strict||l.generator||l.async?this.treatFunctionsAsVar?ut:Ye:Wt));var se=this.yieldPos,le=this.awaitPos,Pe=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(mt(l.async,l.generator)),R&fr||(l.id=this.type===m.name?this.parseIdent():null),this.parseFunctionParams(l),this.parseFunctionBody(l,k,!1,Z),this.yieldPos=se,this.awaitPos=le,this.awaitIdentPos=Pe,this.finishNode(l,R&fr?"FunctionDeclaration":"FunctionExpression")},Le.parseFunctionParams=function(l){this.expect(m.parenL),l.params=this.parseBindingList(m.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},Le.parseClass=function(l,R){this.next();var k=this.strict;this.strict=!0,this.parseClassId(l,R),this.parseClassSuper(l);var q=this.enterClassBody(),Z=this.startNode(),se=!1;for(Z.body=[],this.expect(m.braceL);this.type!==m.braceR;){var le=this.parseClassElement(l.superClass!==null);le&&(Z.body.push(le),le.type==="MethodDefinition"&&le.kind==="constructor"?(se&&this.raiseRecoverable(le.start,"Duplicate constructor in the same class"),se=!0):le.key&&le.key.type==="PrivateIdentifier"&&On(q,le)&&this.raiseRecoverable(le.key.start,"Identifier '#"+le.key.name+"' has already been declared"))}return this.strict=k,this.next(),l.body=this.finishNode(Z,"ClassBody"),this.exitClassBody(),this.finishNode(l,R?"ClassDeclaration":"ClassExpression")},Le.parseClassElement=function(l){if(this.eat(m.semi))return null;var R=this.options.ecmaVersion,k=this.startNode(),q="",Z=!1,se=!1,le="method",Pe=!1;if(this.eatContextual("static")){if(R>=13&&this.eat(m.braceL))return this.parseClassStaticBlock(k),k;this.isClassElementNameStart()||this.type===m.star?Pe=!0:q="static"}if(k.static=Pe,!q&&R>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===m.star)&&!this.canInsertSemicolon()?se=!0:q="async"),!q&&(R>=9||!se)&&this.eat(m.star)&&(Z=!0),!q&&!se&&!Z){var xe=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?le=xe:q=xe)}if(q?(k.computed=!1,k.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),k.key.name=q,this.finishNode(k.key,"Identifier")):this.parseClassElementName(k),R<13||this.type===m.parenL||le!=="method"||Z||se){var ot=!k.static&&Hr(k,"constructor"),_t=ot&&l;ot&&le!=="method"&&this.raise(k.key.start,"Constructor can't have get/set modifier"),k.kind=ot?"constructor":le,this.parseClassMethod(k,Z,se,_t)}else this.parseClassField(k);return k},Le.isClassElementNameStart=function(){return this.type===m.name||this.type===m.privateId||this.type===m.num||this.type===m.string||this.type===m.bracketL||this.type.keyword},Le.parseClassElementName=function(l){this.type===m.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),l.computed=!1,l.key=this.parsePrivateIdent()):this.parsePropertyName(l)},Le.parseClassMethod=function(l,R,k,q){var Z=l.key;l.kind==="constructor"?(R&&this.raise(Z.start,"Constructor can't be a generator"),k&&this.raise(Z.start,"Constructor can't be an async method")):l.static&&Hr(l,"prototype")&&this.raise(Z.start,"Classes may not have a static property named prototype");var se=l.value=this.parseMethod(R,k,q);return l.kind==="get"&&se.params.length!==0&&this.raiseRecoverable(se.start,"getter should have no params"),l.kind==="set"&&se.params.length!==1&&this.raiseRecoverable(se.start,"setter should have exactly one param"),l.kind==="set"&&se.params[0].type==="RestElement"&&this.raiseRecoverable(se.params[0].start,"Setter cannot use rest params"),this.finishNode(l,"MethodDefinition")},Le.parseClassField=function(l){return Hr(l,"constructor")?this.raise(l.key.start,"Classes can't have a field named 'constructor'"):l.static&&Hr(l,"prototype")&&this.raise(l.key.start,"Classes can't have a static field named 'prototype'"),this.eat(m.eq)?(this.enterScope(Se|F),l.value=this.parseMaybeAssign(),this.exitScope()):l.value=null,this.semicolon(),this.finishNode(l,"PropertyDefinition")},Le.parseClassStaticBlock=function(l){l.body=[];var R=this.labels;for(this.labels=[],this.enterScope(be|F);this.type!==m.braceR;){var k=this.parseStatement(null);l.body.push(k)}return this.next(),this.exitScope(),this.labels=R,this.finishNode(l,"StaticBlock")},Le.parseClassId=function(l,R){this.type===m.name?(l.id=this.parseIdent(),R&&this.checkLValSimple(l.id,Ye,!1)):(R===!0&&this.unexpected(),l.id=null)},Le.parseClassSuper=function(l){l.superClass=this.eat(m._extends)?this.parseExprSubscripts(null,!1):null},Le.enterClassBody=function(){var l={declared:Object.create(null),used:[]};return this.privateNameStack.push(l),l.declared},Le.exitClassBody=function(){var l=this.privateNameStack.pop(),R=l.declared,k=l.used;if(this.options.checkPrivateFields)for(var q=this.privateNameStack.length,Z=q===0?null:this.privateNameStack[q-1],se=0;se<k.length;++se){var le=k[se];W(R,le.name)||(Z?Z.used.push(le):this.raiseRecoverable(le.start,"Private field '#"+le.name+"' must be declared in an enclosing class"))}};function On(l,R){var k=R.key.name,q=l[k],Z="true";return R.type==="MethodDefinition"&&(R.kind==="get"||R.kind==="set")&&(Z=(R.static?"s":"i")+R.kind),q==="iget"&&Z==="iset"||q==="iset"&&Z==="iget"||q==="sget"&&Z==="sset"||q==="sset"&&Z==="sget"?(l[k]="true",!1):q?!0:(l[k]=Z,!1)}function Hr(l,R){var k=l.computed,q=l.key;return!k&&(q.type==="Identifier"&&q.name===R||q.type==="Literal"&&q.value===R)}Le.parseExportAllDeclaration=function(l,R){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(l.exported=this.parseModuleExportName(),this.checkExport(R,l.exported,this.lastTokStart)):l.exported=null),this.expectContextual("from"),this.type!==m.string&&this.unexpected(),l.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(l.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(l,"ExportAllDeclaration")},Le.parseExport=function(l,R){if(this.next(),this.eat(m.star))return this.parseExportAllDeclaration(l,R);if(this.eat(m._default))return this.checkExport(R,"default",this.lastTokStart),l.declaration=this.parseExportDefaultDeclaration(),this.finishNode(l,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())l.declaration=this.parseExportDeclaration(l),l.declaration.type==="VariableDeclaration"?this.checkVariableExport(R,l.declaration.declarations):this.checkExport(R,l.declaration.id,l.declaration.id.start),l.specifiers=[],l.source=null,this.options.ecmaVersion>=16&&(l.attributes=[]);else{if(l.declaration=null,l.specifiers=this.parseExportSpecifiers(R),this.eatContextual("from"))this.type!==m.string&&this.unexpected(),l.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(l.attributes=this.parseWithClause());else{for(var k=0,q=l.specifiers;k<q.length;k+=1){var Z=q[k];this.checkUnreserved(Z.local),this.checkLocalExport(Z.local),Z.local.type==="Literal"&&this.raise(Z.local.start,"A string literal cannot be used as an exported binding without `from`.")}l.source=null,this.options.ecmaVersion>=16&&(l.attributes=[])}this.semicolon()}return this.finishNode(l,"ExportNamedDeclaration")},Le.parseExportDeclaration=function(l){return this.parseStatement(null)},Le.parseExportDefaultDeclaration=function(){var l;if(this.type===m._function||(l=this.isAsyncFunction())){var R=this.startNode();return this.next(),l&&this.next(),this.parseFunction(R,fr|Gt,!1,l)}else if(this.type===m._class){var k=this.startNode();return this.parseClass(k,"nullableID")}else{var q=this.parseMaybeAssign();return this.semicolon(),q}},Le.checkExport=function(l,R,k){l&&(typeof R!="string"&&(R=R.type==="Identifier"?R.name:R.value),W(l,R)&&this.raiseRecoverable(k,"Duplicate export '"+R+"'"),l[R]=!0)},Le.checkPatternExport=function(l,R){var k=R.type;if(k==="Identifier")this.checkExport(l,R,R.start);else if(k==="ObjectPattern")for(var q=0,Z=R.properties;q<Z.length;q+=1){var se=Z[q];this.checkPatternExport(l,se)}else if(k==="ArrayPattern")for(var le=0,Pe=R.elements;le<Pe.length;le+=1){var xe=Pe[le];xe&&this.checkPatternExport(l,xe)}else k==="Property"?this.checkPatternExport(l,R.value):k==="AssignmentPattern"?this.checkPatternExport(l,R.left):k==="RestElement"&&this.checkPatternExport(l,R.argument)},Le.checkVariableExport=function(l,R){if(l)for(var k=0,q=R;k<q.length;k+=1){var Z=q[k];this.checkPatternExport(l,Z.id)}},Le.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},Le.parseExportSpecifier=function(l){var R=this.startNode();return R.local=this.parseModuleExportName(),R.exported=this.eatContextual("as")?this.parseModuleExportName():R.local,this.checkExport(l,R.exported,R.exported.start),this.finishNode(R,"ExportSpecifier")},Le.parseExportSpecifiers=function(l){var R=[],k=!0;for(this.expect(m.braceL);!this.eat(m.braceR);){if(k)k=!1;else if(this.expect(m.comma),this.afterTrailingComma(m.braceR))break;R.push(this.parseExportSpecifier(l))}return R},Le.parseImport=function(l){return this.next(),this.type===m.string?(l.specifiers=si,l.source=this.parseExprAtom()):(l.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),l.source=this.type===m.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(l.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(l,"ImportDeclaration")},Le.parseImportSpecifier=function(){var l=this.startNode();return l.imported=this.parseModuleExportName(),this.eatContextual("as")?l.local=this.parseIdent():(this.checkUnreserved(l.imported),l.local=l.imported),this.checkLValSimple(l.local,Ye),this.finishNode(l,"ImportSpecifier")},Le.parseImportDefaultSpecifier=function(){var l=this.startNode();return l.local=this.parseIdent(),this.checkLValSimple(l.local,Ye),this.finishNode(l,"ImportDefaultSpecifier")},Le.parseImportNamespaceSpecifier=function(){var l=this.startNode();return this.next(),this.expectContextual("as"),l.local=this.parseIdent(),this.checkLValSimple(l.local,Ye),this.finishNode(l,"ImportNamespaceSpecifier")},Le.parseImportSpecifiers=function(){var l=[],R=!0;if(this.type===m.name&&(l.push(this.parseImportDefaultSpecifier()),!this.eat(m.comma)))return l;if(this.type===m.star)return l.push(this.parseImportNamespaceSpecifier()),l;for(this.expect(m.braceL);!this.eat(m.braceR);){if(R)R=!1;else if(this.expect(m.comma),this.afterTrailingComma(m.braceR))break;l.push(this.parseImportSpecifier())}return l},Le.parseWithClause=function(){var l=[];if(!this.eat(m._with))return l;this.expect(m.braceL);for(var R={},k=!0;!this.eat(m.braceR);){if(k)k=!1;else if(this.expect(m.comma),this.afterTrailingComma(m.braceR))break;var q=this.parseImportAttribute(),Z=q.key.type==="Identifier"?q.key.name:q.key.value;W(R,Z)&&this.raiseRecoverable(q.key.start,"Duplicate attribute key '"+Z+"'"),R[Z]=!0,l.push(q)}return l},Le.parseImportAttribute=function(){var l=this.startNode();return l.key=this.type===m.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(m.colon),this.type!==m.string&&this.unexpected(),l.value=this.parseExprAtom(),this.finishNode(l,"ImportAttribute")},Le.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===m.string){var l=this.parseLiteral(this.value);return de.test(l.value)&&this.raise(l.start,"An export name cannot include a lone surrogate."),l}return this.parseIdent(!0)},Le.adaptDirectivePrologue=function(l){for(var R=0;R<l.length&&this.isDirectiveCandidate(l[R]);++R)l[R].directive=l[R].expression.raw.slice(1,-1)},Le.isDirectiveCandidate=function(l){return this.options.ecmaVersion>=5&&l.type==="ExpressionStatement"&&l.expression.type==="Literal"&&typeof l.expression.value=="string"&&(this.input[l.start]==='"'||this.input[l.start]==="'")};var Yt=at.prototype;Yt.toAssignable=function(l,R,k){if(this.options.ecmaVersion>=6&&l)switch(l.type){case"Identifier":this.inAsync&&l.name==="await"&&this.raise(l.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":l.type="ObjectPattern",k&&this.checkPatternErrors(k,!0);for(var q=0,Z=l.properties;q<Z.length;q+=1){var se=Z[q];this.toAssignable(se,R),se.type==="RestElement"&&(se.argument.type==="ArrayPattern"||se.argument.type==="ObjectPattern")&&this.raise(se.argument.start,"Unexpected token")}break;case"Property":l.kind!=="init"&&this.raise(l.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(l.value,R);break;case"ArrayExpression":l.type="ArrayPattern",k&&this.checkPatternErrors(k,!0),this.toAssignableList(l.elements,R);break;case"SpreadElement":l.type="RestElement",this.toAssignable(l.argument,R),l.argument.type==="AssignmentPattern"&&this.raise(l.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":l.operator!=="="&&this.raise(l.left.end,"Only '=' operator can be used for specifying default value."),l.type="AssignmentPattern",delete l.operator,this.toAssignable(l.left,R);break;case"ParenthesizedExpression":this.toAssignable(l.expression,R,k);break;case"ChainExpression":this.raiseRecoverable(l.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!R)break;default:this.raise(l.start,"Assigning to rvalue")}else k&&this.checkPatternErrors(k,!0);return l},Yt.toAssignableList=function(l,R){for(var k=l.length,q=0;q<k;q++){var Z=l[q];Z&&this.toAssignable(Z,R)}if(k){var se=l[k-1];this.options.ecmaVersion===6&&R&&se&&se.type==="RestElement"&&se.argument.type!=="Identifier"&&this.unexpected(se.argument.start)}return l},Yt.parseSpread=function(l){var R=this.startNode();return this.next(),R.argument=this.parseMaybeAssign(!1,l),this.finishNode(R,"SpreadElement")},Yt.parseRestBinding=function(){var l=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==m.name&&this.unexpected(),l.argument=this.parseBindingAtom(),this.finishNode(l,"RestElement")},Yt.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case m.bracketL:var l=this.startNode();return this.next(),l.elements=this.parseBindingList(m.bracketR,!0,!0),this.finishNode(l,"ArrayPattern");case m.braceL:return this.parseObj(!0)}return this.parseIdent()},Yt.parseBindingList=function(l,R,k,q){for(var Z=[],se=!0;!this.eat(l);)if(se?se=!1:this.expect(m.comma),R&&this.type===m.comma)Z.push(null);else{if(k&&this.afterTrailingComma(l))break;if(this.type===m.ellipsis){var le=this.parseRestBinding();this.parseBindingListItem(le),Z.push(le),this.type===m.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(l);break}else Z.push(this.parseAssignableListItem(q))}return Z},Yt.parseAssignableListItem=function(l){var R=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(R),R},Yt.parseBindingListItem=function(l){return l},Yt.parseMaybeDefault=function(l,R,k){if(k=k||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(m.eq))return k;var q=this.startNodeAt(l,R);return q.left=k,q.right=this.parseMaybeAssign(),this.finishNode(q,"AssignmentPattern")},Yt.checkLValSimple=function(l,R,k){R===void 0&&(R=Et);var q=R!==Et;switch(l.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(l.name)&&this.raiseRecoverable(l.start,(q?"Binding ":"Assigning to ")+l.name+" in strict mode"),q&&(R===Ye&&l.name==="let"&&this.raiseRecoverable(l.start,"let is disallowed as a lexically bound name"),k&&(W(k,l.name)&&this.raiseRecoverable(l.start,"Argument name clash"),k[l.name]=!0),R!==hr&&this.declareName(l.name,R,l.start));break;case"ChainExpression":this.raiseRecoverable(l.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":q&&this.raiseRecoverable(l.start,"Binding member expression");break;case"ParenthesizedExpression":return q&&this.raiseRecoverable(l.start,"Binding parenthesized expression"),this.checkLValSimple(l.expression,R,k);default:this.raise(l.start,(q?"Binding":"Assigning to")+" rvalue")}},Yt.checkLValPattern=function(l,R,k){switch(R===void 0&&(R=Et),l.type){case"ObjectPattern":for(var q=0,Z=l.properties;q<Z.length;q+=1){var se=Z[q];this.checkLValInnerPattern(se,R,k)}break;case"ArrayPattern":for(var le=0,Pe=l.elements;le<Pe.length;le+=1){var xe=Pe[le];xe&&this.checkLValInnerPattern(xe,R,k)}break;default:this.checkLValSimple(l,R,k)}},Yt.checkLValInnerPattern=function(l,R,k){switch(R===void 0&&(R=Et),l.type){case"Property":this.checkLValInnerPattern(l.value,R,k);break;case"AssignmentPattern":this.checkLValPattern(l.left,R,k);break;case"RestElement":this.checkLValPattern(l.argument,R,k);break;default:this.checkLValPattern(l,R,k)}};var cr=function(R,k,q,Z,se){this.token=R,this.isExpr=!!k,this.preserveSpace=!!q,this.override=Z,this.generator=!!se},$t={b_stat:new cr("{",!1),b_expr:new cr("{",!0),b_tmpl:new cr("${",!1),p_stat:new cr("(",!1),p_expr:new cr("(",!0),q_tmpl:new cr("`",!0,!0,function(l){return l.tryReadTemplateToken()}),f_stat:new cr("function",!1),f_expr:new cr("function",!0),f_expr_gen:new cr("function",!0,!1,null,!0),f_gen:new cr("function",!1,!1,null,!0)},gr=at.prototype;gr.initialContext=function(){return[$t.b_stat]},gr.curContext=function(){return this.context[this.context.length-1]},gr.braceIsBlock=function(l){var R=this.curContext();return R===$t.f_expr||R===$t.f_stat?!0:l===m.colon&&(R===$t.b_stat||R===$t.b_expr)?!R.isExpr:l===m._return||l===m.name&&this.exprAllowed?O.test(this.input.slice(this.lastTokEnd,this.start)):l===m._else||l===m.semi||l===m.eof||l===m.parenR||l===m.arrow?!0:l===m.braceL?R===$t.b_stat:l===m._var||l===m._const||l===m.name?!1:!this.exprAllowed},gr.inGeneratorContext=function(){for(var l=this.context.length-1;l>=1;l--){var R=this.context[l];if(R.token==="function")return R.generator}return!1},gr.updateContext=function(l){var R,k=this.type;k.keyword&&l===m.dot?this.exprAllowed=!1:(R=k.updateContext)?R.call(this,l):this.exprAllowed=k.beforeExpr},gr.overrideContext=function(l){this.curContext()!==l&&(this.context[this.context.length-1]=l)},m.parenR.updateContext=m.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var l=this.context.pop();l===$t.b_stat&&this.curContext().token==="function"&&(l=this.context.pop()),this.exprAllowed=!l.isExpr},m.braceL.updateContext=function(l){this.context.push(this.braceIsBlock(l)?$t.b_stat:$t.b_expr),this.exprAllowed=!0},m.dollarBraceL.updateContext=function(){this.context.push($t.b_tmpl),this.exprAllowed=!0},m.parenL.updateContext=function(l){var R=l===m._if||l===m._for||l===m._with||l===m._while;this.context.push(R?$t.p_stat:$t.p_expr),this.exprAllowed=!0},m.incDec.updateContext=function(){},m._function.updateContext=m._class.updateContext=function(l){l.beforeExpr&&l!==m._else&&!(l===m.semi&&this.curContext()!==$t.p_stat)&&!(l===m._return&&O.test(this.input.slice(this.lastTokEnd,this.start)))&&!((l===m.colon||l===m.braceL)&&this.curContext()===$t.b_stat)?this.context.push($t.f_expr):this.context.push($t.f_stat),this.exprAllowed=!1},m.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},m.backQuote.updateContext=function(){this.curContext()===$t.q_tmpl?this.context.pop():this.context.push($t.q_tmpl),this.exprAllowed=!1},m.star.updateContext=function(l){if(l===m._function){var R=this.context.length-1;this.context[R]===$t.f_expr?this.context[R]=$t.f_expr_gen:this.context[R]=$t.f_gen}this.exprAllowed=!0},m.name.updateContext=function(l){var R=!1;this.options.ecmaVersion>=6&&l!==m.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(R=!0),this.exprAllowed=R};var Ge=at.prototype;Ge.checkPropClash=function(l,R,k){if(!(this.options.ecmaVersion>=9&&l.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(l.computed||l.method||l.shorthand))){var q=l.key,Z;switch(q.type){case"Identifier":Z=q.name;break;case"Literal":Z=String(q.value);break;default:return}var se=l.kind;if(this.options.ecmaVersion>=6){Z==="__proto__"&&se==="init"&&(R.proto&&(k?k.doubleProto<0&&(k.doubleProto=q.start):this.raiseRecoverable(q.start,"Redefinition of __proto__ property")),R.proto=!0);return}Z="$"+Z;var le=R[Z];if(le){var Pe;se==="init"?Pe=this.strict&&le.init||le.get||le.set:Pe=le.init||le[se],Pe&&this.raiseRecoverable(q.start,"Redefinition of property")}else le=R[Z]={init:!1,get:!1,set:!1};le[se]=!0}},Ge.parseExpression=function(l,R){var k=this;return this.catchStackOverflow(function(){var q=k.start,Z=k.startLoc,se=k.parseMaybeAssign(l,R);if(k.type===m.comma){var le=k.startNodeAt(q,Z);for(le.expressions=[se];k.eat(m.comma);)le.expressions.push(k.parseMaybeAssign(l,R));return k.finishNode(le,"SequenceExpression")}return se})},Ge.parseMaybeAssign=function(l,R,k){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(l);this.exprAllowed=!1}var q=!1,Z=-1,se=-1,le=-1;R?(Z=R.parenthesizedAssign,se=R.trailingComma,le=R.doubleProto,R.parenthesizedAssign=R.trailingComma=-1):(R=new Or,q=!0);var Pe=this.start,xe=this.startLoc;(this.type===m.parenL||this.type===m.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=l==="await");var ot=this.parseMaybeConditional(l,R);if(k&&(ot=k.call(this,ot,Pe,xe)),this.type.isAssign){var _t=this.startNodeAt(Pe,xe);return _t.operator=this.value,this.type===m.eq&&(ot=this.toAssignable(ot,!1,R)),q||(R.parenthesizedAssign=R.trailingComma=R.doubleProto=-1),R.shorthandAssign>=ot.start&&(R.shorthandAssign=-1),this.type===m.eq?this.checkLValPattern(ot):this.checkLValSimple(ot),_t.left=ot,this.next(),_t.right=this.parseMaybeAssign(l),le>-1&&(R.doubleProto=le),this.finishNode(_t,"AssignmentExpression")}else q&&this.checkExpressionErrors(R,!0);return Z>-1&&(R.parenthesizedAssign=Z),se>-1&&(R.trailingComma=se),ot},Ge.parseMaybeConditional=function(l,R){var k=this.start,q=this.startLoc,Z=this.parseExprOps(l,R);if(this.checkExpressionErrors(R))return Z;if(!(Z.type==="ArrowFunctionExpression"&&Z.start===k)&&this.eat(m.question)){var se=this.startNodeAt(k,q);return se.test=Z,se.consequent=this.parseMaybeAssign(),this.expect(m.colon),se.alternate=this.parseMaybeAssign(l),this.finishNode(se,"ConditionalExpression")}return Z},Ge.parseExprOps=function(l,R){var k=this.start,q=this.startLoc,Z=this.parseMaybeUnary(R,!1,!1,l);return this.checkExpressionErrors(R)||Z.start===k&&Z.type==="ArrowFunctionExpression"?Z:this.parseExprOp(Z,k,q,-1,l)},Ge.parseExprOp=function(l,R,k,q,Z){var se=this.type.binop;if(se!=null&&(!Z||this.type!==m._in)&&se>q){var le=this.type===m.logicalOR||this.type===m.logicalAND,Pe=this.type===m.coalesce;Pe&&(se=m.logicalAND.binop);var xe=this.value;this.next();var ot=this.start,_t=this.startLoc,ir=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,Z),ot,_t,se,Z),vn=this.buildBinary(R,k,l,ir,xe,le||Pe);return(le&&this.type===m.coalesce||Pe&&(this.type===m.logicalOR||this.type===m.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(vn,R,k,q,Z)}return l},Ge.buildBinary=function(l,R,k,q,Z,se){q.type==="PrivateIdentifier"&&this.raise(q.start,"Private identifier can only be left side of binary expression");var le=this.startNodeAt(l,R);return le.left=k,le.operator=Z,le.right=q,this.finishNode(le,se?"LogicalExpression":"BinaryExpression")},Ge.parseMaybeUnary=function(l,R,k,q){var Z=this.start,se=this.startLoc,le;if(this.isContextual("await")&&this.canAwait)le=this.parseAwait(q),R=!0;else if(this.type.prefix){var Pe=this.startNode(),xe=this.type===m.incDec;Pe.operator=this.value,Pe.prefix=!0,this.next(),Pe.argument=this.parseMaybeUnary(null,!0,xe,q),this.checkExpressionErrors(l,!0),xe?this.checkLValSimple(Pe.argument):this.strict&&Pe.operator==="delete"&&hn(Pe.argument)?this.raiseRecoverable(Pe.start,"Deleting local variable in strict mode"):Pe.operator==="delete"&&on(Pe.argument)?this.raiseRecoverable(Pe.start,"Private fields can not be deleted"):R=!0,le=this.finishNode(Pe,xe?"UpdateExpression":"UnaryExpression")}else if(!R&&this.type===m.privateId)(q||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),le=this.parsePrivateIdent(),this.type!==m._in&&this.unexpected();else{if(le=this.parseExprSubscripts(l,q),this.checkExpressionErrors(l))return le;for(;this.type.postfix&&!this.canInsertSemicolon();){var ot=this.startNodeAt(Z,se);ot.operator=this.value,ot.prefix=!1,ot.argument=le,this.checkLValSimple(le),this.next(),le=this.finishNode(ot,"UpdateExpression")}}if(!k&&this.eat(m.starstar))if(R)this.unexpected(this.lastTokStart);else return this.buildBinary(Z,se,le,this.parseMaybeUnary(null,!1,!1,q),"**",!1);else return le};function hn(l){return l.type==="Identifier"||l.type==="ParenthesizedExpression"&&hn(l.expression)}function on(l){return l.type==="MemberExpression"&&l.property.type==="PrivateIdentifier"||l.type==="ChainExpression"&&on(l.expression)||l.type==="ParenthesizedExpression"&&on(l.expression)}Ge.parseExprSubscripts=function(l,R){var k=this.start,q=this.startLoc,Z=this.parseExprAtom(l,R);if(Z.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return Z;var se=this.parseSubscripts(Z,k,q,!1,R);return l&&se.type==="MemberExpression"&&(l.parenthesizedAssign>=se.start&&(l.parenthesizedAssign=-1),l.parenthesizedBind>=se.start&&(l.parenthesizedBind=-1),l.trailingComma>=se.start&&(l.trailingComma=-1)),se},Ge.parseSubscripts=function(l,R,k,q,Z){for(var se=this.options.ecmaVersion>=8&&l.type==="Identifier"&&l.name==="async"&&this.lastTokEnd===l.end&&!this.canInsertSemicolon()&&l.end-l.start===5&&this.potentialArrowAt===l.start,le=!1;;){var Pe=this.parseSubscript(l,R,k,q,se,le,Z);if(Pe.optional&&(le=!0),Pe===l||Pe.type==="ArrowFunctionExpression"){if(le){var xe=this.startNodeAt(R,k);xe.expression=Pe,Pe=this.finishNode(xe,"ChainExpression")}return Pe}l=Pe}},Ge.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(m.arrow)},Ge.parseSubscriptAsyncArrow=function(l,R,k,q){return this.parseArrowExpression(this.startNodeAt(l,R),k,!0,q)},Ge.parseSubscript=function(l,R,k,q,Z,se,le){var Pe=this.options.ecmaVersion>=11,xe=Pe&&this.eat(m.questionDot);q&&xe&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var ot=this.eat(m.bracketL);if(ot||xe&&this.type!==m.parenL&&this.type!==m.backQuote||this.eat(m.dot)){var _t=this.startNodeAt(R,k);_t.object=l,ot?(_t.property=this.parseExpression(),this.expect(m.bracketR)):this.type===m.privateId&&l.type!=="Super"?_t.property=this.parsePrivateIdent():_t.property=this.parseIdent(this.options.allowReserved!=="never"),_t.computed=!!ot,Pe&&(_t.optional=xe),l=this.finishNode(_t,"MemberExpression")}else if(!q&&this.eat(m.parenL)){var ir=new Or,vn=this.yieldPos,Eu=this.awaitPos,cc=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var ld=this.parseExprList(m.parenR,this.options.ecmaVersion>=8,!1,ir);if(Z&&!xe&&this.shouldParseAsyncArrow())return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=vn,this.awaitPos=Eu,this.awaitIdentPos=cc,this.parseSubscriptAsyncArrow(R,k,ld,le);this.checkExpressionErrors(ir,!0),this.yieldPos=vn||this.yieldPos,this.awaitPos=Eu||this.awaitPos,this.awaitIdentPos=cc||this.awaitIdentPos;var uc=this.startNodeAt(R,k);uc.callee=l,uc.arguments=ld,Pe&&(uc.optional=xe),l=this.finishNode(uc,"CallExpression")}else if(this.type===m.backQuote){(xe||se)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var lc=this.startNodeAt(R,k);lc.tag=l,lc.quasi=this.parseTemplate({isTagged:!0}),l=this.finishNode(lc,"TaggedTemplateExpression")}return l},Ge.parseExprAtom=function(l,R,k){this.type===m.slash&&this.readRegexp();var q,Z=this.potentialArrowAt===this.start;switch(this.type){case m._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),q=this.startNode(),this.next(),this.type===m.parenL&&!this.allowDirectSuper&&this.raise(q.start,"super() call outside constructor of a subclass"),this.type!==m.dot&&this.type!==m.bracketL&&this.type!==m.parenL&&this.unexpected(),this.finishNode(q,"Super");case m._this:return q=this.startNode(),this.next(),this.finishNode(q,"ThisExpression");case m.name:var se=this.start,le=this.startLoc,Pe=this.containsEsc,xe=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!Pe&&xe.name==="async"&&!this.canInsertSemicolon()&&this.eat(m._function))return this.overrideContext($t.f_expr),this.parseFunction(this.startNodeAt(se,le),0,!1,!0,R);if(Z&&!this.canInsertSemicolon()){if(this.eat(m.arrow))return this.parseArrowExpression(this.startNodeAt(se,le),[xe],!1,R);if(this.options.ecmaVersion>=8&&xe.name==="async"&&this.type===m.name&&!Pe&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return xe=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(m.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(se,le),[xe],!0,R)}return xe;case m.regexp:var ot=this.value;return q=this.parseLiteral(ot.value),q.regex={pattern:ot.pattern,flags:ot.flags},q;case m.num:case m.string:return this.parseLiteral(this.value);case m._null:case m._true:case m._false:return q=this.startNode(),q.value=this.type===m._null?null:this.type===m._true,q.raw=this.type.keyword,this.next(),this.finishNode(q,"Literal");case m.parenL:var _t=this.start,ir=this.parseParenAndDistinguishExpression(Z,R);return l&&(l.parenthesizedAssign<0&&!this.isSimpleAssignTarget(ir)&&(l.parenthesizedAssign=_t),l.parenthesizedBind<0&&(l.parenthesizedBind=_t)),ir;case m.bracketL:return q=this.startNode(),this.next(),q.elements=this.parseExprList(m.bracketR,!0,!0,l),this.finishNode(q,"ArrayExpression");case m.braceL:return this.overrideContext($t.b_expr),this.parseObj(!1,l);case m._function:return q=this.startNode(),this.next(),this.parseFunction(q,0);case m._class:return this.parseClass(this.startNode(),!1);case m._new:return this.parseNew();case m.backQuote:return this.parseTemplate();case m._import:return this.options.ecmaVersion>=11?this.parseExprImport(k):this.unexpected();default:return this.parseExprAtomDefault()}},Ge.parseExprAtomDefault=function(){this.unexpected()},Ge.parseExprImport=function(l){var R=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===m.parenL&&!l)return this.parseDynamicImport(R);if(this.type===m.dot){var k=this.startNodeAt(R.start,R.loc&&R.loc.start);return k.name="import",R.meta=this.finishNode(k,"Identifier"),this.parseImportMeta(R)}else this.unexpected()},Ge.parseDynamicImport=function(l){if(this.next(),l.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(m.parenR)?l.options=null:(this.expect(m.comma),this.afterTrailingComma(m.parenR)?l.options=null:(l.options=this.parseMaybeAssign(),this.eat(m.parenR)||(this.expect(m.comma),this.afterTrailingComma(m.parenR)||this.unexpected())));else if(!this.eat(m.parenR)){var R=this.start;this.eat(m.comma)&&this.eat(m.parenR)?this.raiseRecoverable(R,"Trailing comma is not allowed in import()"):this.unexpected(R)}return this.finishNode(l,"ImportExpression")},Ge.parseImportMeta=function(l){this.next();var R=this.containsEsc;return l.property=this.parseIdent(!0),l.property.name!=="meta"&&this.raiseRecoverable(l.property.start,"The only valid meta property for import is 'import.meta'"),R&&this.raiseRecoverable(l.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(l.start,"Cannot use 'import.meta' outside a module"),this.finishNode(l,"MetaProperty")},Ge.parseLiteral=function(l){var R=this.startNode();return R.value=l,R.raw=this.input.slice(this.start,this.end),R.raw.charCodeAt(R.raw.length-1)===110&&(R.bigint=R.value!=null?R.value.toString():R.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(R,"Literal")},Ge.parseParenExpression=function(){this.expect(m.parenL);var l=this.parseExpression();return this.expect(m.parenR),l},Ge.shouldParseArrow=function(l){return!this.canInsertSemicolon()},Ge.parseParenAndDistinguishExpression=function(l,R){var k=this.start,q=this.startLoc,Z,se=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var le=this.start,Pe=this.startLoc,xe=[],ot=!0,_t=!1,ir=new Or,vn=this.yieldPos,Eu=this.awaitPos,cc;for(this.yieldPos=0,this.awaitPos=0;this.type!==m.parenR;)if(ot?ot=!1:this.expect(m.comma),se&&this.afterTrailingComma(m.parenR,!0)){_t=!0;break}else if(this.type===m.ellipsis){cc=this.start,xe.push(this.parseParenItem(this.parseRestBinding())),this.type===m.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else xe.push(this.parseMaybeAssign(!1,ir,this.parseParenItem));var ld=this.lastTokEnd,uc=this.lastTokEndLoc;if(this.expect(m.parenR),l&&this.shouldParseArrow(xe)&&this.eat(m.arrow))return this.checkPatternErrors(ir,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=vn,this.awaitPos=Eu,this.parseParenArrowList(k,q,xe,R);(!xe.length||_t)&&this.unexpected(this.lastTokStart),cc&&this.unexpected(cc),this.checkExpressionErrors(ir,!0),this.yieldPos=vn||this.yieldPos,this.awaitPos=Eu||this.awaitPos,xe.length>1?(Z=this.startNodeAt(le,Pe),Z.expressions=xe,this.finishNodeAt(Z,"SequenceExpression",ld,uc)):Z=xe[0]}else Z=this.parseParenExpression();if(this.options.preserveParens){var lc=this.startNodeAt(k,q);return lc.expression=Z,this.finishNode(lc,"ParenthesizedExpression")}else return Z},Ge.parseParenItem=function(l){return l},Ge.parseParenArrowList=function(l,R,k,q){return this.parseArrowExpression(this.startNodeAt(l,R),k,!1,q)};var At=[];Ge.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var l=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===m.dot){var R=this.startNodeAt(l.start,l.loc&&l.loc.start);R.name="new",l.meta=this.finishNode(R,"Identifier"),this.next();var k=this.containsEsc;return l.property=this.parseIdent(!0),l.property.name!=="target"&&this.raiseRecoverable(l.property.start,"The only valid meta property for new is 'new.target'"),k&&this.raiseRecoverable(l.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(l.start,"'new.target' can only be used in functions and class static block"),this.finishNode(l,"MetaProperty")}var q=this.start,Z=this.startLoc;return l.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),q,Z,!0,!1),l.callee.type==="Super"&&this.raiseRecoverable(q,"Invalid use of 'super'"),this.eat(m.parenL)?l.arguments=this.parseExprList(m.parenR,this.options.ecmaVersion>=8,!1):l.arguments=At,this.finishNode(l,"NewExpression")},Ge.parseTemplateElement=function(l){var R=l.isTagged,k=this.startNode();return this.type===m.invalidTemplate?(R||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),k.value={raw:this.value.replace(/\r\n?/g,`
|
|
6
6
|
`),cooked:null}):k.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
@@ -8,7 +8,7 @@ Defaulting to 2020, but this will stop working in the future.`)),R.ecmaVersion=1
|
|
|
8
8
|
`;break;default:l+=String.fromCharCode(k);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),R=this.pos}else++this.pos}},Qe.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(m.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
9
9
|
`&&++this.pos;case`
|
|
10
10
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},Qe.readEscapedChar=function(l){var R=this.input.charCodeAt(++this.pos);switch(++this.pos,R){case 110:return`
|
|
11
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return he(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),l){var k=this.pos-1;this.invalidStringToken(k,"Invalid escape sequence in template string")}default:if(R>=48&&R<=55){var q=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Z=parseInt(q,8);return Z>255&&(q=q.slice(0,-1),Z=parseInt(q,8)),this.pos+=q.length-1,R=this.input.charCodeAt(this.pos),(q!=="0"||R===56||R===57)&&(this.strict||l)&&this.invalidStringToken(this.pos-1-q.length,l?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(Z)}return E(R)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(R)}},Qe.readHexChar=function(l){var R=this.pos,k=this.readInt(16,l);return k===null&&this.invalidStringToken(R,"Bad character escape sequence"),k},Qe.readWord1=function(){this.containsEsc=!1;for(var l="",R=!0,k=this.pos,q=this.options.ecmaVersion>=6;this.pos<this.input.length;){var Z=this.fullCharCodeAtPos();if(y(Z,q))this.pos+=Z<=65535?1:2;else if(Z===92){this.containsEsc=!0,l+=this.input.slice(k,this.pos);var se=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var le=this.readCodePoint();(R?p:y)(le,q)||this.invalidStringToken(se,"Invalid Unicode escape"),l+=he(le),k=this.pos}else break;R=!1}return l+this.input.slice(k,this.pos)},Qe.readWord=function(){var l=this.readWord1(),R=m.name;return this.keywords.test(l)&&(R=$[l]),this.finishToken(R,l)};var st="8.17.0";at.acorn={Parser:at,version:st,defaultOptions:C,Position:j,SourceLocation:V,getLineInfo:K,Node:an,TokenType:h,tokTypes:m,keywordTypes:$,TokContext:cr,tokContexts:$t,isIdentifierChar:y,isIdentifierStart:p,Token:Wr,isNewLine:E,lineBreak:O,lineBreakG:P,nonASCIIwhitespace:D};function un(l,R){return at.parse(l,R)}function Nt(l,R,k){return at.parseExpressionAt(l,R,k)}function Ru(l,R){return at.tokenizer(l,R)}e.Node=an,e.Parser=at,e.Position=j,e.SourceLocation=V,e.TokContext=cr,e.Token=Wr,e.TokenType=h,e.defaultOptions=C,e.getLineInfo=K,e.isIdentifierChar=y,e.isIdentifierStart=p,e.isNewLine=E,e.keywordTypes=$,e.lineBreak=O,e.lineBreakG=P,e.nonASCIIwhitespace=D,e.parse=un,e.parseExpressionAt=Nt,e.tokContexts=$t,e.tokTypes=m,e.tokenizer=Ru,e.version=st})});var fg=te((fye,Ww)=>{var{parse:vU}=Hw();function pc(){let e=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return e.code="FRONTFRIEND_CONFIG_VALIDATION",e}function Kw(e){if(e.type!=="Property"||e.computed||e.method||e.kind!=="init")throw pc();let t=e.key.type==="Identifier"?e.key.name:e.key.value;if(typeof t!="string"||["__proto__","constructor","prototype"].includes(t))throw pc();return t}function Bw(e){if(e.type==="ExportDefaultDeclaration")return e.declaration;let t=e.type==="ExpressionStatement"?e.expression:null;return t?.type==="AssignmentExpression"&&t.operator==="="&&t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.name==="module"&&t.left.property.name==="exports"?t.right:null}function _U(e,t){if(e.type!=="VariableDeclaration"||e.declarations.length!==1)return null;let[r]=e.declarations;return r.id.type!=="Identifier"||t?.type!=="Identifier"||t.name!==r.id.name?null:r.init}function bU(e){let r=vU(e,{ecmaVersion:"latest",sourceType:"module"}).body.filter(o=>o.type!=="EmptyStatement"&&!o.directive),i=r.length===1?Bw(r[0]):r.length===2?_U(r[0],Bw(r[1])):null;if(i?.type!=="ObjectExpression")throw pc();function n(o,a=0){if(a>64)throw pc();if(o.type==="Literal"&&(o.value===null||["string","number","boolean"].includes(typeof o.value)))return o.value;if(o.type==="ArrayExpression")return o.elements.map(s=>{if(!s)throw pc();return n(s,a+1)});if(o.type==="ObjectExpression")return Object.fromEntries(o.properties.map(s=>[Kw(s),n(s.value,a+1)]));if(o.type==="UnaryExpression"&&["-","+"].includes(o.operator)&&o.argument.type==="Literal"&&typeof o.argument.value=="number")return o.operator==="-"?-o.argument.value:o.argument.value;if(o.type==="TemplateLiteral"&&o.expressions.length===0)return o.quasis[0].value.cooked;if(o.type==="MemberExpression"&&!o.computed&&o.object.type==="MemberExpression"&&!o.object.computed&&o.object.object.name==="process"&&o.object.property.name==="env")return process.env[o.property.name];if(o.type==="LogicalExpression"&&["||","??"].includes(o.operator)){let s=n(o.left,a+1);return o.operator==="||"?s||n(o.right,a+1):s??n(o.right,a+1)}throw pc()}return{config:n(i),expression:i}}Ww.exports={parseStaticConfig:bU,propertyName:Kw}});var Xw=te((pye,Yw)=>{var go=require("path"),{fileExists:pg}=Qa();function Gw(e,t=process.cwd()){let r=t;for(;r!==go.parse(r).root;){let i=go.join(r,e);if(pg(i))return i;r=go.dirname(r)}return null}function SU(e,t=process.cwd(),r=null){let i=[],n=t,o=10;for(let a=0;a<o;a++){i.push(go.join(n,e)),a<3&&i.push(go.join(n,"../".repeat(a+1)+e));let s=go.dirname(n);if(s===n)break;n=s}i.push(go.join(__dirname,"../../../",e));for(let a of i)if(pg(a)&&(!r||r(a)))return a;return null}function wU(e,t=process.cwd()){let r=e.map(i=>go.isAbsolute(i)?i:go.join(t,i));for(let i of r)if(pg(i))return i;return null}function $U(e=process.cwd()){let t=Gw("frontfriend.config.js",e);return t?go.dirname(t):e}Yw.exports={findFileUpward:Gw,findDirectoryUpward:SU,findDirectoryWithPaths:wU,resolveProjectRoot:$U}});var Es=te((mye,RU)=>{RU.exports={name:"@frontfriend/sdk",version:"1.0.0"}});var Pu=te((hye,Qw)=>{var{name:EU}=Es();Qw.exports={PACKAGE_NAME:EU}});var Ps=te((gye,t0)=>{var{PACKAGE_NAME:md}=Pu(),qa=require("fs"),PU=require("http"),OU=require("https"),Qn=require("path"),hd=["contracts","tokens","components"],IU=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],CU={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},TU=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],kU=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function e0(e){try{return JSON.parse(qa.readFileSync(e,"utf8"))}catch{return{}}}function mg(e){if(e===void 0)return null;if(!Array.isArray(e)){let i=new Error("`adopt` in frontfriend.config.js must be an array.");throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let t=e.filter(i=>!hd.includes(i));if(t.length>0){let i=new Error(`Unknown Frontfriend adoption level: ${t.join(", ")}.`);throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let r=e.includes("components")?2:e.includes("tokens")?1:0;return hd.slice(0,r+1)}function jU(e){for(let[t,r]of Object.entries(CU)){let i=r.find(o=>qa.existsSync(Qn.join(e,o)));if(!i)continue;let n=qa.readFileSync(Qn.join(e,i),"utf8");return{buildTool:t,present:n.includes(`${md}/${t}`)}}return{buildTool:null,present:!1}}function AU(e){let t=[Qn.join(e,"components","ui"),Qn.join(e,"src","components","ui"),Qn.join(e,"app","components","ui")].filter(n=>qa.existsSync(n)),r=new Set;function i(n){for(let o of qa.readdirSync(n,{withFileTypes:!0})){let a=Qn.join(n,o.name);if(o.isDirectory())i(a);else if(/\.(js|jsx|ts|tsx|vue)$/.test(o.name)){if(!qa.readFileSync(a,"utf8").includes(md))continue;let c=Qn.basename(o.name,Qn.extname(o.name));r.add(c.toLowerCase()==="index"?Qn.basename(n):c.toLowerCase())}}}return t.forEach(i),[...r].sort()}function NU(e){let t=e0(Qn.join(e,"package.json")),r={...t.dependencies||{},...t.devDependencies||{}},i=r.tailwindcss||null,o=[e0(Qn.join(e,"components.json"))?.tailwind?.css,...IU].filter(Boolean).find(c=>qa.existsSync(Qn.join(e,c))),a=o?qa.readFileSync(Qn.join(e,o),"utf8"):"",s=kU.filter(c=>r[c]);return!s.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(a)&&!a.includes(`${md}/theme.css`)&&s.push("css-custom-properties"),{nativeTokens:{present:a.includes("/* Frontfriend managed native tokens: start */"),file:o||null},tailwind:{present:!!i,version:i,major:i&&Number((String(i).match(/\d+/)||[])[0])||null},componentsJson:qa.existsSync(Qn.join(e,"components.json")),themeImport:{present:a.includes(`${md}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(a),file:o||null},plugin:jU(e),frontfriendComponents:AU(e),foreignComponentLibraries:TU.filter(c=>r[c]),foreignTokenSystems:s}}function MU(e,t){let r=mg(e)||hd,i=r.includes("tokens"),n=r.includes("components"),o=[];return i&&!t.themeImport.present&&!t.nativeTokens?.present&&o.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!i&&t.themeImport.present&&o.push("Frontfriend tokens are present in CSS but are not adopted in config."),n&&!t.componentsJson&&o.push("Config adopts components, but components.json was not observed."),!n&&t.frontfriendComponents.length>0&&o.push("Frontfriend components are installed but are not adopted in config."),o}function xU({apiUrl:e,token:t,ffId:r,name:i,adopt:n,observed:o,framework:a,primitive:s}){if(!e||!t||!r||!i||!a||s===void 0)return Promise.resolve({reported:!1,unavailable:!0});let c=new URL("/api/apps/sync",e),u=JSON.stringify({ffId:r,name:i,adopt:mg(n),observed:o,runtime:"sdk",framework:a,primitive:s}),d=c.protocol==="https:"?OU:PU;return new Promise(f=>{let p=d.request(c,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","content-length":Buffer.byteLength(u)}},y=>{y.resume(),y.on("end",()=>{y.statusCode>=200&&y.statusCode<300?f({reported:!0,unavailable:!1}):f({reported:!1,unavailable:!0})})});p.on("error",()=>f({reported:!1,unavailable:!0})),p.setTimeout(1500,()=>{p.destroy(),f({reported:!1,unavailable:!0})}),p.end(u)})}t0.exports={ADOPTION_LEVELS:hd,normalizeAdopt:mg,probeAdoption:NU,adoptionWarnings:MU,reportAdoption:xU}});var gd=te((vye,n0)=>{var Ou=require("path"),{parseStaticConfig:qU}=fg(),{findFileUpward:DU}=Xw(),{fileExists:yye,readJsonFileSafe:r0,readFileSafe:LU}=Qa(),{normalizeAdopt:UU}=Ps();function hg(e,t){let r=Ou.dirname(t),i={...e,ffId:e["ff-id"]||null,appRoot:r};if(!i.name){let n=r0(Ou.join(r,"package.json"))?.name;n&&(i.name=n)}return e.adopt!==void 0&&(i.adopt=UU(e.adopt),i.adoptExplicit=!0),i}async function zU(e){return qU(LU(e)).config}var gg=class{findConfigFile(t=process.cwd()){return DU("frontfriend.config.js",t)}isESModule(t){try{let r=Ou.join(t,"package.json"),i=r0(r);if(i)return i.type==="module"}catch{}return!1}async load({startDir:t=process.cwd(),strict:r=!1,fresh:i=!1}={}){let n=this.findConfigFile(t);if(n)try{if(i)return hg(await zU(n),n);let o,a=Ou.dirname(n);if(n.endsWith(".js")&&this.isESModule(a)){let u=await import(`file://${n}`);o=u.default||u}else o=require(n);return hg(o,n)}catch(o){if(r||o.code==="FRONTFRIEND_CONFIG_VALIDATION")throw o;console.error("Error loading frontfriend.config.js:",o.message)}return{ffId:null,appRoot:t}}loadSync(){let t=this.findConfigFile();if(t)try{let r=Ou.dirname(t);if(t.endsWith(".js")&&this.isESModule(r))console.error("Error: frontfriend.config.js is an ES module. Please use the async load() method");else{let n=require(t);return hg(n,t)}}catch(r){if(r.code==="FRONTFRIEND_CONFIG_VALIDATION")throw r;console.error("Error loading frontfriend.config.js:",r.message)}return{ffId:null,appRoot:process.cwd()}}};n0.exports=gg});var yd={};mo(yd,{ProjectTargetError:()=>es,SUPPORTED_PROJECT_TARGETS:()=>i0,assertMatchingProjectTargets:()=>o0,defaultV4ProjectTarget:()=>FU,parseProjectTarget:()=>Tn,projectTargetKey:()=>Da,registryRoute:()=>ZU,resolveProjectTarget:()=>JU});function Da(e){return`${e.framework}/${e.primitive}`}function Tn(e,t="Project target"){let r=e,i=typeof r?.framework=="string"?r.framework.trim().toLowerCase():"",n=typeof r?.primitive=="string"?r.primitive.trim().toLowerCase():"",o=`${i}/${n}`;if(!i||!n||!VU.has(o))throw new es("INVALID_PROJECT_TARGET",`${t} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${o}.`,{framework:i||null,primitive:n||null});return{framework:i,primitive:n}}function FU(e="react"){return Tn({framework:e,primitive:e==="vue"?"reka":"base"})}function o0(e){let t=Object.entries(e).filter(([,n])=>n!=null).map(([n,o])=>[n,Tn(o,n)]);if(t.length===0)throw new es("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let r=Da(t[0][1]);if(t.find(([,n])=>Da(n)!==r))throw new es("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${t.map(([n,o])=>`${n}=${Da(o)}`).join(", ")}.`,{targets:Object.fromEntries(t)});return t[0][1]}function JU({persisted:e,configured:t,app:r,release:i,lock:n,proposed:o}={}){let a={persisted:e,configured:t,app:r,release:i,lock:n};if(Object.values(a).some(s=>s!=null))return o0(a);if(o)return Tn(o,"migration proposal");throw new es("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function ZU(e,t){throw Tn(e),String(t||"").trim(),new es("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var i0,VU,es,Os=Ve(()=>{i0=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),VU=new Set(i0.map(e=>`${e.framework}/${e.primitive}`)),es=class extends Error{constructor(t,r,i={}){super(r),this.name="ProjectTargetError",this.code=t,Object.assign(this,i)}}});var f0=te((_ye,d0)=>{var a0=require("fs"),s0=require("path"),{parseProjectTarget:HU,ProjectTargetError:BU}=(Os(),hi(yd)),KU=[["radix",e=>e==="radix-ui"||e.startsWith("@radix-ui/")&&e!=="@radix-ui/react-slot"],["base",e=>e==="@base-ui-components/react"||e==="@base-ui/react"],["aria",e=>e==="react-aria-components"||e==="react-aria"],["reka",e=>e==="reka-ui"||e==="radix-vue"]];function c0(e){return JSON.parse(a0.readFileSync(e,"utf8"))}function u0(e){try{let t=c0(s0.join(e,"package.json"));return{...t.dependencies||{},...t.devDependencies||{}}}catch{return{}}}function l0(e){let t=u0(e);return t.vue||t["@vitejs/plugin-vue"]||t.nuxt?"vue":"react"}var vd=e=>`${e.framework}/${e.primitive}`;function yg(e,t){try{return{status:"supported",target:HU(e),...t}}catch(r){if(!(r instanceof BU))throw r;return{status:"unsupported",detected:e,reason:r.message,...t}}}function WU(e,{persisted:t,declared:r,allowMissingComponents:i=!1}={}){let n=s0.join(e,"components.json"),o=a0.existsSync(n),a=u0(e),s=l0(e),c=t?.framework&&t?.primitive?t:r,u=c?.framework===s&&c?.primitive&&(s==="react"?a.react:a.vue||a.nuxt);if(!o&&!u&&!i)return{status:"not_shadcn",reason:"components.json was not found: this is not a shadcn application. Run `npx shadcn@latest init` (`npx shadcn-vue@latest init` for Vue) first, or run connect in the application directory."};let d;try{d=o?c0(n):{}}catch($){return{status:i?"unsupported":"not_shadcn",reason:`components.json is not valid JSON (${$.message}).`}}let f=typeof d?.style=="string"?d.style:null,p=o?[`components.json${f?` (style ${f})`:""}`]:["Explicit Project target for a new application"],y=s==="vue"?["vue","@vitejs/plugin-vue","nuxt"].find($=>a[$]):a.react?"react":null;y&&p.push(`package.json: ${y}`);let h=new Map;for(let[$,w]of KU){let m=Object.keys(a).sort().find(w);m&&h.set($,`package.json: ${m}`)}let v=f&&/^(radix|base|aria|reka)-/.exec(f)?.[1];v&&!h.has(v)&&h.set(v,`components.json: style ${f}`),p.push(...h.values());let _={components_json:o?"components.json":null,evidence:p};if(t?.framework&&t?.primitive)return yg({framework:t.framework,primitive:t.primitive},_);if(h.size>1)return{status:"conflict",reason:`Evidence for several primitives (${[...h.keys()].join(", ")}): a project uses one Project target. Remove the unused primitive, then run connect again.`,..._};let g=h.size===1?{framework:[...h.keys()][0]==="reka"?"vue":s,primitive:[...h.keys()][0]}:null;if(r?.framework||r?.primitive){let $={framework:r.framework||s,primitive:r.primitive||g?.primitive};return $.primitive?g&&vd(g)!==vd($)?{status:"conflict",reason:`The declared target ${vd($)} conflicts with the project, which shows ${vd(g)}.`,..._}:yg($,_):{status:"undetermined",reason:"The primitive cannot be determined. Pass --primitive with --framework.",..._}}return g?yg(g,_):{status:"undetermined",reason:"components.json exists, but no primitive package is installed yet, so the primitive cannot be determined. Pass --primitive: radix, base or aria for React, reka for Vue.",..._}}d0.exports={detectShadcnProject:WU,detectProjectFramework:l0}});var bd=te((bye,g0)=>{var{parseStaticConfig:vg,propertyName:_d}=fg(),{fileExists:p0,readFileSafe:_g,writeTextFile:bg,readJsonFileSafe:GU}=Qa(),mc=require("path"),{normalizeAdopt:m0}=Ps(),{parseProjectTarget:YU}=(Os(),hi(yd));function h0(e){try{return GU(e)??{}}catch{return{}}}function XU(e){return h0(mc.join(e,"package.json")).name||mc.basename(e)}function QU(e={}){let t={...e};return delete t.ffId,delete t.appRoot,delete t.adoptExplicit,delete t["auth-token"],delete t.authToken,t}function ez(e,t,{ffId:r,name:i,adopt:n,framework:o,primitive:a,apiUrl:s,baseLibrary:c,tag:u}){let d=YU({framework:o,primitive:a},"Setup Project target"),f=QU(t),p={name:i.trim(),"ff-id":r.trim(),adopt:m0(n),framework:d.framework,primitive:d.primitive};if(u!==void 0){if(typeof u!="string"||!u.trim())throw new Error("Release tag must not be empty.");p.tag=u.trim()}if(c!==void 0){if(!["frontfriend","shadcn"].includes(c))throw new Error("Base library must be frontfriend or shadcn.");p.baseLibrary=c}s&&(p["api-url"]=String(s).replace(/\/+$/,""),delete f.apiUrl);for(let[v,_]of Object.entries(f))v in p||(p[v]=_);let y=mc.join(e,"frontfriend.config.js"),h;if(p0(y)){let v=_g(y),{expression:_}=vg(v),g=new Set(["name","ff-id","adopt","framework","primitive",...u!==void 0?["tag","releaseTagId"]:[],...s?["api-url","apiUrl"]:[],...c!==void 0?["baseLibrary"]:[]]),$=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),w=_.properties.filter(O=>!g.has(_d(O))&&!$.has(_d(O))).map(O=>v.slice(O.start,O.end));h=[...Object.entries(p).filter(([O])=>g.has(O)).map(([O,P])=>`${JSON.stringify(O)}: ${JSON.stringify(P)}`),...w]}else h=Object.entries(p).map(([v,_])=>`${JSON.stringify(v)}: ${JSON.stringify(_)}`);return bg(y,Sg(e,h)),p}function Sg(e,t){let r=`{
|
|
11
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return he(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),l){var k=this.pos-1;this.invalidStringToken(k,"Invalid escape sequence in template string")}default:if(R>=48&&R<=55){var q=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],Z=parseInt(q,8);return Z>255&&(q=q.slice(0,-1),Z=parseInt(q,8)),this.pos+=q.length-1,R=this.input.charCodeAt(this.pos),(q!=="0"||R===56||R===57)&&(this.strict||l)&&this.invalidStringToken(this.pos-1-q.length,l?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(Z)}return E(R)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(R)}},Qe.readHexChar=function(l){var R=this.pos,k=this.readInt(16,l);return k===null&&this.invalidStringToken(R,"Bad character escape sequence"),k},Qe.readWord1=function(){this.containsEsc=!1;for(var l="",R=!0,k=this.pos,q=this.options.ecmaVersion>=6;this.pos<this.input.length;){var Z=this.fullCharCodeAtPos();if(y(Z,q))this.pos+=Z<=65535?1:2;else if(Z===92){this.containsEsc=!0,l+=this.input.slice(k,this.pos);var se=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var le=this.readCodePoint();(R?p:y)(le,q)||this.invalidStringToken(se,"Invalid Unicode escape"),l+=he(le),k=this.pos}else break;R=!1}return l+this.input.slice(k,this.pos)},Qe.readWord=function(){var l=this.readWord1(),R=m.name;return this.keywords.test(l)&&(R=$[l]),this.finishToken(R,l)};var st="8.17.0";at.acorn={Parser:at,version:st,defaultOptions:C,Position:j,SourceLocation:V,getLineInfo:K,Node:an,TokenType:h,tokTypes:m,keywordTypes:$,TokContext:cr,tokContexts:$t,isIdentifierChar:y,isIdentifierStart:p,Token:Wr,isNewLine:E,lineBreak:O,lineBreakG:P,nonASCIIwhitespace:D};function un(l,R){return at.parse(l,R)}function Nt(l,R,k){return at.parseExpressionAt(l,R,k)}function Ru(l,R){return at.tokenizer(l,R)}e.Node=an,e.Parser=at,e.Position=j,e.SourceLocation=V,e.TokContext=cr,e.Token=Wr,e.TokenType=h,e.defaultOptions=C,e.getLineInfo=K,e.isIdentifierChar=y,e.isIdentifierStart=p,e.isNewLine=E,e.keywordTypes=$,e.lineBreak=O,e.lineBreakG=P,e.nonASCIIwhitespace=D,e.parse=un,e.parseExpressionAt=Nt,e.tokContexts=$t,e.tokTypes=m,e.tokenizer=Ru,e.version=st})});var fg=te((fye,Ww)=>{var{parse:vU}=Hw();function pc(){let e=new Error("Configuration reads require a data-only object export. Remove executable statements from frontfriend.config.js.");return e.code="FRONTFRIEND_CONFIG_VALIDATION",e}function Kw(e){if(e.type!=="Property"||e.computed||e.method||e.kind!=="init")throw pc();let t=e.key.type==="Identifier"?e.key.name:e.key.value;if(typeof t!="string"||["__proto__","constructor","prototype"].includes(t))throw pc();return t}function Bw(e){if(e.type==="ExportDefaultDeclaration")return e.declaration;let t=e.type==="ExpressionStatement"?e.expression:null;return t?.type==="AssignmentExpression"&&t.operator==="="&&t.left.type==="MemberExpression"&&!t.left.computed&&t.left.object.name==="module"&&t.left.property.name==="exports"?t.right:null}function _U(e,t){if(e.type!=="VariableDeclaration"||e.declarations.length!==1)return null;let[r]=e.declarations;return r.id.type!=="Identifier"||t?.type!=="Identifier"||t.name!==r.id.name?null:r.init}function bU(e){let r=vU(e,{ecmaVersion:"latest",sourceType:"module"}).body.filter(o=>o.type!=="EmptyStatement"&&!o.directive),i=r.length===1?Bw(r[0]):r.length===2?_U(r[0],Bw(r[1])):null;if(i?.type!=="ObjectExpression")throw pc();function n(o,a=0){if(a>64)throw pc();if(o.type==="Literal"&&(o.value===null||["string","number","boolean"].includes(typeof o.value)))return o.value;if(o.type==="ArrayExpression")return o.elements.map(s=>{if(!s)throw pc();return n(s,a+1)});if(o.type==="ObjectExpression")return Object.fromEntries(o.properties.map(s=>[Kw(s),n(s.value,a+1)]));if(o.type==="UnaryExpression"&&["-","+"].includes(o.operator)&&o.argument.type==="Literal"&&typeof o.argument.value=="number")return o.operator==="-"?-o.argument.value:o.argument.value;if(o.type==="TemplateLiteral"&&o.expressions.length===0)return o.quasis[0].value.cooked;if(o.type==="MemberExpression"&&!o.computed&&o.object.type==="MemberExpression"&&!o.object.computed&&o.object.object.name==="process"&&o.object.property.name==="env")return process.env[o.property.name];if(o.type==="LogicalExpression"&&["||","??"].includes(o.operator)){let s=n(o.left,a+1);return o.operator==="||"?s||n(o.right,a+1):s??n(o.right,a+1)}throw pc()}return{config:n(i),expression:i}}Ww.exports={parseStaticConfig:bU,propertyName:Kw}});var Xw=te((pye,Yw)=>{var go=require("path"),{fileExists:pg}=Qa();function Gw(e,t=process.cwd()){let r=t;for(;r!==go.parse(r).root;){let i=go.join(r,e);if(pg(i))return i;r=go.dirname(r)}return null}function SU(e,t=process.cwd(),r=null){let i=[],n=t,o=10;for(let a=0;a<o;a++){i.push(go.join(n,e)),a<3&&i.push(go.join(n,"../".repeat(a+1)+e));let s=go.dirname(n);if(s===n)break;n=s}i.push(go.join(__dirname,"../../../",e));for(let a of i)if(pg(a)&&(!r||r(a)))return a;return null}function wU(e,t=process.cwd()){let r=e.map(i=>go.isAbsolute(i)?i:go.join(t,i));for(let i of r)if(pg(i))return i;return null}function $U(e=process.cwd()){let t=Gw("frontfriend.config.js",e);return t?go.dirname(t):e}Yw.exports={findFileUpward:Gw,findDirectoryUpward:SU,findDirectoryWithPaths:wU,resolveProjectRoot:$U}});var Es=te((mye,RU)=>{RU.exports={name:"@frontfriend/sdk",version:"1.1.0"}});var Pu=te((hye,Qw)=>{var{name:EU}=Es();Qw.exports={PACKAGE_NAME:EU}});var Ps=te((gye,t0)=>{var{PACKAGE_NAME:md}=Pu(),qa=require("fs"),PU=require("http"),OU=require("https"),Qn=require("path"),hd=["contracts","tokens","components"],IU=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"],CU={next:["next.config.js","next.config.mjs","next.config.ts"],vite:["vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs"]},TU=["primereact","@mui/material","antd","@chakra-ui/react","@mantine/core","@fluentui/react"],kU=["style-dictionary","@tokens-studio/sd-transforms","@vanilla-extract/css","styled-components","@emotion/react"];function e0(e){try{return JSON.parse(qa.readFileSync(e,"utf8"))}catch{return{}}}function mg(e){if(e===void 0)return null;if(!Array.isArray(e)){let i=new Error("`adopt` in frontfriend.config.js must be an array.");throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let t=e.filter(i=>!hd.includes(i));if(t.length>0){let i=new Error(`Unknown Frontfriend adoption level: ${t.join(", ")}.`);throw i.code="FRONTFRIEND_CONFIG_VALIDATION",i}let r=e.includes("components")?2:e.includes("tokens")?1:0;return hd.slice(0,r+1)}function jU(e){for(let[t,r]of Object.entries(CU)){let i=r.find(o=>qa.existsSync(Qn.join(e,o)));if(!i)continue;let n=qa.readFileSync(Qn.join(e,i),"utf8");return{buildTool:t,present:n.includes(`${md}/${t}`)}}return{buildTool:null,present:!1}}function AU(e){let t=[Qn.join(e,"components","ui"),Qn.join(e,"src","components","ui"),Qn.join(e,"app","components","ui")].filter(n=>qa.existsSync(n)),r=new Set;function i(n){for(let o of qa.readdirSync(n,{withFileTypes:!0})){let a=Qn.join(n,o.name);if(o.isDirectory())i(a);else if(/\.(js|jsx|ts|tsx|vue)$/.test(o.name)){if(!qa.readFileSync(a,"utf8").includes(md))continue;let c=Qn.basename(o.name,Qn.extname(o.name));r.add(c.toLowerCase()==="index"?Qn.basename(n):c.toLowerCase())}}}return t.forEach(i),[...r].sort()}function NU(e){let t=e0(Qn.join(e,"package.json")),r={...t.dependencies||{},...t.devDependencies||{}},i=r.tailwindcss||null,o=[e0(Qn.join(e,"components.json"))?.tailwind?.css,...IU].filter(Boolean).find(c=>qa.existsSync(Qn.join(e,c))),a=o?qa.readFileSync(Qn.join(e,o),"utf8"):"",s=kU.filter(c=>r[c]);return!s.length&&/:root[\s\S]*--(?:color|spacing|font|radius)-[\w-]+\s*:/.test(a)&&!a.includes(`${md}/theme.css`)&&s.push("css-custom-properties"),{nativeTokens:{present:a.includes("/* Frontfriend managed native tokens: start */"),file:o||null},tailwind:{present:!!i,version:i,major:i&&Number((String(i).match(/\d+/)||[])[0])||null},componentsJson:qa.existsSync(Qn.join(e,"components.json")),themeImport:{present:a.includes(`${md}/theme.css`)||/@import\s+["'][^"']*node_modules\/\.cache\/frontfriend\/theme\.css["']/.test(a),file:o||null},plugin:jU(e),frontfriendComponents:AU(e),foreignComponentLibraries:TU.filter(c=>r[c]),foreignTokenSystems:s}}function MU(e,t){let r=mg(e)||hd,i=r.includes("tokens"),n=r.includes("components"),o=[];return i&&!t.themeImport.present&&!t.nativeTokens?.present&&o.push("Config adopts tokens, but the Frontfriend theme import was not observed."),!i&&t.themeImport.present&&o.push("Frontfriend tokens are present in CSS but are not adopted in config."),n&&!t.componentsJson&&o.push("Config adopts components, but components.json was not observed."),!n&&t.frontfriendComponents.length>0&&o.push("Frontfriend components are installed but are not adopted in config."),o}function xU({apiUrl:e,token:t,ffId:r,name:i,adopt:n,observed:o,framework:a,primitive:s}){if(!e||!t||!r||!i||!a||s===void 0)return Promise.resolve({reported:!1,unavailable:!0});let c=new URL("/api/apps/sync",e),u=JSON.stringify({ffId:r,name:i,adopt:mg(n),observed:o,runtime:"sdk",framework:a,primitive:s}),d=c.protocol==="https:"?OU:PU;return new Promise(f=>{let p=d.request(c,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json","content-length":Buffer.byteLength(u)}},y=>{y.resume(),y.on("end",()=>{y.statusCode>=200&&y.statusCode<300?f({reported:!0,unavailable:!1}):f({reported:!1,unavailable:!0})})});p.on("error",()=>f({reported:!1,unavailable:!0})),p.setTimeout(1500,()=>{p.destroy(),f({reported:!1,unavailable:!0})}),p.end(u)})}t0.exports={ADOPTION_LEVELS:hd,normalizeAdopt:mg,probeAdoption:NU,adoptionWarnings:MU,reportAdoption:xU}});var gd=te((vye,n0)=>{var Ou=require("path"),{parseStaticConfig:qU}=fg(),{findFileUpward:DU}=Xw(),{fileExists:yye,readJsonFileSafe:r0,readFileSafe:LU}=Qa(),{normalizeAdopt:UU}=Ps();function hg(e,t){let r=Ou.dirname(t),i={...e,ffId:e["ff-id"]||null,appRoot:r};if(!i.name){let n=r0(Ou.join(r,"package.json"))?.name;n&&(i.name=n)}return e.adopt!==void 0&&(i.adopt=UU(e.adopt),i.adoptExplicit=!0),i}async function zU(e){return qU(LU(e)).config}var gg=class{findConfigFile(t=process.cwd()){return DU("frontfriend.config.js",t)}isESModule(t){try{let r=Ou.join(t,"package.json"),i=r0(r);if(i)return i.type==="module"}catch{}return!1}async load({startDir:t=process.cwd(),strict:r=!1,fresh:i=!1}={}){let n=this.findConfigFile(t);if(n)try{if(i)return hg(await zU(n),n);let o,a=Ou.dirname(n);if(n.endsWith(".js")&&this.isESModule(a)){let u=await import(`file://${n}`);o=u.default||u}else o=require(n);return hg(o,n)}catch(o){if(r||o.code==="FRONTFRIEND_CONFIG_VALIDATION")throw o;console.error("Error loading frontfriend.config.js:",o.message)}return{ffId:null,appRoot:t}}loadSync(){let t=this.findConfigFile();if(t)try{let r=Ou.dirname(t);if(t.endsWith(".js")&&this.isESModule(r))console.error("Error: frontfriend.config.js is an ES module. Please use the async load() method");else{let n=require(t);return hg(n,t)}}catch(r){if(r.code==="FRONTFRIEND_CONFIG_VALIDATION")throw r;console.error("Error loading frontfriend.config.js:",r.message)}return{ffId:null,appRoot:process.cwd()}}};n0.exports=gg});var yd={};mo(yd,{ProjectTargetError:()=>es,SUPPORTED_PROJECT_TARGETS:()=>i0,assertMatchingProjectTargets:()=>o0,defaultV4ProjectTarget:()=>FU,parseProjectTarget:()=>Tn,projectTargetKey:()=>Da,registryRoute:()=>ZU,resolveProjectTarget:()=>JU});function Da(e){return`${e.framework}/${e.primitive}`}function Tn(e,t="Project target"){let r=e,i=typeof r?.framework=="string"?r.framework.trim().toLowerCase():"",n=typeof r?.primitive=="string"?r.primitive.trim().toLowerCase():"",o=`${i}/${n}`;if(!i||!n||!VU.has(o))throw new es("INVALID_PROJECT_TARGET",`${t} must be exactly one of react/radix, react/base, react/aria, or vue/reka; received ${o}.`,{framework:i||null,primitive:n||null});return{framework:i,primitive:n}}function FU(e="react"){return Tn({framework:e,primitive:e==="vue"?"reka":"base"})}function o0(e){let t=Object.entries(e).filter(([,n])=>n!=null).map(([n,o])=>[n,Tn(o,n)]);if(t.length===0)throw new es("PROJECT_TARGET_REQUIRED","A persisted or configured Project target is required.");let r=Da(t[0][1]);if(t.find(([,n])=>Da(n)!==r))throw new es("PROJECT_TARGET_MISMATCH",`Project target mismatch: ${t.map(([n,o])=>`${n}=${Da(o)}`).join(", ")}.`,{targets:Object.fromEntries(t)});return t[0][1]}function JU({persisted:e,configured:t,app:r,release:i,lock:n,proposed:o}={}){let a={persisted:e,configured:t,app:r,release:i,lock:n};if(Object.values(a).some(s=>s!=null))return o0(a);if(o)return Tn(o,"migration proposal");throw new es("PROJECT_TARGET_REQUIRED","A Project target is required; package detection may only propose one during migration.")}function ZU(e,t){throw Tn(e),String(t||"").trim(),new es("CURRENT_ROUTE_RETIRED","Components resolve only from an authenticated immutable Design System Release.")}var i0,VU,es,Os=Ve(()=>{i0=Object.freeze([Object.freeze({framework:"react",primitive:"radix"}),Object.freeze({framework:"react",primitive:"base"}),Object.freeze({framework:"react",primitive:"aria"}),Object.freeze({framework:"vue",primitive:"reka"})]),VU=new Set(i0.map(e=>`${e.framework}/${e.primitive}`)),es=class extends Error{constructor(t,r,i={}){super(r),this.name="ProjectTargetError",this.code=t,Object.assign(this,i)}}});var f0=te((_ye,d0)=>{var a0=require("fs"),s0=require("path"),{parseProjectTarget:HU,ProjectTargetError:BU}=(Os(),hi(yd)),KU=[["radix",e=>e==="radix-ui"||e.startsWith("@radix-ui/")&&e!=="@radix-ui/react-slot"],["base",e=>e==="@base-ui-components/react"||e==="@base-ui/react"],["aria",e=>e==="react-aria-components"||e==="react-aria"],["reka",e=>e==="reka-ui"||e==="radix-vue"]];function c0(e){return JSON.parse(a0.readFileSync(e,"utf8"))}function u0(e){try{let t=c0(s0.join(e,"package.json"));return{...t.dependencies||{},...t.devDependencies||{}}}catch{return{}}}function l0(e){let t=u0(e);return t.vue||t["@vitejs/plugin-vue"]||t.nuxt?"vue":"react"}var vd=e=>`${e.framework}/${e.primitive}`;function yg(e,t){try{return{status:"supported",target:HU(e),...t}}catch(r){if(!(r instanceof BU))throw r;return{status:"unsupported",detected:e,reason:r.message,...t}}}function WU(e,{persisted:t,declared:r,allowMissingComponents:i=!1}={}){let n=s0.join(e,"components.json"),o=a0.existsSync(n),a=u0(e),s=l0(e),c=t?.framework&&t?.primitive?t:r,u=c?.framework===s&&c?.primitive&&(s==="react"?a.react:a.vue||a.nuxt);if(!o&&!u&&!i)return{status:"not_shadcn",reason:"components.json was not found: this is not a shadcn application. Run `npx shadcn@latest init` (`npx shadcn-vue@latest init` for Vue) first, or run connect in the application directory."};let d;try{d=o?c0(n):{}}catch($){return{status:i?"unsupported":"not_shadcn",reason:`components.json is not valid JSON (${$.message}).`}}let f=typeof d?.style=="string"?d.style:null,p=o?[`components.json${f?` (style ${f})`:""}`]:["Explicit Project target for a new application"],y=s==="vue"?["vue","@vitejs/plugin-vue","nuxt"].find($=>a[$]):a.react?"react":null;y&&p.push(`package.json: ${y}`);let h=new Map;for(let[$,w]of KU){let m=Object.keys(a).sort().find(w);m&&h.set($,`package.json: ${m}`)}let v=f&&/^(radix|base|aria|reka)-/.exec(f)?.[1];v&&!h.has(v)&&h.set(v,`components.json: style ${f}`),p.push(...h.values());let _={components_json:o?"components.json":null,evidence:p};if(t?.framework&&t?.primitive)return yg({framework:t.framework,primitive:t.primitive},_);if(h.size>1)return{status:"conflict",reason:`Evidence for several primitives (${[...h.keys()].join(", ")}): a project uses one Project target. Remove the unused primitive, then run connect again.`,..._};let g=h.size===1?{framework:[...h.keys()][0]==="reka"?"vue":s,primitive:[...h.keys()][0]}:null;if(r?.framework||r?.primitive){let $={framework:r.framework||s,primitive:r.primitive||g?.primitive};return $.primitive?g&&vd(g)!==vd($)?{status:"conflict",reason:`The declared target ${vd($)} conflicts with the project, which shows ${vd(g)}.`,..._}:yg($,_):{status:"undetermined",reason:"The primitive cannot be determined. Pass --primitive with --framework.",..._}}return g?yg(g,_):{status:"undetermined",reason:"components.json exists, but no primitive package is installed yet, so the primitive cannot be determined. Pass --primitive: radix, base or aria for React, reka for Vue.",..._}}d0.exports={detectShadcnProject:WU,detectProjectFramework:l0}});var bd=te((bye,g0)=>{var{parseStaticConfig:vg,propertyName:_d}=fg(),{fileExists:p0,readFileSafe:_g,writeTextFile:bg,readJsonFileSafe:GU}=Qa(),mc=require("path"),{normalizeAdopt:m0}=Ps(),{parseProjectTarget:YU}=(Os(),hi(yd));function h0(e){try{return GU(e)??{}}catch{return{}}}function XU(e){return h0(mc.join(e,"package.json")).name||mc.basename(e)}function QU(e={}){let t={...e};return delete t.ffId,delete t.appRoot,delete t.adoptExplicit,delete t["auth-token"],delete t.authToken,t}function ez(e,t,{ffId:r,name:i,adopt:n,framework:o,primitive:a,apiUrl:s,baseLibrary:c,tag:u}){let d=YU({framework:o,primitive:a},"Setup Project target"),f=QU(t),p={name:i.trim(),"ff-id":r.trim(),adopt:m0(n),framework:d.framework,primitive:d.primitive};if(u!==void 0){if(typeof u!="string"||!u.trim())throw new Error("Release tag must not be empty.");p.tag=u.trim()}if(c!==void 0){if(!["frontfriend","shadcn"].includes(c))throw new Error("Base library must be frontfriend or shadcn.");p.baseLibrary=c}s&&(p["api-url"]=String(s).replace(/\/+$/,""),delete f.apiUrl);for(let[v,_]of Object.entries(f))v in p||(p[v]=_);let y=mc.join(e,"frontfriend.config.js"),h;if(p0(y)){let v=_g(y),{expression:_}=vg(v),g=new Set(["name","ff-id","adopt","framework","primitive",...u!==void 0?["tag","releaseTagId"]:[],...s?["api-url","apiUrl"]:[],...c!==void 0?["baseLibrary"]:[]]),$=new Set(["auth-token","authToken","ffId","appRoot","adoptExplicit"]),w=_.properties.filter(O=>!g.has(_d(O))&&!$.has(_d(O))).map(O=>v.slice(O.start,O.end));h=[...Object.entries(p).filter(([O])=>g.has(O)).map(([O,P])=>`${JSON.stringify(O)}: ${JSON.stringify(P)}`),...w]}else h=Object.entries(p).map(([v,_])=>`${JSON.stringify(v)}: ${JSON.stringify(_)}`);return bg(y,Sg(e,h)),p}function Sg(e,t){let r=`{
|
|
12
12
|
${t.join(`,
|
|
13
13
|
`)}
|
|
14
14
|
}`;return h0(mc.join(e,"package.json")).type==="module"?`const config = ${r};
|
|
@@ -34,7 +34,7 @@ export default config;
|
|
|
34
34
|
`?i=!0:o!==" "&&o!==" "&&o!=="\r"&&(i=!1)}return t.join("")}function u$(e,t){let r=e[t],i=r==='"'||r==="'"||r==="`"?r:"",n=r==="{"?1:0;if(!i&&!n)return t;for(let o=t+1;o<e.length;o++){let a=e[o];if(a==="\\"&&i){o++;continue}if(i){if(a===i&&(i="",!n))return o+1;continue}if(a==='"'||a==="'"||a==="`")i=a;else if(a==="{")n++;else if(a==="}"&&--n===0)return o+1}return e.length}function zg(e){let t=[],r=/<([A-Za-z][\w.:-]*)\b/g;for(let i of e.matchAll(r)){let n=i.index+i[0].length;for(;n<e.length&&e[n]!==">";n++)/[{"'`]/.test(e[n])&&(n=u$(e,n)-1);t.push({name:i[1],attrs:e.slice(i.index+i[0].length,n),offset:i.index})}return t}function Vg(e){let t=[],r=/(?:^|\s)(:?class(?:Name)?|v-bind:class)\s*=\s*/g,i;for(;i=r.exec(e);){let n=r.lastIndex,o=u$(e,n),a=e.slice(n,o).trim();a.startsWith("{")&&a.endsWith("}")&&(a=a.slice(1,-1).trim());let s=/^("[^"\\]*"|'[^'\\]*'|`[^`$\\]*`)$/.test(a);t.push(s&&!i[1].startsWith(":")&&!i[1].startsWith("v-bind:")?{value:a.slice(1,-1)}:{}),r.lastIndex=Math.max(o,n+1)}return t}function Fg(e,t){return/(?:^|\/)components\/ui(?:\/|$)|^@frontfriend\/(?:react|components-react|components-vue)/.test(t)?e.replace(/[{}]/g,"").split(",").map(r=>r.trim().split(/\s+as\s+/)).filter(r=>/^[A-Z]\w*$/.test(r[0]??"")).map(r=>[r[1]??r[0],{name:r[0],module:t}]):[]}function l$(e,t){let r=["semantic-vocabulary","component-override","icon-library"],i=Object.fromEntries(r.map(d=>[d,[]])),n=Object.fromEntries(r.map(d=>[d,new Set])),o=t.vocabulary?new Set(t.vocabulary.map(s$)):null,a=t.iconLibrary?a$(t.iconLibrary)??t.iconLibrary:null,s=o$(t.componentControls),c=new Set,u=0;for(let[d,f]of Object.entries(e)){if(!/\.(?:tsx|jsx|vue|svelte|html?|mdx|[jt]s)$/.test(d))continue;u++;let p=Ug(f),y=(v,_,g)=>i[v].push({file:d,line:p.slice(0,_).split(`
|
|
35
35
|
`).length,snippet:g}),h=new Map;for(let v of hc(p)){let _=v[2],g=a$(_);a&&g&&g!==a&&y("icon-library",v.index,v[0]),(/\.(?:svg)(?:\?|$)/i.test(_)||/(?:^|\/)icons?(?:\/|$)/i.test(_)&&!g)&&n["icon-library"].add("SVG or icon wrappers cannot be resolved to an icon family");for(let[$,w]of Fg(v[1],_))h.set($,w)}/\b(?:import|require)\s*\(/.test(p)&&n["icon-library"].add("Dynamic imports and require calls are unresolved");for(let v of zg(p)){(v.name.toLowerCase()==="svg"||v.name==="Icon")&&n["icon-library"].add("Inline SVG and Icon wrappers need visual or dependency inspection");let _=h.get(v.name);(/\{\s*\.\.\./.test(v.attrs)||/v-bind\s*=/.test(v.attrs))&&(n["semantic-vocabulary"].add("Spread or bound attributes may supply runtime classes"),n["component-override"].add("Spread or bound attributes may override appearance"));for(let g of Vg(v.attrs)){if(g.value===void 0){n["semantic-vocabulary"].add("Runtime-built or bound classes are outside static coverage"),n["component-override"].add("Runtime-built or bound classes are outside static coverage");continue}let $=(0,gc.analyzeSource)(`className=${JSON.stringify(g.value)}`).tokens;for(let w of g.value.split(/\s+/).filter(Boolean)){let m=s$(w);if(o&&p4(m)&&($.has(w)||m.startsWith("icon-"))&&!l4(m)&&!o.has(m)&&!o.has(f4(m))?y("semantic-vocabulary",v.offset,w):!(0,gc.isUtility)(m)&&!o?.has(m)&&!["group","peer","dark"].includes(m)&&n["semantic-vocabulary"].add("Unresolved custom classes need their stylesheet"),_&&c$.test(m)){let O=s?i$(s,_.name,_.module):void 0;s?O?O.has(w)||y("component-override",v.offset,`${v.name}: ${w}`):c.add(_.name):n["component-override"].add("The selected Design System component controls are unavailable: appearance classes on its components are undetermined")}!_&&/^[A-Z]/.test(v.name)&&n["component-override"].add("Unrecognised component imports or wrappers need dependency inspection")}}}}return c.size&&n["component-override"].add(`The selected Design System configures no controls for ${[...c].sort().join(", ")}: their appearance classes are undetermined`),r.map(d=>{let f=u?d==="semantic-vocabulary"&&!o?"The selected foundation vocabulary is unavailable":d==="icon-library"&&!a?"No icon library is declared":null:"No supported source files",p=[...n[d]];return{id:d,status:i[d].length?"fail":"pass",evidence:i[d],count:i[d].length,tell:null,dimension:"token",coverage:f?"none":p.length?"partial":"full",coverageReason:f??(p.length?p.join("; "):void 0),message:i[d].length?`Static ${d} violations detected.`:`No violations detected in statically resolved ${d} inputs.`}})}var gc,c$,u4,d4,a$,s$,f4,p4,Jg=Ve(()=>{"use strict";Td();gc=ho(r$(),1);Mu();c$=/^(?:bg-|text-(?!left$|right$|center$|justify$|start$|end$|wrap$|nowrap$|balance$|pretty$|ellipsis$|clip$)|border(?:$|-(?!collapse$|separate$|spacing-))|rounded(?:$|-)|shadow(?:$|-)|ring(?:$|-)|font-|leading-|tracking-|fill-|stroke-|opacity-|decoration-|from-|via-|to-)/,u4=/^(?:[pm][xytrblse]?-|gap(?:-[xy])?-|space-[xy]-|size-|[wh]-|(?:min|max)-[wh]-|icon-|animate-)/;d4={"lucide-react":"lucide","lucide-vue-next":"lucide","@phosphor-icons/react":"phosphor","@phosphor-icons/vue":"phosphor","@tabler/icons-react":"tabler","@tabler/icons-vue":"tabler","@heroicons/react":"heroicons","@heroicons/vue":"heroicons","@hugeicons/react":"hugeicons","@hugeicons/core-free-icons":"hugeicons","@remixicon/react":"remixicon","@remixicon/vue":"remixicon","@radix-ui/react-icons":"radix","react-icons":"react-icons"},a$=e=>Object.entries(d4).find(([t])=>e===t||e.startsWith(`${t}/`))?.[1],s$=e=>(0,gc.utilitySegment)(e).replace(/^!|!$/g,""),f4=e=>e.replace(/\/\d{1,3}$/,"").replace(/^(ring-offset|fill)-/,"bg-").replace(/^(ring|outline|stroke)-/,"border-"),p4=e=>c$.test(e)||u4.test(e)});function f$(e){if(!qu(e))return null;let t=new Map(Object.values(Hg).map(n=>[Xi(n),n])),r={},i=!1;for(let[n,o]of Object.entries(e)){if(!qu(o))continue;i=!0;let a=t.get(Xi(n));if(!a)continue;let s="styles"in o||"behavior"in o?o.styles:o;if(!qu(s))continue;let c=qu(s.slots)?s.slots:{},u=Zg(c.content)??Zg(s.content)??Zg(s.root);u!==void 0&&(r[a]=u)}return i?r:null}function h4(e){if(/^\d+(?:\.\d+)?$/.test(e))return{px:Number(e)*4};if(e==="px")return{px:1};if(e==="none")return{none:!0};if(m4.has(e))return{contentSized:!0};if(d$[e]!==void 0)return{px:d$[e]*16};let t=/^\[(\d+(?:\.\d+)?)(px|rem)\]$/.exec(e);return t?{px:Number(t[1])*(t[2]==="rem"?16:1)}:{relative:!0}}function xu(e){let t={base:{},prefixed:[],shrinks:!0,flexRow:!1,scrollsX:!1},r=!1,i=!1;for(let n of e.split(/\s+/).filter(Boolean)){let o=n.replace(/^!|!$/g,""),a=o.lastIndexOf(":"),s=a===-1?o:o.slice(a+1),c=/^(min-w|max-w|w)-(.+)$/.exec(s);if(c){let u=c[1],d=h4(c[2]);a===-1?t.base[u]=d:t.prefixed.push({property:u,size:d,token:o});continue}a===-1&&(s==="flex"||s==="inline-flex"?r=!0:s==="flex-col"||s==="flex-col-reverse"?i=!0:s==="shrink-0"||s==="flex-shrink-0"||s==="flex-none"?t.shrinks=!1:/^overflow-(?:x-)?(?:auto|scroll)$/.test(s)&&(t.scrollsX=!0))}return t.flexRow=r&&!i,t}function g4(e,t){let r=a=>a&&"px"in a?a.px:void 0,i=r(e.base["min-w"])??0,n=r(e.base.w),o=e.base["max-w"];return n===void 0||o&&!("px"in o)&&!("none"in o)||t&&e.shrinks?i:Math.max(i,Math.min(n,r(o)??1/0))}function y4(e){if(e.prefixed.some(n=>n.property!=="min-w"))return"undetermined";let{w:t,"max-w":r}=e.base,i=r&&"px"in r?r.px:void 0;return t&&"px"in t?{px:Math.min(t.px,i??1/0)}:i!==void 0?{px:i}:r&&"relative"in r?"undetermined":!t||"contentSized"in t?"content":"undetermined"}function b4(e){let t=[...zg(e).map(n=>({...n,close:!1})),...[...e.matchAll(v4)].map(n=>({name:n[1],attrs:"",offset:n.index,close:!0}))].sort((n,o)=>n.offset-o.offset),r=[],i=[];for(let n of t){if(n.close){let a=i.map(s=>s.name).lastIndexOf(n.name);if(a===-1)continue;for(let s of i.splice(a))s.end=n.offset;continue}let o={name:n.name,attrs:n.attrs,offset:n.offset,end:-1,parent:i.at(-1)??null};r.push(o),/\/\s*$/.test(n.attrs)?o.end=n.offset:i.push(o)}return r}function p$(e,t){let r=[],i=new Set,n=0;for(let[s,c]of Object.entries(e)){if(!/\.(?:tsx|jsx|vue|svelte|html?|mdx)$/.test(s)||(n++,!t))continue;let u=Ug(c),d=new Map;for(let y of hc(u))for(let[h,v]of Fg(y[1],y[2]))d.set(h,v);let f=b4(u),p=y=>{let h=d.get(y.name);return h?Hg[h.name]:void 0};for(let y of f){let h=p(y);if(!h){Hg[y.name]&&i.add(`${y.name} is not imported from the Design System: its width is unknown`);continue}if(y.end===-1){i.add(`${y.name} has no closing tag in the same file`);continue}let v=f.filter(m=>{if(m.offset<=y.offset||m.offset>=y.end)return!1;for(let O=m.parent;O&&O!==y;O=O.parent)if(p(O))return!1;return!0}),_=kd(y.attrs),g=t[h],$=_===null||/\{\s*\.\.\./.test(y.attrs)||_4.test(y.attrs)||g===void 0?"undetermined":y4(xu(`${g} ${_}`)),w=xu(`${g??""} ${_??""}`);for(let m of v){if(p(m))continue;let O=kd(m.attrs);if(O===null||/\{\s*\.\.\./.test(m.attrs)||/v-bind\s*=/.test(m.attrs)){i.add("Runtime-built or spread classes inside overlay content are outside static coverage");continue}let P=xu(O),E=!1;for(let N=m.parent;N&&N!==y;N=N.parent)xu(kd(N.attrs)??"").scrollsX&&(E=!0);if(E)continue;let I=m.parent===y?w.flexRow:xu(kd(m.parent.attrs)??"").flexRow,D=g4(P,I),z=P.prefixed.some(N=>N.property!=="max-w"&&"px"in N.size);if(!(!D&&!z)&&$!=="content"){if($==="undetermined"){i.add(`The width of ${y.name} is not a fixed size in the selected configuration or is changed in code`);continue}D>$.px?r.push({file:s,line:u.slice(0,m.offset).split(`
|
|
36
36
|
`).length,snippet:`${y.name} is ${$.px}px wide (${h}); a ${m.name} inside it keeps ${D}px`}):z&&P.prefixed.some(N=>"px"in N.size&&N.size.px>$.px)&&i.add("Responsive or state-dependent widths inside overlay content are undetermined")}}}}let o=n?t?null:"The selected Design System component configuration is unavailable: overlay widths are unknown":"No supported source files",a=[...i];return{id:"overlay-width",status:r.length?"fail":"pass",evidence:r,count:r.length,tell:null,dimension:null,coverage:o?"none":a.length?"partial":"full",coverageReason:o??(a.length?a.join("; "):void 0),message:r.length?`${r.length} fixed width${r.length===1?"":"s"} inside Design System overlay content exceed the overlay width: the content is drawn outside the overlay. Let the content take the overlay width (w-full, max-w-full) or change the overlay width in the Design System.`:"No fixed width inside Design System overlay content exceeds the overlay width in the statically resolved classes."}}var Hg,qu,Zg,d$,m4,v4,_4,kd,Bg=Ve(()=>{"use strict";Td();Mu();Jg();Hg={PopoverContent:"popover",DropdownMenuContent:"dropdown-menu",DialogContent:"dialog",SheetContent:"sheet",SelectContent:"select",TooltipContent:"tooltip"},qu=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Zg=e=>typeof e=="string"?e:qu(e)&&typeof(e.root??e.base)=="string"?e.root??e.base:void 0;d$={"3xs":16,"2xs":18,xs:20,sm:24,md:28,lg:32,xl:36,"2xl":42,"3xl":48,"4xl":56,"5xl":64,"6xl":72,"7xl":80},m4=new Set(["auto","fit","max","min"]);v4=/<\/([A-Za-z][\w.:-]*)\s*>/g,_4=/(?:^|\s)(?:fullWidth|width|size)(?=[\s=]|$)/;kd=e=>{let t=Vg(e);return t.some(r=>r.value===void 0)?null:t.map(r=>r.value).join(" ")}});function I4(e){let t={present:!1,tokenNames:[],raw:"",spacingScale:null,scaleSource:null,scaleUnit:null};if(!e)return t;t.present=!0,t.raw=e;let r=e.match(/--[a-z0-9]+(?:-[a-z0-9]+)*/gi)||[],i=e.match(/\b(?:bg|text|border|ring|fill|stroke)-[a-z0-9-]+/gi)||[];return t.tokenNames=[...new Set([...r,...i])].filter(n=>n.length>4),Object.assign(t,C4(e)),t}function C4(e){let t=[...e.matchAll(/--(?:space|spacing|sp|gap)[a-z0-9-]*\s*:\s*([0-9.]+)px/gi)].map(n=>Number(n[1]));if(t.length>=3)return{spacingScale:ry(t),scaleSource:"token --space*/--spacing* (px)",scaleUnit:"px"};let r=R$(/--spacing\s*:\s*([^;\n|`]+)/i.exec(e)?.[1]);if(r)return ey(r,`Tailwind --spacing: ${Qg(r)} declared in L2`);let i=e.match(/base[-\s]?(4|8)\b/i);if(i){let n=Number(i[1]);return{spacingScale:Array.from({length:16},(o,a)=>n*(a+1)),scaleSource:`base-${n}`,scaleUnit:"px"}}for(let n of e.split(/\r?\n/)){if(!/spacing|scale/i.test(n))continue;let o=(n.match(/\b\d{1,3}\b/g)||[]).map(Number).filter(a=>a>=2&&a<=128);if(o.length>=4){let a=/\bpx\b/i.test(n)?"px":"unit";return{spacingScale:ry(o),scaleSource:`sequence declared in L2 (${a})`,scaleUnit:a}}}return{spacingScale:null,scaleSource:null,scaleUnit:null}}function R$(e){let t=/^\s*([0-9]*\.?[0-9]+)\s*(rem|px)\s*$/i.exec(e??"");if(!t)return null;let r=Number(t[1])*(t[2].toLowerCase()==="rem"?16:1);return r>0&&r<=64?r:null}function ey(e,t){let r=[...w$,...Array.from({length:$$},(n,o)=>o+1)];return{spacingScale:ry([1,...r.map(n=>Number((n*e).toFixed(3)))]),scaleSource:t,scaleUnit:"px",scaleStep:e}}function h$(e,t,r,i){let n=e+.3963377774*t+.2158037573*r,o=e-.1055613458*t-.0638541728*r,a=e-.0894841775*t-1.291485548*r,s=n*n*n,c=o*o*o,u=a*a*a;return{r:Kg(4.0767416621*s-3.3077115913*c+.2309699292*u),g:Kg(-1.2684380046*s+2.6097574011*c-.3413193965*u),b:Kg(-.0041960863*s-.7034186147*c+1.707614701*u),alpha:i}}function j4(e,t,r,i){let n=(e%360+360)%360,o=a=>{let s=(a+n/30)%12;return r-t*Math.min(r,1-r)*Math.max(-1,Math.min(s-3,9-s,1))};return{r:vo(o(0)),g:vo(o(8)),b:vo(o(4)),alpha:i}}function Ua(e,t){if(e===void 0)return null;if(e==="none")return 0;let r=/^(-?[0-9]*\.?[0-9]+(?:e-?\d+)?)%$/.exec(e);if(r)return Number(r[1])/100*t;let i=/^-?[0-9]*\.?[0-9]+(?:e-?\d+)?$/.test(e)?Number(e):NaN;return Number.isFinite(i)?i:null}function g$(e){if(e===void 0)return null;if(e==="none")return 0;let t=/^(-?[0-9]*\.?[0-9]+)(deg|turn|rad|grad)?$/.exec(e);if(!t)return null;let r=Number(t[1]);switch(t[2]){case"turn":return r*360;case"rad":return r*180/Math.PI;case"grad":return r*.9;default:return r}}function ty(e){let t=e.replace(/!important\s*$/i,"").trim().toLowerCase();if(Lu[t])return{...Lu[t]};let r=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t)?.[1];if(r){let v=r.length<=4?r.split("").map(g=>g+g).join(""):r,_=g=>parseInt(v.slice(g,g+2),16)/255;return{r:_(0),g:_(2),b:_(4),alpha:v.length===8?_(6):1}}let i=/^(rgba?|hsla?|oklch|oklab)\(\s*([^()]*)\)$/.exec(t),n=i?.[1]??"bare-hsl",o=i?i[2]:t,[a,s]=o.replace(/,/g," ").split("/"),c=(a??"").trim().split(/\s+/).filter(Boolean),u=s?.trim()||(c.length===4?c.pop():void 0);if(c.length!==3)return null;let d=u===void 0?1:Ua(u,1);if(d===null)return null;let f=vo(d);if(n==="rgb"||n==="rgba"){let[v,_,g]=c.map($=>Ua($,255));return v==null||_==null||g==null?null:{r:vo(v/255),g:vo(_/255),b:vo(g/255),alpha:f}}if(n==="hsl"||n==="hsla"||n==="bare-hsl"){if(n==="bare-hsl"&&!/%$/.test(c[1]))return null;let v=g$(c[0]),_=Ua(c[1],100),g=Ua(c[2],100);return v===null||_===null||g===null?null:j4(v,vo(_/100),vo(g/100),f)}if(n==="oklch"){let v=Ua(c[0],1),_=Ua(c[1],.4),g=g$(c[2]);if(v===null||_===null||g===null)return null;let $=g*Math.PI/180;return h$(v,Math.max(0,_)*Math.cos($),Math.max(0,_)*Math.sin($),f)}let p=Ua(c[0],1),y=Ua(c[1],.4),h=Ua(c[2],.4);return p===null||y===null||h===null?null:h$(p,y,h,f)}function y$(e,t){let r=e.alpha+t.alpha*(1-e.alpha);if(r===0)return{r:0,g:0,b:0,alpha:0};let i=(n,o)=>(n*e.alpha+o*t.alpha*(1-e.alpha))/r;return{r:i(e.r,t.r),g:i(e.g,t.g),b:i(e.b,t.b),alpha:r}}function jd(e,t){let r=v$(e),i=v$(t);return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}function N4(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,s=>s.replace(/[^\n]/g," ")),r=[],i=[],n=0,o=()=>{let s=i[i.length-1];if(!s||i.slice(0,-1).some(u=>!/^@layer\b/i.test(u)))return null;if(/^@theme\b/i.test(s))return"theme";let c=s.split(",").map(u=>u.trim().toLowerCase());return c.some(u=>/^(?::root|html|:host)?(?:\.dark|\[data-theme=["']?dark["']?\])$/.test(u)&&u!=="")?"dark":c.some(u=>u===":root"||u==="html"||u===":host")?"light":null},a=s=>{let c=t.slice(n,s),u=/^\s*(--[A-Za-z0-9_-]+)\s*:\s*([\s\S]*?)\s*$/.exec(c),d=o();if(u&&d&&u[2]){let f=n+c.indexOf(u[1]);r.push({scope:d,name:u[1],value:u[2].replace(/\s+/g," "),line:t.slice(0,f).split(`
|
|
37
|
-
`).length})}};for(let s=0;s<t.length;s++){let c=t[s];c==="{"?(i.push(t.slice(n,s).trim()),n=s+1):c===";"?(a(s),n=s+1):c==="}"&&(a(s),i.pop(),n=s+1)}return r}function M4(e){let t=[];return e.split(/\r?\n/).forEach((r,i)=>{let n=/^\s*\|\s*`?(--[a-z0-9-]+)`?\s*\|(.*)$/i.exec(r);if(n){let o=n[2].split("|").map(a=>a.replace(/`/g,"").trim()).filter(a=>ty(a)||/^var\(/.test(a));o.length&&t.push({name:n[1].toLowerCase(),light:o[0],...o[1]?{dark:o[1]}:{},line:i+1});return}for(let o of r.matchAll(/(--[a-z0-9-]+)\s*:\s*([^;\n|`]+)/gi)){let a=o[2].trim();(ty(a)||/^var\(/i.test(a))&&t.push({name:o[1].toLowerCase(),light:a,line:i+1})}}),t}function D4(e){let t=[];return e.split(/\r?\n/).forEach((r,i)=>{for(let n of r.replace(/`/g,"").matchAll(q4))t.push({fg:n[1].toLowerCase(),bg:n[3].toLowerCase(),...n[2]?{fgValue:n[2]}:{},...n[4]?{bgValue:n[4]}:{},line:i+1})}),t}function E$(e,t,r){return(t==="dark"?e.dark.get(r):void 0)??e.light.get(r)??e.theme.get(r)}function Nd(e,t,r,i=0){if(i>8)return null;if(!/var\(/i.test(r))return r;let n=/var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,\s*([^()]*(?:\([^()]*\))?[^()]*))?\)/i.exec(r);if(!n)return null;let o=E$(e,t,n[1]),a=o?Nd(e,t,o.value,i+1):n[2]?Nd(e,t,n[2].trim(),i+1):null;return a===null?null:Nd(e,t,r.replace(n[0],a),i+1)}function Is(e,t,r){let i=E$(e,t,r);if(!i)return null;let n=Nd(e,t,i.value),o=n?ty(n):null;return o&&n?{color:o,entry:i,value:n}:null}function P$(e,t,r,i){for(let n of[`--color-${i}`,`--${i}`,`--${r}-${i}`]){let o=Is(e,t,n);if(o)return o.color}return Lu[i]?{...Lu[i]}:null}function Gg(e,t){let r=Is(e,t,"--background")?.color??P$(e,t,"bg","background");return r&&r.alpha===1?r:t==="light"?{...Lu.white}:null}function Yg(e,t,r){let i=t.alpha<1?r?y$(t,r):null:t;return!i||i.alpha<1?null:{fg:e.alpha<1?y$(e,i):e,bg:i}}function L4(e){let t=new Set([...e.light.keys(),...e.dark.keys()]),r=[];for(let n of t){let o=/^(--.*?)-?foreground$/.exec(n)?.[1];if(o===void 0)continue;let a=o==="--"?"--background":o;t.has(a)&&r.push([n,a])}for(let n of["--background","--card","--popover"])r.push(["--muted-foreground",n],["--destructive",n]);let i=new Set;return r.filter(([n,o])=>{let a=`${n}|${o}`;return!t.has(n)||!t.has(o)||i.has(a)?!1:(i.add(a),!0)})}function z4(e){let t={"":{bg:[],text:[]},dark:{bg:[],text:[]}};for(let r of e.split(/\s+/)){let i=r.replace(/^!|!$/g,"").split(":"),n=i.pop()??"",o=i.join(":");if(o!==""&&o!=="dark")continue;let a=O$.exec(n);a&&t[o][a[1]].push(n)}return t}function Ad(e,t,r){for(let i of[...r].reverse()){let n=V4(e,t,i);if(n)return{utility:i,color:n}}return null}function V4(e,t,r){let i=O$.exec(r);if(!i)return null;let n=P$(e,t,i[1],i[2]);return n?i[3]?{...n,alpha:n.alpha*(Math.min(100,Number(i[3]))/100)}:n:null}function F4(e,t){if(typeof e.tailwindVersion=="number")return e.tailwindVersion>=4;let r=e.theme;return r&&[r.light,r.dark,r.theme].some(i=>i&&Object.keys(i).length>0)?!0:t.some(i=>/@import\s+["']tailwindcss|@theme\b|@tailwindcss\//.test(i))}function Du(e,t,r,i=6,n={}){let{fileFilter:o=null,reject:a=null}=n,s=new RegExp(r.source,r.flags.includes("g")?r.flags:r.flags+"g"),c=[],u=0;for(let d of t){if(o&&!o(d))continue;let f=e(d).split(/\r?\n/);for(let p=0;p<f.length;p++){let y=f[p]??"";if(a&&a.test(y))continue;let h=y.match(s);h&&(u+=h.length,c.length<i&&c.push({file:d,line:p+1,snippet:y.trim().slice(0,120)}))}}return{total:u,evidence:c}}function I$({files:e,l2:t,l2Path:r="design-guidelines.md",strict:i=!1,staticContext:n,theme:o,tailwindVersion:a}){let s=[],c=(ae,fe,he,de=[],j=0)=>{s.push({id:ae,status:fe,message:he,evidence:de,count:j})},u=new Map;for(let[ae,fe]of Object.entries(e))u.set(ae.replace(/\\/g,"/"),fe);let d=[...u.keys()].filter(ae=>!ae.split("/").some(fe=>w4.has(fe))&&S4.has(O4(ae).toLowerCase())),f=ae=>u.get(ae)??"";if(d.length===0)return c("target","warn","No source files found in the provided tree. Nothing to verify."),b$(s,i);let p=I4(t),y=ae=>!$4.test(m$(ae)),h=d.filter(ae=>/\.(tsx|jsx|vue|svelte|html?)$/.test(ae)),v=d.filter(ae=>R4.test(ae)&&/\.(tsx|jsx|vue|svelte)$/.test(ae)),_=d.filter(ae=>/\.(css|scss|less)$/i.test(ae)),g=/(?:^|\/)(?:components\/)?ui\//i,$=A4();for(let ae of p.present?M4(p.raw):[])$.light.set(ae.name,{value:ae.light,file:r,line:ae.line}),ae.dark&&$.dark.set(ae.name,{value:ae.dark,file:r,line:ae.line});let w=p.present?D4(p.raw):[];for(let ae of w)for(let[fe,he]of[[ae.fg,ae.fgValue],[ae.bg,ae.bgValue]])he&&!$.light.has(fe)&&$.light.set(fe,{value:he,file:r,line:ae.line});let m=o?.source??"foundation";for(let ae of["light","dark","theme"])for(let[fe,he]of Object.entries(o?.[ae]??{}))typeof he=="string"&&$[ae].set(fe,{value:he,file:m,line:0});for(let ae of _)for(let fe of N4(f(ae)))$[fe.scope].set(fe.name,{value:fe.value,file:ae,line:fe.line});let O=Du(f,d,/(#[0-9a-fA-F]{3,8}\b|\brgba?\(|\bhsla?\(|\b(?:oklch|oklab|lab|lch|hwb)\(|\bcolor\(\s*(?:srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65)\b)/,6,{fileFilter:ae=>y(ae)&&!/\/icons?\//i.test(ae)&&!/icon/i.test(m$(ae)),reject:/(fill|stroke)\s*=|<path|<svg|\sd=|points=|viewBox|gradient/i});O.total>0?c("raw-color-literals","warn",`${O.total} raw color literals (hex/rgb/hsl/oklch/oklab/lab/lch/color()) outside theme files: likely bypassing the design-system tokens. Use the semantic tokens.`,O.evidence,O.total):c("raw-color-literals","pass","No raw colors outside theme files.");let P=Du(f,h,/(?:padding|margin|gap)\s*:\s*['"]?[1-9]\d{0,3}px/i,6,{fileFilter:y,reject:/\b0px|max-width|min-width|@media|transition|animation|calc\(/i});P.total>0?c("raw-spacing","warn",`${P.total} hardcoded px spacing/measure values in styles: verify they follow the system scale, not arbitrary values.`,P.evidence,P.total):c("raw-spacing","pass","No suspicious hardcoded px spacing.");let E=I();function I(){if(p.spacingScale&&p.spacingScale.length>0&&p.scaleUnit==="px")return p;let ae=$.theme.get("--spacing")??$.light.get("--spacing"),fe=R$(ae?.value);return fe&&ae?ey(fe,`Tailwind --spacing: ${Qg(fe)} (${ae.file})`):F4({tailwindVersion:a,theme:o},_.map(f))?ey(T4,"Tailwind v4 default --spacing: 0.25rem = 4px"):null}if(E?.spacingScale){let ae=new Set(E.spacingScale),fe=K=>ae.has(Number(K.toFixed(3))),he=[],de=0,j=(K,C,M)=>{de++,he.length<6&&he.push({file:K,line:C+1,snippet:M.trim().slice(0,120)})};for(let K of h){if(!y(K))continue;let C=f(K).split(/\r?\n/),M=g.test(K);for(let L=0;L<C.length;L++){let oe=C[L]??"";if(!/max-width|min-width|@media|transition|animation|calc\(/i.test(oe))for(let ue of oe.matchAll(/(?:padding|margin|gap)[a-z-]*\s*:\s*([^;}]+)/gi))for(let pe of(ue[1]??"").matchAll(/\b([1-9]\d{0,3})px/g))fe(Number(pe[1]))||j(K,L,oe);if(!M){for(let ue of oe.matchAll(/(?:^|[\s"'`:])-?(?:[pm][xytrblse]?|gap(?:-[xy])?|space-[xy])-\[([0-9]*\.?[0-9]+)(px|rem)\]/g)){let pe=Number(ue[1])*(ue[2]==="rem"?16:1);pe>0&&!fe(pe)&&j(K,L,oe)}if(E.scaleStep)for(let ue of oe.matchAll(/(?:^|[\s"'`:])-?(?:[pm][xytrblse]?|gap(?:-[xy])?|space-[xy])-([0-9]+\.[0-9]+)(?=[\s"'`]|$)/g))k4(Number(ue[1]))||j(K,L,oe)}}}let V=E.scaleStep?`${E.scaleSource}: whole multiples of ${Qg(E.scaleStep)}, the 0.5/1.5/2.5/3.5 steps and 1px`:`${E.scaleSource}: ${E.spacingScale.join("\xB7")}px`;de>0?c("off-scale-spacing","warn",`C2: ${de} spacing values outside the declared scale (${V}). Eyeballed values (e.g. 13px, 7px) = a missing system decision.`,he,de):c("off-scale-spacing","pass",`C2: spacing consistent with the declared scale (${V}).`)}{let ae=[],fe=new Set,he=0,de=(C,M,L)=>{fe.has(C)||(fe.add(C),he++,L<4.5&&ae.push(M))},j=$.light.size+$.dark.size+$.theme.size>0,V=$.dark.size>0?Xg:["light"];if(j)for(let C of h){if(!y(C))continue;let M=f(C).split(/\r?\n/);for(let L=0;L<M.length;L++)for(let oe of(M[L]??"").matchAll(U4)){let ue=z4(oe[2]??"");if(!(!ue[""].bg.length||!ue[""].text.length))for(let pe of V){let me=(pe==="dark"?Ad($,pe,ue.dark.bg):null)??Ad($,pe,ue[""].bg),De=(pe==="dark"?Ad($,pe,ue.dark.text):null)??Ad($,pe,ue[""].text),vt=me&&De?Yg(De.color,me.color,Gg($,pe)):null;if(!me||!De||!vt)continue;let x=jd(vt.fg,vt.bg);de(`${C}:${L}:${pe}:${De.utility}|${me.utility}`,{file:C,line:L+1,snippet:`${De.utility} on ${me.utility} (${pe}) = ${x.toFixed(2)}:1`},x)}}}for(let C of w)for(let M of Xg){if(M==="dark"&&!$.dark.has(C.fg)&&!$.dark.has(C.bg))continue;let L=Is($,M,C.fg),oe=Is($,M,C.bg),ue=L&&oe?Yg(L.color,oe.color,Gg($,M)):null;if(!L||!oe||!ue)continue;let pe=jd(ue.fg,ue.bg);de(`token:${M}:${C.fg}|${C.bg}`,{file:r,line:C.line,snippet:`${C.fg} (${L.value}) on ${C.bg} (${oe.value}) (${M}) = ${pe.toFixed(2)}:1`},pe)}let K=L4($);for(let[C,M]of K)for(let L of Xg){if(L==="dark"&&!$.dark.has(C)&&!$.dark.has(M))continue;let oe=Is($,L,C),ue=Is($,L,M),pe=oe&&ue?Yg(oe.color,ue.color,Gg($,L)):null;if(!oe||!ue||!pe)continue;let me=jd(pe.fg,pe.bg);de(`token:${L}:${C}|${M}`,{file:oe.entry.file,line:oe.entry.line,snippet:`${C} (${oe.value}) on ${M} (${ue.value}) (${L}) = ${me.toFixed(2)}:1`},me)}if(!K.length&&!w.length&&p.present){let C=/(text|foreground|\bfg\b|ink|content|label|heading|body|muted)/,M=/(surface|background|\bbg\b|base|canvas|paper|card|panel)/,L=[...$.light].filter(([,pe])=>pe.file===r).map(([pe])=>({name:pe,hit:Is($,"light",pe)})).filter(pe=>!!pe.hit&&pe.hit.color.alpha===1),oe=L.filter(pe=>C.test(pe.name)),ue=L.filter(pe=>M.test(pe.name));for(let pe of oe)for(let me of ue){if(pe.name===me.name||pe.hit.value.toLowerCase()===me.hit.value.toLowerCase())continue;let De=jd(pe.hit.color,me.hit.color);de(`l2:${pe.name}|${me.name}`,{file:r,line:0,snippet:`${pe.name} (${pe.hit.value}) on ${me.name} (${me.hit.value}) = ${De.toFixed(2)}:1`},De)}}ae.length>0?c("contrast-tokens","warn",`B2: ${ae.length} of ${he} text/surface colour pairs below WCAG AA 4.5:1 (class lists that paint text on a background, conventional foreground/background tokens, light and dark). Large text needs only 3:1: check the size where the pair is used.`,ae.slice(0,6),ae.length):he>0&&c("contrast-tokens","pass",`B2: ${he} text/surface colour pairs \u2265 4.5:1.`)}let D=Du(f,h,E4,6);D.total>0?c("app-shell","pass",`Shell/navigation detected (${D.total} references).`,D.evidence,D.total):v.length>0?c("app-shell","fail",`Detected ${v.length} app pages but NO navigation/shell component (Nav/Sidebar/Layout/Menu\u2026). A B2B app always has shell + nav.`,[],v.length):c("app-shell","warn","No shell/nav detected and no clear app pages: verify manually whether one is needed.");let z=Du(f,h,P4,6);if(z.total>0?c("data-states","pass",`Data-state handling detected (${z.total} references to loading/empty/error).`,z.evidence,z.total):c("data-states","warn",'No sign of data states (empty/loading/error). Screens must not "exist only when full".'),h.length>=2){let ae=[/\b(?:export\s+)?(?:default\s+)?function\s+([A-Z][A-Za-z0-9]*)\s*\(/g,/\b(?:export\s+)?const\s+([A-Z][A-Za-z0-9]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z0-9_$]+)\s*=>/g,/\b(?:export\s+)?const\s+([A-Z][A-Za-z0-9]*)\s*=\s*function\b/g,/\bclass\s+([A-Z][A-Za-z0-9]*)\b/g],fe=new Map;for(let de of h){let j=f(de).split(/\r?\n/);for(let V=0;V<j.length;V++)for(let K of ae){K.lastIndex=0;let C;for(;C=K.exec(j[V]??"");){let M=C[1];if(!M)continue;let L=fe.get(M)??new Map;L.has(de)||L.set(de,V+1),fe.set(M,L)}}}let he=[...fe.entries()].filter(([,de])=>de.size>=2);if(he.length>0){let de=[];for(let[j,V]of he)for(let[K,C]of V)de.length<6&&de.push({file:K,line:C,snippet:`${j} redefined here (also in other files)`});c("duplicate-components","warn",`${he.length} components defined in MULTIPLE files (${he.map(([j])=>j).slice(0,8).join(", ")}): "repeated pattern = single source" (\xA78.6/\xA78.7) \u2014 extract them into ONE shared component instead of duplicating per page.`,de,he.length)}else c("duplicate-components","pass","No components duplicated across files (repeated pattern = single source).")}let N=p.present?(p.raw.match(/design\s*system[^:\n]*:\s*([^\n|]+)/i)||[])[1]:null,U=N?N.replace(/^[\s*_`]+|[\s*_`]+$/g,"").trim():null,J=!!(U&&!/^(none|no\b|—|-|n\/a|\{)/i.test(U)),W=/\/(components\/)?ui\//i,G=[...d,...n?.componentLibraryPaths??[]].some(ae=>W.test(ae));if(J||G){let ae=Du(f,h,/<(button|input|select|table|textarea|dialog)\b/,6,{fileFilter:he=>!W.test(he)&&y(he)&&/\.(tsx|jsx|vue|svelte)$/.test(he),reject:/type=["']hidden["']/i}),fe=J&&U?U.slice(0,60):"the project's ui/ library";ae.total>0?c("component-usage","warn",`${ae.total} raw interactive elements (<button>/<input>/<select>/<table>\u2026) outside the ui/ library: the project has a design system (${fe}) \u2014 use ITS components, not the bare elements.`,ae.evidence,ae.total):c("component-usage","pass",`No raw interactive elements outside the ui/ library (DS: ${fe}).`)}if(p.present&&p.tokenNames.length>0){let ae=0,fe=p.tokenNames.slice(0,60);e:for(let he of h){let de=f(he);for(let j of fe)if(de.includes(j)){ae++;break}if(ae>=3)break e}ae===0&&O.total>0?c("token-usage","warn",`The guidelines declare tokens (${p.tokenNames.length}) but none are found in the code and there are ${O.total} raw colors: the design system appears bypassed.`):c("token-usage","pass","The declared tokens are used in the code.")}else t!==void 0&&!p.present&&c("token-usage","warn",`L2 not readable at ${r}: token usage cannot be verified.`);if(n){let ae=Object.fromEntries(d.map(fe=>[fe,f(fe)]));s.push(...l$(ae,n),p$(ae,n.overlayContent))}return b$(s,i)}function b$(e,t){if(t)for(let o of e)o.status==="warn"&&["raw-color-literals","token-usage"].includes(o.id)&&(o.status="fail");let r=e.map(o=>{let a=S$[o.id]||{tell:null,dim:null};return{...o,tell:a.tell,dimension:a.dim}}),i=r.filter(o=>o.status==="fail"),n=r.filter(o=>o.status==="warn");return{tool:"ff-check",schema_version:"1.0",verification_level:"L1 (static/mechanical \u2014 no pixels)",pending:["visual craft verification (look, hierarchy, perceived consistency) \u2192 requires Pillar B (render+screenshot)"],summary:{fail:i.length,warn:n.length,pass:r.filter(o=>o.status==="pass").length},checks:r}}var S4,w4,$4,R4,E4,P4,S$,O4,m$,T4,w$,$$,Qg,k4,vo,Kg,Wg,Lu,v$,ry,A4,x4,_$,q4,Xg,U4,O$,J4,ny=Ve(()=>{"use strict";Jg();Bg();S4=new Set([".ts",".tsx",".js",".jsx",".vue",".svelte",".css",".scss",".less",".mdx",".html",".htm"]),w4=new Set(["node_modules",".git","dist","build",".next",".nuxt","out","coverage",".turbo",".cache",".svelte-kit","storybook-static"]),$4=/(tokens?|theme|palette|colou?rs?|globals|variables|design-system|tailwind\.config|index\.css|app\.css)/i,R4=/(?:^|\/)(pages?|routes?|views?|screens?|app)\//i,E4=/\b(Nav(bar|igation)?|Sidebar|Shell|App\s?Layout|Layout|Menu|Topbar|Header|RootLayout)\b/,P4=/(isLoading|loading|isFetching|isError|hasError|error|empty|isEmpty|Skeleton|Spinner|EmptyState|no[-_ ]?data|placeholder)/i,S$={"semantic-vocabulary":{tell:null,dim:"token"},"component-override":{tell:null,dim:"token"},"icon-library":{tell:"E4",dim:"ui"},target:{tell:null,dim:"meta"},"raw-color-literals":{tell:null,dim:"token"},"raw-spacing":{tell:null,dim:"token"},"off-scale-spacing":{tell:"C2",dim:"ui"},"contrast-tokens":{tell:"B2",dim:"ui"},"app-shell":{tell:null,dim:"baseline"},"data-states":{tell:"F1",dim:"baseline"},"duplicate-components":{tell:"A10",dim:"ui"},"token-usage":{tell:null,dim:"token"},"component-usage":{tell:null,dim:"token"},"overlay-width":{tell:"G5",dim:"ui"}},O4=e=>/(\.[^./\\]+)$/.exec(e)?.[1]??"",m$=e=>e.split("/").pop()??e;T4=4,w$=[.5,1.5,2.5,3.5],$$=96,Qg=e=>`${Number(e.toFixed(3))}px`;k4=e=>e===0||Number.isInteger(e)&&e<=$$||w$.includes(e),vo=e=>e<0?0:e>1?1:e,Kg=e=>{let t=vo(e);return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055},Wg=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);Lu={white:{r:1,g:1,b:1,alpha:1},black:{r:0,g:0,b:0,alpha:1},transparent:{r:0,g:0,b:0,alpha:0}};v$=({r:e,g:t,b:r})=>.2126*Wg(e)+.7152*Wg(t)+.0722*Wg(r);ry=e=>[...new Set(e)].filter(t=>Number.isFinite(t)).sort((t,r)=>t-r),A4=()=>({light:new Map,dark:new Map,theme:new Map});x4=String.raw`#[0-9a-f]{3,8}\b|(?:oklch|oklab|hsla?|rgba?)\([^()]*\)`,_$=String.raw`(--[a-z0-9-]+)(?:\s*[:=]?\s*\(?\s*(${x4})\s*\)?)?`,q4=new RegExp(String.raw`${_$}\s+on\s+${_$}`,"gi");Xg=["light","dark"],U4=/(["'`])((?:(?!\1)[^\\]|\\.)*?)\1/g,O$=/^(bg|text)-([a-z][a-z0-9-]*?)(?:\/(\d{1,3}))?$/;J4=Object.keys(S$)});var za,Va,Yye,C$=Ve(()=>{"use strict";ny();za=["contracts-only","tokens","components"],Va={"icon-library":{id:"icon-library",version:"1.0",requiredInputs:["files","iconLibrary"],adoptionModes:["components"],analysedSubset:"Static imports of known icon packages compared with the declared icon family. SVG, wrappers, require and dynamic imports are outside coverage.",knownFalsePositives:"Unused static icon imports are still counted. Family identity does not verify icon weight or rendered appearance.",relatedRuleIds:["FF-BASE-03"],confidence:"high",needsWholeProject:!1},"component-override":{id:"component-override",version:"1.1",requiredInputs:["files","componentControls"],adoptionModes:["components"],analysedSubset:"Literal appearance classes on components imported from components/ui or Frontfriend packages, compared with the controls the selected Design System configures for that component (its component configuration: root, slots, variant and size classes). Layout classes are allowed. Without the controls, or for a component the Design System does not configure, appearance classes are undetermined and reported as a coverage gap.",knownFalsePositives:"A class the Design System configures for another variant of the same component is accepted as a control (choosing it through className instead of the variant prop is not detected); wrapper and namespace imports cannot be resolved and are reported as coverage gaps.",relatedRuleIds:["FF-BASE-02"],confidence:"high",needsWholeProject:!1},"overlay-width":{id:"overlay-width",version:"1.0",requiredInputs:["files","overlayContent"],adoptionModes:["components"],analysedSubset:"Literal w-*, min-w-* and max-w-* classes on elements written inside Design System overlay content (PopoverContent, DropdownMenuContent, DialogContent, SheetContent, SelectContent, TooltipContent) in the same file, compared with the overlay width of the selected component configuration merged with the classes passed to the overlay. A child that a flex row can shrink, a relative max width, or a scroll container declared inside the overlay is not an overflow. Runtime classes, width props, responsive widths and overlays whose width is relative or variable are coverage gaps; fixed widths inside other components rendered in the overlay are not followed. Sizes assume a 16px root font size.",knownFalsePositives:"A child hidden at runtime (display none, a closed branch) is still measured; an overlay width changed by a CSS rule outside the class attributes is not seen.",relatedRuleIds:["B2B-DEF-G5"],confidence:"high",needsWholeProject:!1},"semantic-vocabulary":{id:"semantic-vocabulary",version:"1.0",requiredInputs:["files","vocabulary"],adoptionModes:["components"],analysedSubset:"Literal class attributes in JSX, Vue, Svelte and HTML; visual utilities compared with the selected foundation. Runtime expressions and custom classes are coverage gaps.",knownFalsePositives:"Text resembling markup in strings can be counted; computed classes and bindings are not resolved.",relatedRuleIds:["FF-BASE-01"],confidence:"high",needsWholeProject:!1},target:{id:"target",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Presence of at least one source file (ts, tsx, js, jsx, vue, svelte, css, scss, less, mdx, html) outside ignored build folders.",knownFalsePositives:"None: it only reports an empty input.",confidence:"high",needsWholeProject:!1},"raw-color-literals":{id:"raw-color-literals",version:"1.1",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Colour literals in every source file except theme/token definition files and icon files: hex, rgb()/rgba(), hsl()/hsla() and the modern syntaxes oklch(), oklab(), lab(), lch(), hwb() and color(<space> \u2026); SVG attribute lines are skipped.",knownFalsePositives:"Literals inside comments, tests or data (a colour picker default, a chart palette) are counted like styling.",confidence:"high",needsWholeProject:!1},"raw-spacing":{id:"raw-spacing",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"padding/margin/gap declarations with a px value in component files (tsx, jsx, vue, svelte, html); 0px, media queries, transitions and calc() are skipped.",knownFalsePositives:"A px value that intentionally matches the scale (e.g. 16px where the token is 16px) is still reported: the check sees the literal, not the intent.",confidence:"high",needsWholeProject:!1},"off-scale-spacing":{id:"off-scale-spacing",version:"1.1",requiredInputs:["files","l2"],adoptionModes:za,analysedSubset:'px spacing declarations and arbitrary spacing utilities (p-[13px], gap-[0.8rem]) in component files, compared with one scale, in this order: the px scale declared in the guidelines (L2: --space* tokens, a Tailwind --spacing unit, "base-N" or a declared sequence); else the --spacing unit of the selected theme or the passed stylesheets; else the Tailwind default 0.25rem (4px) when the project is Tailwind v4. A Tailwind scale is the whole multiples of its unit, the 0.5/1.5/2.5/3.5 steps and 1px. rem values assume a 16px root font size. Without any scale the check does not run.',knownFalsePositives:"A scale derived from a prose sequence may miss steps; a root font size other than 16px shifts every rem conversion; an intentional off-grid value (an optical adjustment) is reported like an eyeballed one.",confidence:"medium",needsWholeProject:!1},"contrast-tokens":{id:"contrast-tokens",version:"1.2",requiredInputs:["l2"],adoptionModes:za,analysedSubset:'WCAG AA (4.5:1) contrast, light and dark, of colour tokens from the guidelines (L2), the selected theme and the passed stylesheets (:root, .dark, @theme), in hex, rgb(), hsl(), bare H S% L%, oklch() or oklab() with var() references resolved. Pairs: those the guidelines declare as "<text token> [colour] on <surface token> [colour]" (e.g. --text-neutral-mid #11150A on --layer-below #FFFFFF; a pair without colours reads them from the theme); bg-/text- utilities in the same class string (including dark: variants; a /NN opacity is composited over the page background), and the convention pairs --x-foreground on --x, --foreground on --background, and --muted-foreground and --destructive on --background, --card and --popover.',knownFalsePositives:"A convention pair that never meets on screen is reported like a real pair; a bg-/text- pair in one class string may be painted on different elements; colours outside sRGB are clipped, and color-mix(), relative colours, lab()/lch() and color() values are not evaluated.",confidence:"medium",needsWholeProject:!1},"app-shell":{id:"app-shell",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Identifiers that look like a shell (Nav, Sidebar, Layout, Menu, Header\u2026) anywhere in component files, versus files under pages/, routes/, views/, screens/ or app/.",knownFalsePositives:"A shell provided by a framework layout outside the scanned tree is not seen; an identifier named Layout that is not a shell counts as one.",confidence:"medium",needsWholeProject:!0},"data-states":{id:"data-states",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Textual hints of loading/empty/error handling (isLoading, Skeleton, EmptyState, error\u2026) in component files. A hint is not a verified state.",knownFalsePositives:"A file that never renders data (a pure layout or a utility) legitimately has no state hints; a variable named error unrelated to UI counts as a hint.",confidence:"medium",needsWholeProject:!1},"duplicate-components":{id:"duplicate-components",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"PascalCase component definitions (function, arrow const, class) that appear in two or more component files.",knownFalsePositives:"Same-named components that are intentionally different (a local Header inside two unrelated features) are reported; forwardRef/styled definitions are not seen.",confidence:"medium",needsWholeProject:!0},"token-usage":{id:"token-usage",version:"1.0",requiredInputs:["files","l2"],adoptionModes:["tokens","components"],analysedSubset:"Whether any token name declared in the guidelines (CSS variables, bg-/text-/border- utilities) appears in the component files, when raw colours were also found.",knownFalsePositives:"Tokens consumed through a theme object or a preprocessor alias are not matched by name.",confidence:"medium",needsWholeProject:!0},"component-usage":{id:"component-usage",version:"1.1",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Raw <button>/<input>/<select>/<table>/<textarea>/<dialog> elements outside the ui/ library, when the guidelines declare a design system or the tree has a ui/ folder.",knownFalsePositives:"Raw elements inside a wrapper that the design system does not cover (a native table in a report) are reported like a bypass.",confidence:"medium",needsWholeProject:!1}},Yye=Object.keys(Va)});function K4(e,t){if(!t.hasFiles&&t.inputs.includes("files"))return"no source files were passed";if(!t.hasL2&&t.inputs.includes("l2")&&!B4.has(e))return"the design guidelines (L2) were not available";switch(e){case"off-scale-spacing":return"no spacing scale is known: the guidelines (L2) declare no px scale, no --spacing token was read from the theme or the passed stylesheets, and the project is not recognised as Tailwind v4";case"contrast-tokens":return'no text/surface colour pair could be evaluated: no colour tokens in the guidelines (L2), the selected theme or the passed stylesheets, or none in a readable colour syntax. Declare pairs in the guidelines as "<text token> <colour> on <surface token> <colour>" (e.g. --text-neutral-mid #11150A on --layer-below #FFFFFF)';case"duplicate-components":return"fewer than two component files were passed";case"component-usage":return"no design system is declared in the guidelines and no ui/ library is in the files";case"token-usage":return"the guidelines declare no token names";default:return"the check did not run"}}function W4(e,t){let r=e.scope.map(o=>k$.exec(o)?.[1]).filter(o=>!!o);if(r.length!==e.scope.length)return{applies:!0};let i=t.map(o=>o.toLowerCase());return r.map(o=>o.split("/").pop().toLowerCase()).some(o=>i.some(a=>a.includes(o)))?{applies:!0}:{applies:!1,reason:`pattern scope (${Gr(r)}) matches none of the passed file paths`}}function Y4(e){let t=new Set;for(let{content:r}of e){for(let i of hc(r)){let n=i[2];if(G4.test(n)){/components\/ui\/./.test(n)&&t.add(Xi(n.split("/").pop()));for(let o of i[1].replace(/[{}]/g,"").split(",")){let a=o.trim().split(/\s+as\s+/)[0]??"";/^[A-Z]\w*$/.test(a)&&t.add(Xi(a))}}}for(let i of r.matchAll(/<([A-Z][\w.]*|[a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/g))t.add(Xi(i[1]))}return t.delete(""),[...t].sort()}function Q4(e,t){if(!e.scope.length)return{applies:!0};let r=[],i=e.checks.some(o=>t.examined.has(o.id)),n=[];for(let o of e.scope){let a=j$.exec(o)?.[1],s=X4.exec(o)?.[1],c=k$.exec(o)?.[1];if(a!==void 0){if(!t.areas||t.areas.has(a.toUpperCase())||i)return{applies:!0};r.push(`area ${a} is not among the touched areas (${Gr([...t.areas].sort())})`)}else if(s!==void 0){let u=Xi(s);if(u&&t.components.some(d=>d.startsWith(u)))return{applies:!0};r.push(`component ${s} is not used in the passed files`)}else if(c!==void 0)n.push(o);else return{applies:!0}}if(n.length){let o=W4({scope:n},t.paths);if(o.applies)return{applies:!0};r.push(o.reason)}return{applies:!1,reason:`${A$}: ${r.join("; ")}`}}function e6(e,t,r){if(e.status==="pass")return[];let i=Va[e.id],n={check:e.id,checkVersion:i?.version??"unknown",severity:H4[e.status],confidence:i?.confidence??"medium",message:e.message,ruleIds:t},o=t6(e.id,r);return e.evidence.length?e.evidence.map(a=>({...n,file:a.file,line:a.line,snippet:a.snippet,...o?{fix:o}:{}})):[{...n,...o?{fix:o}:{}}]}function t6(e,t){if(e==="raw-color-literals"&&t?.length){let r=t.filter(i=>/^(bg|text|border)-/.test(i)).slice(0,3);return r.length?`Replace the literal with a semantic class from the foundation vocabulary (e.g. ${Gr(r)}).`:void 0}if(e==="component-usage")return"Use the design-system component for this element instead of the bare HTML element."}function N$(e){let t=e.fileScope??"subset",r=e.files.map(G=>G.path.replace(/\\/g,"/")),i=Object.fromEntries(e.files.map(G=>[G.path.replace(/\\/g,"/"),G.content])),n=typeof e.l2=="string"&&e.l2.trim().length>0,o=I$({files:i,staticContext:{vocabulary:e.vocabulary,iconLibrary:e.iconLibrary,componentControls:e.componentControls,overlayContent:e.overlayContent,componentLibraryPaths:e.componentLibraryPaths},...n?{l2:e.l2}:{},l2Path:e.l2Path??"design-guidelines.md",theme:e.theme,tailwindVersion:e.tailwindVersion}),a=new Map(o.checks.map(G=>[G.id,G])),s=r.filter(G=>!/(^|\/)(node_modules|\.git|dist|build|\.next|\.nuxt|out|coverage|\.turbo|\.cache|\.svelte-kit|storybook-static)(\/|$)/.test(G)&&/\.(tsx?|jsx?|vue|svelte|css|scss|less|mdx|html?)$/i.test(G)).length,c={hasFiles:s>0,hasL2:n},u=new Map,d=[],f={scope:t,files:e.files.length,analysed:s,executed:[],notExecuted:[],insufficient:[]};e.rulesAvailable===!1&&f.insufficient.push({check:"rules-source",reason:"The selected rules could not be read. Run frontfriend design sync."});let p={};for(let[G,ae]of Object.entries(Va)){if(e.adoption&&!ae.adoptionModes.includes(e.adoption)){u.set(G,{kind:"not-run",reason:`the check does not apply to a ${e.adoption} App`}),f.notExecuted.push({check:G,reason:`does not apply to a ${e.adoption} App`});continue}let fe=a.get(G);if(!fe){if(G==="target")continue;let j=K4(G,{...c,inputs:ae.requiredInputs});u.set(G,{kind:"not-run",reason:j}),f.notExecuted.push({check:G,reason:j});continue}if(fe.coverage==="none"){let j=fe.coverageReason??"Required inputs are unavailable";u.set(G,{kind:"not-run",reason:j}),f.notExecuted.push({check:G,reason:j});continue}p[G]=ae.version;let he=e6(fe,[],e.vocabulary),de=he.filter(j=>j.file!==void 0);if(ae.needsWholeProject&&t==="subset"){let j="reasons about the whole project; on a subset of files no clean pass is claimed";f.insufficient.push({check:G,reason:j}),d.push(...de),u.set(G,de.length?{kind:"evidence"}:{kind:"insufficient",reason:j});continue}if(f.executed.push(G),d.push(...he),fe.coverage==="partial"){let j=fe.coverageReason??"Only statically resolved inputs were analysed";f.insufficient.push({check:G,reason:j}),u.set(G,he.length?{kind:"evidence"}:{kind:"insufficient",reason:j})}else u.set(G,he.length?{kind:"evidence"}:{kind:"clean"})}let y=(e.areas??[]).map(G=>G.trim().toUpperCase()).filter(Boolean),h=y.length?new Set(y):null,v=Y4(e.files),_=G=>Va[G]?.requiredInputs.includes("files")??!1,g=new Set([...u].filter(([G,ae])=>_(G)&&(ae.kind==="evidence"||ae.kind==="clean")).map(([G])=>G).concat(f.insufficient.filter(G=>_(G.check)&&!Va[G.check]?.needsWholeProject).map(G=>G.check))),$={paths:r,areas:h,components:v,examined:g},w=new Map;for(let G of e.rules)w.set(G.id,G.enabled===!1?{applies:!1,reason:"the rule is switched off for this Design System"}:Q4(G,$));let m=new Map;for(let G of e.rules)if(w.get(G.id)?.applies)for(let ae of G.checks)m.set(ae.id,[...m.get(ae.id)??[],G.id]);d=d.map(G=>({...G,ruleIds:m.get(G.check)??[]}));let O=e.rules.map(G=>{let ae={id:G.id,nature:G.nature,maturity:G.maturity,area:G.area??r6(G.scope),checks:G.checks.map(C=>C.id)},fe=w.get(G.id);if(!fe.applies)return{...ae,status:"not-applicable",reason:fe.reason};if(e.adoption&&G.checks.length&&G.checks.every(C=>Va[C.id]&&!Va[C.id].adoptionModes.includes(e.adoption)))return{...ae,status:"not-applicable",reason:`The cited checks do not apply to a ${e.adoption} App`};if(!G.checks.length)return{...ae,status:"unverified",reason:"cites no automated check: honour it by reading the rule"};let he=G.checks.map(C=>({...C,outcome:u.get(C.id)??{kind:"unknown",reason:`check "${C.id}" is not in the checker catalog`}})),de=he.filter(C=>C.outcome.kind==="evidence");if(de.length)return{...ae,status:"violated",reason:`evidence from ${Gr(de.map(C=>C.id))}`};let j=he.filter(C=>C.outcome.kind==="clean"),V=he.filter(C=>C.outcome.kind!=="clean"),K=V.map(C=>`${C.id} (${"reason"in C.outcome?C.outcome.reason:"no outcome"})`);return he.some(C=>C.outcome.kind==="insufficient"&&!Va[C.id]?.needsWholeProject)?{...ae,status:"partial",reason:Gr(K)}:j.length?V.length?{...ae,status:"partial",reason:`${Gr(j.map(C=>C.id))} found nothing; could not run ${Gr(K)}`}:j.every(C=>C.coverage==="full")?{...ae,status:"verified",reason:`${Gr(j.map(C=>C.id))} ran with full coverage and found nothing`}:{...ae,status:"partial",reason:`${Gr(j.filter(C=>C.coverage==="partial").map(C=>C.id))} covers the rule only partially and found nothing`}:{...ae,status:"unverified",reason:`no cited check ran: ${Gr(K)}`}}),P=[...new Set(e.rules.flatMap(G=>w.get(G.id)?.applies?G.checks.map(ae=>ae.id):[]))].map(G=>({id:G,outcome:u.get(G)})).filter(G=>!G.outcome||G.outcome.kind!=="clean"&&G.outcome.kind!=="evidence").map(G=>({check:G.id,reason:G.outcome&&"reason"in G.outcome?G.outcome.reason:`check "${G.id}" is not in the checker catalog`,ruleIds:m.get(G.id)??[]})),E=e.rules.filter(G=>w.get(G.id)?.reason?.startsWith(A$)),I=new Set(e.rules.flatMap(G=>[...G.area?[G.area]:[],...G.scope.map(ae=>j$.exec(ae)?.[1]??"")]).filter(Boolean).map(G=>G.toUpperCase())),D=h&&e.rules.length?[...h].filter(G=>!I.has(G)).sort():[],z={areas:h?[...h].sort():null,components:v,outside:E.map(G=>G.id),outsideRequirements:E.filter(G=>G.nature==="requirement"&&G.maturity==="decided").map(G=>G.id),unknownAreas:D,note:h?`Area-scoped rules outside the touched areas (${Gr([...h].sort())}) are not assessed by this run, unless a check they cite examined the passed files; declare every area you touched.${D.length?` No rule of the selection is scoped to ${Gr(D)}: check the area codes read with get_rules.`:""}`:"No touched areas declared: every area-scoped rule is in the perimeter. Pass the areas you touched (the ones read with get_rules) to narrow it."},N=Object.fromEntries(Z4.map(G=>[G,O.filter(ae=>ae.status===G).length])),U=d.filter(G=>G.severity==="error").length,J=d.filter(G=>G.severity==="warning").length,W={tool:"check-compliance",schemaVersion:"1.0",engineVersion:iy,checkVersions:p,summary:{text:n6({errors:U,warnings:J,coverage:f,counts:N,perimeter:z}),errors:U,warnings:J,rules:N},coverage:f,findings:d,rules:O,missingChecks:P,perimeter:z,...e.selection?{selection:e.selection}:{}};return{...W,gate:Md(W)}}function r6(e){let t=e.find(r=>r.startsWith("area:"));return t?t.slice(5):null}function n6({errors:e,warnings:t,coverage:r,counts:i,perimeter:n}){let o=[],a=r.executed.length?Gr(r.executed):"none";return o.push(e+t===0?`No violations detected in the executed checks (${a}).`:`${e} error${e===1?"":"s"} and ${t} warning${t===1?"":"s"} from the executed checks (${a}).`),r.insufficient.length&&o.push(`Insufficient coverage on this file subset: ${Gr(r.insufficient.map(s=>s.check))} (no clean pass claimed).`),r.notExecuted.length&&o.push(`Not executed: ${r.notExecuted.map(s=>`${s.check} (${s.reason})`).join("; ")}.`),o.push(`Rules: ${i.verified} verified, ${i.violated} violated, ${i.partial} partial, ${i.unverified} unverified, ${i["not-applicable"]} not applicable.`),n.outside.length?o.push(`${n.outside.length} of the not applicable rules lie outside the check perimeter (${n.areas?`touched areas: ${Gr(n.areas)}`:"scope not matched by the passed files"})${n.outsideRequirements.length?`, including ${n.outsideRequirements.length} decided requirement${n.outsideRequirements.length===1?"":"s"}`:""}: this run does not verify them.`):n.areas||o.push("No touched areas declared: every area-scoped rule is in the perimeter."),n.unknownAreas.length&&o.push(`Declared areas no rule is scoped to: ${Gr(n.unknownAreas)}.`),o.push("Rules without a check and visual craft stay unverified: this is not a statement of interface compliance."),o.join(" ")}function M$(e){let{report:t}=e,r=Md(t,{attested:(e.attestations??[]).map(i=>i.rule_id)});return{report_protocol:1,ff_id:e.ffId,app:e.app,selection:e.selection,engine_version:t.engineVersion,check_versions:t.checkVersions,files:Object.entries(e.digests).sort(([i],[n])=>i.localeCompare(n)).map(([i,n])=>({path:i,digest:n})),rules_source:e.rulesSource,summary:{errors:t.summary.errors,warnings:t.summary.warnings,rules:t.summary.rules,gate:{verdict:r.verdict,exitCode:r.exitCode}},coverage:t.coverage,findings:t.findings.map(i=>({check:i.check,check_version:i.checkVersion,severity:i.severity,confidence:i.confidence,...i.file!==void 0?{file:i.file}:{},...i.line!==void 0?{line:i.line}:{},rule_ids:i.ruleIds})),rules:t.rules.map(i=>({id:i.id,status:i.status,nature:i.nature,maturity:i.maturity,area:i.area??null,checks:i.checks,...i.reason?{reason:i.reason}:{}})),attestations:e.attestations??[]}}function T$(e){return x$(e)&&e.status==="unverified"&&Array.isArray(e.checks)&&e.checks.length===0}function i6(e,t){let r=[],i=Gr(t.incomplete.map(n=>n.id));if(e==="findings"&&r.push("Fix the error findings, then run check_compliance again."),e==="not-executed"&&r.push(`Give the checks that did not run the input their reason names (source files, synced rules, guidelines, theme or component controls)${i?` for ${i}`:""}, then run check_compliance again.`),e==="partial-coverage"){let n=new Set(t.incomplete.flatMap(a=>a.checks??[])),o=t.insufficient.filter(a=>n.has(a.check)).map(a=>`${a.check}: ${a.reason}`);r.push(`Clean with partial coverage: the executed checks found nothing, but they cover ${i} only partially by design, so the verdict stays NOT-VERIFIED and no code change can raise it. Review those requirements by reading and on screen, then record the audit with this result.${o.length?` Coverage notes: ${o.join("; ")}.`:""}`)}return t.warnings>0&&r.push(`Fix or justify the ${t.warnings} warning finding${t.warnings===1?"":"s"}.`),t.manual.length&&r.push(`Declare the manual requirements you honoured by reading in record_audit { acknowledged_rules } (or as check_compliance attestations): ${Gr(t.manual)}.`),r.length||r.push("Nothing left to fix in the executed checks: record the audit with this result."),r}function Md(e,t={}){let r=new Set(t.attested??[]),i=e.rules.filter(T$).map(f=>f.id),n=i.filter(f=>!r.has(f)),o=i.filter(f=>r.has(f)),a=e.rules.filter(f=>x$(f)&&!T$(f)&&["unverified","partial"].includes(f.status)),s={incomplete:a,insufficient:e.coverage.insufficient,manual:n,warnings:e.summary.warnings},c=(f,p,y,h)=>({verdict:f,exitCode:p,reasons:y,reasonCode:h,nextSteps:i6(h,s),manual:n,attested:o});if(e.summary.errors>0)return c("FAIL",2,["Open error findings."],"findings");let u=a.map(f=>`${f.id}: ${f.status}${f.reason?` \u2014 ${f.reason}`:""}`),d=e.coverage.insufficient.filter(f=>f.check==="rules-source").map(f=>f.reason);if(u.push(...d),e.coverage.analysed===0&&u.unshift("No source files were analysed."),u.length){let f=e.coverage.executed?new Set(e.coverage.executed):null,p=h=>h.status==="partial"&&!!f&&!!h.checks?.length&&h.checks.every(v=>f.has(v)),y=e.coverage.analysed>0&&!d.length&&a.every(p);return c("NOT-VERIFIED",t.ci?2:1,u,y?"partial-coverage":"not-executed")}return e.summary.warnings>0?c("WARN",t.warningsAsErrors?2:1,["Open warning findings."],"findings"):c("PASS",0,[`No violations detected in executed checks; the verdict is limited to their declared coverage.${n.length?` ${n.length} manual requirement${n.length===1?"":"s"} to honour by reading (not gated).`:""}`],"clean")}var iy,Z4,H4,Gr,B4,k$,G4,j$,X4,A$,x$,q$=Ve(()=>{"use strict";Td();ny();C$();Mu();iy="0.16.0",Z4=["verified","violated","partial","unverified","not-applicable"],H4={fail:"error",warn:"warning"},Gr=e=>e.join(", "),B4=new Set(["off-scale-spacing","contrast-tokens"]);k$=/^pattern:(.+)$/;G4=/(?:^|\/)components\/ui(?:\/|$)|^@frontfriend\/(?:react|components-react|components-vue)/;j$=/^area:(.+)$/,X4=/^component:(.+)$/,A$="outside the check perimeter";x$=e=>e.nature==="requirement"&&e.maturity==="decided"});var oy={};mo(oy,{COMPLIANCE_ENGINE_VERSION:()=>iy,buildComplianceReportPayload:()=>M$,checkCompliance:()=>N$,complianceGate:()=>Md,componentControlsFromConfig:()=>n$,composeGuidelinesChapters:()=>H0,overlayContentFromConfig:()=>f$});var ay=Ve(()=>{"use strict";B0();q$();Mu();Bg()});var nR=te((cve,rR)=>{"use strict";var Vr=require("node:fs"),pr=require("node:path"),o6=require("node:crypto"),{resolveAuthToken:a6}=xa(),{resolveProjectContext:s6}=wg(),{parseApplicationLock:c6}=(kg(),hi(P0)),{fetchDesignRules:U$,RULES_DIR:Uu}=Ng(),u6=gd(),{nativeIconLibrary:l6,renderFoundation:d6}=L0(),{CACHE_DIR_NAME:f6}=Ma(),xd=".frontfriend/design/design-guidelines.md",Ld=".frontfriend/foundation.md",Cs="rules.json",D$=`node_modules/${f6}/components-config.json`,p6=new Set(["node_modules",".git","dist","build",".next",".nuxt","out","coverage",".turbo",".cache",".svelte-kit","storybook-static"]);function ly(e){return e||(ay(),hi(oy))}var z$=e=>e.split(pr.sep).join("/");function dy(e,t){if(!Array.isArray(t)||t.length===0)throw new Error("Pass files: a non-empty list of project-relative paths.");let r=Vr.realpathSync(e),i=[],n=[],o=new Set;for(let a of t){if(typeof a!="string"||!a.trim())throw new Error("Every file must be a non-empty path.");let s=a.replace(/\\/g,"/");if(s.split("/").includes(".."))throw new Error(`Path escapes the project root: ${a}`);let c=pr.isAbsolute(s)?pr.normalize(s):pr.join(r,s);if(!Vr.existsSync(c)){n.push({path:a,reason:"not found"});continue}let u=Vr.realpathSync(c);if(u!==r&&!u.startsWith(r+pr.sep))throw new Error(`Path resolves outside the project root (symlink or absolute path): ${a}`);if(!Vr.statSync(u).isFile()){n.push({path:a,reason:"not a file"});continue}let d=z$(pr.relative(r,u));o.has(d)||(o.add(d),i.push({path:d,content:Vr.readFileSync(u,"utf8")}))}return{files:i,skipped:n}}function L$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function V$(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="*")e[r+1]==="*"?(r++,e[r+1]==="/"?(r++,t+="(?:.*/)?"):t+=".*"):t+="[^/]*";else if(i==="?")t+="[^/]";else if(i==="{"){let n=e.indexOf("}",r);n===-1?t+="\\{":(t+=`(?:${e.slice(r+1,n).split(",").map(L$).join("|")})`,r=n)}else t+=L$(i)}return new RegExp(`^${t}$`)}function F$(e){let t=[],r=[e];for(;r.length;){let i=r.pop();for(let n of Vr.readdirSync(i,{withFileTypes:!0})){if(n.isDirectory()){p6.has(n.name)||r.push(pr.join(i,n.name));continue}n.isFile()&&t.push(z$(pr.relative(e,pr.join(i,n.name))))}}return t.sort()}function J$(e,t){let r=t.filter(o=>!/[*?{]/.test(o)),i=t.filter(o=>/[*?{]/.test(o)).map(o=>V$(o.replace(/^\.\//,"")));if(!i.length)return r;let n=F$(e).filter(o=>i.some(a=>a.test(o)));return[...new Set([...r,...n])]}function Z$(e,t){let r=pr.join(e,...xd.split("/")),i=pr.join(pr.dirname(r),"guidelines"),n=Vr.existsSync(i)?Vr.readdirSync(i).filter(s=>s.endsWith(".md")):[];if(!(Vr.existsSync(r)||n.length>0))return{present:!1,l2:void 0,path:xd};let a=Vr.existsSync(r)?Vr.readFileSync(r,"utf8"):"";if(n.length){let s={"design-guidelines.md":a};for(let c of n)s[`guidelines/${c}`]=Vr.readFileSync(pr.join(i,c),"utf8");a=ly(t).composeGuidelinesChapters(s).body}return{present:!0,l2:a,path:xd}}function qd(e){let t=pr.join(e,...Ld.split("/"));return Vr.existsSync(t)?H$(Vr.readFileSync(t,"utf8")):{present:!1,vocabulary:void 0,iconLibrary:null}}var m6=/^(?:(?:bg|text|border|ring|fill|stroke|icon|font|animate|rounded|shadow)-[a-z0-9-]+|shadow)$/;function H$(e){let t=e.indexOf("## This design system"),r=t===-1?e:e.slice(t),i=[...new Set([...r.matchAll(/`([a-z][a-z0-9-]*)`/g)].map(a=>a[1]).filter(a=>m6.test(a)))].sort(),n=/Icon library: `([^`]+)`/.exec(e),o={};for(let a of e.split(/^## /m).slice(1)){let s=/^(light|dark|theme)\s*\n/.exec(a)?.[1];if(!s)continue;let c=[...a.matchAll(/^- `(--[A-Za-z0-9_*-]+)`: `([^`\n]*)`\s*$/gm)];c.length&&(o[s]=Object.fromEntries(c.map(u=>[u[1],u[2]])))}return{present:!0,vocabulary:i,iconLibrary:n?n[1]:null,...Object.keys(o).length?{tokens:o}:{}}}async function B$({projectRoot:e,apiUrl:t,ffId:r,lock:i,fetchImpl:n}){let o=i?.tokenSourceReleaseId||i?.releaseId;if(t){let a=o?`release=${encodeURIComponent(o)}`:"root=true";try{let s=await n(`${t}/api/design-systems/${encodeURIComponent(r)}/processed-tokens?${a}&colorFormat=oklch`,{signal:AbortSignal.timeout(6e4)});if(!s.ok)throw new Error(`HTTP ${s.status}`);let c=await s.json();if(!c||c.base!=="shadcn"&&(!c.semanticVariables||typeof c.semanticVariables!="object"))throw new Error("Foundation response has no semantic vocabulary");let u=c.base==="shadcn"?l6(e,{processedData:c}):c.iconLibrary;return{...H$(d6({processedData:c,iconLibrary:u})),componentsConfig:c.componentsConfig,source:"server",release_id:o||null,selection_note:o?"App token release":"Current base release (no app token release pinned)"}}catch(s){return{...qd(e),source:"local-mirror",reason:`Selected foundation unavailable (${s.message}); using the locally installed foundation`}}}return{...qd(e),source:"local-mirror",reason:"No API URL; using the locally installed foundation"}}function K$({projectRoot:e,ffId:t,foundation:r,lock:i,engine:n}){let o=ly(n),a=r?.source==="server"?o.componentControlsFromConfig(r.componentsConfig):null;if(a)return{controls:a,overlayContent:o.overlayContentFromConfig(r.componentsConfig),source:"server",components:Object.keys(a).length,...r.release_id?{release_id:r.release_id}:{}};let s=r?.source==="server"?"the selected token release carries no component configuration":r?.source?"the selected token release is unavailable":"offline run: the selected token release was not fetched",c=pr.join(e,...D$.split("/")),u=yc(pr.join(pr.dirname(c),"metadata.json"));if(t&&u?.ffId!==t&&Vr.existsSync(c)){let v=u?.ffId?"belongs to another Design System":"does not declare its Design System (missing or incomplete metadata)";return{controls:null,source:"none",components:0,reason:`${s}; the local component cache ${v}: run \`frontfriend init\`. Appearance classes on Design System components are reported as undetermined, not as overrides`}}let d=i?.tokenSourceReleaseId||i?.releaseId,f=yc(pr.join(pr.dirname(c),"versionMetadata.json")),p=f?.releaseId??u?.tokenSourceReleaseId;if(i?.tokenVersionId&&((f?.versionId??u?.tokenVersionId)!==i.tokenVersionId||d&&p&&p!==d))return{controls:null,source:"none",components:0,reason:`${s}; the local component cache does not match the selected token version and source Release. Fetch the selected release before checking component overrides`};let y=Vr.existsSync(c)?yc(c):null,h=y?o.componentControlsFromConfig(y):null;return h?{controls:h,overlayContent:o.overlayContentFromConfig(y),source:"local-cache",components:Object.keys(h).length,reason:`${s}; using the component configuration cached by \`frontfriend init\` (${D$}), which may predate the selected release`}:{controls:null,source:"none",components:0,reason:`${s} and no component configuration is cached: run \`frontfriend init\`. Appearance classes on Design System components are reported as undetermined, not as overrides`}}function fy(e){if(e==null)return;let t=[];for(let r of Array.isArray(e)?e:[e])for(let i of String(r).split(",")){let n=i.trim();if(n){if(!/^[A-Za-z][A-Za-z0-9-]*$/.test(n))throw new Error(`Invalid area code: ${n}. Pass rule area codes such as FRM, COL, A11Y.`);t.push(n.toUpperCase())}}return t.length?[...new Set(t)]:void 0}function yc(e){try{return JSON.parse(Vr.readFileSync(e,"utf8"))}catch{return null}}function Dd(e,t){let r=pr.join(e,"frontfriend.lock.json");if(!Vr.existsSync(r))return{selection:{view:"working"},lock:null,adopted:!1,declared:"No frontfriend.lock.json: reading the working contracts (declared, not a substitute for an adopted snapshot)."};let i=c6(Vr.readFileSync(r,"utf8"));if(i.ffId&&t&&i.ffId!==t)throw new Error("frontfriend.lock.json belongs to another Design System.");return i.design?{selection:{view:"adopted",design_snapshot_id:i.design.snapshotId},lock:i,adopted:!0,declared:`Adopted design snapshot ${i.design.snapshotId} from frontfriend.lock.json.`}:{selection:{view:"working"},lock:i,adopted:!1,declared:"The Application lock has no adopted design snapshot: reading the working contracts (declared, not substituted)."}}var W$=e=>e.design_snapshot_id?`&view=adopted&design_snapshot_id=${encodeURIComponent(e.design_snapshot_id)}`:"&view=working";function sy(e,t){return e?e.view===t.view&&(e.design_snapshot_id||null)===(t.design_snapshot_id||null):!1}function G$(e){let t=(e||[]).find(r=>r.path===Cs);if(!t)return null;try{let r=JSON.parse(t.content);return Array.isArray(r.rules)?r:null}catch{return null}}var cy=e=>(Array.isArray(e)?e:[]).map(t=>({slug:t.slug,revision_id:t.revision_id,version:t.version,digest:t.digest}));async function Y$({projectRoot:e,apiUrl:t,token:r,ffId:i,appName:n,selection:o,fetchImpl:a=fetch}){let s;if(r&&t)try{let u=await U$({url:`${t}/api/design/rules?ffId=${encodeURIComponent(i)}&name=${encodeURIComponent(n)}${W$(o)}`,token:r,fetchImpl:a});if(u.design_system?.ff_id!==i)throw new Error("Rules response belongs to a different Design System.");if(!sy(u.selection,o))throw new Error("Rules response does not match the requested selection.");let d=G$(u.files);if(d)return{rules:d.rules,source:"server",selection:u.selection,revisions:cy(d.sources),payload:u};s="the server rules mirror has no rules.json (upgrade the SaaS)"}catch(u){s=u.message}else s=r?"no API URL":"not authenticated";let c=yc(pr.join(e,...Uu.split("/"),Cs));return c&&Array.isArray(c.rules)&&sy(c.selection,o)&&(!c.design_system?.ff_id||c.design_system.ff_id===i)?{rules:c.rules,source:"local-mirror",selection:c.selection||o,revisions:cy(c.sources),reason:`server unavailable (${s}); using ${Uu}/${Cs}`}:{rules:[],source:"none",selection:o,revisions:[],reason:`server unavailable (${s}) and no matching ${Uu}/${Cs}: run \`frontfriend design sync\``}}function zu(e){let t=Array.isArray(e?.adopt)?e.adopt:null;if(t)return t.includes("components")?"components":t.includes("tokens")?"tokens":"contracts-only"}async function uy(e){try{return await new u6().load({startDir:e,strict:!0,fresh:!0})}catch{return null}}var h6=e=>o6.createHash("sha256").update(e).digest("hex");function X$(e){let t=yc(pr.join(e,"package.json")),r=t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss,i=typeof r=="string"?/^[\^~>=<v\s]*(\d+)/.exec(r)?.[1]:void 0;return i?Number(i):null}function Q$({projectRoot:e,files:t,rules:r,selection:i,adoption:n,fileScope:o,engine:a,selectedFoundation:s,rulesAvailable:c=!0,ffId:u,areas:d,selectedLock:f}){let p=ly(a),y=Z$(e,p),h=s||qd(e),v=K$({projectRoot:e,ffId:u,foundation:h,lock:f,engine:p});return{report:p.checkCompliance({files:t,rules:r,rulesAvailable:c,componentLibraryPaths:F$(e).filter(g=>/(?:^|\/)(?:components\/)?ui\/.*\.(?:tsx|jsx|vue|svelte)$/.test(g)),vocabulary:h.vocabulary,iconLibrary:h.iconLibrary,componentControls:v.controls,overlayContent:v.overlayContent,selection:i,l2:y.l2,l2Path:y.path,fileScope:o,adoption:n,areas:d,theme:h.tokens?{...h.tokens,source:h.source==="server"?"selected foundation":Ld}:void 0,tailwindVersion:X$(e)}),guidelines:y,foundation:h,controls:v,brain:p}}function eR({guidelines:e,foundation:t,controls:r}){return{guidelines:e.present?e.path:null,foundation:t.present?t.source==="server"?"server":Ld:null,foundation_source:t.source||"local-mirror",...t.reason?{foundation_note:t.reason}:{},...t.selection_note?{foundation_selection:t.selection_note,token_release_id:t.release_id}:{},icon_library:t.iconLibrary,component_controls:{source:r.source,components:r.components,...r.release_id?{token_release_id:r.release_id}:{},...r.reason?{note:r.reason}:{}}}}var tR=e=>e.gate.manual;function g6({apiUrl:e,envToken:t,fetchImpl:r=fetch,engine:i,resolveToken:n=a6,resolveContext:o=s6}={}){async function a(){try{return await n({baseURL:e,envToken:t,silent:!0})}catch{return null}}async function s(y,h){if(!y||!e)return{stored:!1,reason:y?"no API URL configured":"not authenticated: run `frontfriend login`"};try{let v=await r(`${e}/api/design/compliance-reports`,{method:"POST",headers:{authorization:`Bearer ${y}`,"content-type":"application/json",accept:"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(6e4)}),_=await v.json().catch(()=>null);return v.ok?{stored:!0,report_id:_?.report_id,client_reported:!0}:{stored:!1,reason:_?.error||`HTTP ${v.status}`}}catch(v){return{stored:!1,reason:v.message}}}async function c({project_path:y,files:h,areas:v,attestations:_=[]}={}){let g=await o(y);if(g.status!=="ready")return{isError:!0,result:g};let $=fy(v),w=g.project_path,{files:m,skipped:O}=dy(w,h),P=Dd(w,g.ff_id),E=await a(),I=await Y$({projectRoot:w,apiUrl:e,token:E,ffId:g.ff_id,appName:g.app_name,selection:P.selection,fetchImpl:r}),D=await uy(w),z=await B$({projectRoot:w,apiUrl:e,ffId:g.ff_id,lock:P.lock,fetchImpl:r}),{report:N,guidelines:U,foundation:J,controls:W,brain:G}=Q$({projectRoot:w,files:m,rules:I.rules,rulesAvailable:I.source!=="none",selection:I.selection,adoption:zu(D),fileScope:"subset",selectedFoundation:z,selectedLock:P.lock,engine:i,ffId:g.ff_id,areas:$}),ae=Object.fromEntries(m.map(j=>[j.path,h6(j.content)])),fe=G.buildComplianceReportPayload({report:N,ffId:g.ff_id,app:g.app_name,selection:I.selection,digests:ae,rulesSource:{source:I.source,revisions:I.revisions,...I.reason?{reason:I.reason}:{}},attestations:_}),he=await s(E,fe),de=G.complianceGate(N,{attested:_.map(j=>j.rule_id)});return{isError:!1,result:{project_path:w,design_system:{ff_id:g.ff_id},app:g.app_name,selection:I.selection,selection_note:P.declared,rules_source:{source:I.source,rules:I.rules.length,revisions:I.revisions,...I.reason?{reason:I.reason}:{}},inputs:eR({guidelines:U,foundation:J,controls:W}),files:{requested:h.length,analysed:m.map(j=>j.path),skipped:O},...N,gate:de,unverified_requirements:tR({gate:de}),server:he,note:`Local result: snippets stay on this machine; the platform received paths, digests and outcomes only. Fix error findings before closing. unverified_requirements are the manual requirements (no automated check): they never fail the gate; declare the ones you honoured via attestations on check_compliance (or record_audit { acknowledged_rules }), the rest become borderline findings. Requirements whose checks could not establish them are in gate.reasons and keep the result NOT-VERIFIED; gate.reasonCode says why (partial-coverage: every cited check ran and found nothing but covers its requirement only partially, a clean result with partial coverage; not-executed: a cited check did not run) and gate.nextSteps lists what leads to a clean state. Pass compliance_report_id: server.report_id to record_audit (the inline compliance object, this whole result, is still accepted when the report was not stored). ${N.perimeter.note}`}}}let u=y=>({ok:!1,reason:`not attempted: ${y}`});async function d({project_path:y}={}){let h={config:null,auth:null,design_system:null,selection:null,first_read:null},v;try{v=await o(y)}catch(z){h.config={ok:!1,reason:z.message}}if(v?.status==="ambiguous"?h.config={ok:!1,reason:"Several apps found under this path: pass the app directory as project_path.",candidates:v.candidates}:v?.status==="needs_setup"?h.config={ok:!1,reason:"frontfriend.config.js is missing or has no ff-id: a copied config is not a connection. Connect a Design System first: run `frontfriend setup --ff-id <ff-id>` or setup_project.",project_path:v.project_path}:v&&(h.config={ok:!0,reason:"frontfriend.config.js declares ff-id and the App name.",project_path:v.project_path,ff_id:v.ff_id,app_name:v.app_name}),!h.config.ok){for(let z of["auth","design_system","selection","first_read"])h[z]=u("configuration missing");return p(h)}let _=v.project_path,g=null;try{g=await n({baseURL:e,envToken:t,silent:!0}),h.auth=g?{ok:!0,reason:"An access token was resolved from the stored credential.",api_url:e}:{ok:!1,reason:"No Frontfriend credentials found. Run `frontfriend login`."}}catch(z){h.auth={ok:!1,reason:`Credential refresh failed: ${z.message}. Run \`frontfriend login\`.`}}if(!h.auth.ok){for(let z of["design_system","selection","first_read"])h[z]=u("not authenticated");return p(h)}let $=null;try{$=Dd(_,v.ff_id)}catch(z){h.selection={ok:!1,reason:`frontfriend.lock.json is unreadable: ${z.message}`}}let w=await uy(_),m=z=>`${e}/api/design/rules?ffId=${encodeURIComponent(v.ff_id)}&name=${encodeURIComponent(v.app_name)}${W$(z)}`,O=async z=>{try{return{payload:await U$({url:m(z),token:g,fetchImpl:r})}}catch(N){return{error:N.message}}},P=await O($?$.selection:{view:"working"}),E=P.payload;if(P.payload)h.design_system={ok:!0,reason:"The server resolved the Design System and the App.",design_system:P.payload.design_system,app:P.payload.app,adoption_mode:zu(w)||"not configured"};else if($?.adopted){let z=await O({view:"working"});h.design_system=z.payload?{ok:!0,reason:"The server resolved the Design System and the App (working view used only for this step).",design_system:z.payload.design_system,app:z.payload.app,adoption_mode:zu(w)||"not configured"}:{ok:!1,reason:z.error}}else h.design_system={ok:!1,reason:P.error};if(h.selection||(h.design_system.ok?$.adopted?h.selection=P.payload&&P.payload.selection?.design_snapshot_id===$.selection.design_snapshot_id?{ok:!0,reason:$.declared,selection:P.payload.selection}:{ok:!1,reason:`The adopted design snapshot ${$.selection.design_snapshot_id} could not be resolved by the server (${P.error||"selection mismatch"}); it was not replaced by the working view.`,selection:$.selection}:h.selection={ok:!0,reason:$.declared,selection:{view:"working"},adopted_snapshot:null}:h.selection=u("Design System unresolved")),h.selection.ok||(E=null),!E)return h.first_read=u(h.selection.ok?"Design System unresolved":"selection unresolved"),p(h);let I=G$(E.files),D=I?.rules?.[0];return h.first_read=D?{ok:!0,reason:"A real read returned a rule with its provenance.",rule:{id:D.id,nature:D.nature,maturity:D.maturity,source:D.source},rules:I.rules.length}:{ok:!0,reason:I?"The read succeeded; this selection has no structured rules yet (declared: no rules yet).":"The read succeeded but the server mirror carries no rules.json (upgrade the SaaS); no rules could be read.",rule:null,rules:0},p(h)}async function f({project_path:y,verification:h}={}){let v=await d({project_path:y});if(!h)return v;try{if(typeof h.id!="string"||!h.id||h.id.length>200||typeof h.ff_id!="string"||!h.ff_id||h.ff_id.length>200)throw new Error("Invalid verification attempt. Start again in the browser.");let _=await n({baseURL:e,envToken:t,silent:!0});if(!_)throw new Error("Sign in with frontfriend login, then repeat verification.");let g=await r(`${e.replace(/\/+$/,"")}/api/design-systems/${encodeURIComponent(h.ff_id)}/connections/${encodeURIComponent(h.id)}`,{method:"POST",headers:{authorization:`Bearer ${_}`,"content-type":"application/json"},body:JSON.stringify({ffId:v.outcomes.config.ff_id||null,appName:v.outcomes.config.app_name||null,outcomes:Object.fromEntries(Object.entries(v.outcomes).map(([w,m])=>[w,{ok:m.ok===!0,attempted:!m.reason?.startsWith("not attempted:")}]))})}),$=await g.json();if(!g.ok)throw new Error($.error||"Unable to report verification.");return{...v,verification:{reported:!0,status:$.status}}}catch(_){return{...v,verification:{reported:!1,error:_.message}}}}function p(y){let h=Object.values(y).every(v=>v?.ok);return{connected:h,outcomes:y,note:h?"Connected: configuration, credentials, Design System, selection and a real read all succeeded.":"Not connected: a copied configuration alone is never a connection. Fix the first failing outcome and run `frontfriend mcp doctor` again."}}return{checkCompliance:c,connectionStatus:f}}async function y6({projectRoot:e,patterns:t=["**/*.{ts,tsx,js,jsx,vue,svelte,css,scss,less,mdx,html,htm}"],areas:r,engine:i,fileScope:n="subset"}){let o=fy(r),a=J$(e,t);if(!a.length)throw new Error(`No files match: ${t.join(" ")}`);let{files:s,skipped:c}=dy(e,a),u=yc(pr.join(e,...Uu.split("/"),Cs)),d=u&&Array.isArray(u.rules)?u.rules:[],f=u&&Array.isArray(u.rules)?{source:"local-mirror",rules:d.length,revisions:cy(u.sources)}:{source:"none",rules:0,revisions:[],reason:`no ${Uu}/${Cs}: run \`frontfriend design sync\``},p={view:"working"},y,h;try{let O=Dd(e,u?.design_system?.ff_id);p=O.selection,y=O.lock,h=O.declared}catch(O){throw new Error(`Cannot resolve the selected snapshot: ${O.message}`)}if(u&&!sy(u.selection,p))throw new Error("Local rules do not match the selected snapshot. Run `frontfriend design sync`.");let v=await uy(e);if(u?.design_system?.ff_id&&v?.["ff-id"]&&u.design_system.ff_id!==v["ff-id"])throw new Error("Local rules belong to a different Design System. Run `frontfriend design sync`.");let _=u?.design_system?.ff_id||v?.["ff-id"],{report:g,guidelines:$,foundation:w,controls:m}=Q$({projectRoot:e,files:s,rules:d,rulesAvailable:f.source!=="none",selection:p,adoption:zu(v),fileScope:n,engine:i,ffId:_,areas:o,selectedLock:y});return{...g,selection:p,selection_note:h,rules_source:f,inputs:eR({guidelines:$,foundation:w,controls:m}),files:{requested:a.length,analysed:s.map(O=>O.path),skipped:c},unverified_requirements:tR(g)}}rR.exports={DESIGN_GUIDELINES_PATH:xd,FOUNDATION_PATH:Ld,RULES_JSON:Cs,createComplianceBridge:g6,runLocalCheck:y6,resolveProjectFiles:dy,expandGlobs:J$,globToRegExp:V$,loadLocalGuidelines:Z$,loadFoundationVocabulary:qd,loadSelectedFoundation:B$,loadComponentControls:K$,normalizeAreas:fy,loadRules:Y$,readSelection:Dd,adoptionMode:zu,projectTailwindVersion:X$}});var Vd=te(zd=>{var v6=Object.create,Ud=Object.defineProperty,_6=Object.getOwnPropertyDescriptor,b6=Object.getOwnPropertyNames,S6=Object.getPrototypeOf,w6=Object.prototype.hasOwnProperty,$6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),R6=(e,t)=>{let r={};for(var i in e)Ud(r,i,{get:e[i],enumerable:!0});return t&&Ud(r,Symbol.toStringTag,{value:"Module"}),r},E6=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=b6(t),o=0,a=n.length,s;o<a;o++)s=n[o],!w6.call(e,s)&&s!==r&&Ud(e,s,{get:(c=>t[c]).bind(null,s),enumerable:!(i=_6(t,s))||i.enumerable});return e},P6=(e,t,r)=>(r=e!=null?v6(S6(e)):{},E6(t||!e||!e.__esModule?Ud(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(zd,"__commonJSMin",{enumerable:!0,get:function(){return $6}});Object.defineProperty(zd,"__exportAll",{enumerable:!0,get:function(){return R6}});Object.defineProperty(zd,"__toESM",{enumerable:!0,get:function(){return P6}})});var my=te(py=>{var O6=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),iR=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),I6=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),C6=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function T6(e){return typeof e=="string"&&iR.has(e.replace(/#$/,""))}function k6(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(O6.has(r))return"2020-12";if(iR.has(r))return"2019-09";if(I6.has(r)||C6.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}Object.defineProperty(py,"declaredDialect",{enumerable:!0,get:function(){return k6}});Object.defineProperty(py,"declares2019Dialect",{enumerable:!0,get:function(){return T6}})});var ze=te(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.CONSTANT_CATCH=Ae.Class=Ae.BIGINT_FORMAT_RANGES=Ae.NUMBER_FORMAT_RANGES=Ae.primitiveTypes=Ae.propertyKeyTypes=Ae.getParsedType=Ae.allowsEval=Ae.captureStackTrace=void 0;Ae.assertEqual=A6;Ae.assertNotEqual=N6;Ae.toZod=M6;Ae.assertIs=x6;Ae.assertNever=q6;Ae.assert=D6;Ae.getEnumValues=L6;Ae.joinValues=U6;Ae.jsonStringifyReplacer=z6;Ae.cached=aR;Ae.nullish=V6;Ae.cleanRegex=F6;Ae.floatSafeRemainder=J6;Ae.defineLazy=Z6;Ae.objectClone=H6;Ae.assignProp=Fa;Ae.mergeDefs=Ja;Ae.cloneDef=B6;Ae.getElementAtPath=K6;Ae.promiseAllObject=W6;Ae.randomString=G6;Ae.esc=Y6;Ae.slugify=X6;Ae.isObject=gy;Ae.isPlainObject=Jd;Ae.shallowClone=Q6;Ae.numKeys=eV;Ae.escapeRegex=rV;Ae.clone=is;Ae.normalizeParams=nV;Ae.createTransparentProxy=iV;Ae.stringifyPrimitive=sR;Ae.optionalKeys=oV;Ae.pick=aV;Ae.omit=sV;Ae.extend=cV;Ae.safeExtend=uV;Ae.merge=lV;Ae.partial=dV;Ae.required=fV;Ae.aborted=pV;Ae.explicitlyAborted=mV;Ae.prefixIssues=hV;Ae.unwrapMessage=vc;Ae.attachSchema=gV;Ae.finalizeIssue=yV;Ae.getSizableOrigin=vV;Ae.codePointLength=bV;Ae.getLengthableOrigin=SV;Ae.parsedType=wV;Ae.issue=$V;Ae.cleanEnum=RV;Ae.base64ToUint8Array=cR;Ae.uint8ArrayToBase64=uR;Ae.base64urlToUint8Array=EV;Ae.uint8ArrayToBase64url=PV;Ae.hexToUint8Array=OV;Ae.uint8ArrayToHex=IV;Ae.members=CV;Ae.own=Fd;Ae.hide=TV;Ae.defineLazyInternal=NV;Ae.installLazyProp=MV;Ae.constantCatch=xV;var j6=os();function A6(e){return e}function N6(e){return e}function M6(){return e=>e}function x6(e){}function q6(e){throw new Error("Unexpected value in exhaustive check")}function D6(e){}function L6(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function U6(e,t="|"){return e.map(r=>sR(r)).join(t)}function z6(e,t){return typeof t=="bigint"?t.toString():t}function aR(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function V6(e){return e==null}function F6(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function J6(e,t){let r=e/t,i=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var oR=Symbol("evaluating");function Z6(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==oR)return i===void 0&&(i=oR,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function H6(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fa(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ja(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function B6(e){return Ja(e._zod.def)}function K6(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function W6(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function G6(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function Y6(e){return JSON.stringify(e)}function X6(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}Ae.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Ae.allowsEval=aR(()=>{if(j6.globalConfig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Jd(e){if(gy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gy(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Q6(e){return Jd(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function eV(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var tV=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};Ae.getParsedType=tV;Ae.propertyKeyTypes=new Set(["string","number","symbol"]);Ae.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rV(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function is(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function nV(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function iV(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function sR(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function oV(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}Ae.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Ae.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function aV(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Ja(e._zod.def,{get shape(){let a={};for(let s of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,s))throw new Error(`Unrecognized key: "${String(s)}"`);t[s]&&Fa(a,s,r.shape[s])}return Fa(this,"shape",a),a},checks:[]});return is(e,o)}function sV(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Ja(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,s))throw new Error(`Unrecognized key: "${String(s)}"`);t[s]&&delete a[s]}return Fa(this,"shape",a),a},checks:[]});return is(e,o)}function cV(e,t){if(!Jd(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ja(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Fa(this,"shape",o),o}});return is(e,n)}function uV(e,t){if(!Jd(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ja(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Fa(this,"shape",i),i}});return is(e,r)}function lV(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ja(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Fa(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return is(e,r)}function dV(e,t,r,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let s=Ja(t._zod.def,{get shape(){let c=t._zod.def.shape,u={...c};if(r)for(let d of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(c,d))throw new Error(`Unrecognized key: "${String(d)}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:c[d]}):c[d])}else for(let d of Reflect.ownKeys(c))u[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return Fa(this,"shape",u),u},checks:[]});return is(t,s)}function fV(e,t,r){let i=Ja(t._zod.def,{get shape(){let n=t._zod.def.shape,o={...n};if(r)for(let a of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(o,a))throw new Error(`Unrecognized key: "${String(a)}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a of Reflect.ownKeys(n))o[a]=new e({type:"nonoptional",innerType:n[a]});return Fa(this,"shape",o),o}});return is(t,i)}function pV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function mV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function hV(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function vc(e){return typeof e=="string"?e:e?.message}function gV(e,t,r){var i;for(let n=t;n<e.length;n++)(i=e[n]).schema??(i.schema=r)}function yV(e,t,r){var i;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:vc(e.inst?._zod.def?.error?.(e))??vc(o?.(e))??vc(t?.error?.(e))??vc(r.customError?.(e))??vc(r.localeError?.(e))??"Invalid input",{inst:s,schema:c,continue:u,input:d,...f}=e;return f.path??(f.path=[]),f.message=a,t?.reportInput&&(f.input=d),f}function vV(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var _V=/[\uD800-\uDBFF]/;function bV(e){let t=e.length;if(!_V.test(e))return t;let r=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(r--,i++);return r}function SV(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wV(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $V(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function RV(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function cR(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function uR(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function EV(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return cR(t+r)}function PV(e){return uR(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function OV(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function IV(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var yy=class{constructor(...t){}};Ae.Class=yy;function CV(e,t){for(let r in t){let i=Object.getOwnPropertyDescriptor(t,r);i.get?Object.defineProperty(e,r,{...i,enumerable:!1}):kV(e,r,i.value)}}function Fd(e,t,r,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:r}),r}function TV(e,t,r){return Fd(e,t,r,!1)}function kV(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Fd(this,t,r.bind(this))},set(i){Fd(this,t,i)}})}function jV(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var hy,ns=!1,AV={configurable:!0,get(){ns=!0}};function NV(e,t,r){let i=Object.getPrototypeOf(e._zod);if(t in i&&hy!==e._zod){hy=void 0;return}hy=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,AV);let n=ns;ns=!1;try{let o=r(this);return ns?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),ns=ns||n,o}catch(o){throw delete this[t],ns=ns||n,o}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function MV(e,t,r,i){let n=jV(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}Ae.CONSTANT_CATCH="~constantCatch";function xV(e){let t=()=>e;return t[Ae.CONSTANT_CATCH]=!0,t}});var os=te(_n=>{"use strict";var lR;Object.defineProperty(_n,"__esModule",{value:!0});_n.globalConfig=_n.$ZodEncodeError=_n.$ZodAsyncError=_n.$brand=_n.NEVER=void 0;_n.$constructor=LV;_n.config=UV;var qV=ze();_n.NEVER=Object.freeze({status:"aborted"});var vy={value:void 0,enumerable:!1},dR="captureStackTrace"in Error?Error:null;function DV(e){let t=dR;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return dR=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function LV(e,t,r,i){let n={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=n;let a=r,s=a&&new WeakSet;function c(p,y){if(!p._zod){vy.value=new o(y);try{Object.defineProperty(p,"_zod",vy)}finally{vy.value=void 0}}if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,y),s){let v=Object.getPrototypeOf(p),_=p._zod.constr.prototype,g=v;for(;g&&g!==_;)g=Object.getPrototypeOf(g);let $=g??v;s.has($)||(s.add($),(0,qV.members)($,a))}let h=f.prototype;for(let v in h)Object.prototype.hasOwnProperty.call(h,v)&&(v in p||(p[v]=h[v].bind(p)))}let u=i?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function f(p){let y=i?.Parent?DV(d):this;c(y,p);let h=y._zod.deferred;if(h){for(let _ of h)_();y._zod.deferred=void 0}let v=globalThis.__zod_globalConfig?.postProcessor;return v&&v(y),y}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>i?.Parent&&p instanceof i.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}_n.$brand=Symbol("zod_brand");var _y=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};_n.$ZodAsyncError=_y;var by=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};_n.$ZodEncodeError=by;(lR=globalThis).__zod_globalConfig??(lR.__zod_globalConfig={});_n.globalConfig=globalThis.__zod_globalConfig;function UV(e){return e&&Object.assign(_n.globalConfig,e),_n.globalConfig}});var $y=te(ln=>{"use strict";var zV=ln&&ln.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),VV=ln&&ln.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),FV=ln&&ln.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zV(t,e,r);return VV(t,e),t};Object.defineProperty(ln,"__esModule",{value:!0});ln.$ZodRealError=ln.$ZodError=void 0;ln.flattenError=WV;ln.formatError=GV;ln.treeifyError=YV;ln.toDotPath=hR;ln.prettifyError=XV;var pR=os(),JV=FV(ze());function ZV(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,JV.jsonStringifyReplacer,2)),e.message}function HV(e){this._zod.message=e}var BV={get:ZV,set:HV,enumerable:!0,configurable:!0},Sy={value:void 0,enumerable:!1},wy={value:void 0,enumerable:!1},fR=new WeakSet([Object.prototype,Error.prototype]),mR=(e,t)=>{e.name="$ZodError",Sy.value=e._zod,Object.defineProperty(e,"_zod",Sy),wy.value=t,Object.defineProperty(e,"issues",wy),Sy.value=void 0,wy.value=void 0,Object.defineProperty(e,"message",BV);let r=Object.getPrototypeOf(e);fR.has(r)||(fR.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))};ln.$ZodError=(0,pR.$constructor)("$ZodError",mR);ln.$ZodRealError=(0,pR.$constructor)("$ZodError",mR,void 0,{Parent:Error});function KV(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function WV(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?KV(r,n.path[0],()=>[]).push(t(n)):i.push(t(n));return{formErrors:i,fieldErrors:r}}function GV(e,t=r=>r.message){let r={_errors:[]},i=(n,o=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)r._errors.push(t(a));else{let c=r,u=0;for(;u<s.length;){let d=s[u],f=u===s.length-1;if(d==="_errors"){f&&c._errors.push(t(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,d)||Object.defineProperty(c,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[d];f&&p._errors.push(t(a)),c=p,u++}}}};return i(e),r}function YV(e,t=r=>r.message){let r={errors:[]},i=(n,o=[])=>{var a;for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>i({issues:c},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let c=[...o,...s.path];if(c.length===0){r.errors.push(t(s));continue}let u=r,d=0;for(;d<c.length;){let f=c[d],p=d===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(a=u.items)[f]??(a[f]={errors:[]}),u=u.items[f]),p&&u.errors.push(t(s)),d++}}};return i(e),r}function hR(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function XV(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${hR(i.path)}`);return t.join(`
|
|
37
|
+
`).length})}};for(let s=0;s<t.length;s++){let c=t[s];c==="{"?(i.push(t.slice(n,s).trim()),n=s+1):c===";"?(a(s),n=s+1):c==="}"&&(a(s),i.pop(),n=s+1)}return r}function M4(e){let t=[];return e.split(/\r?\n/).forEach((r,i)=>{let n=/^\s*\|\s*`?(--[a-z0-9-]+)`?\s*\|(.*)$/i.exec(r);if(n){let o=n[2].split("|").map(a=>a.replace(/`/g,"").trim()).filter(a=>ty(a)||/^var\(/.test(a));o.length&&t.push({name:n[1].toLowerCase(),light:o[0],...o[1]?{dark:o[1]}:{},line:i+1});return}for(let o of r.matchAll(/(--[a-z0-9-]+)\s*:\s*([^;\n|`]+)/gi)){let a=o[2].trim();(ty(a)||/^var\(/i.test(a))&&t.push({name:o[1].toLowerCase(),light:a,line:i+1})}}),t}function D4(e){let t=[];return e.split(/\r?\n/).forEach((r,i)=>{for(let n of r.replace(/`/g,"").matchAll(q4))t.push({fg:n[1].toLowerCase(),bg:n[3].toLowerCase(),...n[2]?{fgValue:n[2]}:{},...n[4]?{bgValue:n[4]}:{},line:i+1})}),t}function E$(e,t,r){return(t==="dark"?e.dark.get(r):void 0)??e.light.get(r)??e.theme.get(r)}function Nd(e,t,r,i=0){if(i>8)return null;if(!/var\(/i.test(r))return r;let n=/var\(\s*(--[A-Za-z0-9_-]+)\s*(?:,\s*([^()]*(?:\([^()]*\))?[^()]*))?\)/i.exec(r);if(!n)return null;let o=E$(e,t,n[1]),a=o?Nd(e,t,o.value,i+1):n[2]?Nd(e,t,n[2].trim(),i+1):null;return a===null?null:Nd(e,t,r.replace(n[0],a),i+1)}function Is(e,t,r){let i=E$(e,t,r);if(!i)return null;let n=Nd(e,t,i.value),o=n?ty(n):null;return o&&n?{color:o,entry:i,value:n}:null}function P$(e,t,r,i){for(let n of[`--color-${i}`,`--${i}`,`--${r}-${i}`]){let o=Is(e,t,n);if(o)return o.color}return Lu[i]?{...Lu[i]}:null}function Gg(e,t){let r=Is(e,t,"--background")?.color??P$(e,t,"bg","background");return r&&r.alpha===1?r:t==="light"?{...Lu.white}:null}function Yg(e,t,r){let i=t.alpha<1?r?y$(t,r):null:t;return!i||i.alpha<1?null:{fg:e.alpha<1?y$(e,i):e,bg:i}}function L4(e){let t=new Set([...e.light.keys(),...e.dark.keys()]),r=[];for(let n of t){let o=/^(--.*?)-?foreground$/.exec(n)?.[1];if(o===void 0)continue;let a=o==="--"?"--background":o;t.has(a)&&r.push([n,a])}for(let n of["--background","--card","--popover"])r.push(["--muted-foreground",n],["--destructive",n]);let i=new Set;return r.filter(([n,o])=>{let a=`${n}|${o}`;return!t.has(n)||!t.has(o)||i.has(a)?!1:(i.add(a),!0)})}function z4(e){let t={"":{bg:[],text:[]},dark:{bg:[],text:[]}};for(let r of e.split(/\s+/)){let i=r.replace(/^!|!$/g,"").split(":"),n=i.pop()??"",o=i.join(":");if(o!==""&&o!=="dark")continue;let a=O$.exec(n);a&&t[o][a[1]].push(n)}return t}function Ad(e,t,r){for(let i of[...r].reverse()){let n=V4(e,t,i);if(n)return{utility:i,color:n}}return null}function V4(e,t,r){let i=O$.exec(r);if(!i)return null;let n=P$(e,t,i[1],i[2]);return n?i[3]?{...n,alpha:n.alpha*(Math.min(100,Number(i[3]))/100)}:n:null}function F4(e,t){if(typeof e.tailwindVersion=="number")return e.tailwindVersion>=4;let r=e.theme;return r&&[r.light,r.dark,r.theme].some(i=>i&&Object.keys(i).length>0)?!0:t.some(i=>/@import\s+["']tailwindcss|@theme\b|@tailwindcss\//.test(i))}function Du(e,t,r,i=6,n={}){let{fileFilter:o=null,reject:a=null}=n,s=new RegExp(r.source,r.flags.includes("g")?r.flags:r.flags+"g"),c=[],u=0;for(let d of t){if(o&&!o(d))continue;let f=e(d).split(/\r?\n/);for(let p=0;p<f.length;p++){let y=f[p]??"";if(a&&a.test(y))continue;let h=y.match(s);h&&(u+=h.length,c.length<i&&c.push({file:d,line:p+1,snippet:y.trim().slice(0,120)}))}}return{total:u,evidence:c}}function I$({files:e,l2:t,l2Path:r="design-guidelines.md",strict:i=!1,staticContext:n,theme:o,tailwindVersion:a}){let s=[],c=(ae,fe,he,de=[],j=0)=>{s.push({id:ae,status:fe,message:he,evidence:de,count:j})},u=new Map;for(let[ae,fe]of Object.entries(e))u.set(ae.replace(/\\/g,"/"),fe);let d=[...u.keys()].filter(ae=>!ae.split("/").some(fe=>w4.has(fe))&&S4.has(O4(ae).toLowerCase())),f=ae=>u.get(ae)??"";if(d.length===0)return c("target","warn","No source files found in the provided tree. Nothing to verify."),b$(s,i);let p=I4(t),y=ae=>!$4.test(m$(ae)),h=d.filter(ae=>/\.(tsx|jsx|vue|svelte|html?)$/.test(ae)),v=d.filter(ae=>R4.test(ae)&&/\.(tsx|jsx|vue|svelte)$/.test(ae)),_=d.filter(ae=>/\.(css|scss|less)$/i.test(ae)),g=/(?:^|\/)(?:components\/)?ui\//i,$=A4();for(let ae of p.present?M4(p.raw):[])$.light.set(ae.name,{value:ae.light,file:r,line:ae.line}),ae.dark&&$.dark.set(ae.name,{value:ae.dark,file:r,line:ae.line});let w=p.present?D4(p.raw):[];for(let ae of w)for(let[fe,he]of[[ae.fg,ae.fgValue],[ae.bg,ae.bgValue]])he&&!$.light.has(fe)&&$.light.set(fe,{value:he,file:r,line:ae.line});let m=o?.source??"foundation";for(let ae of["light","dark","theme"])for(let[fe,he]of Object.entries(o?.[ae]??{}))typeof he=="string"&&$[ae].set(fe,{value:he,file:m,line:0});for(let ae of _)for(let fe of N4(f(ae)))$[fe.scope].set(fe.name,{value:fe.value,file:ae,line:fe.line});let O=Du(f,d,/(#[0-9a-fA-F]{3,8}\b|\brgba?\(|\bhsla?\(|\b(?:oklch|oklab|lab|lch|hwb)\(|\bcolor\(\s*(?:srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65)\b)/,6,{fileFilter:ae=>y(ae)&&!/\/icons?\//i.test(ae)&&!/icon/i.test(m$(ae)),reject:/(fill|stroke)\s*=|<path|<svg|\sd=|points=|viewBox|gradient/i});O.total>0?c("raw-color-literals","warn",`${O.total} raw color literals (hex/rgb/hsl/oklch/oklab/lab/lch/color()) outside theme files: likely bypassing the design-system tokens. Use the semantic tokens.`,O.evidence,O.total):c("raw-color-literals","pass","No raw colors outside theme files.");let P=Du(f,h,/(?:padding|margin|gap)\s*:\s*['"]?[1-9]\d{0,3}px/i,6,{fileFilter:y,reject:/\b0px|max-width|min-width|@media|transition|animation|calc\(/i});P.total>0?c("raw-spacing","warn",`${P.total} hardcoded px spacing/measure values in styles: verify they follow the system scale, not arbitrary values.`,P.evidence,P.total):c("raw-spacing","pass","No suspicious hardcoded px spacing.");let E=I();function I(){if(p.spacingScale&&p.spacingScale.length>0&&p.scaleUnit==="px")return p;let ae=$.theme.get("--spacing")??$.light.get("--spacing"),fe=R$(ae?.value);return fe&&ae?ey(fe,`Tailwind --spacing: ${Qg(fe)} (${ae.file})`):F4({tailwindVersion:a,theme:o},_.map(f))?ey(T4,"Tailwind v4 default --spacing: 0.25rem = 4px"):null}if(E?.spacingScale){let ae=new Set(E.spacingScale),fe=K=>ae.has(Number(K.toFixed(3))),he=[],de=0,j=(K,C,M)=>{de++,he.length<6&&he.push({file:K,line:C+1,snippet:M.trim().slice(0,120)})};for(let K of h){if(!y(K))continue;let C=f(K).split(/\r?\n/),M=g.test(K);for(let L=0;L<C.length;L++){let oe=C[L]??"";if(!/max-width|min-width|@media|transition|animation|calc\(/i.test(oe))for(let ue of oe.matchAll(/(?:padding|margin|gap)[a-z-]*\s*:\s*([^;}]+)/gi))for(let pe of(ue[1]??"").matchAll(/\b([1-9]\d{0,3})px/g))fe(Number(pe[1]))||j(K,L,oe);if(!M){for(let ue of oe.matchAll(/(?:^|[\s"'`:])-?(?:[pm][xytrblse]?|gap(?:-[xy])?|space-[xy])-\[([0-9]*\.?[0-9]+)(px|rem)\]/g)){let pe=Number(ue[1])*(ue[2]==="rem"?16:1);pe>0&&!fe(pe)&&j(K,L,oe)}if(E.scaleStep)for(let ue of oe.matchAll(/(?:^|[\s"'`:])-?(?:[pm][xytrblse]?|gap(?:-[xy])?|space-[xy])-([0-9]+\.[0-9]+)(?=[\s"'`]|$)/g))k4(Number(ue[1]))||j(K,L,oe)}}}let V=E.scaleStep?`${E.scaleSource}: whole multiples of ${Qg(E.scaleStep)}, the 0.5/1.5/2.5/3.5 steps and 1px`:`${E.scaleSource}: ${E.spacingScale.join("\xB7")}px`;de>0?c("off-scale-spacing","warn",`C2: ${de} spacing values outside the declared scale (${V}). Eyeballed values (e.g. 13px, 7px) = a missing system decision.`,he,de):c("off-scale-spacing","pass",`C2: spacing consistent with the declared scale (${V}).`)}{let ae=[],fe=new Set,he=0,de=(C,M,L)=>{fe.has(C)||(fe.add(C),he++,L<4.5&&ae.push(M))},j=$.light.size+$.dark.size+$.theme.size>0,V=$.dark.size>0?Xg:["light"];if(j)for(let C of h){if(!y(C))continue;let M=f(C).split(/\r?\n/);for(let L=0;L<M.length;L++)for(let oe of(M[L]??"").matchAll(U4)){let ue=z4(oe[2]??"");if(!(!ue[""].bg.length||!ue[""].text.length))for(let pe of V){let me=(pe==="dark"?Ad($,pe,ue.dark.bg):null)??Ad($,pe,ue[""].bg),De=(pe==="dark"?Ad($,pe,ue.dark.text):null)??Ad($,pe,ue[""].text),vt=me&&De?Yg(De.color,me.color,Gg($,pe)):null;if(!me||!De||!vt)continue;let x=jd(vt.fg,vt.bg);de(`${C}:${L}:${pe}:${De.utility}|${me.utility}`,{file:C,line:L+1,snippet:`${De.utility} on ${me.utility} (${pe}) = ${x.toFixed(2)}:1`},x)}}}for(let C of w)for(let M of Xg){if(M==="dark"&&!$.dark.has(C.fg)&&!$.dark.has(C.bg))continue;let L=Is($,M,C.fg),oe=Is($,M,C.bg),ue=L&&oe?Yg(L.color,oe.color,Gg($,M)):null;if(!L||!oe||!ue)continue;let pe=jd(ue.fg,ue.bg);de(`token:${M}:${C.fg}|${C.bg}`,{file:r,line:C.line,snippet:`${C.fg} (${L.value}) on ${C.bg} (${oe.value}) (${M}) = ${pe.toFixed(2)}:1`},pe)}let K=L4($);for(let[C,M]of K)for(let L of Xg){if(L==="dark"&&!$.dark.has(C)&&!$.dark.has(M))continue;let oe=Is($,L,C),ue=Is($,L,M),pe=oe&&ue?Yg(oe.color,ue.color,Gg($,L)):null;if(!oe||!ue||!pe)continue;let me=jd(pe.fg,pe.bg);de(`token:${L}:${C}|${M}`,{file:oe.entry.file,line:oe.entry.line,snippet:`${C} (${oe.value}) on ${M} (${ue.value}) (${L}) = ${me.toFixed(2)}:1`},me)}if(!K.length&&!w.length&&p.present){let C=/(text|foreground|\bfg\b|ink|content|label|heading|body|muted)/,M=/(surface|background|\bbg\b|base|canvas|paper|card|panel)/,L=[...$.light].filter(([,pe])=>pe.file===r).map(([pe])=>({name:pe,hit:Is($,"light",pe)})).filter(pe=>!!pe.hit&&pe.hit.color.alpha===1),oe=L.filter(pe=>C.test(pe.name)),ue=L.filter(pe=>M.test(pe.name));for(let pe of oe)for(let me of ue){if(pe.name===me.name||pe.hit.value.toLowerCase()===me.hit.value.toLowerCase())continue;let De=jd(pe.hit.color,me.hit.color);de(`l2:${pe.name}|${me.name}`,{file:r,line:0,snippet:`${pe.name} (${pe.hit.value}) on ${me.name} (${me.hit.value}) = ${De.toFixed(2)}:1`},De)}}ae.length>0?c("contrast-tokens","warn",`B2: ${ae.length} of ${he} text/surface colour pairs below WCAG AA 4.5:1 (class lists that paint text on a background, conventional foreground/background tokens, light and dark). Large text needs only 3:1: check the size where the pair is used.`,ae.slice(0,6),ae.length):he>0&&c("contrast-tokens","pass",`B2: ${he} text/surface colour pairs \u2265 4.5:1.`)}let D=Du(f,h,E4,6);D.total>0?c("app-shell","pass",`Shell/navigation detected (${D.total} references).`,D.evidence,D.total):v.length>0?c("app-shell","fail",`Detected ${v.length} app pages but NO navigation/shell component (Nav/Sidebar/Layout/Menu\u2026). A B2B app always has shell + nav.`,[],v.length):c("app-shell","warn","No shell/nav detected and no clear app pages: verify manually whether one is needed.");let z=Du(f,h,P4,6);if(z.total>0?c("data-states","pass",`Data-state handling detected (${z.total} references to loading/empty/error).`,z.evidence,z.total):c("data-states","warn",'No sign of data states (empty/loading/error). Screens must not "exist only when full".'),h.length>=2){let ae=[/\b(?:export\s+)?(?:default\s+)?function\s+([A-Z][A-Za-z0-9]*)\s*\(/g,/\b(?:export\s+)?const\s+([A-Z][A-Za-z0-9]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z0-9_$]+)\s*=>/g,/\b(?:export\s+)?const\s+([A-Z][A-Za-z0-9]*)\s*=\s*function\b/g,/\bclass\s+([A-Z][A-Za-z0-9]*)\b/g],fe=new Map;for(let de of h){let j=f(de).split(/\r?\n/);for(let V=0;V<j.length;V++)for(let K of ae){K.lastIndex=0;let C;for(;C=K.exec(j[V]??"");){let M=C[1];if(!M)continue;let L=fe.get(M)??new Map;L.has(de)||L.set(de,V+1),fe.set(M,L)}}}let he=[...fe.entries()].filter(([,de])=>de.size>=2);if(he.length>0){let de=[];for(let[j,V]of he)for(let[K,C]of V)de.length<6&&de.push({file:K,line:C,snippet:`${j} redefined here (also in other files)`});c("duplicate-components","warn",`${he.length} components defined in MULTIPLE files (${he.map(([j])=>j).slice(0,8).join(", ")}): "repeated pattern = single source" (\xA78.6/\xA78.7) \u2014 extract them into ONE shared component instead of duplicating per page.`,de,he.length)}else c("duplicate-components","pass","No components duplicated across files (repeated pattern = single source).")}let N=p.present?(p.raw.match(/design\s*system[^:\n]*:\s*([^\n|]+)/i)||[])[1]:null,U=N?N.replace(/^[\s*_`]+|[\s*_`]+$/g,"").trim():null,J=!!(U&&!/^(none|no\b|—|-|n\/a|\{)/i.test(U)),W=/\/(components\/)?ui\//i,G=[...d,...n?.componentLibraryPaths??[]].some(ae=>W.test(ae));if(J||G){let ae=Du(f,h,/<(button|input|select|table|textarea|dialog)\b/,6,{fileFilter:he=>!W.test(he)&&y(he)&&/\.(tsx|jsx|vue|svelte)$/.test(he),reject:/type=["']hidden["']/i}),fe=J&&U?U.slice(0,60):"the project's ui/ library";ae.total>0?c("component-usage","warn",`${ae.total} raw interactive elements (<button>/<input>/<select>/<table>\u2026) outside the ui/ library: the project has a design system (${fe}) \u2014 use ITS components, not the bare elements.`,ae.evidence,ae.total):c("component-usage","pass",`No raw interactive elements outside the ui/ library (DS: ${fe}).`)}if(p.present&&p.tokenNames.length>0){let ae=0,fe=p.tokenNames.slice(0,60);e:for(let he of h){let de=f(he);for(let j of fe)if(de.includes(j)){ae++;break}if(ae>=3)break e}ae===0&&O.total>0?c("token-usage","warn",`The guidelines declare tokens (${p.tokenNames.length}) but none are found in the code and there are ${O.total} raw colors: the design system appears bypassed.`):c("token-usage","pass","The declared tokens are used in the code.")}else t!==void 0&&!p.present&&c("token-usage","warn",`L2 not readable at ${r}: token usage cannot be verified.`);if(n){let ae=Object.fromEntries(d.map(fe=>[fe,f(fe)]));s.push(...l$(ae,n),p$(ae,n.overlayContent))}return b$(s,i)}function b$(e,t){if(t)for(let o of e)o.status==="warn"&&["raw-color-literals","token-usage"].includes(o.id)&&(o.status="fail");let r=e.map(o=>{let a=S$[o.id]||{tell:null,dim:null};return{...o,tell:a.tell,dimension:a.dim}}),i=r.filter(o=>o.status==="fail"),n=r.filter(o=>o.status==="warn");return{tool:"ff-check",schema_version:"1.0",verification_level:"L1 (static/mechanical \u2014 no pixels)",pending:["visual craft verification (look, hierarchy, perceived consistency) \u2192 requires Pillar B (render+screenshot)"],summary:{fail:i.length,warn:n.length,pass:r.filter(o=>o.status==="pass").length},checks:r}}var S4,w4,$4,R4,E4,P4,S$,O4,m$,T4,w$,$$,Qg,k4,vo,Kg,Wg,Lu,v$,ry,A4,x4,_$,q4,Xg,U4,O$,J4,ny=Ve(()=>{"use strict";Jg();Bg();S4=new Set([".ts",".tsx",".js",".jsx",".vue",".svelte",".css",".scss",".less",".mdx",".html",".htm"]),w4=new Set(["node_modules",".git","dist","build",".next",".nuxt","out","coverage",".turbo",".cache",".svelte-kit","storybook-static"]),$4=/(tokens?|theme|palette|colou?rs?|globals|variables|design-system|tailwind\.config|index\.css|app\.css)/i,R4=/(?:^|\/)(pages?|routes?|views?|screens?|app)\//i,E4=/\b(Nav(bar|igation)?|Sidebar|Shell|App\s?Layout|Layout|Menu|Topbar|Header|RootLayout)\b/,P4=/(isLoading|loading|isFetching|isError|hasError|error|empty|isEmpty|Skeleton|Spinner|EmptyState|no[-_ ]?data|placeholder)/i,S$={"semantic-vocabulary":{tell:null,dim:"token"},"component-override":{tell:null,dim:"token"},"icon-library":{tell:"E4",dim:"ui"},target:{tell:null,dim:"meta"},"raw-color-literals":{tell:null,dim:"token"},"raw-spacing":{tell:null,dim:"token"},"off-scale-spacing":{tell:"C2",dim:"ui"},"contrast-tokens":{tell:"B2",dim:"ui"},"app-shell":{tell:null,dim:"baseline"},"data-states":{tell:"F1",dim:"baseline"},"duplicate-components":{tell:"A10",dim:"ui"},"token-usage":{tell:null,dim:"token"},"component-usage":{tell:null,dim:"token"},"overlay-width":{tell:"G5",dim:"ui"}},O4=e=>/(\.[^./\\]+)$/.exec(e)?.[1]??"",m$=e=>e.split("/").pop()??e;T4=4,w$=[.5,1.5,2.5,3.5],$$=96,Qg=e=>`${Number(e.toFixed(3))}px`;k4=e=>e===0||Number.isInteger(e)&&e<=$$||w$.includes(e),vo=e=>e<0?0:e>1?1:e,Kg=e=>{let t=vo(e);return t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055},Wg=e=>e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4);Lu={white:{r:1,g:1,b:1,alpha:1},black:{r:0,g:0,b:0,alpha:1},transparent:{r:0,g:0,b:0,alpha:0}};v$=({r:e,g:t,b:r})=>.2126*Wg(e)+.7152*Wg(t)+.0722*Wg(r);ry=e=>[...new Set(e)].filter(t=>Number.isFinite(t)).sort((t,r)=>t-r),A4=()=>({light:new Map,dark:new Map,theme:new Map});x4=String.raw`#[0-9a-f]{3,8}\b|(?:oklch|oklab|hsla?|rgba?)\([^()]*\)`,_$=String.raw`(--[a-z0-9-]+)(?:\s*[:=]?\s*\(?\s*(${x4})\s*\)?)?`,q4=new RegExp(String.raw`${_$}\s+on\s+${_$}`,"gi");Xg=["light","dark"],U4=/(["'`])((?:(?!\1)[^\\]|\\.)*?)\1/g,O$=/^(bg|text)-([a-z][a-z0-9-]*?)(?:\/(\d{1,3}))?$/;J4=Object.keys(S$)});var za,Va,Yye,C$=Ve(()=>{"use strict";ny();za=["contracts-only","tokens","components"],Va={"icon-library":{id:"icon-library",version:"1.0",requiredInputs:["files","iconLibrary"],adoptionModes:["components"],analysedSubset:"Static imports of known icon packages compared with the declared icon family. SVG, wrappers, require and dynamic imports are outside coverage.",knownFalsePositives:"Unused static icon imports are still counted. Family identity does not verify icon weight or rendered appearance.",relatedRuleIds:["FF-BASE-03"],confidence:"high",needsWholeProject:!1},"component-override":{id:"component-override",version:"1.1",requiredInputs:["files","componentControls"],adoptionModes:["components"],analysedSubset:"Literal appearance classes on components imported from components/ui or Frontfriend packages, compared with the controls the selected Design System configures for that component (its component configuration: root, slots, variant and size classes). Layout classes are allowed. Without the controls, or for a component the Design System does not configure, appearance classes are undetermined and reported as a coverage gap.",knownFalsePositives:"A class the Design System configures for another variant of the same component is accepted as a control (choosing it through className instead of the variant prop is not detected); wrapper and namespace imports cannot be resolved and are reported as coverage gaps.",relatedRuleIds:["FF-BASE-02"],confidence:"high",needsWholeProject:!1},"overlay-width":{id:"overlay-width",version:"1.0",requiredInputs:["files","overlayContent"],adoptionModes:["components"],analysedSubset:"Literal w-*, min-w-* and max-w-* classes on elements written inside Design System overlay content (PopoverContent, DropdownMenuContent, DialogContent, SheetContent, SelectContent, TooltipContent) in the same file, compared with the overlay width of the selected component configuration merged with the classes passed to the overlay. A child that a flex row can shrink, a relative max width, or a scroll container declared inside the overlay is not an overflow. Runtime classes, width props, responsive widths and overlays whose width is relative or variable are coverage gaps; fixed widths inside other components rendered in the overlay are not followed. Sizes assume a 16px root font size.",knownFalsePositives:"A child hidden at runtime (display none, a closed branch) is still measured; an overlay width changed by a CSS rule outside the class attributes is not seen.",relatedRuleIds:["B2B-DEF-G5"],confidence:"high",needsWholeProject:!1},"semantic-vocabulary":{id:"semantic-vocabulary",version:"1.0",requiredInputs:["files","vocabulary"],adoptionModes:["components"],analysedSubset:"Literal class attributes in JSX, Vue, Svelte and HTML; visual utilities compared with the selected foundation. Runtime expressions and custom classes are coverage gaps.",knownFalsePositives:"Text resembling markup in strings can be counted; computed classes and bindings are not resolved.",relatedRuleIds:["FF-BASE-01"],confidence:"high",needsWholeProject:!1},target:{id:"target",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Presence of at least one source file (ts, tsx, js, jsx, vue, svelte, css, scss, less, mdx, html) outside ignored build folders.",knownFalsePositives:"None: it only reports an empty input.",confidence:"high",needsWholeProject:!1},"raw-color-literals":{id:"raw-color-literals",version:"1.1",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Colour literals in every source file except theme/token definition files and icon files: hex, rgb()/rgba(), hsl()/hsla() and the modern syntaxes oklch(), oklab(), lab(), lch(), hwb() and color(<space> \u2026); SVG attribute lines are skipped.",knownFalsePositives:"Literals inside comments, tests or data (a colour picker default, a chart palette) are counted like styling.",confidence:"high",needsWholeProject:!1},"raw-spacing":{id:"raw-spacing",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"padding/margin/gap declarations with a px value in component files (tsx, jsx, vue, svelte, html); 0px, media queries, transitions and calc() are skipped.",knownFalsePositives:"A px value that intentionally matches the scale (e.g. 16px where the token is 16px) is still reported: the check sees the literal, not the intent.",confidence:"high",needsWholeProject:!1},"off-scale-spacing":{id:"off-scale-spacing",version:"1.1",requiredInputs:["files","l2"],adoptionModes:za,analysedSubset:'px spacing declarations and arbitrary spacing utilities (p-[13px], gap-[0.8rem]) in component files, compared with one scale, in this order: the px scale declared in the guidelines (L2: --space* tokens, a Tailwind --spacing unit, "base-N" or a declared sequence); else the --spacing unit of the selected theme or the passed stylesheets; else the Tailwind default 0.25rem (4px) when the project is Tailwind v4. A Tailwind scale is the whole multiples of its unit, the 0.5/1.5/2.5/3.5 steps and 1px. rem values assume a 16px root font size. Without any scale the check does not run.',knownFalsePositives:"A scale derived from a prose sequence may miss steps; a root font size other than 16px shifts every rem conversion; an intentional off-grid value (an optical adjustment) is reported like an eyeballed one.",confidence:"medium",needsWholeProject:!1},"contrast-tokens":{id:"contrast-tokens",version:"1.2",requiredInputs:["l2"],adoptionModes:za,analysedSubset:'WCAG AA (4.5:1) contrast, light and dark, of colour tokens from the guidelines (L2), the selected theme and the passed stylesheets (:root, .dark, @theme), in hex, rgb(), hsl(), bare H S% L%, oklch() or oklab() with var() references resolved. Pairs: those the guidelines declare as "<text token> [colour] on <surface token> [colour]" (e.g. --text-neutral-mid #11150A on --layer-below #FFFFFF; a pair without colours reads them from the theme); bg-/text- utilities in the same class string (including dark: variants; a /NN opacity is composited over the page background), and the convention pairs --x-foreground on --x, --foreground on --background, and --muted-foreground and --destructive on --background, --card and --popover.',knownFalsePositives:"A convention pair that never meets on screen is reported like a real pair; a bg-/text- pair in one class string may be painted on different elements; colours outside sRGB are clipped, and color-mix(), relative colours, lab()/lch() and color() values are not evaluated.",confidence:"medium",needsWholeProject:!1},"app-shell":{id:"app-shell",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Identifiers that look like a shell (Nav, Sidebar, Layout, Menu, Header\u2026) anywhere in component files, versus files under pages/, routes/, views/, screens/ or app/.",knownFalsePositives:"A shell provided by a framework layout outside the scanned tree is not seen; an identifier named Layout that is not a shell counts as one.",confidence:"medium",needsWholeProject:!0},"data-states":{id:"data-states",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Textual hints of loading/empty/error handling (isLoading, Skeleton, EmptyState, error\u2026) in component files. A hint is not a verified state.",knownFalsePositives:"A file that never renders data (a pure layout or a utility) legitimately has no state hints; a variable named error unrelated to UI counts as a hint.",confidence:"medium",needsWholeProject:!1},"duplicate-components":{id:"duplicate-components",version:"1.0",requiredInputs:["files"],adoptionModes:za,analysedSubset:"PascalCase component definitions (function, arrow const, class) that appear in two or more component files.",knownFalsePositives:"Same-named components that are intentionally different (a local Header inside two unrelated features) are reported; forwardRef/styled definitions are not seen.",confidence:"medium",needsWholeProject:!0},"token-usage":{id:"token-usage",version:"1.0",requiredInputs:["files","l2"],adoptionModes:["tokens","components"],analysedSubset:"Whether any token name declared in the guidelines (CSS variables, bg-/text-/border- utilities) appears in the component files, when raw colours were also found.",knownFalsePositives:"Tokens consumed through a theme object or a preprocessor alias are not matched by name.",confidence:"medium",needsWholeProject:!0},"component-usage":{id:"component-usage",version:"1.1",requiredInputs:["files"],adoptionModes:za,analysedSubset:"Raw <button>/<input>/<select>/<table>/<textarea>/<dialog> elements outside the ui/ library, when the guidelines declare a design system or the tree has a ui/ folder.",knownFalsePositives:"Raw elements inside a wrapper that the design system does not cover (a native table in a report) are reported like a bypass.",confidence:"medium",needsWholeProject:!1}},Yye=Object.keys(Va)});function K4(e,t){if(!t.hasFiles&&t.inputs.includes("files"))return"no source files were passed";if(!t.hasL2&&t.inputs.includes("l2")&&!B4.has(e))return"the design guidelines (L2) were not available";switch(e){case"off-scale-spacing":return"no spacing scale is known: the guidelines (L2) declare no px scale, no --spacing token was read from the theme or the passed stylesheets, and the project is not recognised as Tailwind v4";case"contrast-tokens":return'no text/surface colour pair could be evaluated: no colour tokens in the guidelines (L2), the selected theme or the passed stylesheets, or none in a readable colour syntax. Declare pairs in the guidelines as "<text token> <colour> on <surface token> <colour>" (e.g. --text-neutral-mid #11150A on --layer-below #FFFFFF)';case"duplicate-components":return"fewer than two component files were passed";case"component-usage":return"no design system is declared in the guidelines and no ui/ library is in the files";case"token-usage":return"the guidelines declare no token names";default:return"the check did not run"}}function W4(e,t){let r=e.scope.map(o=>k$.exec(o)?.[1]).filter(o=>!!o);if(r.length!==e.scope.length)return{applies:!0};let i=t.map(o=>o.toLowerCase());return r.map(o=>o.split("/").pop().toLowerCase()).some(o=>i.some(a=>a.includes(o)))?{applies:!0}:{applies:!1,reason:`pattern scope (${Gr(r)}) matches none of the passed file paths`}}function Y4(e){let t=new Set;for(let{content:r}of e){for(let i of hc(r)){let n=i[2];if(G4.test(n)){/components\/ui\/./.test(n)&&t.add(Xi(n.split("/").pop()));for(let o of i[1].replace(/[{}]/g,"").split(",")){let a=o.trim().split(/\s+as\s+/)[0]??"";/^[A-Z]\w*$/.test(a)&&t.add(Xi(a))}}}for(let i of r.matchAll(/<([A-Z][\w.]*|[a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/g))t.add(Xi(i[1]))}return t.delete(""),[...t].sort()}function Q4(e,t){if(!e.scope.length)return{applies:!0};let r=[],i=e.checks.some(o=>t.examined.has(o.id)),n=[];for(let o of e.scope){let a=j$.exec(o)?.[1],s=X4.exec(o)?.[1],c=k$.exec(o)?.[1];if(a!==void 0){if(!t.areas||t.areas.has(a.toUpperCase())||i)return{applies:!0};r.push(`area ${a} is not among the touched areas (${Gr([...t.areas].sort())})`)}else if(s!==void 0){let u=Xi(s);if(u&&t.components.some(d=>d.startsWith(u)))return{applies:!0};r.push(`component ${s} is not used in the passed files`)}else if(c!==void 0)n.push(o);else return{applies:!0}}if(n.length){let o=W4({scope:n},t.paths);if(o.applies)return{applies:!0};r.push(o.reason)}return{applies:!1,reason:`${A$}: ${r.join("; ")}`}}function e6(e,t,r){if(e.status==="pass")return[];let i=Va[e.id],n={check:e.id,checkVersion:i?.version??"unknown",severity:H4[e.status],confidence:i?.confidence??"medium",message:e.message,ruleIds:t},o=t6(e.id,r);return e.evidence.length?e.evidence.map(a=>({...n,file:a.file,line:a.line,snippet:a.snippet,...o?{fix:o}:{}})):[{...n,...o?{fix:o}:{}}]}function t6(e,t){if(e==="raw-color-literals"&&t?.length){let r=t.filter(i=>/^(bg|text|border)-/.test(i)).slice(0,3);return r.length?`Replace the literal with a semantic class from the foundation vocabulary (e.g. ${Gr(r)}).`:void 0}if(e==="component-usage")return"Use the design-system component for this element instead of the bare HTML element."}function N$(e){let t=e.fileScope??"subset",r=e.files.map(G=>G.path.replace(/\\/g,"/")),i=Object.fromEntries(e.files.map(G=>[G.path.replace(/\\/g,"/"),G.content])),n=typeof e.l2=="string"&&e.l2.trim().length>0,o=I$({files:i,staticContext:{vocabulary:e.vocabulary,iconLibrary:e.iconLibrary,componentControls:e.componentControls,overlayContent:e.overlayContent,componentLibraryPaths:e.componentLibraryPaths},...n?{l2:e.l2}:{},l2Path:e.l2Path??"design-guidelines.md",theme:e.theme,tailwindVersion:e.tailwindVersion}),a=new Map(o.checks.map(G=>[G.id,G])),s=r.filter(G=>!/(^|\/)(node_modules|\.git|dist|build|\.next|\.nuxt|out|coverage|\.turbo|\.cache|\.svelte-kit|storybook-static)(\/|$)/.test(G)&&/\.(tsx?|jsx?|vue|svelte|css|scss|less|mdx|html?)$/i.test(G)).length,c={hasFiles:s>0,hasL2:n},u=new Map,d=[],f={scope:t,files:e.files.length,analysed:s,executed:[],notExecuted:[],insufficient:[]};e.rulesAvailable===!1&&f.insufficient.push({check:"rules-source",reason:"The selected rules could not be read. Run frontfriend design sync."});let p={};for(let[G,ae]of Object.entries(Va)){if(e.adoption&&!ae.adoptionModes.includes(e.adoption)){u.set(G,{kind:"not-run",reason:`the check does not apply to a ${e.adoption} App`}),f.notExecuted.push({check:G,reason:`does not apply to a ${e.adoption} App`});continue}let fe=a.get(G);if(!fe){if(G==="target")continue;let j=K4(G,{...c,inputs:ae.requiredInputs});u.set(G,{kind:"not-run",reason:j}),f.notExecuted.push({check:G,reason:j});continue}if(fe.coverage==="none"){let j=fe.coverageReason??"Required inputs are unavailable";u.set(G,{kind:"not-run",reason:j}),f.notExecuted.push({check:G,reason:j});continue}p[G]=ae.version;let he=e6(fe,[],e.vocabulary),de=he.filter(j=>j.file!==void 0);if(ae.needsWholeProject&&t==="subset"){let j="reasons about the whole project; on a subset of files no clean pass is claimed";f.insufficient.push({check:G,reason:j}),d.push(...de),u.set(G,de.length?{kind:"evidence"}:{kind:"insufficient",reason:j});continue}if(f.executed.push(G),d.push(...he),fe.coverage==="partial"){let j=fe.coverageReason??"Only statically resolved inputs were analysed";f.insufficient.push({check:G,reason:j}),u.set(G,he.length?{kind:"evidence"}:{kind:"insufficient",reason:j})}else u.set(G,he.length?{kind:"evidence"}:{kind:"clean"})}let y=(e.areas??[]).map(G=>G.trim().toUpperCase()).filter(Boolean),h=y.length?new Set(y):null,v=Y4(e.files),_=G=>Va[G]?.requiredInputs.includes("files")??!1,g=new Set([...u].filter(([G,ae])=>_(G)&&(ae.kind==="evidence"||ae.kind==="clean")).map(([G])=>G).concat(f.insufficient.filter(G=>_(G.check)&&!Va[G.check]?.needsWholeProject).map(G=>G.check))),$={paths:r,areas:h,components:v,examined:g},w=new Map;for(let G of e.rules)w.set(G.id,G.enabled===!1?{applies:!1,reason:"the rule is switched off for this Design System"}:Q4(G,$));let m=new Map;for(let G of e.rules)if(w.get(G.id)?.applies)for(let ae of G.checks)m.set(ae.id,[...m.get(ae.id)??[],G.id]);d=d.map(G=>({...G,ruleIds:m.get(G.check)??[]}));let O=e.rules.map(G=>{let ae={id:G.id,nature:G.nature,maturity:G.maturity,area:G.area??r6(G.scope),checks:G.checks.map(C=>C.id)},fe=w.get(G.id);if(!fe.applies)return{...ae,status:"not-applicable",reason:fe.reason};if(e.adoption&&G.checks.length&&G.checks.every(C=>Va[C.id]&&!Va[C.id].adoptionModes.includes(e.adoption)))return{...ae,status:"not-applicable",reason:`The cited checks do not apply to a ${e.adoption} App`};if(!G.checks.length)return{...ae,status:"unverified",reason:"cites no automated check: honour it by reading the rule"};let he=G.checks.map(C=>({...C,outcome:u.get(C.id)??{kind:"unknown",reason:`check "${C.id}" is not in the checker catalog`}})),de=he.filter(C=>C.outcome.kind==="evidence");if(de.length)return{...ae,status:"violated",reason:`evidence from ${Gr(de.map(C=>C.id))}`};let j=he.filter(C=>C.outcome.kind==="clean"),V=he.filter(C=>C.outcome.kind!=="clean"),K=V.map(C=>`${C.id} (${"reason"in C.outcome?C.outcome.reason:"no outcome"})`);return he.some(C=>C.outcome.kind==="insufficient"&&!Va[C.id]?.needsWholeProject)?{...ae,status:"partial",reason:Gr(K)}:j.length?V.length?{...ae,status:"partial",reason:`${Gr(j.map(C=>C.id))} found nothing; could not run ${Gr(K)}`}:j.every(C=>C.coverage==="full")?{...ae,status:"verified",reason:`${Gr(j.map(C=>C.id))} ran with full coverage and found nothing`}:{...ae,status:"partial",reason:`${Gr(j.filter(C=>C.coverage==="partial").map(C=>C.id))} covers the rule only partially and found nothing`}:{...ae,status:"unverified",reason:`no cited check ran: ${Gr(K)}`}}),P=[...new Set(e.rules.flatMap(G=>w.get(G.id)?.applies?G.checks.map(ae=>ae.id):[]))].map(G=>({id:G,outcome:u.get(G)})).filter(G=>!G.outcome||G.outcome.kind!=="clean"&&G.outcome.kind!=="evidence").map(G=>({check:G.id,reason:G.outcome&&"reason"in G.outcome?G.outcome.reason:`check "${G.id}" is not in the checker catalog`,ruleIds:m.get(G.id)??[]})),E=e.rules.filter(G=>w.get(G.id)?.reason?.startsWith(A$)),I=new Set(e.rules.flatMap(G=>[...G.area?[G.area]:[],...G.scope.map(ae=>j$.exec(ae)?.[1]??"")]).filter(Boolean).map(G=>G.toUpperCase())),D=h&&e.rules.length?[...h].filter(G=>!I.has(G)).sort():[],z={areas:h?[...h].sort():null,components:v,outside:E.map(G=>G.id),outsideRequirements:E.filter(G=>G.nature==="requirement"&&G.maturity==="decided").map(G=>G.id),unknownAreas:D,note:h?`Area-scoped rules outside the touched areas (${Gr([...h].sort())}) are not assessed by this run, unless a check they cite examined the passed files; declare every area you touched.${D.length?` No rule of the selection is scoped to ${Gr(D)}: check the area codes read with get_rules.`:""}`:"No touched areas declared: every area-scoped rule is in the perimeter. Pass the areas you touched (the ones read with get_rules) to narrow it."},N=Object.fromEntries(Z4.map(G=>[G,O.filter(ae=>ae.status===G).length])),U=d.filter(G=>G.severity==="error").length,J=d.filter(G=>G.severity==="warning").length,W={tool:"check-compliance",schemaVersion:"1.0",engineVersion:iy,checkVersions:p,summary:{text:n6({errors:U,warnings:J,coverage:f,counts:N,perimeter:z}),errors:U,warnings:J,rules:N},coverage:f,findings:d,rules:O,missingChecks:P,perimeter:z,...e.selection?{selection:e.selection}:{}};return{...W,gate:Md(W)}}function r6(e){let t=e.find(r=>r.startsWith("area:"));return t?t.slice(5):null}function n6({errors:e,warnings:t,coverage:r,counts:i,perimeter:n}){let o=[],a=r.executed.length?Gr(r.executed):"none";return o.push(e+t===0?`No violations detected in the executed checks (${a}).`:`${e} error${e===1?"":"s"} and ${t} warning${t===1?"":"s"} from the executed checks (${a}).`),r.insufficient.length&&o.push(`Insufficient coverage on this file subset: ${Gr(r.insufficient.map(s=>s.check))} (no clean pass claimed).`),r.notExecuted.length&&o.push(`Not executed: ${r.notExecuted.map(s=>`${s.check} (${s.reason})`).join("; ")}.`),o.push(`Rules: ${i.verified} verified, ${i.violated} violated, ${i.partial} partial, ${i.unverified} unverified, ${i["not-applicable"]} not applicable.`),n.outside.length?o.push(`${n.outside.length} of the not applicable rules lie outside the check perimeter (${n.areas?`touched areas: ${Gr(n.areas)}`:"scope not matched by the passed files"})${n.outsideRequirements.length?`, including ${n.outsideRequirements.length} decided requirement${n.outsideRequirements.length===1?"":"s"}`:""}: this run does not verify them.`):n.areas||o.push("No touched areas declared: every area-scoped rule is in the perimeter."),n.unknownAreas.length&&o.push(`Declared areas no rule is scoped to: ${Gr(n.unknownAreas)}.`),o.push("Rules without a check and visual craft stay unverified: this is not a statement of interface compliance."),o.join(" ")}function M$(e){let{report:t}=e,r=Md(t,{attested:(e.attestations??[]).map(i=>i.rule_id)});return{report_protocol:1,ff_id:e.ffId,app:e.app,selection:e.selection,engine_version:t.engineVersion,check_versions:t.checkVersions,files:Object.entries(e.digests).sort(([i],[n])=>i.localeCompare(n)).map(([i,n])=>({path:i,digest:n})),rules_source:e.rulesSource,summary:{errors:t.summary.errors,warnings:t.summary.warnings,rules:t.summary.rules,gate:{verdict:r.verdict,exitCode:r.exitCode}},coverage:t.coverage,findings:t.findings.map(i=>({check:i.check,check_version:i.checkVersion,severity:i.severity,confidence:i.confidence,...i.file!==void 0?{file:i.file}:{},...i.line!==void 0?{line:i.line}:{},rule_ids:i.ruleIds})),rules:t.rules.map(i=>({id:i.id,status:i.status,nature:i.nature,maturity:i.maturity,area:i.area??null,checks:i.checks,...i.reason?{reason:i.reason}:{}})),attestations:e.attestations??[]}}function T$(e){return x$(e)&&e.status==="unverified"&&Array.isArray(e.checks)&&e.checks.length===0}function i6(e,t){let r=[],i=Gr(t.incomplete.map(n=>n.id));if(e==="findings"&&r.push("Fix the error findings, then run check_compliance again."),e==="not-executed"&&r.push(`Give the checks that did not run the input their reason names (source files, synced rules, guidelines, theme or component controls)${i?` for ${i}`:""}, then run check_compliance again.`),e==="partial-coverage"){let n=new Set(t.incomplete.flatMap(a=>a.checks??[])),o=t.insufficient.filter(a=>n.has(a.check)).map(a=>`${a.check}: ${a.reason}`);r.push(`Clean with partial coverage: the executed checks found nothing, but they cover ${i} only partially by design, so the verdict stays NOT-VERIFIED and no code change can raise it. Review those requirements by reading and on screen, then record the audit with this result.${o.length?` Coverage notes: ${o.join("; ")}.`:""}`)}return t.warnings>0&&r.push(`Fix or justify the ${t.warnings} warning finding${t.warnings===1?"":"s"}.`),t.manual.length&&r.push(`Declare the manual requirements you honoured by reading in record_audit { acknowledged_rules } (or as check_compliance attestations): ${Gr(t.manual)}.`),r.length||r.push("Nothing left to fix in the executed checks: record the audit with this result."),r}function Md(e,t={}){let r=new Set(t.attested??[]),i=e.rules.filter(T$).map(f=>f.id),n=i.filter(f=>!r.has(f)),o=i.filter(f=>r.has(f)),a=e.rules.filter(f=>x$(f)&&!T$(f)&&["unverified","partial"].includes(f.status)),s={incomplete:a,insufficient:e.coverage.insufficient,manual:n,warnings:e.summary.warnings},c=(f,p,y,h)=>({verdict:f,exitCode:p,reasons:y,reasonCode:h,nextSteps:i6(h,s),manual:n,attested:o});if(e.summary.errors>0)return c("FAIL",2,["Open error findings."],"findings");let u=a.map(f=>`${f.id}: ${f.status}${f.reason?` \u2014 ${f.reason}`:""}`),d=e.coverage.insufficient.filter(f=>f.check==="rules-source").map(f=>f.reason);if(u.push(...d),e.coverage.analysed===0&&u.unshift("No source files were analysed."),u.length){let f=e.coverage.executed?new Set(e.coverage.executed):null,p=h=>h.status==="partial"&&!!f&&!!h.checks?.length&&h.checks.every(v=>f.has(v)),y=e.coverage.analysed>0&&!d.length&&a.every(p);return c("NOT-VERIFIED",t.ci?2:1,u,y?"partial-coverage":"not-executed")}return e.summary.warnings>0?c("WARN",t.warningsAsErrors?2:1,["Open warning findings."],"findings"):c("PASS",0,[`No violations detected in executed checks; the verdict is limited to their declared coverage.${n.length?` ${n.length} manual requirement${n.length===1?"":"s"} to honour by reading (not gated).`:""}`],"clean")}var iy,Z4,H4,Gr,B4,k$,G4,j$,X4,A$,x$,q$=Ve(()=>{"use strict";Td();ny();C$();Mu();iy="0.16.1",Z4=["verified","violated","partial","unverified","not-applicable"],H4={fail:"error",warn:"warning"},Gr=e=>e.join(", "),B4=new Set(["off-scale-spacing","contrast-tokens"]);k$=/^pattern:(.+)$/;G4=/(?:^|\/)components\/ui(?:\/|$)|^@frontfriend\/(?:react|components-react|components-vue)/;j$=/^area:(.+)$/,X4=/^component:(.+)$/,A$="outside the check perimeter";x$=e=>e.nature==="requirement"&&e.maturity==="decided"});var oy={};mo(oy,{COMPLIANCE_ENGINE_VERSION:()=>iy,buildComplianceReportPayload:()=>M$,checkCompliance:()=>N$,complianceGate:()=>Md,componentControlsFromConfig:()=>n$,composeGuidelinesChapters:()=>H0,overlayContentFromConfig:()=>f$});var ay=Ve(()=>{"use strict";B0();q$();Mu();Bg()});var nR=te((cve,rR)=>{"use strict";var Vr=require("node:fs"),pr=require("node:path"),o6=require("node:crypto"),{resolveAuthToken:a6}=xa(),{resolveProjectContext:s6}=wg(),{parseApplicationLock:c6}=(kg(),hi(P0)),{fetchDesignRules:U$,RULES_DIR:Uu}=Ng(),u6=gd(),{nativeIconLibrary:l6,renderFoundation:d6}=L0(),{CACHE_DIR_NAME:f6}=Ma(),xd=".frontfriend/design/design-guidelines.md",Ld=".frontfriend/foundation.md",Cs="rules.json",D$=`node_modules/${f6}/components-config.json`,p6=new Set(["node_modules",".git","dist","build",".next",".nuxt","out","coverage",".turbo",".cache",".svelte-kit","storybook-static"]);function ly(e){return e||(ay(),hi(oy))}var z$=e=>e.split(pr.sep).join("/");function dy(e,t){if(!Array.isArray(t)||t.length===0)throw new Error("Pass files: a non-empty list of project-relative paths.");let r=Vr.realpathSync(e),i=[],n=[],o=new Set;for(let a of t){if(typeof a!="string"||!a.trim())throw new Error("Every file must be a non-empty path.");let s=a.replace(/\\/g,"/");if(s.split("/").includes(".."))throw new Error(`Path escapes the project root: ${a}`);let c=pr.isAbsolute(s)?pr.normalize(s):pr.join(r,s);if(!Vr.existsSync(c)){n.push({path:a,reason:"not found"});continue}let u=Vr.realpathSync(c);if(u!==r&&!u.startsWith(r+pr.sep))throw new Error(`Path resolves outside the project root (symlink or absolute path): ${a}`);if(!Vr.statSync(u).isFile()){n.push({path:a,reason:"not a file"});continue}let d=z$(pr.relative(r,u));o.has(d)||(o.add(d),i.push({path:d,content:Vr.readFileSync(u,"utf8")}))}return{files:i,skipped:n}}function L$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function V$(e){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(i==="*")e[r+1]==="*"?(r++,e[r+1]==="/"?(r++,t+="(?:.*/)?"):t+=".*"):t+="[^/]*";else if(i==="?")t+="[^/]";else if(i==="{"){let n=e.indexOf("}",r);n===-1?t+="\\{":(t+=`(?:${e.slice(r+1,n).split(",").map(L$).join("|")})`,r=n)}else t+=L$(i)}return new RegExp(`^${t}$`)}function F$(e){let t=[],r=[e];for(;r.length;){let i=r.pop();for(let n of Vr.readdirSync(i,{withFileTypes:!0})){if(n.isDirectory()){p6.has(n.name)||r.push(pr.join(i,n.name));continue}n.isFile()&&t.push(z$(pr.relative(e,pr.join(i,n.name))))}}return t.sort()}function J$(e,t){let r=t.filter(o=>!/[*?{]/.test(o)),i=t.filter(o=>/[*?{]/.test(o)).map(o=>V$(o.replace(/^\.\//,"")));if(!i.length)return r;let n=F$(e).filter(o=>i.some(a=>a.test(o)));return[...new Set([...r,...n])]}function Z$(e,t){let r=pr.join(e,...xd.split("/")),i=pr.join(pr.dirname(r),"guidelines"),n=Vr.existsSync(i)?Vr.readdirSync(i).filter(s=>s.endsWith(".md")):[];if(!(Vr.existsSync(r)||n.length>0))return{present:!1,l2:void 0,path:xd};let a=Vr.existsSync(r)?Vr.readFileSync(r,"utf8"):"";if(n.length){let s={"design-guidelines.md":a};for(let c of n)s[`guidelines/${c}`]=Vr.readFileSync(pr.join(i,c),"utf8");a=ly(t).composeGuidelinesChapters(s).body}return{present:!0,l2:a,path:xd}}function qd(e){let t=pr.join(e,...Ld.split("/"));return Vr.existsSync(t)?H$(Vr.readFileSync(t,"utf8")):{present:!1,vocabulary:void 0,iconLibrary:null}}var m6=/^(?:(?:bg|text|border|ring|fill|stroke|icon|font|animate|rounded|shadow)-[a-z0-9-]+|shadow)$/;function H$(e){let t=e.indexOf("## This design system"),r=t===-1?e:e.slice(t),i=[...new Set([...r.matchAll(/`([a-z][a-z0-9-]*)`/g)].map(a=>a[1]).filter(a=>m6.test(a)))].sort(),n=/Icon library: `([^`]+)`/.exec(e),o={};for(let a of e.split(/^## /m).slice(1)){let s=/^(light|dark|theme)\s*\n/.exec(a)?.[1];if(!s)continue;let c=[...a.matchAll(/^- `(--[A-Za-z0-9_*-]+)`: `([^`\n]*)`\s*$/gm)];c.length&&(o[s]=Object.fromEntries(c.map(u=>[u[1],u[2]])))}return{present:!0,vocabulary:i,iconLibrary:n?n[1]:null,...Object.keys(o).length?{tokens:o}:{}}}async function B$({projectRoot:e,apiUrl:t,ffId:r,lock:i,token:n,fetchImpl:o}){let a=i?.tokenSourceReleaseId||i?.releaseId;if(t&&n){let s=a?`release=${encodeURIComponent(a)}`:"root=true";try{let c=await o(`${t}/api/design-systems/${encodeURIComponent(r)}/processed-tokens?${s}&colorFormat=oklch`,{headers:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(6e4)});if(!c.ok)throw new Error(`HTTP ${c.status}`);let u=await c.json();if(!u||u.base!=="shadcn"&&(!u.semanticVariables||typeof u.semanticVariables!="object"))throw new Error("Foundation response has no semantic vocabulary");let d=u.base==="shadcn"?l6(e,{processedData:u}):u.iconLibrary;return{...H$(d6({processedData:u,iconLibrary:d})),componentsConfig:u.componentsConfig,source:"server",release_id:a||null,selection_note:a?"App token release":"Current base release (no app token release pinned)"}}catch(c){return{...qd(e),source:"local-mirror",reason:`Selected foundation unavailable (${c.message}); using the locally installed foundation`}}}return{...qd(e),source:"local-mirror",reason:t?"Not signed in; using the locally installed foundation":"No API URL; using the locally installed foundation"}}function K$({projectRoot:e,ffId:t,foundation:r,lock:i,engine:n}){let o=ly(n),a=r?.source==="server"?o.componentControlsFromConfig(r.componentsConfig):null;if(a)return{controls:a,overlayContent:o.overlayContentFromConfig(r.componentsConfig),source:"server",components:Object.keys(a).length,...r.release_id?{release_id:r.release_id}:{}};let s=r?.source==="server"?"the selected token release carries no component configuration":r?.source?"the selected token release is unavailable":"offline run: the selected token release was not fetched",c=pr.join(e,...D$.split("/")),u=yc(pr.join(pr.dirname(c),"metadata.json"));if(t&&u?.ffId!==t&&Vr.existsSync(c)){let v=u?.ffId?"belongs to another Design System":"does not declare its Design System (missing or incomplete metadata)";return{controls:null,source:"none",components:0,reason:`${s}; the local component cache ${v}: run \`frontfriend init\`. Appearance classes on Design System components are reported as undetermined, not as overrides`}}let d=i?.tokenSourceReleaseId||i?.releaseId,f=yc(pr.join(pr.dirname(c),"versionMetadata.json")),p=f?.releaseId??u?.tokenSourceReleaseId;if(i?.tokenVersionId&&((f?.versionId??u?.tokenVersionId)!==i.tokenVersionId||d&&p&&p!==d))return{controls:null,source:"none",components:0,reason:`${s}; the local component cache does not match the selected token version and source Release. Fetch the selected release before checking component overrides`};let y=Vr.existsSync(c)?yc(c):null,h=y?o.componentControlsFromConfig(y):null;return h?{controls:h,overlayContent:o.overlayContentFromConfig(y),source:"local-cache",components:Object.keys(h).length,reason:`${s}; using the component configuration cached by \`frontfriend init\` (${D$}), which may predate the selected release`}:{controls:null,source:"none",components:0,reason:`${s} and no component configuration is cached: run \`frontfriend init\`. Appearance classes on Design System components are reported as undetermined, not as overrides`}}function fy(e){if(e==null)return;let t=[];for(let r of Array.isArray(e)?e:[e])for(let i of String(r).split(",")){let n=i.trim();if(n){if(!/^[A-Za-z][A-Za-z0-9-]*$/.test(n))throw new Error(`Invalid area code: ${n}. Pass rule area codes such as FRM, COL, A11Y.`);t.push(n.toUpperCase())}}return t.length?[...new Set(t)]:void 0}function yc(e){try{return JSON.parse(Vr.readFileSync(e,"utf8"))}catch{return null}}function Dd(e,t){let r=pr.join(e,"frontfriend.lock.json");if(!Vr.existsSync(r))return{selection:{view:"working"},lock:null,adopted:!1,declared:"No frontfriend.lock.json: reading the working contracts (declared, not a substitute for an adopted snapshot)."};let i=c6(Vr.readFileSync(r,"utf8"));if(i.ffId&&t&&i.ffId!==t)throw new Error("frontfriend.lock.json belongs to another Design System.");return i.design?{selection:{view:"adopted",design_snapshot_id:i.design.snapshotId},lock:i,adopted:!0,declared:`Adopted design snapshot ${i.design.snapshotId} from frontfriend.lock.json.`}:{selection:{view:"working"},lock:i,adopted:!1,declared:"The Application lock has no adopted design snapshot: reading the working contracts (declared, not substituted)."}}var W$=e=>e.design_snapshot_id?`&view=adopted&design_snapshot_id=${encodeURIComponent(e.design_snapshot_id)}`:"&view=working";function sy(e,t){return e?e.view===t.view&&(e.design_snapshot_id||null)===(t.design_snapshot_id||null):!1}function G$(e){let t=(e||[]).find(r=>r.path===Cs);if(!t)return null;try{let r=JSON.parse(t.content);return Array.isArray(r.rules)?r:null}catch{return null}}var cy=e=>(Array.isArray(e)?e:[]).map(t=>({slug:t.slug,revision_id:t.revision_id,version:t.version,digest:t.digest}));async function Y$({projectRoot:e,apiUrl:t,token:r,ffId:i,appName:n,selection:o,fetchImpl:a=fetch}){let s;if(r&&t)try{let u=await U$({url:`${t}/api/design/rules?ffId=${encodeURIComponent(i)}&name=${encodeURIComponent(n)}${W$(o)}`,token:r,fetchImpl:a});if(u.design_system?.ff_id!==i)throw new Error("Rules response belongs to a different Design System.");if(!sy(u.selection,o))throw new Error("Rules response does not match the requested selection.");let d=G$(u.files);if(d)return{rules:d.rules,source:"server",selection:u.selection,revisions:cy(d.sources),payload:u};s="the server rules mirror has no rules.json (upgrade the SaaS)"}catch(u){s=u.message}else s=r?"no API URL":"not authenticated";let c=yc(pr.join(e,...Uu.split("/"),Cs));return c&&Array.isArray(c.rules)&&sy(c.selection,o)&&(!c.design_system?.ff_id||c.design_system.ff_id===i)?{rules:c.rules,source:"local-mirror",selection:c.selection||o,revisions:cy(c.sources),reason:`server unavailable (${s}); using ${Uu}/${Cs}`}:{rules:[],source:"none",selection:o,revisions:[],reason:`server unavailable (${s}) and no matching ${Uu}/${Cs}: run \`frontfriend design sync\``}}function zu(e){let t=Array.isArray(e?.adopt)?e.adopt:null;if(t)return t.includes("components")?"components":t.includes("tokens")?"tokens":"contracts-only"}async function uy(e){try{return await new u6().load({startDir:e,strict:!0,fresh:!0})}catch{return null}}var h6=e=>o6.createHash("sha256").update(e).digest("hex");function X$(e){let t=yc(pr.join(e,"package.json")),r=t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss,i=typeof r=="string"?/^[\^~>=<v\s]*(\d+)/.exec(r)?.[1]:void 0;return i?Number(i):null}function Q$({projectRoot:e,files:t,rules:r,selection:i,adoption:n,fileScope:o,engine:a,selectedFoundation:s,rulesAvailable:c=!0,ffId:u,areas:d,selectedLock:f}){let p=ly(a),y=Z$(e,p),h=s||qd(e),v=K$({projectRoot:e,ffId:u,foundation:h,lock:f,engine:p});return{report:p.checkCompliance({files:t,rules:r,rulesAvailable:c,componentLibraryPaths:F$(e).filter(g=>/(?:^|\/)(?:components\/)?ui\/.*\.(?:tsx|jsx|vue|svelte)$/.test(g)),vocabulary:h.vocabulary,iconLibrary:h.iconLibrary,componentControls:v.controls,overlayContent:v.overlayContent,selection:i,l2:y.l2,l2Path:y.path,fileScope:o,adoption:n,areas:d,theme:h.tokens?{...h.tokens,source:h.source==="server"?"selected foundation":Ld}:void 0,tailwindVersion:X$(e)}),guidelines:y,foundation:h,controls:v,brain:p}}function eR({guidelines:e,foundation:t,controls:r}){return{guidelines:e.present?e.path:null,foundation:t.present?t.source==="server"?"server":Ld:null,foundation_source:t.source||"local-mirror",...t.reason?{foundation_note:t.reason}:{},...t.selection_note?{foundation_selection:t.selection_note,token_release_id:t.release_id}:{},icon_library:t.iconLibrary,component_controls:{source:r.source,components:r.components,...r.release_id?{token_release_id:r.release_id}:{},...r.reason?{note:r.reason}:{}}}}var tR=e=>e.gate.manual;function g6({apiUrl:e,envToken:t,fetchImpl:r=fetch,engine:i,resolveToken:n=a6,resolveContext:o=s6}={}){async function a(){try{return await n({baseURL:e,envToken:t,silent:!0})}catch{return null}}async function s(y,h){if(!y||!e)return{stored:!1,reason:y?"no API URL configured":"not authenticated: run `frontfriend login`"};try{let v=await r(`${e}/api/design/compliance-reports`,{method:"POST",headers:{authorization:`Bearer ${y}`,"content-type":"application/json",accept:"application/json"},body:JSON.stringify(h),signal:AbortSignal.timeout(6e4)}),_=await v.json().catch(()=>null);return v.ok?{stored:!0,report_id:_?.report_id,client_reported:!0}:{stored:!1,reason:_?.error||`HTTP ${v.status}`}}catch(v){return{stored:!1,reason:v.message}}}async function c({project_path:y,files:h,areas:v,attestations:_=[]}={}){let g=await o(y);if(g.status!=="ready")return{isError:!0,result:g};let $=fy(v),w=g.project_path,{files:m,skipped:O}=dy(w,h),P=Dd(w,g.ff_id),E=await a(),I=await Y$({projectRoot:w,apiUrl:e,token:E,ffId:g.ff_id,appName:g.app_name,selection:P.selection,fetchImpl:r}),D=await uy(w),z=await B$({projectRoot:w,apiUrl:e,ffId:g.ff_id,lock:P.lock,token:E,fetchImpl:r}),{report:N,guidelines:U,foundation:J,controls:W,brain:G}=Q$({projectRoot:w,files:m,rules:I.rules,rulesAvailable:I.source!=="none",selection:I.selection,adoption:zu(D),fileScope:"subset",selectedFoundation:z,selectedLock:P.lock,engine:i,ffId:g.ff_id,areas:$}),ae=Object.fromEntries(m.map(j=>[j.path,h6(j.content)])),fe=G.buildComplianceReportPayload({report:N,ffId:g.ff_id,app:g.app_name,selection:I.selection,digests:ae,rulesSource:{source:I.source,revisions:I.revisions,...I.reason?{reason:I.reason}:{}},attestations:_}),he=await s(E,fe),de=G.complianceGate(N,{attested:_.map(j=>j.rule_id)});return{isError:!1,result:{project_path:w,design_system:{ff_id:g.ff_id},app:g.app_name,selection:I.selection,selection_note:P.declared,rules_source:{source:I.source,rules:I.rules.length,revisions:I.revisions,...I.reason?{reason:I.reason}:{}},inputs:eR({guidelines:U,foundation:J,controls:W}),files:{requested:h.length,analysed:m.map(j=>j.path),skipped:O},...N,gate:de,unverified_requirements:tR({gate:de}),server:he,note:`Local result: snippets stay on this machine; the platform received paths, digests and outcomes only. Fix error findings before closing. unverified_requirements are the manual requirements (no automated check): they never fail the gate; declare the ones you honoured via attestations on check_compliance (or record_audit { acknowledged_rules }), the rest become borderline findings. Requirements whose checks could not establish them are in gate.reasons and keep the result NOT-VERIFIED; gate.reasonCode says why (partial-coverage: every cited check ran and found nothing but covers its requirement only partially, a clean result with partial coverage; not-executed: a cited check did not run) and gate.nextSteps lists what leads to a clean state. Pass compliance_report_id: server.report_id to record_audit (the inline compliance object, this whole result, is still accepted when the report was not stored). ${N.perimeter.note}`}}}let u=y=>({ok:!1,reason:`not attempted: ${y}`});async function d({project_path:y}={}){let h={config:null,auth:null,design_system:null,selection:null,first_read:null},v;try{v=await o(y)}catch(z){h.config={ok:!1,reason:z.message}}if(v?.status==="ambiguous"?h.config={ok:!1,reason:"Several apps found under this path: pass the app directory as project_path.",candidates:v.candidates}:v?.status==="needs_setup"?h.config={ok:!1,reason:"frontfriend.config.js is missing or has no ff-id: a copied config is not a connection. Connect a Design System first: run `frontfriend setup --ff-id <ff-id>` or setup_project.",project_path:v.project_path}:v&&(h.config={ok:!0,reason:"frontfriend.config.js declares ff-id and the App name.",project_path:v.project_path,ff_id:v.ff_id,app_name:v.app_name}),!h.config.ok){for(let z of["auth","design_system","selection","first_read"])h[z]=u("configuration missing");return p(h)}let _=v.project_path,g=null;try{g=await n({baseURL:e,envToken:t,silent:!0}),h.auth=g?{ok:!0,reason:"An access token was resolved from the stored credential.",api_url:e}:{ok:!1,reason:"No Frontfriend credentials found. Run `frontfriend login`."}}catch(z){h.auth={ok:!1,reason:`Credential refresh failed: ${z.message}. Run \`frontfriend login\`.`}}if(!h.auth.ok){for(let z of["design_system","selection","first_read"])h[z]=u("not authenticated");return p(h)}let $=null;try{$=Dd(_,v.ff_id)}catch(z){h.selection={ok:!1,reason:`frontfriend.lock.json is unreadable: ${z.message}`}}let w=await uy(_),m=z=>`${e}/api/design/rules?ffId=${encodeURIComponent(v.ff_id)}&name=${encodeURIComponent(v.app_name)}${W$(z)}`,O=async z=>{try{return{payload:await U$({url:m(z),token:g,fetchImpl:r})}}catch(N){return{error:N.message}}},P=await O($?$.selection:{view:"working"}),E=P.payload;if(P.payload)h.design_system={ok:!0,reason:"The server resolved the Design System and the App.",design_system:P.payload.design_system,app:P.payload.app,adoption_mode:zu(w)||"not configured"};else if($?.adopted){let z=await O({view:"working"});h.design_system=z.payload?{ok:!0,reason:"The server resolved the Design System and the App (working view used only for this step).",design_system:z.payload.design_system,app:z.payload.app,adoption_mode:zu(w)||"not configured"}:{ok:!1,reason:z.error}}else h.design_system={ok:!1,reason:P.error};if(h.selection||(h.design_system.ok?$.adopted?h.selection=P.payload&&P.payload.selection?.design_snapshot_id===$.selection.design_snapshot_id?{ok:!0,reason:$.declared,selection:P.payload.selection}:{ok:!1,reason:`The adopted design snapshot ${$.selection.design_snapshot_id} could not be resolved by the server (${P.error||"selection mismatch"}); it was not replaced by the working view.`,selection:$.selection}:h.selection={ok:!0,reason:$.declared,selection:{view:"working"},adopted_snapshot:null}:h.selection=u("Design System unresolved")),h.selection.ok||(E=null),!E)return h.first_read=u(h.selection.ok?"Design System unresolved":"selection unresolved"),p(h);let I=G$(E.files),D=I?.rules?.[0];return h.first_read=D?{ok:!0,reason:"A real read returned a rule with its provenance.",rule:{id:D.id,nature:D.nature,maturity:D.maturity,source:D.source},rules:I.rules.length}:{ok:!0,reason:I?"The read succeeded; this selection has no structured rules yet (declared: no rules yet).":"The read succeeded but the server mirror carries no rules.json (upgrade the SaaS); no rules could be read.",rule:null,rules:0},p(h)}async function f({project_path:y,verification:h}={}){let v=await d({project_path:y});if(!h)return v;try{if(typeof h.id!="string"||!h.id||h.id.length>200||typeof h.ff_id!="string"||!h.ff_id||h.ff_id.length>200)throw new Error("Invalid verification attempt. Start again in the browser.");let _=await n({baseURL:e,envToken:t,silent:!0});if(!_)throw new Error("Sign in with frontfriend login, then repeat verification.");let g=await r(`${e.replace(/\/+$/,"")}/api/design-systems/${encodeURIComponent(h.ff_id)}/connections/${encodeURIComponent(h.id)}`,{method:"POST",headers:{authorization:`Bearer ${_}`,"content-type":"application/json"},body:JSON.stringify({ffId:v.outcomes.config.ff_id||null,appName:v.outcomes.config.app_name||null,outcomes:Object.fromEntries(Object.entries(v.outcomes).map(([w,m])=>[w,{ok:m.ok===!0,attempted:!m.reason?.startsWith("not attempted:")}]))})}),$=await g.json();if(!g.ok)throw new Error($.error||"Unable to report verification.");return{...v,verification:{reported:!0,status:$.status}}}catch(_){return{...v,verification:{reported:!1,error:_.message}}}}function p(y){let h=Object.values(y).every(v=>v?.ok);return{connected:h,outcomes:y,note:h?"Connected: configuration, credentials, Design System, selection and a real read all succeeded.":"Not connected: a copied configuration alone is never a connection. Fix the first failing outcome and run `frontfriend mcp doctor` again."}}return{checkCompliance:c,connectionStatus:f}}async function y6({projectRoot:e,patterns:t=["**/*.{ts,tsx,js,jsx,vue,svelte,css,scss,less,mdx,html,htm}"],areas:r,engine:i,fileScope:n="subset"}){let o=fy(r),a=J$(e,t);if(!a.length)throw new Error(`No files match: ${t.join(" ")}`);let{files:s,skipped:c}=dy(e,a),u=yc(pr.join(e,...Uu.split("/"),Cs)),d=u&&Array.isArray(u.rules)?u.rules:[],f=u&&Array.isArray(u.rules)?{source:"local-mirror",rules:d.length,revisions:cy(u.sources)}:{source:"none",rules:0,revisions:[],reason:`no ${Uu}/${Cs}: run \`frontfriend design sync\``},p={view:"working"},y,h;try{let O=Dd(e,u?.design_system?.ff_id);p=O.selection,y=O.lock,h=O.declared}catch(O){throw new Error(`Cannot resolve the selected snapshot: ${O.message}`)}if(u&&!sy(u.selection,p))throw new Error("Local rules do not match the selected snapshot. Run `frontfriend design sync`.");let v=await uy(e);if(u?.design_system?.ff_id&&v?.["ff-id"]&&u.design_system.ff_id!==v["ff-id"])throw new Error("Local rules belong to a different Design System. Run `frontfriend design sync`.");let _=u?.design_system?.ff_id||v?.["ff-id"],{report:g,guidelines:$,foundation:w,controls:m}=Q$({projectRoot:e,files:s,rules:d,rulesAvailable:f.source!=="none",selection:p,adoption:zu(v),fileScope:n,engine:i,ffId:_,areas:o,selectedLock:y});return{...g,selection:p,selection_note:h,rules_source:f,inputs:eR({guidelines:$,foundation:w,controls:m}),files:{requested:a.length,analysed:s.map(O=>O.path),skipped:c},unverified_requirements:tR(g)}}rR.exports={DESIGN_GUIDELINES_PATH:xd,FOUNDATION_PATH:Ld,RULES_JSON:Cs,createComplianceBridge:g6,runLocalCheck:y6,resolveProjectFiles:dy,expandGlobs:J$,globToRegExp:V$,loadLocalGuidelines:Z$,loadFoundationVocabulary:qd,loadSelectedFoundation:B$,loadComponentControls:K$,normalizeAreas:fy,loadRules:Y$,readSelection:Dd,adoptionMode:zu,projectTailwindVersion:X$}});var Vd=te(zd=>{var v6=Object.create,Ud=Object.defineProperty,_6=Object.getOwnPropertyDescriptor,b6=Object.getOwnPropertyNames,S6=Object.getPrototypeOf,w6=Object.prototype.hasOwnProperty,$6=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),R6=(e,t)=>{let r={};for(var i in e)Ud(r,i,{get:e[i],enumerable:!0});return t&&Ud(r,Symbol.toStringTag,{value:"Module"}),r},E6=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=b6(t),o=0,a=n.length,s;o<a;o++)s=n[o],!w6.call(e,s)&&s!==r&&Ud(e,s,{get:(c=>t[c]).bind(null,s),enumerable:!(i=_6(t,s))||i.enumerable});return e},P6=(e,t,r)=>(r=e!=null?v6(S6(e)):{},E6(t||!e||!e.__esModule?Ud(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(zd,"__commonJSMin",{enumerable:!0,get:function(){return $6}});Object.defineProperty(zd,"__exportAll",{enumerable:!0,get:function(){return R6}});Object.defineProperty(zd,"__toESM",{enumerable:!0,get:function(){return P6}})});var my=te(py=>{var O6=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),iR=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),I6=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),C6=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function T6(e){return typeof e=="string"&&iR.has(e.replace(/#$/,""))}function k6(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(O6.has(r))return"2020-12";if(iR.has(r))return"2019-09";if(I6.has(r)||C6.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}Object.defineProperty(py,"declaredDialect",{enumerable:!0,get:function(){return k6}});Object.defineProperty(py,"declares2019Dialect",{enumerable:!0,get:function(){return T6}})});var ze=te(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.CONSTANT_CATCH=Ae.Class=Ae.BIGINT_FORMAT_RANGES=Ae.NUMBER_FORMAT_RANGES=Ae.primitiveTypes=Ae.propertyKeyTypes=Ae.getParsedType=Ae.allowsEval=Ae.captureStackTrace=void 0;Ae.assertEqual=A6;Ae.assertNotEqual=N6;Ae.toZod=M6;Ae.assertIs=x6;Ae.assertNever=q6;Ae.assert=D6;Ae.getEnumValues=L6;Ae.joinValues=U6;Ae.jsonStringifyReplacer=z6;Ae.cached=aR;Ae.nullish=V6;Ae.cleanRegex=F6;Ae.floatSafeRemainder=J6;Ae.defineLazy=Z6;Ae.objectClone=H6;Ae.assignProp=Fa;Ae.mergeDefs=Ja;Ae.cloneDef=B6;Ae.getElementAtPath=K6;Ae.promiseAllObject=W6;Ae.randomString=G6;Ae.esc=Y6;Ae.slugify=X6;Ae.isObject=gy;Ae.isPlainObject=Jd;Ae.shallowClone=Q6;Ae.numKeys=eV;Ae.escapeRegex=rV;Ae.clone=is;Ae.normalizeParams=nV;Ae.createTransparentProxy=iV;Ae.stringifyPrimitive=sR;Ae.optionalKeys=oV;Ae.pick=aV;Ae.omit=sV;Ae.extend=cV;Ae.safeExtend=uV;Ae.merge=lV;Ae.partial=dV;Ae.required=fV;Ae.aborted=pV;Ae.explicitlyAborted=mV;Ae.prefixIssues=hV;Ae.unwrapMessage=vc;Ae.attachSchema=gV;Ae.finalizeIssue=yV;Ae.getSizableOrigin=vV;Ae.codePointLength=bV;Ae.getLengthableOrigin=SV;Ae.parsedType=wV;Ae.issue=$V;Ae.cleanEnum=RV;Ae.base64ToUint8Array=cR;Ae.uint8ArrayToBase64=uR;Ae.base64urlToUint8Array=EV;Ae.uint8ArrayToBase64url=PV;Ae.hexToUint8Array=OV;Ae.uint8ArrayToHex=IV;Ae.members=CV;Ae.own=Fd;Ae.hide=TV;Ae.defineLazyInternal=NV;Ae.installLazyProp=MV;Ae.constantCatch=xV;var j6=os();function A6(e){return e}function N6(e){return e}function M6(){return e=>e}function x6(e){}function q6(e){throw new Error("Unexpected value in exhaustive check")}function D6(e){}function L6(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function U6(e,t="|"){return e.map(r=>sR(r)).join(t)}function z6(e,t){return typeof t=="bigint"?t.toString():t}function aR(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function V6(e){return e==null}function F6(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function J6(e,t){let r=e/t,i=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-i)<n?0:r-i}var oR=Symbol("evaluating");function Z6(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==oR)return i===void 0&&(i=oR,i=r()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function H6(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fa(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ja(...e){let t={};for(let r of e){let i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function B6(e){return Ja(e._zod.def)}function K6(e,t){return t?t.reduce((r,i)=>r?.[i],e):e}function W6(e){let t=Object.keys(e),r=t.map(i=>e[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function G6(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<e;i++)r+=t[Math.floor(Math.random()*t.length)];return r}function Y6(e){return JSON.stringify(e)}function X6(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}Ae.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gy(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Ae.allowsEval=aR(()=>{if(j6.globalConfig.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Jd(e){if(gy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gy(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Q6(e){return Jd(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function eV(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var tV=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};Ae.getParsedType=tV;Ae.propertyKeyTypes=new Set(["string","number","symbol"]);Ae.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rV(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function is(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function nV(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function iV(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function sR(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function oV(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}Ae.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Ae.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function aV(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Ja(e._zod.def,{get shape(){let a={};for(let s of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,s))throw new Error(`Unrecognized key: "${String(s)}"`);t[s]&&Fa(a,s,r.shape[s])}return Fa(this,"shape",a),a},checks:[]});return is(e,o)}function sV(e,t){let r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Ja(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(r.shape,s))throw new Error(`Unrecognized key: "${String(s)}"`);t[s]&&delete a[s]}return Fa(this,"shape",a),a},checks:[]});return is(e,o)}function cV(e,t){if(!Jd(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ja(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Fa(this,"shape",o),o}});return is(e,n)}function uV(e,t){if(!Jd(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ja(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Fa(this,"shape",i),i}});return is(e,r)}function lV(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ja(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Fa(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return is(e,r)}function dV(e,t,r,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let s=Ja(t._zod.def,{get shape(){let c=t._zod.def.shape,u={...c};if(r)for(let d of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(c,d))throw new Error(`Unrecognized key: "${String(d)}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:c[d]}):c[d])}else for(let d of Reflect.ownKeys(c))u[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return Fa(this,"shape",u),u},checks:[]});return is(t,s)}function fV(e,t,r){let i=Ja(t._zod.def,{get shape(){let n=t._zod.def.shape,o={...n};if(r)for(let a of Reflect.ownKeys(r)){if(!Object.prototype.hasOwnProperty.call(o,a))throw new Error(`Unrecognized key: "${String(a)}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a of Reflect.ownKeys(n))o[a]=new e({type:"nonoptional",innerType:n[a]});return Fa(this,"shape",o),o}});return is(t,i)}function pV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function mV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function hV(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function vc(e){return typeof e=="string"?e:e?.message}function gV(e,t,r){var i;for(let n=t;n<e.length;n++)(i=e[n]).schema??(i.schema=r)}function yV(e,t,r){var i;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:vc(e.inst?._zod.def?.error?.(e))??vc(o?.(e))??vc(t?.error?.(e))??vc(r.customError?.(e))??vc(r.localeError?.(e))??"Invalid input",{inst:s,schema:c,continue:u,input:d,...f}=e;return f.path??(f.path=[]),f.message=a,t?.reportInput&&(f.input=d),f}function vV(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var _V=/[\uD800-\uDBFF]/;function bV(e){let t=e.length;if(!_V.test(e))return t;let r=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(r--,i++);return r}function SV(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wV(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $V(...e){let[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}function RV(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function cR(e){let t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}function uR(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function EV(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return cR(t+r)}function PV(e){return uR(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function OV(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i/2]=Number.parseInt(t.slice(i,i+2),16);return r}function IV(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var yy=class{constructor(...t){}};Ae.Class=yy;function CV(e,t){for(let r in t){let i=Object.getOwnPropertyDescriptor(t,r);i.get?Object.defineProperty(e,r,{...i,enumerable:!1}):kV(e,r,i.value)}}function Fd(e,t,r,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:r}),r}function TV(e,t,r){return Fd(e,t,r,!1)}function kV(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Fd(this,t,r.bind(this))},set(i){Fd(this,t,i)}})}function jV(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var hy,ns=!1,AV={configurable:!0,get(){ns=!0}};function NV(e,t,r){let i=Object.getPrototypeOf(e._zod);if(t in i&&hy!==e._zod){hy=void 0;return}hy=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,AV);let n=ns;ns=!1;try{let o=r(this);return ns?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),ns=ns||n,o}catch(o){throw delete this[t],ns=ns||n,o}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function MV(e,t,r,i){let n=jV(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=r(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}Ae.CONSTANT_CATCH="~constantCatch";function xV(e){let t=()=>e;return t[Ae.CONSTANT_CATCH]=!0,t}});var os=te(_n=>{"use strict";var lR;Object.defineProperty(_n,"__esModule",{value:!0});_n.globalConfig=_n.$ZodEncodeError=_n.$ZodAsyncError=_n.$brand=_n.NEVER=void 0;_n.$constructor=LV;_n.config=UV;var qV=ze();_n.NEVER=Object.freeze({status:"aborted"});var vy={value:void 0,enumerable:!1},dR="captureStackTrace"in Error?Error:null;function DV(e){let t=dR;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return dR=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function LV(e,t,r,i){let n={};function o(p){this.def=p,this.constr=f,this.traits=new Set}o.prototype=n;let a=r,s=a&&new WeakSet;function c(p,y){if(!p._zod){vy.value=new o(y);try{Object.defineProperty(p,"_zod",vy)}finally{vy.value=void 0}}if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),t(p,y),s){let v=Object.getPrototypeOf(p),_=p._zod.constr.prototype,g=v;for(;g&&g!==_;)g=Object.getPrototypeOf(g);let $=g??v;s.has($)||(s.add($),(0,qV.members)($,a))}let h=f.prototype;for(let v in h)Object.prototype.hasOwnProperty.call(h,v)&&(v in p||(p[v]=h[v].bind(p)))}let u=i?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function f(p){let y=i?.Parent?DV(d):this;c(y,p);let h=y._zod.deferred;if(h){for(let _ of h)_();y._zod.deferred=void 0}let v=globalThis.__zod_globalConfig?.postProcessor;return v&&v(y),y}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>i?.Parent&&p instanceof i.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}_n.$brand=Symbol("zod_brand");var _y=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};_n.$ZodAsyncError=_y;var by=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};_n.$ZodEncodeError=by;(lR=globalThis).__zod_globalConfig??(lR.__zod_globalConfig={});_n.globalConfig=globalThis.__zod_globalConfig;function UV(e){return e&&Object.assign(_n.globalConfig,e),_n.globalConfig}});var $y=te(ln=>{"use strict";var zV=ln&&ln.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),VV=ln&&ln.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),FV=ln&&ln.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&zV(t,e,r);return VV(t,e),t};Object.defineProperty(ln,"__esModule",{value:!0});ln.$ZodRealError=ln.$ZodError=void 0;ln.flattenError=WV;ln.formatError=GV;ln.treeifyError=YV;ln.toDotPath=hR;ln.prettifyError=XV;var pR=os(),JV=FV(ze());function ZV(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,JV.jsonStringifyReplacer,2)),e.message}function HV(e){this._zod.message=e}var BV={get:ZV,set:HV,enumerable:!0,configurable:!0},Sy={value:void 0,enumerable:!1},wy={value:void 0,enumerable:!1},fR=new WeakSet([Object.prototype,Error.prototype]),mR=(e,t)=>{e.name="$ZodError",Sy.value=e._zod,Object.defineProperty(e,"_zod",Sy),wy.value=t,Object.defineProperty(e,"issues",wy),Sy.value=void 0,wy.value=void 0,Object.defineProperty(e,"message",BV);let r=Object.getPrototypeOf(e);fR.has(r)||(fR.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))};ln.$ZodError=(0,pR.$constructor)("$ZodError",mR);ln.$ZodRealError=(0,pR.$constructor)("$ZodError",mR,void 0,{Parent:Error});function KV(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function WV(e,t=r=>r.message){let r={},i=[];for(let n of e.issues)n.path.length>0?KV(r,n.path[0],()=>[]).push(t(n)):i.push(t(n));return{formErrors:i,fieldErrors:r}}function GV(e,t=r=>r.message){let r={_errors:[]},i=(n,o=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)r._errors.push(t(a));else{let c=r,u=0;for(;u<s.length;){let d=s[u],f=u===s.length-1;if(d==="_errors"){f&&c._errors.push(t(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,d)||Object.defineProperty(c,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[d];f&&p._errors.push(t(a)),c=p,u++}}}};return i(e),r}function YV(e,t=r=>r.message){let r={errors:[]},i=(n,o=[])=>{var a;for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>i({issues:c},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let c=[...o,...s.path];if(c.length===0){r.errors.push(t(s));continue}let u=r,d=0;for(;d<c.length;){let f=c[d],p=d===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(a=u.items)[f]??(a[f]={errors:[]}),u=u.items[f]),p&&u.errors.push(t(s)),d++}}};return i(e),r}function hR(e){let t=[],r=e.map(i=>typeof i=="object"?i.key:i);for(let i of r)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function XV(e){let t=[],r=[...e.issues].sort((i,n)=>(i.path??[]).length-(n.path??[]).length);for(let i of r)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${hR(i.path)}`);return t.join(`
|
|
38
38
|
`)}});var Ey=te(qe=>{"use strict";var QV=qe&&qe.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),eF=qe&&qe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ry=qe&&qe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&QV(t,e,r);return eF(t,e),t};Object.defineProperty(qe,"__esModule",{value:!0});qe.safeDecodeAsync=qe._safeDecodeAsync=qe.safeEncodeAsync=qe._safeEncodeAsync=qe.safeDecode=qe._safeDecode=qe.safeEncode=qe._safeEncode=qe.decodeAsync=qe._decodeAsync=qe.encodeAsync=qe._encodeAsync=qe.decode=qe._decode=qe.encode=qe._encode=qe.validateAsync=qe.validate=qe.safeParseAsync=qe._safeParseAsync=qe.safeParse=qe._safeParse=qe.parseAsync=qe._parseAsync=qe.parse=qe._parse=void 0;var Ts=Ry(os()),yi=Ry($y()),_c=Ry(ze());function Zd(e,t){return{callee:t?.callee??e,Err:t?.Err}}var tF=e=>{let t=(r,i,n,o)=>{let a=n?{...n,async:!1}:{async:!1},s=r._zod.run({value:i,issues:[]},a);if(s instanceof Promise)throw new Ts.$ZodAsyncError;if(s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>_c.finalizeIssue(u,a,Ts.config())));throw _c.captureStackTrace(c,o?.callee??t),c}return s.value};return t};qe._parse=tF;qe.parse=(0,qe._parse)(yi.$ZodRealError);var rF=e=>{let t=async(r,i,n,o)=>{let a=n?{...n,async:!0}:{async:!0},s=r._zod.run({value:i,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>_c.finalizeIssue(u,a,Ts.config())));throw _c.captureStackTrace(c,o?.callee??t),c}return s.value};return t};qe._parseAsync=rF;qe.parseAsync=(0,qe._parseAsync)(yi.$ZodRealError);var nF=e=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Ts.$ZodAsyncError;return o.issues.length?{success:!1,error:new(e??yi.$ZodError)(o.issues.map(a=>_c.finalizeIssue(a,n,Ts.config())))}:{success:!0,data:o.value}};qe._safeParse=nF;qe.safeParse=(0,qe._safeParse)(yi.$ZodRealError);var iF=e=>async(t,r,i)=>{let n=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>_c.finalizeIssue(a,n,Ts.config())))}:{success:!0,data:o.value}};qe._safeParseAsync=iF;qe.safeParseAsync=(0,qe._safeParseAsync)(yi.$ZodRealError);var oF=Symbol.for("zod.compile.invalid"),aF=Symbol.for("zod.compile.fallback");qe.validate=(e,t,r)=>{let i=e._zod.bag.validator;return i!==void 0&&i(t)!==oF?!0:sF(e,t,r)};function sF(e,t,r){let i=r?{...r,async:!1}:{async:!1},n=e._zod.bag.fallbackRun,o;if(n?(i[aF]=!0,o=n({value:t,issues:[]},i)):o=e._zod.run({value:t,issues:[]},i),o instanceof Promise)throw new Ts.$ZodAsyncError;return o.issues.length===0}var cF=async(e,t,r)=>{let i=r?{...r,async:!0}:{async:!0},n=e._zod.run({value:t,issues:[]},i);return n instanceof Promise&&(n=await n),n.issues.length===0};qe.validateAsync=cF;var uF=e=>{let t=(0,qe._parse)(e),r=(i,n,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return t(i,n,s,Zd(r,a))};return r};qe._encode=uF;qe.encode=(0,qe._encode)(yi.$ZodRealError);var lF=e=>{let t=(0,qe._parse)(e),r=(i,n,o,a)=>t(i,n,o,Zd(r,a));return r};qe._decode=lF;qe.decode=(0,qe._decode)(yi.$ZodRealError);var dF=e=>{let t=(0,qe._parseAsync)(e),r=async(i,n,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return await t(i,n,s,Zd(r,a))};return r};qe._encodeAsync=dF;qe.encodeAsync=(0,qe._encodeAsync)(yi.$ZodRealError);var fF=e=>{let t=(0,qe._parseAsync)(e),r=async(i,n,o,a)=>await t(i,n,o,Zd(r,a));return r};qe._decodeAsync=fF;qe.decodeAsync=(0,qe._decodeAsync)(yi.$ZodRealError);var pF=e=>(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return(0,qe._safeParse)(e)(t,r,n)};qe._safeEncode=pF;qe.safeEncode=(0,qe._safeEncode)(yi.$ZodRealError);var mF=e=>(t,r,i)=>(0,qe._safeParse)(e)(t,r,i);qe._safeDecode=mF;qe.safeDecode=(0,qe._safeDecode)(yi.$ZodRealError);var hF=e=>async(t,r,i)=>{let n=i?{...i,direction:"backward"}:{direction:"backward"};return(0,qe._safeParseAsync)(e)(t,r,n)};qe._safeEncodeAsync=hF;qe.safeEncodeAsync=(0,qe._safeEncodeAsync)(yi.$ZodRealError);var gF=e=>async(t,r,i)=>(0,qe._safeParseAsync)(e)(t,r,i);qe._safeDecodeAsync=gF;qe.safeDecodeAsync=(0,qe._safeDecodeAsync)(yi.$ZodRealError)});var bc=te(ye=>{"use strict";var yF=ye&&ye.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),vF=ye&&ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),_F=ye&&ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&yF(t,e,r);return vF(t,e),t};Object.defineProperty(ye,"__esModule",{value:!0});ye.sha256_base64=ye.sha256_hex=ye.sha1_base64url=ye.sha1_base64=ye.sha1_hex=ye.md5_base64url=ye.md5_base64=ye.md5_hex=ye.hex=ye.uppercase=ye.lowercase=ye.undefined=ye.null=ye.boolean=ye.number=ye.integer=ye.bigint=ye.string=ye.date=ye.creditCard=ye.e164=ye.httpProtocol=ye.domain=ye.hostname=ye.base64url=ye.base64=ye.cidrv6=ye.cidrv4=ye.mac=ye.ipv6=ye.ipv4=ye.browserEmail=ye.idnEmail=ye.unicodeEmail=ye.rfc5322Email=ye.html5Email=ye.email=ye.uuid7=ye.uuid6=ye.uuid4=ye.uuid=ye.guid=ye.extendedDuration=ye.duration=ye.nanoid=ye.ksuid=ye.xid=ye.ulid=ye.cuid2=ye.cuid=void 0;ye.sha512_base64url=ye.sha512_base64=ye.sha512_hex=ye.sha384_base64url=ye.sha384_base64=ye.sha384_hex=ye.sha256_base64url=void 0;ye.nanoidOfLength=SF;ye.emoji=RF;ye.time=OF;ye.datetime=IF;var bF=_F(ze());ye.cuid=/^[cC][0-9a-z]{6,}$/;ye.cuid2=/^[0-9a-z]+$/;ye.ulid=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;ye.xid=/^[0-9a-vA-V]{20}$/;ye.ksuid=/^[A-Za-z0-9]{27}$/;ye.nanoid=/^[a-zA-Z0-9_-]{21}$/;function SF(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}ye.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;ye.extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;ye.guid=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;var wF=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;ye.uuid=wF;ye.uuid4=(0,ye.uuid)(4);ye.uuid6=(0,ye.uuid)(6);ye.uuid7=(0,ye.uuid)(7);ye.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;ye.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;ye.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;ye.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u;ye.idnEmail=ye.unicodeEmail;ye.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;var $F="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function RF(){return new RegExp($F,"u")}ye.ipv4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;ye.ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var EF=e=>{let t=bF.escapeRegex(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)};ye.mac=EF;ye.cidrv4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;ye.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;ye.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;ye.base64url=/^[A-Za-z0-9_-]*$/;ye.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;ye.domain=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/;ye.httpProtocol=/^https?$/;ye.e164=/^\+[1-9]\d{6,14}$/;ye.creditCard=/^\d(?:[ -]?\d){11,18}$/;var gR="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function PF(e){return new RegExp(`^${e}$`)}ye.date=PF(gR);function Py(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function OF(e){return new RegExp(`^${Py(e)}$`)}function IF(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Py({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${r}|${Py({precision:e.precision})}`:r;return new RegExp(`^${gR}T(?:${i})$`)}var CF=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};ye.string=CF;ye.bigint=/^-?\d+n?$/;ye.integer=/^-?\d+$/;ye.number=/^-?\d+(?:\.\d+)?$/;ye.boolean=/^(?:true|false)$/i;var TF=/^null$/i;ye.null=TF;var kF=/^undefined$/i;ye.undefined=kF;ye.lowercase=/^[^A-Z]*$/;ye.uppercase=/^[^a-z]*$/;ye.hex=/^[0-9a-fA-F]*$/;function Vu(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Fu(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}ye.md5_hex=/^[0-9a-fA-F]{32}$/;ye.md5_base64=Vu(22,"==");ye.md5_base64url=Fu(22);ye.sha1_hex=/^[0-9a-fA-F]{40}$/;ye.sha1_base64=Vu(27,"=");ye.sha1_base64url=Fu(27);ye.sha256_hex=/^[0-9a-fA-F]{64}$/;ye.sha256_base64=Vu(43,"=");ye.sha256_base64url=Fu(43);ye.sha384_hex=/^[0-9a-fA-F]{96}$/;ye.sha384_base64=Vu(64,"");ye.sha384_base64url=Fu(64);ye.sha512_hex=/^[0-9a-fA-F]{128}$/;ye.sha512_base64=Vu(86,"==");ye.sha512_base64url=Fu(86)});var Bd=te(Fe=>{"use strict";var jF=Fe&&Fe.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),AF=Fe&&Fe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Oy=Fe&&Fe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&jF(t,e,r);return AF(t,e),t};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.$ZodCheckOverwrite=Fe.$ZodCheckMimeType=Fe.$ZodCheckProperty=Fe.$ZodCheckEndsWith=Fe.$ZodCheckStartsWith=Fe.$ZodCheckIncludes=Fe.$ZodCheckUpperCase=Fe.$ZodCheckLowerCase=Fe.$ZodCheckRegex=Fe.$ZodCheckStringFormat=Fe.$ZodCheckLengthEquals=Fe.$ZodCheckMinLength=Fe.$ZodCheckMaxLength=Fe.$ZodCheckSizeEquals=Fe.$ZodCheckMinSize=Fe.$ZodCheckMaxSize=Fe.$ZodCheckBigIntFormat=Fe.$ZodCheckNumberFormat=Fe.$ZodCheckMultipleOf=Fe.$ZodCheckGreaterThan=Fe.$ZodCheckLessThan=Fe.$ZodCheck=void 0;var Sr=Oy(os()),Iy=Oy(bc()),Yr=Oy(ze());Fe.$ZodCheck=Sr.$constructor("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Cy=e=>{let t=e.value;return!Yr.nullish(t)&&t.size!==void 0},Ty=e=>{let t=e.value;return!Yr.nullish(t)&&t.length!==void 0},Hd={number:"number",bigint:"bigint",object:"date"};Fe.$ZodCheckLessThan=Sr.$constructor("$ZodCheckLessThan",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=Hd[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:Hd[typeof i.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});Fe.$ZodCheckGreaterThan=Sr.$constructor("$ZodCheckGreaterThan",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=Hd[typeof t.value];e._zod.onattach.push(i=>{let n=i._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:Hd[typeof i.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}});Fe.$ZodCheckMultipleOf=Sr.$constructor("$ZodCheckMultipleOf",(e,t)=>{Fe.$ZodCheck.init(e,t),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Yr.floatSafeRemainder(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}});Fe.$ZodCheckNumberFormat=Sr.$constructor("$ZodCheckNumberFormat",(e,t)=>{Fe.$ZodCheck.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,o]=Yr.NUMBER_FORMAT_RANGES[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=n,s.maximum=o,r&&(s.pattern=Iy.integer)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}});Fe.$ZodCheckBigIntFormat=Sr.$constructor("$ZodCheckBigIntFormat",(e,t)=>{Fe.$ZodCheck.init(e,t);let[r,i]=Yr.BIGINT_FORMAT_RANGES[t.format];e._zod.onattach.push(n=>{let o=n._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i}),e._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});Fe.$ZodCheckMaxSize=Sr.$constructor("$ZodCheckMaxSize",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Cy),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value;n.size<=t.maximum||i.issues.push({origin:Yr.getSizableOrigin(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}});Fe.$ZodCheckMinSize=Sr.$constructor("$ZodCheckMinSize",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Cy),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value;n.size>=t.minimum||i.issues.push({origin:Yr.getSizableOrigin(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}});Fe.$ZodCheckSizeEquals=Sr.$constructor("$ZodCheckSizeEquals",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Cy),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=i=>{let n=i.value,o=n.size;if(o===t.size)return;let a=o>t.size;i.issues.push({origin:Yr.getSizableOrigin(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});Fe.$ZodCheckMaxLength=Sr.$constructor("$ZodCheckMaxLength",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Ty),e._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>t.maximum?Yr.codePointLength(n):o)<=t.maximum)return;let s=Yr.getLengthableOrigin(n);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}});Fe.$ZodCheckMinLength=Sr.$constructor("$ZodCheckMinLength",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Ty),e._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let n=i.value,o=n.length;if((typeof n=="string"&&o>=t.minimum&&o<t.minimum*2?Yr.codePointLength(n):o)>=t.minimum)return;let s=Yr.getLengthableOrigin(n);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}});Fe.$ZodCheckLengthEquals=Sr.$constructor("$ZodCheckLengthEquals",(e,t)=>{var r;Fe.$ZodCheck.init(e,t),(r=e._zod.def).when??(r.when=Ty),e._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=i=>{let n=i.value,o=n.length,a=typeof n=="string"&&o>=t.length&&o<=t.length*2?Yr.codePointLength(n):o;if(a===t.length)return;let s=Yr.getLengthableOrigin(n),c=a>t.length;i.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}});Fe.$ZodCheckStringFormat=Sr.$constructor("$ZodCheckStringFormat",(e,t)=>{var r,i;Fe.$ZodCheck.init(e,t),e._zod.onattach.push(n=>{let o=n._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})});Fe.$ZodCheckRegex=Sr.$constructor("$ZodCheckRegex",(e,t)=>{Fe.$ZodCheckStringFormat.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});Fe.$ZodCheckLowerCase=Sr.$constructor("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Iy.lowercase),Fe.$ZodCheckStringFormat.init(e,t)});Fe.$ZodCheckUpperCase=Sr.$constructor("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Iy.uppercase),Fe.$ZodCheckStringFormat.init(e,t)});Fe.$ZodCheckIncludes=Sr.$constructor("$ZodCheckIncludes",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=Yr.escapeRegex(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=i,e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}});Fe.$ZodCheckStartsWith=Sr.$constructor("$ZodCheckStartsWith",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=new RegExp(`^${Yr.escapeRegex(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}});Fe.$ZodCheckEndsWith=Sr.$constructor("$ZodCheckEndsWith",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=new RegExp(`.*${Yr.escapeRegex(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function yR(e,t,r){e.issues.length&&t.issues.push(...Yr.prefixIssues(r,e.issues))}Fe.$ZodCheckProperty=Sr.$constructor("$ZodCheckProperty",(e,t)=>{Fe.$ZodCheck.init(e,t),e._zod.check=r=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>yR(n,r,t.property));yR(i,r,t.property)}});Fe.$ZodCheckMimeType=Sr.$constructor("$ZodCheckMimeType",(e,t)=>{Fe.$ZodCheck.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}});Fe.$ZodCheckOverwrite=Sr.$constructor("$ZodCheckOverwrite",(e,t)=>{Fe.$ZodCheck.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var Wd=te(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.Doc=void 0;var ky=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
39
39
|
`).filter(a=>a),n=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
40
40
|
${r.join(`
|