efficient-shell 12.33.0 → 12.34.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.
Files changed (38) hide show
  1. package/dist/{Browser-TYVPZ2NT.js → Browser-SBOULR4U.js} +15 -15
  2. package/dist/{Files-VUZWJMCE.js → Files-UYO4JLEB.js} +79 -79
  3. package/dist/{Notepad-LXLUGQUN.js → Notepad-C44EOSDD.js} +8 -8
  4. package/dist/{Preview-VRYWLVJY.js → Preview-32K62K27.js} +14 -14
  5. package/dist/ai/index.js +1 -1
  6. package/dist/apps/index.js +1 -1
  7. package/dist/bin/media-host-check.js +1 -1
  8. package/dist/bin/ui-check.js +1 -1
  9. package/dist/charts/PieChart.js +1 -1
  10. package/dist/charts/RadarChart.js +1 -1
  11. package/dist/charts/RadialBarChart.js +1 -1
  12. package/dist/charts/SpecChart.js +1 -1
  13. package/dist/charts/TimeSeriesChart.js +1 -1
  14. package/dist/chunk-56UUJIC4.js +1 -0
  15. package/dist/{chunk-DYOFTZOC.js → chunk-CUJA3HBZ.js} +2 -2
  16. package/dist/{chunk-JTMR3EH3.js → chunk-JZY2RBPX.js} +6 -6
  17. package/dist/{chunk-E6PDAYBR.js → chunk-O5UD3ZWM.js} +4 -4
  18. package/dist/{chunk-XBX3N3VG.js → chunk-OMD5FXGO.js} +2 -2
  19. package/dist/{chunk-DGFFDZCY.js → chunk-OZV5P5A7.js} +5 -5
  20. package/dist/{chunk-XYMEC63O.js → chunk-RUOM4KKK.js} +1 -1
  21. package/dist/{chunk-KZQRUVII.js → chunk-TZBNN6HD.js} +5 -5
  22. package/dist/{chunk-EEFUXXYJ.js → chunk-UF76AFFY.js} +13 -13
  23. package/dist/{chunk-WKWZILZA.js → chunk-VRRPYADW.js} +2 -2
  24. package/dist/{chunk-LPAOHDUE.js → chunk-WAKWESOR.js} +1 -1
  25. package/dist/{chunk-APGIPXR7.js → chunk-YHABPVWU.js} +2 -2
  26. package/dist/data/Gantt.js +1 -1
  27. package/dist/forms/BrandAssetEditor.js +1 -1
  28. package/dist/forms/MediaLibrary.js +1 -1
  29. package/dist/icons/index.js +1 -1
  30. package/dist/index.js +85 -85
  31. package/dist/shell/LanguageSelect.js +1 -1
  32. package/dist/shell/SettingRow.js +1 -1
  33. package/dist/telemetry/index.js +1 -1
  34. package/dist/templates/DashboardTemplate.js +1 -1
  35. package/dist/ui/index.js +1 -1
  36. package/dist/version.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-LSONG4QV.js +0 -1
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as e}from"module";import{join as n}from"path";import{existsSync as t,readFileSync as i,readdirSync as r}from"fs";var o=/[.+^$()|[\]\\]/g;function s(e){let n="",t=0;for(let i=0;i<e.length;i++){const r=e[i];"*"===r?"*"===e[i+1]?"/"===e[i+2]?(n+="(?:[^/]+/)*",i+=2):(n+=".*",i+=1):n+="[^/]*":"?"===r?n+="[^/]":"{"===r?(n+="(?:",t+=1):"}"===r&&t>0?(n+=")",t-=1):n+=","===r&&t>0?"|":r.replace(o,"\\$&")}if(0!==t)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${n}$`)}function a(e){const n=e.map(s);return e=>n.some(n=>n.test(e))}var c=new Set(["node_modules",".git"]),g=new Set(["dist","coverage",".next",".turbo"]);function l(e){const n=e.search(/[*?{]/),t=-1===n?e:e.slice(0,n),i=t.lastIndexOf("/");return-1===i?"":t.slice(0,i)}function u(e,t){const i=a(t),o=[...new Set(t.map(l))].sort(),s=o.filter(e=>!o.some(n=>n!==e&&(""===n||e.startsWith(`${n}/`)))),u=new Set,d=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?c.has(e.name)||""===t&&g.has(e.name)||d(n):e.isFile()&&i(n)&&u.add(n)}};for(const e of s)d(e);return[...u].sort(h)}var h=(e,n)=>e<n?-1:e>n?1:0,d={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"]}};new Set((d.busy?.words??[]).map(e=>e.toLowerCase()));var f=class extends Error{},m=new Set(["$schema","schema","include","exclude","allow"]),p=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),w=e=>"string"==typeof e&&""!==e.trim();var y="d3as2htf4hwbtr.cloudfront.net",S={dealer:{bucket:"inovit-dealer-portal-assets",hosts:["d201q0i87q901p.cloudfront.net"],key_pattern:"^marketing/"},media:{bucket:"regis-media-production",hosts:["media.regis.design","d21nnr9ivf9hcc.cloudfront.net"],key_pattern:"^[a-z0-9_]+/storefront/(?!uploads/thumbs/)"},site:{bucket:"inovit-ecommerce-media",hosts:["cdn.inovit.com","dhxlibd8r3td0.cloudfront.net"],key_pattern:"^images/"}},$=Object.values(S),R=Object.freeze([...new Set([...$.flatMap(e=>e.hosts),y,...$.map(e=>e.bucket)])].sort()),b=new RegExp([...R.map(e=>{return`(?<![\\w-])${n=e,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w-])`;var n}),"(?<![\\w-])[a-z0-9]+\\.cloudfront\\.net(?![\\w-])","(?<![\\w-])(?:[a-z0-9-]+\\.)*s3(?:[.-][a-z0-9-]+)*\\.amazonaws\\.com(?![\\w-])","s3://"].join("|"),"gi");function k(e,n,t){const i=e.createSourceFile(n,t,e.ScriptTarget.Latest,!0,function(e,n){return n.endsWith(".tsx")?e.ScriptKind.TSX:n.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(n)?e.ScriptKind.JS:e.ScriptKind.TS}(e,n)),r=[],o=(e,n)=>{const t=i.getLineAndCharacterOfPosition(e.getStart(i)).line+1;for(const e of function(e){return[...e.matchAll(b)].map(e=>({match:e[0],index:e.index??0}))}(n)){const i=n.slice(0,e.index);r.push({line:t+(i.match(/\n/g)?.length??0),match:e.match})}},s=n=>{e.isStringLiteral(n)||e.isNoSubstitutionTemplateLiteral(n)||e.isTemplateHead(n)||e.isTemplateMiddle(n)||e.isTemplateTail(n)?o(n,n.text):e.isRegularExpressionLiteral(n)&&o(n,n.text.replace(/\\(.)/g,"$1")),e.forEachChild(n,s)};return s(i),r}var v="media-host-check.config.json",x="efficient-shell-media-host-check",C=`${x}: no code writes a media origin; files are reached through the storage backend, the API's URL, media() or imageCopyUrl() (harness API-15, SSOT-2).\n\n ${x} check this repository; exits 1 on a finding\n ${x} --json print the result as JSON\n\nRefused in any string, template or regular expression: every host and bucket in\nthe image-copies contract, any *.cloudfront.net host, any S3 endpoint, and s3://.\nReads ${v} in the current directory.`;function A(e,t,r){const o=[],s=a(r.exclude);for(const e of r.include)0===u(t,[e]).length&&o.push(`include "${e}" matches no file; delete it`);const c=u(t,r.include).filter(e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!s(e)),g=[];for(const r of c)for(const o of k(e,r,i(n(t,r),"utf8")))g.push({file:r,...o});const l=(e,n)=>e.toLowerCase()===n.toLowerCase();for(const e of r.allow)g.some(n=>n.file===e.file&&l(e.match,n.match))||o.push(`allow ${e.file} "${e.match}" matches nothing any more; delete it`);return{files:c.length,findings:g.filter(e=>!(e=>r.allow.some(n=>n.file===e.file&&l(n.match,e.match)))(e)),problems:o}}process.exitCode=function(e,r){let o=!1;for(const n of e){if("--help"===n||"-h"===n)return r.out(C),0;if("--version"===n||"-v"===n)return r.out(r.version),0;if("--json"!==n)return r.err(`${x}: unknown argument "${n}"\n\n${C}`),2;o=!0}const s=n(r.cwd,v);if(!t(s))return r.err(`${x}: no ${v} in ${r.cwd}. Run it from the repository root.`),2;let a;try{const e=function(e,n="media-host-check.config.json"){const t=[];if(!p(e))throw new f(`${n}: expected an object`);for(const n of Object.keys(e))m.has(n)||t.push(`unknown key "${n}"`);1!==e.schema&&t.push('"schema" must be 1');const i=(n,i)=>{const r=e[n];return void 0!==r||i?!Array.isArray(r)||!r.every(w)||i&&0===r.length?(t.push(`"${n}" must be ${i?"a non-empty":"an"} array of globs`),[]):r:[]},r=i("include",!0),o=i("exclude",!1),s=[];void 0===e.allow||Array.isArray(e.allow)||t.push('"allow" must be an array');for(const[n,i]of(Array.isArray(e.allow)?e.allow:[]).entries()){if(!(p(i)&&w(i.file)&&w(i.match)&&w(i.reason))){t.push(`allow[${n}] needs "file", "match" and "reason", each a non-empty string`);continue}const e=Object.keys(i).filter(e=>!["file","match","reason"].includes(e));e.length&&t.push(`allow[${n}] has unknown keys: ${e.join(", ")}`),s.push({file:i.file,match:i.match,reason:i.reason})}if(t.length)throw new f(`${n}:\n ${t.join("\n ")}`);return{schema:1,include:r,exclude:o,allow:s}}(JSON.parse(i(s,"utf8")),v);a=A(r.loadTypeScript(),r.cwd,e)}catch(e){return r.err(`${x}: ${e instanceof f||e instanceof SyntaxError?e.message:String(e)}`),2}const c=a.findings.length>0||a.problems.length>0;if(o)return r.out(JSON.stringify({ok:!c,...a},null,2)),c?1:0;if(!c)return r.out(`${x}: ${a.files} files, no media origin written in code (harness API-15, SSOT-2).`),0;for(const e of a.findings)r.err(`${e.file}:${e.line} "${e.match}" is a media origin written in code.`);for(const e of a.problems)r.err(`${v}: ${e}`);return a.findings.length&&r.err(`\nReach the file through the storage backend, the URL the API returns, media() or imageCopyUrl() (harness API-15, SSOT-2). An origin that must stay goes in "allow" in ${v}, with its reason.`),1}(process.argv.slice(2),{cwd:process.cwd(),out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(t){for(const i of[n(process.cwd(),"package.json"),t])try{return e(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),version:"12.33.0"});
2
+ import{createRequire as e}from"module";import{join as n}from"path";import{existsSync as t,readFileSync as i,readdirSync as r}from"fs";var o=/[.+^$()|[\]\\]/g;function s(e){let n="",t=0;for(let i=0;i<e.length;i++){const r=e[i];"*"===r?"*"===e[i+1]?"/"===e[i+2]?(n+="(?:[^/]+/)*",i+=2):(n+=".*",i+=1):n+="[^/]*":"?"===r?n+="[^/]":"{"===r?(n+="(?:",t+=1):"}"===r&&t>0?(n+=")",t-=1):n+=","===r&&t>0?"|":r.replace(o,"\\$&")}if(0!==t)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${n}$`)}function a(e){const n=e.map(s);return e=>n.some(n=>n.test(e))}var c=new Set(["node_modules",".git"]),g=new Set(["dist","coverage",".next",".turbo"]);function l(e){const n=e.search(/[*?{]/),t=-1===n?e:e.slice(0,n),i=t.lastIndexOf("/");return-1===i?"":t.slice(0,i)}function u(e,t){const i=a(t),o=[...new Set(t.map(l))].sort(),s=o.filter(e=>!o.some(n=>n!==e&&(""===n||e.startsWith(`${n}/`)))),u=new Set,d=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?c.has(e.name)||""===t&&g.has(e.name)||d(n):e.isFile()&&i(n)&&u.add(n)}};for(const e of s)d(e);return[...u].sort(h)}var h=(e,n)=>e<n?-1:e>n?1:0,d={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"]}};new Set((d.busy?.words??[]).map(e=>e.toLowerCase()));var f=class extends Error{},m=new Set(["$schema","schema","include","exclude","allow"]),p=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),w=e=>"string"==typeof e&&""!==e.trim();var y="d3as2htf4hwbtr.cloudfront.net",S={dealer:{bucket:"inovit-dealer-portal-assets",hosts:["d201q0i87q901p.cloudfront.net"],key_pattern:"^marketing/"},media:{bucket:"regis-media-production",hosts:["media.regis.design","d21nnr9ivf9hcc.cloudfront.net"],key_pattern:"^[a-z0-9_]+/storefront/(?!uploads/thumbs/)"},site:{bucket:"inovit-ecommerce-media",hosts:["cdn.inovit.com","dhxlibd8r3td0.cloudfront.net"],key_pattern:"^images/"}},$=Object.values(S),R=Object.freeze([...new Set([...$.flatMap(e=>e.hosts),y,...$.map(e=>e.bucket)])].sort()),b=new RegExp([...R.map(e=>{return`(?<![\\w-])${n=e,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w-])`;var n}),"(?<![\\w-])[a-z0-9]+\\.cloudfront\\.net(?![\\w-])","(?<![\\w-])(?:[a-z0-9-]+\\.)*s3(?:[.-][a-z0-9-]+)*\\.amazonaws\\.com(?![\\w-])","s3://"].join("|"),"gi");function k(e,n,t){const i=e.createSourceFile(n,t,e.ScriptTarget.Latest,!0,function(e,n){return n.endsWith(".tsx")?e.ScriptKind.TSX:n.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(n)?e.ScriptKind.JS:e.ScriptKind.TS}(e,n)),r=[],o=(e,n)=>{const t=i.getLineAndCharacterOfPosition(e.getStart(i)).line+1;for(const e of function(e){return[...e.matchAll(b)].map(e=>({match:e[0],index:e.index??0}))}(n)){const i=n.slice(0,e.index);r.push({line:t+(i.match(/\n/g)?.length??0),match:e.match})}},s=n=>{e.isStringLiteral(n)||e.isNoSubstitutionTemplateLiteral(n)||e.isTemplateHead(n)||e.isTemplateMiddle(n)||e.isTemplateTail(n)?o(n,n.text):e.isRegularExpressionLiteral(n)&&o(n,n.text.replace(/\\(.)/g,"$1")),e.forEachChild(n,s)};return s(i),r}var v="media-host-check.config.json",x="efficient-shell-media-host-check",C=`${x}: no code writes a media origin; files are reached through the storage backend, the API's URL, media() or imageCopyUrl() (harness API-15, SSOT-2).\n\n ${x} check this repository; exits 1 on a finding\n ${x} --json print the result as JSON\n\nRefused in any string, template or regular expression: every host and bucket in\nthe image-copies contract, any *.cloudfront.net host, any S3 endpoint, and s3://.\nReads ${v} in the current directory.`;function A(e,t,r){const o=[],s=a(r.exclude);for(const e of r.include)0===u(t,[e]).length&&o.push(`include "${e}" matches no file; delete it`);const c=u(t,r.include).filter(e=>(e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"))(e)&&!s(e)),g=[];for(const r of c)for(const o of k(e,r,i(n(t,r),"utf8")))g.push({file:r,...o});const l=(e,n)=>e.toLowerCase()===n.toLowerCase();for(const e of r.allow)g.some(n=>n.file===e.file&&l(e.match,n.match))||o.push(`allow ${e.file} "${e.match}" matches nothing any more; delete it`);return{files:c.length,findings:g.filter(e=>!(e=>r.allow.some(n=>n.file===e.file&&l(n.match,e.match)))(e)),problems:o}}process.exitCode=function(e,r){let o=!1;for(const n of e){if("--help"===n||"-h"===n)return r.out(C),0;if("--version"===n||"-v"===n)return r.out(r.version),0;if("--json"!==n)return r.err(`${x}: unknown argument "${n}"\n\n${C}`),2;o=!0}const s=n(r.cwd,v);if(!t(s))return r.err(`${x}: no ${v} in ${r.cwd}. Run it from the repository root.`),2;let a;try{const e=function(e,n="media-host-check.config.json"){const t=[];if(!p(e))throw new f(`${n}: expected an object`);for(const n of Object.keys(e))m.has(n)||t.push(`unknown key "${n}"`);1!==e.schema&&t.push('"schema" must be 1');const i=(n,i)=>{const r=e[n];return void 0!==r||i?!Array.isArray(r)||!r.every(w)||i&&0===r.length?(t.push(`"${n}" must be ${i?"a non-empty":"an"} array of globs`),[]):r:[]},r=i("include",!0),o=i("exclude",!1),s=[];void 0===e.allow||Array.isArray(e.allow)||t.push('"allow" must be an array');for(const[n,i]of(Array.isArray(e.allow)?e.allow:[]).entries()){if(!(p(i)&&w(i.file)&&w(i.match)&&w(i.reason))){t.push(`allow[${n}] needs "file", "match" and "reason", each a non-empty string`);continue}const e=Object.keys(i).filter(e=>!["file","match","reason"].includes(e));e.length&&t.push(`allow[${n}] has unknown keys: ${e.join(", ")}`),s.push({file:i.file,match:i.match,reason:i.reason})}if(t.length)throw new f(`${n}:\n ${t.join("\n ")}`);return{schema:1,include:r,exclude:o,allow:s}}(JSON.parse(i(s,"utf8")),v);a=A(r.loadTypeScript(),r.cwd,e)}catch(e){return r.err(`${x}: ${e instanceof f||e instanceof SyntaxError?e.message:String(e)}`),2}const c=a.findings.length>0||a.problems.length>0;if(o)return r.out(JSON.stringify({ok:!c,...a},null,2)),c?1:0;if(!c)return r.out(`${x}: ${a.files} files, no media origin written in code (harness API-15, SSOT-2).`),0;for(const e of a.findings)r.err(`${e.file}:${e.line} "${e.match}" is a media origin written in code.`);for(const e of a.problems)r.err(`${v}: ${e}`);return a.findings.length&&r.err(`\nReach the file through the storage backend, the URL the API returns, media() or imageCopyUrl() (harness API-15, SSOT-2). An origin that must stay goes in "allow" in ${v}, with its reason.`),1}(process.argv.slice(2),{cwd:process.cwd(),out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(t){for(const i of[n(process.cwd(),"package.json"),t])try{return e(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),version:"12.34.0"});
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as o,writeFileSync as s,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label","colour"],l=e=>"string"==typeof e&&a.includes(e),c=["kit-dep","chart-dep"],d=e=>c.includes(e),u=a.filter(e=>!d(e)),h={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a colour role from efficient-shell: its utility or var(--role), COLOUR_ROLES lists them (harness FT-1; the colour kind counts palette classes too)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'},colour:{counts:"a literal colour, in a script string or a stylesheet: a hex, an rgb() / hsl() / oklch() value, a Tailwind palette class (a hue and a step, or white / black), a --color-<hue>-<step> variable, or a named colour in a colour property — a var() fallback included",instead:"a colour role from efficient-shell: its utility (the text, background or border utility of ink, ink-faint, surface, line, accent-fill, accent-text, danger-text, status-danger-line …) or var(--role); COLOUR_ROLES lists them. A merchant site reads the site theme (owner ruling 2026-10-23)"}},p=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],f=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],g=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],m={"efficient-shell":["@headlessui/react"]};function w(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function k(e){return w(e,f)?"icon":w(e,p)?"kit":w(e,g)?"chart":null}function x(e){const t=k(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var b=/[.+^$()|[\]\\]/g;function $(e){let t="",n=0;for(let i=0;i<e.length;i++){const o=e[i];"*"===o?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===o?t+="[^/]":"{"===o?(t+="(?:",n+=1):"}"===o&&n>0?(t+=")",n-=1):t+=","===o&&n>0?"|":o.replace(b,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function y(e){const t=e.map($);return e=>t.some(t=>t.test(e))}var v=new Set(["node_modules",".git"]),S=new Set(["dist","coverage",".next",".turbo"]);function j(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function I(e,t){const i=y(t),o=[...new Set(t.map(j))].sort(),s=o.filter(e=>!o.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?v.has(e.name)||""===t&&S.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)l(e);return[...a].sort(L)}var L=(e,t)=>e<t?-1:e>t?1:0,R=class extends Error{},A=(e,t)=>`${e}:${t}`;function z(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var E=e=>a.indexOf(e);function C(e,t){const n=z(e),i=z(t);return L(n.file,i.file)||E(n.kind)-E(i.kind)}function T(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new R(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new R(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const o=n;if(1!==o.schema)return i("number"==typeof o.schema&&o.schema>1?`"schema": ${o.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(o.kinds)||o.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const s=o.kinds.filter(l);if("object"!=typeof o.counts||null===o.counts||Array.isArray(o.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(o.counts)){const{file:n,kind:o}=z(e);if(!n||!o)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(o)&&r.set(e,t)}return{kinds:s,counts:r}}function M(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(C).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function B(e){const t={};for(const[n,i]of e){const{kind:e}=z(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var P=class extends Error{},O=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),D=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var N="package.json",F=[2,4,8,12,16,20,24,32,40,48];function J(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&F.includes(4*t)}var U=new Set(["iframe","frame","object","embed"]),W=new Set(["href","xlinkHref","to","id","key","htmlFor"]),q=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,_=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,G=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,K=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,H=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,Q=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,V=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,X=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Z=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,Y=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,ee=new Set([0,...F]),te=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,ne="slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose",ie="(?:50|[1-9]00|950)",oe=new RegExp(`(?<![\\w-])(?:bg|text|border(?:-[xytrblse])?|ring(?:-offset)?|inset-ring|outline|divide|fill|stroke|from|via|to|shadow|inset-shadow|drop-shadow|accent|caret|decoration|placeholder)-(?:(?:${ne})-${ie}|white|black)(?:\\/[\\w.]+)?(?![\\w-])`,"g"),se=new RegExp(`--color-(?:(?:${ne})-${ie}|white|black)(?![\\w-])`,"g"),re=/(?<![\w-])(?:rgba?|hsla?|hwb|oklch|oklab|lab|lch)\(\s*[\d.]/g,ae=/(?<![\w-])(?:white|black|red|green|blue|yellow|orange|purple|pink|gray|grey|silver|maroon|navy|teal|olive|lime|aqua|fuchsia|brown|gold|beige|ivory|tan|crimson|coral|salmon|indigo|violet)(?![\w-])/gi,le=/^(?:color|background(?:Color)?|border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Color)?|outline(?:Color)?|fill|stroke|caretColor|accentColor|textDecorationColor|boxShadow|textShadow)$/,ce=/(?<![&a-zA-Z0-9])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,de=e=>[...e.matchAll(ce)].length+[...e.matchAll(re)].length+[...e.matchAll(oe)].length+[...e.matchAll(se)].length,ue=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),he=/(?:…|\.\.\.|&hellip;)\s*$/,pe=new RegExp("\\p{L}","u"),fe=new RegExp("\\p{L}[\\p{L}-]*","u"),ge={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},me=new Set((ge.busy?.words??[]).map(e=>e.toLowerCase())),we=new Set(["label","aria-label",...ge.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),ke=(e,t)=>{if(!he.test(t)||!pe.test(e))return!1;const n=e.match(fe)?.[0]?.toLowerCase();if(n&&me.has(n))return!1;const i=e.replace(he,"").trim(),o=ge.busy;return!(o&&(o.zhStarts.some(e=>i.startsWith(e))||o.zhEnds.some(e=>i.endsWith(e))))},xe=new Set(["confirm","alert","prompt"]),be=new Set(["window","globalThis","self"]);var $e=e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"),ye=e=>/\.(?:css|scss)$/.test(e),ve=/^(?:color|background(?:-color)?|border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-color)?|outline(?:-color)?|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|box-shadow|text-shadow|column-rule(?:-color)?)$/;function Se(e,t){if(!t.includes("colour"))return{};const n=e.replace(/\/\*[\s\S]*?\*\//g,e=>e.replace(/[^\n]/g," ")),i=[],o=e=>n.slice(0,e).split("\n").length;let s=0,r=0;for(let e=0;e<n.length;e++){const t=n[e];if("{"===t||"}"===t||";"===t){const a=n.slice(r,e);if("{"!==t&&s>0){const e=r+(a.length-a.trimStart().length),t=a.trim(),n=t.indexOf(":");if(t.startsWith("@apply"))for(let n=[...t.matchAll(oe)].length;n>0;n--)i.push(o(e));else if(n>0){const s=t.slice(0,n).trim().toLowerCase(),r=t.slice(n+1);if(!/^(?:-webkit-)?mask/.test(s)){const t=de(r)+(ve.test(s)?[...r.matchAll(ae)].length:0);for(let n=0;n<t;n++)i.push(o(e))}}}"{"===t?s++:"}"===t&&(s=Math.max(0,s-1)),r=e+1}}return i.length?{colour:i}:{}}function je(e,t,n,i,o){const s=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=e=>r.getLineAndCharacterOfPosition(e).line+1,d=(e,t)=>{s.has(e)&&(a[e]??=[]).push(c(t.getStart(r)))},u=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},p=new Set;if(s.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))xe.has(n.text)&&p.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const f=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,g=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&o?.add(e);const n=e?k(e):null;n&&d(n,t)},m=(e,t,n)=>{if(s.has("dark"))for(const n of e.matchAll(te))d("dark",t);if(s.has("radius"))for(const n of e.matchAll(_))K.test(n[1].trim())||d("radius",t);if(n&&l&&s.has("hex"))for(const n of e.matchAll(q))d("hex",t);if(n&&s.has("colour"))for(let n=de(e);n>0;n--)d("colour",t);if(s.has("spacing"))for(const n of e.matchAll(H)){const e=n[1];(e.startsWith("[")?Z.test(e.slice(1,-1).trim()):J(e))||d("spacing",t)}if(s.has("font-size"))for(const n of e.matchAll(Q))d("font-size",t);if(s.has("z-index"))for(const n of e.matchAll(V)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&d("z-index",t)}if(s.has("shadow"))for(const n of e.matchAll(X))n[1].startsWith("[")&&Z.test(n[1].slice(1,-1).trim())||d("shadow",t)},w=(t,n,i)=>{const o=e.isStringLiteralLike(n)?n.text.trim():void 0;if(s.has("colour")&&void 0!==o&&le.test(t))for(const e of o.matchAll(ae))d("colour",i);if(s.has("spacing")&&Y.test(t))e.isNumericLiteral(n)?ee.has(Number(n.text))||d("spacing",i):void 0!==o&&!Z.test(o)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(o).some(e=>!ee.has(e))&&d("spacing",i);else if(s.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==o&&!Z.test(o)&&!/^(?:smaller|larger)$/.test(o))&&d("font-size",i);else if(s.has("z-index")&&"zIndex"===t){const t=[],o=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,o)};o(n);for(const e of t)e>30&&d("z-index",i)}else s.has("shadow")&&"boxShadow"===t&&(void 0===o||""===o||Z.test(o)||d("shadow",i))},x=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(/^[a-z]/.test(e)){const n=h(u(t,"type"));"svg"===e&&d("svg",t),"button"===e?d("button",t):"select"===e?d("select",t):"textarea"===e?d("textarea",t):"input"===e&&("range"===n?d("range",t):"hidden"!==n&&d("input",t));const i=h(u(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||d("dialog",t),!U.has(e)&&u(t,"title")&&d("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?d("portal",t):xe.has(n.text)&&!p.has(n.text)?d("native",t):"require"===n.text&&g(f(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?d("portal",t):xe.has(n.name.text)&&e.isIdentifier(n.expression)&&be.has(n.expression.text)&&d("native",t):n.kind===e.SyntaxKind.ImportKeyword&&g(f(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void g(f(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;w(n,i,t),s.has("radius")&&G.test(n)&&(e.isNumericLiteral(i)?K.test(i.text)||d("radius",t):e.isStringLiteralLike(i)&&!K.test(i.text.trim())&&d("radius",t))}else if(e.isStringLiteralLike(t))m(t.text,t,n);else if(e.isTemplateExpression(t)){m(t.head.text,t.head,n);for(const e of t.templateSpans)m(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&W.has(t.name.getText(r))?e.forEachChild(t,e=>x(e,!1)):e.forEachChild(t,e=>x(e,n))};return x(r,!0),s.has("ellipsis-label")&&function(e,t,n){const i=new Set,o=(e,t)=>{i.has(e)||(i.add(e),n(t))},s=n=>{if(n)if(e.isStringLiteralLike(n))ke(n.text,n.text)&&o(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];ke(e.join(" "),e[e.length-1])&&o(n,n.getStart(t))}else e.isConditionalExpression(n)?(s(n.whenTrue),s(n.whenFalse)):e.isBinaryExpression(n)?(s(n.left),s(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?s(n.expression):e.isCallExpression(n)&&Ie.has(Le(n.expression))&&n.arguments[0]&&s(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);ke(e,e)&&o(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?s(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const o=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),s=o?.initializer;return s&&e.isStringLiteral(s)?s.text:s&&e.isJsxExpression(s)&&s.expression&&e.isStringLiteralLike(s.expression)?s.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),o="option"===i&&ge.prompt&&""===a(e,"value");ue.has(i)&&!o&&r(n.children)}else if(e.isJsxAttribute(n))we.has(n.name.getText(t))&&s(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=ge.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);we.has(t)&&!i&&s(n.initializer)}e.forEachChild(n,c)};c(t)}(e,r,e=>(a["ellipsis-label"]??=[]).push(c(e))),a}var Ie=new Set(["say","t"]),Le=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function Re(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function Ae(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),o=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text);return o}var ze=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var Ee=e=>new Map(e.allow.map(e=>[A(e.file,e.kind),e.count]));function Ce(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var Te=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function Me(e,t,n){const i=Ee(e),o=new Map;for(const[e,s]of t.counts){const{kind:t}=z(e);if(!l(t)||!n.includes(t))continue;const r=s-(i.get(e)??0);r>0&&o.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:o}}function Be(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var Pe="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",Oe={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5,colour:8},De={kit:1,dark:1,portal:1,radius:2,chart:1,colour:2},Ne=(...e)=>e.join("-"),Fe=`\nconst s1 = <i className="${[Ne("px","2.5"),Ne("py","1.5"),"md:"+Ne("gap","1.5"),"-"+Ne("mt","1.5"),Ne("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[Ne("p","0"),Ne("px","px"),Ne("p","0.5"),Ne("p","3"),Ne("gap-x","4"),Ne("p","12"),Ne("p","(--space-12)"),Ne("p","[var(--space-12)]"),Ne("space-x","reverse"),Ne("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[Ne("text","[11px]"),Ne("text","[0.8rem]"),Ne("text","xs"),Ne("text","[#fff]"),Ne("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[Ne("z","[9999]"),Ne("z","50"),Ne("z","10"),Ne("z","30"),"-"+Ne("z","10"),Ne("z","auto"),Ne("z","(--z-popup)"),Ne("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[Ne("shadow","[0_1px_2px_#000]"),Ne("shadow","md"),"shadow",Ne("shadow","lg"),Ne("shadow","(--elevation-panel)"),Ne("shadow","black/20"),Ne("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,Je={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1,colour:4},Ue={colour:4},We={"ellipsis-label":9},qe=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var _e="ui-kit.config.json",Ge="ui-kit.baseline.json",Ke="efficient-shell-ui-check",He=`${Ke}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${Ke} check this repository against ${Ge}\n ${Ke} --print print today's counts as a baseline, and change nothing\n ${Ke} --summary print totals per kind and per folder, as Markdown\n ${Ke} --json print the result as JSON\n ${Ke} --update lower the lines whose counts fell, and delete the ones at zero\n ${Ke} --update --allow-move also follow a renamed or split file (no total may rise)\n ${Ke} --init write the first ${Ge}\n ${Ke} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${Ke} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${_e} in the current directory.`;var Qe=(e,t)=>`${e} ${t}${1===e?"":"s"}`,Ve=(e,t)=>{const n=B(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${Ke}: ${r}\n\n${He}`),2;if(r.help)return t.out(He),0;if(r.version)return t.out(t.version),0;const c=e=>(r.json?t.out(JSON.stringify({tool:Ke,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${Ke}: ${e}`),1),p=n(t.cwd,_e);if(!i(p))return c(`no ${_e} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let f,g;try{f=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},o=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},s=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!O(e))?(i(`${t} must be a list of objects`),[]):e;if(!O(e))throw new P(`${t}: must be a JSON object`);for(const t of Object.keys(e))D.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const d=o(e.include,'"include"'),u=o(e.exclude,'"exclude"'),h=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:o(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:o(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:s(e.reason,`"includeImporting"[${t}]`)}));0===d.length&&0===h.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const p=r(e.output,'"output"').map((e,t)=>({files:o(e.files,`"output"[${t}].files`,{required:!0}),reason:s(e.reason,`"output"[${t}]`)})),f=[],g=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=o([e.file],`${n}.file`),d=s(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const u=`${r}:${e.kind}`;g.has(u)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),g.add(u),f.push({file:r,kind:e.kind,count:e.count,reason:d})}),n.length)throw new P(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:d,exclude:u,includeImporting:h,output:p,allow:f}}(JSON.parse(o(p,"utf8")),_e)}catch(e){return c(e instanceof P?e.message:`${_e} is not valid JSON: ${e.message}`)}try{g=t.loadTypeScript()}catch{return c('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const w=function(e){const t=[],n=u,i=[["fixture.tsx",Pe,Oe],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",De],["tokens.tsx",Fe,Je],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",We]];for(const[o,s,r]of i){const i=Re(je(e,o,s,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${o}: read ${qe(i)}; it holds ${qe(r)}`)}const o=Re(Se('\n/* #fff in a comment */\n.a:hover { color: #111; border: 1px solid white; }\n[data-x="#fff"] { mask-image: linear-gradient(#000, transparent); color: var(--ink); }\n.b { --mine: rgb(0 0 0 / .5); background: var(--surface, #fff); }\n',n));n.some(e=>(o[e]??0)!==(Ue[e]??0))&&t.push(`style.css: read ${qe(o)}; it holds ${qe(Ue)}`);const s=Re(je(e,"fixture.tsx",Pe,["button"]));return"button"!==Object.keys(s).join()&&t.push(`asked for button alone, the reader reported ${qe(s)}`),t}(g);if(w.length)return c(`the reader misread its own fixtures with typescript ${g.version}, so nothing it says about this repository can be trusted:\n - `+w.join("\n - "));const k=function(e,t,s){const r=[],a=y(s.exclude),l=y(s.output.flatMap(e=>e.files)),c=new Map,u=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=o(n(t,e),"utf8")),i},h=(e,n)=>{for(const i of e)0===I(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};h(s.include,'"include"'),s.output.forEach((e,t)=>h(e.files,`"output"[${t}]`)),s.includeImporting.forEach((e,t)=>h(e.files,`"includeImporting"[${t}]`));const p=new Set,f=s.kinds.includes("colour"),g=e=>($e(e)||f&&ye(e))&&!a(e)&&!l(e);for(const e of I(t,s.include))g(e)&&p.add(e);for(const n of s.includeImporting)for(const i of I(t,n.files))g(i)&&$e(i)&&!p.has(i)&&ze(Ae(e,i,u(i)),n.modules)&&p.add(i);const w=[...p].sort(),k=s.kinds.filter(e=>!d(e)),b=new Map,$=new Map,v=new Set;for(const t of w){const n=ye(t)?Se(u(t),k):je(e,t,u(t),k,v);let i=!1;for(const e of k){const o=n[e]?.length??0;o&&($.set(A(t,e),o),i=!0)}i&&b.set(t,n)}let S=[],j=[],L=[];const R=s.kinds.filter(d);if(R.length){const e=n(t,N);if(i(e)){const t=JSON.parse(o(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...v].flatMap(e=>m[e]??[])),r=[...new Set(n)].sort();if(s.kinds.includes("kit-dep")){const e=r.filter(e=>"kit-dep"===x(e));S=e.filter(e=>!i.has(e)),j=e.filter(e=>i.has(e)),S.length&&$.set(A(N,"kit-dep"),S.length)}s.kinds.includes("chart-dep")&&(L=r.filter(e=>"chart-dep"===x(e)),L.length&&$.set(A(N,"chart-dep"),L.length))}else for(const e of R)r.push(`"kinds" includes "${e}", and there is no ${N} here to read.`)}for(const e of s.allow)(d(e.kind)?e.file===N:p.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:w,hits:b,counts:$,kitDeps:S,shellPeers:j,chartDeps:L,problems:r}}(g,t.cwd,f);if(0===k.files.length)return c(`read no files. "include" in ${_e} matches nothing, so a pass would mean nothing.`);const b=n(t.cwd,Ge),$=r.json,v=e=>{$||t.out(e)};if(r.print)return t.out(M(Me(f,k,f.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,o]of t.counts){const{file:t,kind:s}=z(e);if(!l(s))continue;const r=n.get(s)??{count:0,files:new Set};r.count+=o,r.files.add(t),n.set(s,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",d=i.get(c)??{};d[s]=(d[s]??0)+o,i.set(c,d)}const o=e.kinds.filter(e=>n.has(e)),s=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>z(e).file)).size} of ${Qe(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${h[e].instead} |`})];if(o.length&&i.size){const e=e=>o.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));s.push("",`| Folder | ${o.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${o.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${o.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return s}(f,k))t.out(e);return 0}let S=null;if(i(b))try{S=T(o(b,"utf8"),Ge)}catch(e){return c(e instanceof R?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!f.kinds.includes(e));if(e.length)return c(`--kind ${e.join(", ")}: not in "kinds" in ${_e}. Add it there first.`);const t=r.kinds;if(S){if(0===t.length)return c(`${Ge} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>S.kinds.includes(e));if(e.length)return c(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=Me(f,k,t);S={kinds:[...S.kinds,...t],counts:new Map([...S.counts,...n.counts])}}else{if(t.length)return c(`there is no ${Ge} yet. Run --init on its own first.`);S=Me(f,k,f.kinds)}s(b,M(S)),v(`${Ke}: wrote ${Ge} (${Qe(S.counts.size,"line")}: ${Ve(S.counts,S.kinds)})`)}if(!S)return c(`no ${Ge}. This repository has not adopted the check yet: run ${Ke} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const o=Ce(e,t),s=Me(e,n,o),r=new Map([...t.counts].filter(([e])=>o.includes(z(e).kind)));if(i){const e=B(r),n=B(s.counts),i=o.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:s,lowered:Be(r,s.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,s.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:o,counts:a},lowered:Be(r,a),refused:[]}}(f,S,k,{allowMove:r.allowMove});if(e.refused.length)return c(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);S=e.baseline,s(b,M(S)),v(`${Ke}: ${e.lowered?`changed ${Qe(e.lowered,"line")} in`:"nothing to change in"} ${Ge}`)}const j=function(e,t,n){const i=[],o=[],s=[...n.problems],r=Ee(e),a=new Set(Ce(e,t)),c=e.kinds.filter(e=>!t.kinds.includes(e));c.length&&s.push(`"kinds" names ${c.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===c.length?"it":"them"}. Run: efficient-shell-ui-check --init ${c.map(e=>`--kind ${e}`).join(" ")}`);const d=t.kinds.filter(t=>!e.kinds.includes(t));d.length&&o.push(`the baseline still carries ${d.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const u=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...u].sort(C)){const{file:c,kind:d}=z(e);if(!l(d)||!a.has(d))continue;const u=n.counts.get(e)??0,p=r.get(e)??0,f=t.counts.get(e)??0;u>p+f?i.push(`${c}: ${d} ${u}, and its line allows ${p+f}${Te(n,c,d)}. ${h[d].counts} is counted; use ${h[d].instead}.`):u<p?s.push(`${c}: ${d} ${u}, and "allow" in ui-kit.config.json says ${p}. ${0===u?"Delete the entry":`Lower its count to ${u}`}: an exception does not outlive what it excused.`):u<p+f&&o.push(`${c}: ${d} ${u}, and its line says ${p+f}`)}return{grown:i,shrunk:o,other:s,updateFixes:0===i.length&&0===s.length&&o.length>0}}(f,S,k),L=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const o=e.git(["rev-parse","--show-prefix"]);if(null===o)return{problems:[],note:"not a git checkout; the base branch was not compared"};const s=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])))return{problems:[],note:`${s} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${s}:${o.trim()}${Ge}`]);if(null===r)return{problems:[],note:`${s} has no ${Ge} yet (adoption)`};let a;try{a=T(r,`${s}:${Ge}`)}catch{return{problems:[],note:`${s}'s ${Ge} could not be read; the base branch was not compared`}}const l=B(a.counts),c=B(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(c[e]??0)>(l[e]??0)).map(e=>`${Ge} holds ${c[e]??0} of "${e}", and ${s} holds ${l[e]??0}. The baseline only goes down: use ${h[e].instead}. A count that is meant to stay goes in "allow" in ${_e}, with its reason.`),note:`compared with ${s}`}}(t,S,f.kinds),E=f.kinds.filter(e=>S.kinds.includes(e)),F=`${Ke} --update`,J=[...j.other,...j.grown,...j.shrunk.map(e=>`${e}. Run: ${F}`),...L.problems],U=0===J.length;if(r.json){const e=new Map(f.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:Ke,version:t.version,ok:U,schema:f.schema,kinds:f.kinds,files:k.files.length,counts:B(k.counts),baseline:B(S.counts),allowed:B(e),kitDeps:k.kitDeps,shellPeers:k.shellPeers,chartDeps:k.chartDeps,failures:J},null,2)),U?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const W=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${g.version})`),t.out(` ok read ${Qe(k.files.length,"file")}`),W(`${_e} and ${Ge} describe this repository`,j.other),W("no file draws more of its own UI than its line allows",j.grown),W("every line is exact: a count that fell is a line to lower",j.shrunk,`Run: ${F}${j.updateFixes?"":" (after the failures above are fixed)"}`),L.note&&W(`the baseline is no higher than the base branch (${L.note})`,L.problems);const q=new Set([...k.counts.keys()].map(e=>z(e).file));return t.out(` ok PROGRESS: ${q.size} of ${Qe(k.files.length,"file")} still draw UI of their own: `+Ve(k.counts,E)),t.out(""),U?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${Qe(J.length,"problem")})`),U?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(e){for(const i of[n(process.cwd(),"package.json"),e])try{return t(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"12.33.0"});
2
+ import{execFileSync as e}from"child_process";import{createRequire as t}from"module";import{join as n}from"path";import{existsSync as i,readFileSync as o,writeFileSync as s,readdirSync as r}from"fs";var a=["button","input","range","textarea","select","dialog","title","portal","native","dark","hex","radius","spacing","font-size","z-index","shadow","kit","icon","svg","kit-dep","chart","chart-dep","ellipsis-label","colour","gutter-literal","view-line-literal","route-literal","root-zone-literal","phone-query","sizes-literal","money-cents","local-helper"],l=e=>"string"==typeof e&&a.includes(e),c=["kit-dep","chart-dep"],u=e=>c.includes(e),d=a.filter(e=>!u(e)),h={button:{counts:"a raw <button>",instead:"Button or IconButton from efficient-shell/ui"},input:{counts:"a raw <input> (not hidden, not a range)",instead:"Input, InputNumber, Checkbox, Radio or Switch from efficient-shell/ui"},range:{counts:'a raw <input type="range">',instead:"Slider from efficient-shell/ui"},textarea:{counts:"a raw <textarea>",instead:"Textarea from efficient-shell/ui"},select:{counts:"a raw <select>",instead:"Select or SearchableSelect from efficient-shell/ui"},dialog:{counts:'a raw <dialog>, or role="dialog" / role="alertdialog" on a raw element',instead:"Dialog or Modal from efficient-shell"},title:{counts:"a title= on a raw element (the browser's own tooltip)",instead:"Tooltip from efficient-shell/ui (harness UI-17)"},portal:{counts:"a createPortal(…) call (a layer the file floats itself)",instead:"Popover, PopupMenu, DropdownMenu, Tooltip or Dialog from efficient-shell/ui"},native:{counts:"window.confirm / alert / prompt, or a bare call that resolves to one",instead:"confirm, confirmDestructive, prompt or toast from efficient-shell (harness UI-20)"},dark:{counts:"a dark: variant in a class string",instead:"the light Tailwind class alone; the shell remaps it in dark mode (harness UI-7)"},hex:{counts:"a hex colour literal in a .tsx string",instead:"a colour role from efficient-shell: its utility or var(--role), COLOUR_ROLES lists them (harness FT-1; the colour kind counts palette classes too)"},radius:{counts:"a literal corner radius (an arbitrary-value radius class, or an inline borderRadius)",instead:"a radius utility from the scale or a role token such as rounded-(--radius-control); the theme sets how round they are (harness UI-7)"},spacing:{counts:"a padding, margin or gap off the scale (6px, 10px, 14px …) or written as a literal length (an arbitrary-value class, an inline style)",instead:"a step of the scale 2/4/8/12/16/20/24/32/40/48 — a Tailwind step, or a role such as var(--space-control-x) (owner ruling 2026-10-12)"},"font-size":{counts:"a literal font size (an arbitrary-value text class, an inline fontSize)",instead:"a type step 9/11/12/14/16/18/20/24/30 — Tailwind's 3xs … 3xl text steps (owner ruling 2026-10-12)"},"z-index":{counts:"a stack order above 30 written as a number (a z utility, an arbitrary value, an inline zIndex)",instead:"a named layer: Z_LAYERS (efficient-shell/ui) in code, its --z-* custom property in markup"},shadow:{counts:"a literal shadow, or a shadow size that is not an elevation level (md, 2xl, xs)",instead:"an elevation: the sm / lg / xl utilities, or var(--elevation-panel) and its siblings (owner ruling 2026-10-12)"},kit:{counts:"an import of a second UI kit",instead:"the component from efficient-shell/ui, or fold it into the shell (harness FT-3)"},icon:{counts:"an import of an icon package",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24)"},svg:{counts:"an <svg> element written in JSX: an icon drawn in place",instead:"<Icon name> from efficient-shell/icons, drawn by the one set (harness UI-24). A chart, an illustration or a mark a host supplies stays on the baseline"},"kit-dep":{counts:"a UI kit or icon package declared in package.json (not one the shell entries imported here need)",instead:"remove the dependency once nothing imports it (harness FT-3)"},chart:{counts:"an import of a second chart library",instead:"a chart from efficient-shell/ui (ChartFrame, TimeSeriesChart, ColumnChart, RankedBars, PieChart, FunnelChart, ScatterChart, …), or add the chart there: one chart system (harness FT-3)"},"chart-dep":{counts:"a chart library declared in package.json",instead:"remove the dependency once nothing imports it (harness FT-3)"},"ellipsis-label":{counts:'a button, link or menu label that ends in "…" or "..."',instead:'the label without the dots, saying what it does ("Extend trial"): "…" means only "the words are cut" (owner ruling 2026-10-14)'},colour:{counts:"a literal colour, in a script string or a stylesheet: a hex, an rgb() / hsl() / oklch() value, a Tailwind palette class (a hue and a step, or white / black), a --color-<hue>-<step> variable, or a named colour in a colour property — a var() fallback included",instead:"a colour role from efficient-shell: its utility (the text, background or border utility of ink, ink-faint, surface, line, accent-fill, accent-text, danger-text, status-danger-line …) or var(--role); COLOUR_ROLES lists them. A merchant site reads the site theme (owner ruling 2026-10-23)"},"gutter-literal":{counts:"the site gutter typed with its own fallback, var(--sf-site-gutter, 40px), in script source (stylesheets are not read)",instead:"SITE_GUTTER_CLASS from efficient-web-builder (lib/content/page-width): the whole class, because Tailwind reads only whole literals; SITE_GUTTER_CAP for the number"},"view-line-literal":{counts:"the 960px written as a length in script source (a max-/min- variant, a media query; a sizes string counts here too)",instead:"the view-lines table in efficient-web-builder (lib/content/view-lines, lib/content/box-stack-line)"},"route-literal":{counts:"a page path typed by hand before a slug: /wheels/, /journal/, /tyres/",instead:"pagePath, postPath or wheelPath from efficient-web-builder (lib/links/page-link-rules), tyrePagePath from efficient-storefront-blocks (render/lib/tyres/tyre-page-path)"},"root-zone-literal":{counts:'the easel root zone key typed as a string ("root:default-zone")',instead:"ROOT_ZONE from efficient-easel (screen/lib/document/content-tree)"},"phone-query":{counts:"the app phone line typed as a media query in script source: (max-width: 767px)",instead:"useIsMobile from efficient-shell: ask the hook, do not write the query"},"sizes-literal":{counts:"a hand-written responsive sizes string (a sizes attribute or sizes: entry with a media condition)",instead:"a named sizes shape from efficient-web-builder (lib/sized-image), built from the view lines"},"money-cents":{counts:"a money amount (amount, price, total, cents, fee, cost, balance) multiplied or divided by 100 by hand",instead:"createMoneyFormatter / useCurrency from efficient-storefront-blocks (render/components/CurrencyContext) for a shopper; formatMoney / currencyDecimals from efficient-shell for the ERP"},"local-helper":{counts:"a local definition (function or const) of a helper a package exports, by name: escapeHtml, deepEqual, timeAgo, formatBytes, hexToRgb and the rest of LOCAL_HELPERS",instead:"import the helper from its home (LOCAL_HELPERS in efficient-shell src/ui-check/kinds.ts names each one)"}},f={escapeHtml:"efficient-shell (utils/escapeHtml)",deepEqual:"efficient-easel (data)",draftsEqual:"efficient-easel deepEqual (data)",timeAgo:"efficient-shell (format)",formatBytes:"efficient-shell (format)",formatFileSize:"efficient-shell formatBytes (format)",fileSize:"efficient-shell formatBytes (format)",humanSize:"efficient-shell formatBytes (format)",hexToRgb:"efficient-shell (forms/color)",parseHex:"efficient-shell parseHexColor (forms/color)",parseHexColor:"efficient-shell (forms/color)",hexOf:"efficient-shell parseHexColor (forms/color)",withAlpha:"efficient-shell hexWithAlpha (forms/colorMix)",isDarkInk:"efficient-shell readableInk (forms/color)",relativeLuminance:"efficient-shell (forms/color)",contrastRatio:"efficient-shell (forms/color)"},p=["@headlessui/","@radix-ui/","@mui/","@chakra-ui/","@mantine/","@floating-ui/","antd","react-aria","react-aria-","react-bootstrap","react-select","react-colorful","react-tooltip","react-hot-toast","react-toastify","sonner"],m=["@heroicons/","@tabler/icons","@tabler/icons-","@phosphor-icons/","@fortawesome/","@iconify/","@radix-ui/react-icons","@mui/icons-material","lucide","lucide-react","simple-icons","react-icons","react-feather"],g=["recharts","chart.js","react-chartjs-2","d3","d3-","@nivo/","victory","victory-","echarts","echarts-for-react","apexcharts","react-apexcharts","@visx/","highcharts","highcharts-react-official","plotly.js","plotly.js-dist","react-plotly.js","lightweight-charts","@antv/g2","@antv/g2plot","chartist","billboard.js","c3","uplot"],w={"efficient-shell":["@headlessui/react"]};function x(e,t){return t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}function k(e){return x(e,m)?"icon":x(e,p)?"kit":x(e,g)?"chart":null}function b(e){const t=k(e);return"kit"===t||"icon"===t?"kit-dep":"chart"===t?"chart-dep":null}var y=/[.+^$()|[\]\\]/g;function $(e){let t="",n=0;for(let i=0;i<e.length;i++){const o=e[i];"*"===o?"*"===e[i+1]?"/"===e[i+2]?(t+="(?:[^/]+/)*",i+=2):(t+=".*",i+=1):t+="[^/]*":"?"===o?t+="[^/]":"{"===o?(t+="(?:",n+=1):"}"===o&&n>0?(t+=")",n-=1):t+=","===o&&n>0?"|":o.replace(y,"\\$&")}if(0!==n)throw new Error(`unbalanced { in glob "${e}"`);return new RegExp(`^${t}$`)}function v(e){const t=e.map($);return e=>t.some(t=>t.test(e))}var S=new Set(["node_modules",".git"]),z=new Set(["dist","coverage",".next",".turbo"]);function E(e){const t=e.search(/[*?{]/),n=-1===t?e:e.slice(0,t),i=n.lastIndexOf("/");return-1===i?"":n.slice(0,i)}function I(e,t){const i=v(t),o=[...new Set(t.map(E))].sort(),s=o.filter(e=>!o.some(t=>t!==e&&(""===t||e.startsWith(`${t}/`)))),a=new Set,l=t=>{let o;try{o=r(n(e,t),{withFileTypes:!0})}catch{return}for(const e of o){const n=t?`${t}/${e.name}`:e.name;e.isDirectory()?S.has(e.name)||""===t&&z.has(e.name)||l(n):e.isFile()&&i(n)&&a.add(n)}};for(const e of s)l(e);return[...a].sort(j)}var j=(e,t)=>e<t?-1:e>t?1:0,A=class extends Error{},L=(e,t)=>`${e}:${t}`;function R(e){const t=e.lastIndexOf(":");return{file:e.slice(0,t),kind:e.slice(t+1)}}var T=e=>a.indexOf(e);function C(e,t){const n=R(e),i=R(t);return j(n.file,i.file)||T(n.kind)-T(i.kind)}function P(e,t="ui-kit.baseline.json"){let n;try{n=JSON.parse(e)}catch(e){throw new A(`${t} is not valid JSON: ${e.message}`)}const i=e=>{throw new A(`${t}: ${e}. The tool writes this file; do not edit it by hand.`)};if("object"!=typeof n||null===n||Array.isArray(n))return i("must be a JSON object");const o=n;if(1!==o.schema)return i("number"==typeof o.schema&&o.schema>1?`"schema": ${o.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');if(!Array.isArray(o.kinds)||o.kinds.some(e=>"string"!=typeof e))return i('"kinds" must be a list');const s=o.kinds.filter(l);if("object"!=typeof o.counts||null===o.counts||Array.isArray(o.counts))return i('"counts" must be an object');const r=new Map;for(const[e,t]of Object.entries(o.counts)){const{file:n,kind:o}=R(e);if(!n||!o)return i(`"${e}" is not "<file>:<kind>"`);if("number"!=typeof t||!Number.isInteger(t)||t<1)return i(`"${e}" must be a whole number, 1 or more (a line that reaches 0 is deleted)`);l(o)&&r.set(e,t)}return{kinds:s,counts:r}}function B(e){const t=a.filter(t=>e.kinds.includes(t)),n=[...e.counts.keys()].filter(t=>(e.counts.get(t)??0)>0).sort(C).map(t=>` ${JSON.stringify(t)}: ${e.counts.get(t)}`);return["{",' "schema": 1,',` "kinds": [${t.map(e=>JSON.stringify(e)).join(", ")}],`,n.length?` "counts": {\n${n.join(",\n")}\n }`:' "counts": {}',"}",""].join("\n")}function M(e){const t={};for(const[n,i]of e){const{kind:e}=R(n);l(e)&&(t[e]=(t[e]??0)+i)}return t}var O=class extends Error{},N=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),D=new Set(["$schema","schema","kinds","include","exclude","includeImporting","output","allow"]);var F="package.json",J=[2,4,8,12,16,20,24,32,40,48];function U(e){if("0"===e||"px"===e)return!0;const t=Number(e);return!!Number.isFinite(t)&&J.includes(4*t)}var q=new Set(["iframe","frame","object","embed"]),W=new Set(["href","xlinkHref","to","id","key","htmlFor"]),_=/(?<![&\w])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,H=/(?<![\w-])rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|ee|es))?-\[([^\]]*)\]/g,K=/^border(?:(?:Top|Bottom)(?:Left|Right)|(?:Start|End)(?:Start|End))?Radius$/,G=/^(?:inherit|initial|unset|revert)$|var\(|^(?:50|100)%$|^(?:999|9999)(?:px)?$/,Z=/(?<![\w-])-?(?:p|px|py|pt|pr|pb|pl|ps|pe|m|mx|my|mt|mr|mb|ml|ms|me|gap|gap-x|gap-y|space-x|space-y)-(\d+(?:\.\d+)?|px|\[[^\]]*\])(?![\w.[/-])/g,V=/(?<![\w-])text-\[(?:length:)?(\d*\.?\d+(?:px|rem|em|%))\]/g,Q=/(?<![\w-])z-(\d+|\[[^\]]*\])(?![\w.[/-])/g,X=/(?<![\w-])shadow-(xs|2xs|md|2xl|\[[^\]]*\])(?![\w.[/-])/g,Y=/var\(|^(?:inherit|initial|unset|revert|revert-layer|none|auto)$/,ee=/^(?:(?:padding|margin)(?:Top|Right|Bottom|Left|Inline|Block|InlineStart|InlineEnd|BlockStart|BlockEnd)?|gap|rowGap|columnGap)$/,te=new Set([0,...J]),ne=/var\(\s*--sf-site-gutter\s*,\s*-?\d/g,ie=/(?<![\w.-])960px(?![\w-])/g,oe=/(?:^|[^\w-])\/(?:wheels|journal|tyres)\/$/,se=/root:default-zone/g,re=/max-width:\s*767px(?![\w-])/g,ae=/\((?:max|min)-width/,le=/(?:^|[a-z0-9_])(?:amount|price|total|subtotal|cents|fee|fees|cost|balance)$|(?:Amount|Price|Total|Subtotal|Cents|Fee|Fees|Cost|Balance)$/,ce=/(?<![\w-])dark:(?=[\w[\-!@*(])/g,ue="slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose",de="(?:50|[1-9]00|950)",he=new RegExp(`(?<![\\w-])(?:bg|text|border(?:-[xytrblse])?|ring(?:-offset)?|inset-ring|outline|divide|fill|stroke|from|via|to|shadow|inset-shadow|drop-shadow|accent|caret|decoration|placeholder)-(?:(?:${ue})-${de}|white|black)(?:\\/[\\w.]+)?(?![\\w-])`,"g"),fe=new RegExp(`--color-(?:(?:${ue})-${de}|white|black)(?![\\w-])`,"g"),pe=/(?<![\w-])(?:rgba?|hsla?|hwb|oklch|oklab|lab|lch)\(\s*[\d.]/g,me=/(?<![\w-])(?:white|black|red|green|blue|yellow|orange|purple|pink|gray|grey|silver|maroon|navy|teal|olive|lime|aqua|fuchsia|brown|gold|beige|ivory|tan|crimson|coral|salmon|indigo|violet)(?![\w-])/gi,ge=/^(?:color|background(?:Color)?|border(?:Top|Right|Bottom|Left|Inline|Block)?(?:Color)?|outline(?:Color)?|fill|stroke|caretColor|accentColor|textDecorationColor|boxShadow|textShadow)$/,we=/(?<![&a-zA-Z0-9])(?<!url\()#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})(?![\w-])/g,xe=e=>[...e.matchAll(we)].length+[...e.matchAll(pe)].length+[...e.matchAll(he)].length+[...e.matchAll(fe)].length,ke=new Set(["button","a","option","Button","IconButton","SplitButton","Link","NavLink","PopupMenuItem","PopupMenuLabel","DropdownMenuItem","MenuItem","ContextMenuItem"]),be=/(?:…|\.\.\.|&hellip;)\s*$/,ye=new RegExp("\\p{L}","u"),$e=new RegExp("\\p{L}[\\p{L}-]*","u"),ve={busy:{words:["Accepting","Adding","Applying","Approving","Arranging","Asking","Assigning","Booking","Building","Calculating","Cancelling","Capturing","Changing","Checking","Choosing","Closing","Combining","Comparing","Completing","Confirming","Connecting","Converting","Copying","Correcting","Counting","Creating","Deleting","Detaching","Downloading","Drawing","Duplicating","Emailing","Ending","Exporting","Fetching","Filing","Finding","Flushing","Generating","Grouping","Importing","Linking","Loading","Locating","Looking","Making","Marking","Matching","Measuring","Merging","Moving","Opening","Ordering","Paying","Pending","Posting","Preparing","Previewing","Pricing","Processing","Provisioning","Publishing","Purging","Pushing","Queued","Queuing","Quoting","Re-booking","Re-importing","Re-opening","Reading","Rebooting","Rebuilding","Receiving","Reconciling","Reconnecting","Recording","Refreshing","Refunding","Regenerating","Registering","Reinstating","Rejecting","Removing","Reopening","Requesting","Resending","Resetting","Resolving","Restarting","Restoring","Resuming","Retrying","Reversing","Reverting","Running","Saving","Searching","Sending","Setting","Settling","Sharing","Signing","Splitting","Starting","Submitting","Suggesting","Switching","Syncing","Taking","Testing","Transferring","Typing","Updating","Uploading","Verifying","Waiting","Withdrawing","Working"],zhStarts:["正在"],zhEnds:["中"]},placeholder:{},prompt:{}},Se=new Set((ve.busy?.words??[]).map(e=>e.toLowerCase())),ze=new Set(["label","aria-label",...ve.placeholder?[]:["placeholder","searchPlaceholder","emptyOptionLabel","blankLabel"]]),Ee=(e,t)=>{if(!be.test(t)||!ye.test(e))return!1;const n=e.match($e)?.[0]?.toLowerCase();if(n&&Se.has(n))return!1;const i=e.replace(be,"").trim(),o=ve.busy;return!(o&&(o.zhStarts.some(e=>i.startsWith(e))||o.zhEnds.some(e=>i.endsWith(e))))},Ie=new Set(["confirm","alert","prompt"]),je=new Set(["window","globalThis","self"]);var Ae=e=>/\.(?:[cm]?[jt]s|[jt]sx)$/.test(e)&&!e.endsWith(".d.ts"),Le=e=>/\.(?:css|scss)$/.test(e),Re=/^(?:color|background(?:-color)?|border(?:-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?)?(?:-color)?|outline(?:-color)?|fill|stroke|caret-color|accent-color|text-decoration(?:-color)?|box-shadow|text-shadow|column-rule(?:-color)?)$/;function Te(e,t){if(!t.includes("colour"))return{};const n=e.replace(/\/\*[\s\S]*?\*\//g,e=>e.replace(/[^\n]/g," ")),i=[],o=e=>n.slice(0,e).split("\n").length;let s=0,r=0;for(let e=0;e<n.length;e++){const t=n[e];if("{"===t||"}"===t||";"===t){const a=n.slice(r,e);if("{"!==t&&s>0){const e=r+(a.length-a.trimStart().length),t=a.trim(),n=t.indexOf(":");if(t.startsWith("@apply"))for(let n=[...t.matchAll(he)].length;n>0;n--)i.push(o(e));else if(n>0){const s=t.slice(0,n).trim().toLowerCase(),r=t.slice(n+1);if(!/^(?:-webkit-)?mask/.test(s)){const t=xe(r)+(Re.test(s)?[...r.matchAll(me)].length:0);for(let n=0;n<t;n++)i.push(o(e))}}}"{"===t?s++:"}"===t&&(s=Math.max(0,s-1)),r=e+1}}return i.length?{colour:i}:{}}function Ce(e,t,n,i,o){const s=new Set(i),r=e.createSourceFile(t,n,e.ScriptTarget.Latest,!0,function(e,t){return t.endsWith(".tsx")?e.ScriptKind.TSX:t.endsWith(".jsx")?e.ScriptKind.JSX:/\.[cm]?js$/.test(t)?e.ScriptKind.JS:e.ScriptKind.TS}(e,t)),a={},l=/\.[jt]sx$/.test(t),c=e=>r.getLineAndCharacterOfPosition(e).line+1,u=(e,t)=>{s.has(e)&&(a[e]??=[]).push(c(t.getStart(r)))},d=(t,n)=>t.attributes.properties.find(t=>e.isJsxAttribute(t)&&t.name.getText(r)===n),h=t=>{const n=t?.initializer;if(n)return e.isStringLiteral(n)?n.text:e.isJsxExpression(n)&&n.expression&&e.isStringLiteralLike(n.expression)?n.expression.text:void 0},p=new Set;if(s.has("native")){const t=n=>{if(n)if(e.isIdentifier(n))Ie.has(n.text)&&p.add(n.text);else if(e.isObjectBindingPattern(n)||e.isArrayBindingPattern(n))for(const i of n.elements)e.isBindingElement(i)&&t(i.name)},n=i=>{(e.isImportClause(i)||e.isImportSpecifier(i)||e.isNamespaceImport(i)||e.isVariableDeclaration(i)||e.isParameter(i)||e.isFunctionDeclaration(i))&&t(i.name),e.forEachChild(i,n)};n(r)}const m=t=>t&&e.isStringLiteralLike(t)?t.text:void 0,g=(e,t)=>{e&&("efficient-shell"===e||e.startsWith("efficient-shell/"))&&o?.add(e);const n=e?k(e):null;n&&u(n,t)},w=(e,t,n)=>{if(s.has("dark"))for(const n of e.matchAll(ce))u("dark",t);if(s.has("radius"))for(const n of e.matchAll(H))G.test(n[1].trim())||u("radius",t);if(n&&l&&s.has("hex"))for(const n of e.matchAll(_))u("hex",t);if(n&&s.has("colour"))for(let n=xe(e);n>0;n--)u("colour",t);if(s.has("spacing"))for(const n of e.matchAll(Z)){const e=n[1];(e.startsWith("[")?Y.test(e.slice(1,-1).trim()):U(e))||u("spacing",t)}if(s.has("font-size"))for(const n of e.matchAll(V))u("font-size",t);if(s.has("z-index"))for(const n of e.matchAll(Q)){const e=n[1].startsWith("[")?n[1].slice(1,-1).trim():n[1];/^\d+$/.test(e)&&Number(e)>30&&u("z-index",t)}if(s.has("shadow"))for(const n of e.matchAll(X))n[1].startsWith("[")&&Y.test(n[1].slice(1,-1).trim())||u("shadow",t);if(s.has("gutter-literal"))for(const n of e.matchAll(ne))u("gutter-literal",t);if(s.has("view-line-literal"))for(const n of e.matchAll(ie))u("view-line-literal",t);if(s.has("route-literal")&&oe.test(e)&&u("route-literal",t),s.has("root-zone-literal"))for(const n of e.matchAll(se))u("root-zone-literal",t);if(s.has("phone-query"))for(const n of e.matchAll(re))u("phone-query",t)},x=t=>{if(t)return e.isJsxExpression(t)?x(t.expression):e.isStringLiteralLike(t)?t.text:e.isTemplateExpression(t)?[t.head.text,...t.templateSpans.map(e=>e.literal.text)].join(" "):void 0},b=t=>e.isNumericLiteral(t)&&100===Number(t.text),y=(t,n,i)=>{const o=e.isStringLiteralLike(n)?n.text.trim():void 0;if(s.has("colour")&&void 0!==o&&ge.test(t))for(const e of o.matchAll(me))u("colour",i);if(s.has("spacing")&&ee.test(t))e.isNumericLiteral(n)?te.has(Number(n.text))||u("spacing",i):void 0!==o&&!Y.test(o)&&(e=>[...e.matchAll(/(-?\d*\.?\d+)(px|rem|em)\b/g)].map(e=>Math.abs(Number(e[1]))*("px"===e[2]?1:16)))(o).some(e=>!te.has(e))&&u("spacing",i);else if(s.has("font-size")&&"fontSize"===t)(e.isNumericLiteral(n)||void 0!==o&&!Y.test(o)&&!/^(?:smaller|larger)$/.test(o))&&u("font-size",i);else if(s.has("z-index")&&"zIndex"===t){const t=[],o=n=>{e.isNumericLiteral(n)||e.isStringLiteralLike(n)&&/^\d+$/.test(n.text.trim())?t.push(Number(n.text)):e.forEachChild(n,o)};o(n);for(const e of t)e>30&&u("z-index",i)}else s.has("shadow")&&"boxShadow"===t&&(void 0===o||""===o||Y.test(o)||u("shadow",i))},$=(t,n)=>{if(e.isJsxOpeningElement(t)||e.isJsxSelfClosingElement(t)){const e=t.tagName.getText(r);if(s.has("sizes-literal")){const e=x(d(t,"sizes")?.initializer);void 0!==e&&ae.test(e)&&u("sizes-literal",t)}if(/^[a-z]/.test(e)){const n=h(d(t,"type"));"svg"===e&&u("svg",t),"button"===e?u("button",t):"select"===e?u("select",t):"textarea"===e?u("textarea",t):"input"===e&&("range"===n?u("range",t):"hidden"!==n&&u("input",t));const i=h(d(t,"role"));"dialog"!==e&&"dialog"!==i&&"alertdialog"!==i||u("dialog",t),!q.has(e)&&d(t,"title")&&u("title",t)}}else if(e.isCallExpression(t)){const n=t.expression;e.isIdentifier(n)?"createPortal"===n.text?u("portal",t):Ie.has(n.text)&&!p.has(n.text)?u("native",t):"require"===n.text&&g(m(t.arguments[0]),t):e.isPropertyAccessExpression(n)?"createPortal"===n.name.text?u("portal",t):Ie.has(n.name.text)&&e.isIdentifier(n.expression)&&je.has(n.expression.text)&&u("native",t):n.kind===e.SyntaxKind.ImportKeyword&&g(m(t.arguments[0]),t)}else{if(e.isImportDeclaration(t)||e.isExportDeclaration(t))return void g(m(t.moduleSpecifier),t);if(e.isPropertyAssignment(t)){const n=e.isIdentifier(t.name)||e.isStringLiteralLike(t.name)?t.name.text:"",i=t.initializer;if(y(n,i,t),s.has("sizes-literal")&&"sizes"===n){const e=x(i);void 0!==e&&ae.test(e)&&u("sizes-literal",t)}s.has("radius")&&K.test(n)&&(e.isNumericLiteral(i)?G.test(i.text)||u("radius",t):e.isStringLiteralLike(i)&&!G.test(i.text.trim())&&u("radius",t))}else if(e.isBinaryExpression(t)){const n=t.operatorToken.kind;if(s.has("money-cents")&&(n===e.SyntaxKind.AsteriskToken||n===e.SyntaxKind.SlashToken)){const i=b(t.right)?t.left:b(t.left)&&n===e.SyntaxKind.AsteriskToken?t.right:void 0,o=i&&(t=>{let n=t;for(;e.isParenthesizedExpression(n)||e.isNonNullExpression(n)||e.isAsExpression(n);)n=n.expression;return e.isCallExpression(n)&&(n=n.expression),e.isIdentifier(n)?n.text:e.isPropertyAccessExpression(n)?n.name.text:e.isElementAccessExpression(n)&&e.isStringLiteralLike(n.argumentExpression)?n.argumentExpression.text:void 0})(i);o&&le.test(o)&&u("money-cents",t)}}else if(s.has("local-helper")&&(e.isFunctionDeclaration(t)||e.isVariableDeclaration(t))&&t.name&&e.isIdentifier(t.name)&&Object.prototype.hasOwnProperty.call(f,t.name.text)&&(e.isFunctionDeclaration(t)?void 0!==t.body:void 0!==t.initializer&&(e.isArrowFunction(t.initializer)||e.isFunctionExpression(t.initializer))))u("local-helper",t);else if(e.isStringLiteralLike(t))w(t.text,t,n);else if(e.isTemplateExpression(t)){w(t.head.text,t.head,n);for(const e of t.templateSpans)w(e.literal.text,e.literal,n)}}e.isJsxAttribute(t)&&W.has(t.name.getText(r))?e.forEachChild(t,e=>$(e,!1)):e.forEachChild(t,e=>$(e,n))};return $(r,!0),s.has("ellipsis-label")&&function(e,t,n){const i=new Set,o=(e,t)=>{i.has(e)||(i.add(e),n(t))},s=n=>{if(n)if(e.isStringLiteralLike(n))Ee(n.text,n.text)&&o(n,n.getStart(t));else if(e.isTemplateExpression(n)){const e=[n.head.text,...n.templateSpans.map(e=>e.literal.text)];Ee(e.join(" "),e[e.length-1])&&o(n,n.getStart(t))}else e.isConditionalExpression(n)?(s(n.whenTrue),s(n.whenFalse)):e.isBinaryExpression(n)?(s(n.left),s(n.right)):e.isParenthesizedExpression(n)||e.isAsExpression(n)||e.isJsxExpression(n)?s(n.expression):e.isCallExpression(n)&&Pe.has(Be(n.expression))&&n.arguments[0]&&s(n.arguments[0])},r=n=>{for(const i of n)if(e.isJsxText(i)){const e=i.getText(t);Ee(e,e)&&o(i,i.getStart(t)+(e.length-e.trimStart().length))}else e.isJsxExpression(i)?s(i.expression):(e.isJsxElement(i)||e.isJsxFragment(i))&&r(i.children)},a=(n,i)=>{const o=n.attributes.properties.find(n=>e.isJsxAttribute(n)&&n.name.getText(t)===i),s=o?.initializer;return s&&e.isStringLiteral(s)?s.text:s&&e.isJsxExpression(s)&&s.expression&&e.isStringLiteralLike(s.expression)?s.expression.text:void 0},l=t=>t.properties.some(t=>e.isPropertyAssignment(t)&&(e.isIdentifier(t.name)||e.isStringLiteralLike(t.name))&&"value"===t.name.text&&e.isStringLiteralLike(t.initializer)&&""===t.initializer.text),c=n=>{if(e.isJsxElement(n)){const e=n.openingElement,i=e.tagName.getText(t),o="option"===i&&ve.prompt&&""===a(e,"value");ke.has(i)&&!o&&r(n.children)}else if(e.isJsxAttribute(n))ze.has(n.name.getText(t))&&s(n.initializer);else if(e.isPropertyAssignment(n)){const t=e.isIdentifier(n.name)||e.isStringLiteralLike(n.name)?n.name.text:"",i=ve.prompt&&e.isObjectLiteralExpression(n.parent)&&l(n.parent);ze.has(t)&&!i&&s(n.initializer)}e.forEachChild(n,c)};c(t)}(e,r,e=>(a["ellipsis-label"]??=[]).push(c(e))),a}var Pe=new Set(["say","t"]),Be=e=>{const t=e.getText();return t.slice(t.lastIndexOf(".")+1)};function Me(e){const t={};for(const[n,i]of Object.entries(e))i.length&&(t[n]=i.length);return t}function Oe(e,t,n){const i=e.createSourceFile(t,n,e.ScriptTarget.Latest,!1),o=[];for(const t of i.statements)(e.isImportDeclaration(t)||e.isExportDeclaration(t))&&t.moduleSpecifier&&e.isStringLiteralLike(t.moduleSpecifier)&&o.push(t.moduleSpecifier.text);return o}var Ne=(e,t)=>e.some(e=>t.some(t=>t.endsWith("/*")?e.startsWith(t.slice(0,-1)):e===t));var De=e=>new Map(e.allow.map(e=>[L(e.file,e.kind),e.count]));function Fe(e,t){return e.kinds.filter(e=>t.kinds.includes(e))}var Je=(e,t,n)=>{if("kit-dep"===n)return` (${e.kitDeps.join(", ")})`;if("chart-dep"===n)return` (${e.chartDeps.join(", ")})`;const i=e.hits.get(t)?.[n]??[];if(0===i.length)return"";const o=i.slice(0,12).join(", ");return` (line${1===i.length?"":"s"} ${o}${i.length>12?", …":""})`};function Ue(e,t,n){const i=De(e),o=new Map;for(const[e,s]of t.counts){const{kind:t}=R(e);if(!l(t)||!n.includes(t))continue;const r=s-(i.get(e)??0);r>0&&o.set(e,r)}return{kinds:a.filter(e=>n.includes(e)),counts:o}}function qe(e,t){let n=0;for(const i of new Set([...e.keys(),...t.keys()]))(e.get(i)??0)!==(t.get(i)??0)&&(n+=1);return n}var We="\n// <button> in a comment is not a button, and <svg> in one is not a drawing\n/* nor is <input title=\"x\"> in this one, or dark:bg-black, or #fff */\nimport { createPortal } from 'react-dom';\nimport { Dialog } from '@headlessui/react';\nimport { TrashIcon } from '@heroicons/react/24/outline';\nimport type { Icon } from 'lucide-react';\nimport { Button, confirm } from 'efficient-shell';\nexport { Slot } from '@radix-ui/react-slot';\nexport { CheckIcon } from '@radix-ui/react-icons';\nimport { LineChart } from 'recharts';\nimport 'd3-scale';\nexport { VictoryPie } from 'victory';\nimport { BarChart } from '@mui/x-charts';\nimport Tree from 'react-d3-tree';\nimport { TimeSeriesChart } from 'efficient-shell/ui';\n// import 'chart.js' in a comment is not an import, and 'echarts' in a string is not one either\nconst chartLabel = 'd3-array';\n\nconst a = <button title=\"Says what it does\">x</button>;\nconst b = <input type=\"range\" />;\nconst c = <input type=\"text\" />;\nconst c2 = <input type={\"hidden\"} name=\"csrf\" />;\nconst c3 = <input type=\"hidden\" />;\nconst c4 = <input type={kind} />;\nconst d = <select />;\nconst d2 = <textarea />;\nconst e = <div role=\"dialog\" />;\nconst e2 = <dialog open />;\nconst e3 = <section role={'alertdialog'} />;\nconst f = <iframe title=\"Preview\" />;\nconst f2 = <object title=\"Chart\" />;\nconst g = <Button title=\"a prop, not a tooltip\" role=\"dialog\" />;\nconst g2 = (\n <button\n type=\"button\"\n title={hint}\n >\n y\n </button>\n);\nconst h = ReactDOM.createPortal(a, document.body);\nconst i = createPortal(a, document.body);\n\nasync function leave() {\n if (window.confirm('Sure?')) return;\n globalThis.alert('No');\n alert('native: nothing binds the name');\n prompt('native too');\n await confirm('the shell: the import binds it');\n record.confirm('a method, not the popup');\n}\n\nconst j = <div className=\"bg-white dark:bg-black dark:hover:text-white is-dark:no\" />;\nconst k = clsx('text-gray-900', on && 'dark:text-gray-100');\nconst l = <span style={{ color: '#fff', background: \"#12ab34\" }} className={`border-[#0a0b0c80] ${x}`} />;\nconst m = <a href=\"#faded\" id=\"#bad\" key=\"#abc\" to=\"#face\">skip</a>;\nconst n = <label htmlFor={'#dead'}>skip</label>;\nconst o = <span>&#1234; and BG#00340 and #12345 and #added are not colours</span>;\nconst p = 'entity &#x1f; ref BG#00340';\nconst q = <use xlinkHref=\"#abc\" fill=\"url(#fed)\" />;\nconst t = <div className=\"rounded-[4px] rounded-t-[0.5rem] hover:rounded-[2px] rounded-lg rounded-(--radius-card) rounded-[inherit] rounded-[var(--r)]\" />;\nconst u = <div style={{ borderRadius: 6, borderTopLeftRadius: '3px', borderBottomRightRadius: '50%', borderEndEndRadius: 'var(--radius-card)' }} />;\nconst v = <i style={{ borderRadius: 9999 }} />;\nconst w = <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M4 4h16\" /></svg>;\nconst w2 = <Svg viewBox=\"0 0 24 24\" />;\nconst w3 = '<svg viewBox=\"0 0 1 1\"></svg> in a string is not an element';\nconst r = lazy(() => import('@mui/material'));\nconst s = require('react-select');\nconst s2 = require('chart.js/auto');\nconst s3 = import('@nivo/line');\n",_e={button:2,input:2,range:1,textarea:1,select:1,dialog:3,title:2,portal:2,native:4,dark:3,hex:3,radius:5,kit:5,icon:3,svg:1,chart:5,colour:8},He={kit:1,dark:1,portal:1,radius:2,chart:1,colour:2},Ke=(...e)=>e.join("-"),Ge=`\nconst s1 = <i className="${[Ke("px","2.5"),Ke("py","1.5"),"md:"+Ke("gap","1.5"),"-"+Ke("mt","1.5"),Ke("p","[10px]")].join(" ")}" />;\nconst s2 = <i className="${[Ke("p","0"),Ke("px","px"),Ke("p","0.5"),Ke("p","3"),Ke("gap-x","4"),Ke("p","12"),Ke("p","(--space-12)"),Ke("p","[var(--space-12)]"),Ke("space-x","reverse"),Ke("top","1.5")].join(" ")}" />;\nconst s3 = <i style={{ padding: 6, marginTop: '10px', gap: 8, margin: '0 auto', paddingInline: 'var(--space-12)' }} />;\nconst f1 = <i className="${[Ke("text","[11px]"),Ke("text","[0.8rem]"),Ke("text","xs"),Ke("text","[#fff]"),Ke("text","(--text-2xs)")].join(" ")}" />;\nconst f2 = <i style={{ fontSize: 12 }} />;\nconst f3 = { fontSize: 'var(--x)', font: 'inherit' };\nconst z1 = <i className="${[Ke("z","[9999]"),Ke("z","50"),Ke("z","10"),Ke("z","30"),"-"+Ke("z","10"),Ke("z","auto"),Ke("z","(--z-popup)"),Ke("z","[var(--z-popup)]")].join(" ")}" />;\nconst z2 = { zIndex: on ? 2020 : 2010 };\nconst z3 = { zIndex: Z_LAYERS.popup, top: 9999 };\nconst h1 = <i className="${[Ke("shadow","[0_1px_2px_#000]"),Ke("shadow","md"),"shadow",Ke("shadow","lg"),Ke("shadow","(--elevation-panel)"),Ke("shadow","black/20"),Ke("drop-shadow","md")].join(" ")}" />;\nconst h2 = { boxShadow: '0 1px 2px rgba(0,0,0,.1)' };\nconst h3 = { boxShadow: 'none', outline: 'var(--elevation-raised)' };\n`,Ze={spacing:7,"font-size":3,"z-index":4,shadow:3,hex:1,colour:4},Ve={colour:4},Qe={"ellipsis-label":9},Xe=`\n// "root:default-zone" and \`/wheels/\${slug}\` in a comment are not copies\nimport { escapeHtml } from 'efficient-shell/format';\nconst c1 = "${Ke("pl","[var(--sf-site-gutter,40px)]")}";\nconst c2 = "var(--sf-site-gutter)";\nconst c3 = <i className="${Ke("max","[960px]")}:hidden" />;\nconst c4 = "1960px";\nconst c5 = \`/wheels/\${slug}\`;\nconst c6 = "/tyres/" + slug;\nconst c7 = wheelPath(slug);\nconst c8 = { zone: "root:default-zone" };\nconst c9 = "(max-width: 767px)";\nconst c10 = <img sizes="(max-width: 800px) 100vw, 50vw" />;\nconst c11 = <img sizes={CONTENT_SIZES} />;\nconst c12 = Math.round(price * 100) / 100;\nconst c13 = ratio * 100;\nfunction escapeHtml(s: string) { return s; }\nconst c14 = timeAgo(when);\n`,Ye={"gutter-literal":1,"view-line-literal":1,"route-literal":2,"root-zone-literal":1,"phone-query":1,"sizes-literal":1,"money-cents":1,"local-helper":1},et=e=>a.filter(t=>e[t]).map(t=>`${t} ${e[t]}`).join(", ")||"nothing";var tt="ui-kit.config.json",nt="ui-kit.baseline.json",it="efficient-shell-ui-check",ot=`${it}: every surface a person operates takes its UI from efficient-shell (harness UI-24).\n\n ${it} check this repository against ${nt}\n ${it} --print print today's counts as a baseline, and change nothing\n ${it} --summary print totals per kind and per folder, as Markdown\n ${it} --json print the result as JSON\n ${it} --update lower the lines whose counts fell, and delete the ones at zero\n ${it} --update --allow-move also follow a renamed or split file (no total may rise)\n ${it} --init write the first ${nt}\n ${it} --init --kind <kind> take the baseline for a kind just added to "kinds"\n ${it} --no-base do not compare with the pull request's base branch\n\nKinds: ${a.join(", ")}\nReads ${tt} in the current directory.`;var st=(e,t)=>`${e} ${t}${1===e?"":"s"}`,rt=(e,t)=>{const n=M(e);return t.map(e=>`${e} ${n[e]??0}`).join(" · ")};process.exitCode=function(e,t){const r=function(e){const t={print:!1,summary:!1,json:!1,update:!1,allowMove:!1,init:!1,noBase:!1,help:!1,version:!1,kinds:[]};for(let n=0;n<e.length;n++){const i=e[n];if("--print"===i)t.print=!0;else if("--summary"===i)t.summary=!0;else if("--json"===i)t.json=!0;else if("--update"===i)t.update=!0;else if("--allow-move"===i)t.allowMove=!0;else if("--init"===i)t.init=!0;else if("--no-base"===i)t.noBase=!0;else if("--help"===i||"-h"===i)t.help=!0;else if("--version"===i||"-v"===i)t.version=!0;else if("--kind"===i){const i=e[++n];if(!i)return"--kind needs a kind after it";t.kinds.push(...i.split(","))}else{if(!i.startsWith("--kind="))return`unknown argument "${i}"`;t.kinds.push(...i.slice(7).split(","))}}return t.allowMove&&!t.update?"--allow-move goes with --update":t.kinds.length&&!t.init?"--kind goes with --init":[t.print,t.summary,t.update,t.init].filter(Boolean).length>1?"choose one of --print, --summary, --update and --init":t}(e);if("string"==typeof r)return t.err(`${it}: ${r}\n\n${ot}`),2;if(r.help)return t.out(ot),0;if(r.version)return t.out(t.version),0;const c=e=>(r.json?t.out(JSON.stringify({tool:it,version:t.version,ok:!1,failures:[e]},null,2)):t.err(`${it}: ${e}`),1),f=n(t.cwd,tt);if(!i(f))return c(`no ${tt} in ${t.cwd}. Run it from the repository root; the harness has the template.`);let p,m;try{p=function(e,t="ui-kit.config.json"){const n=[],i=e=>{n.push(e)},o=(e,t,{required:n=!1}={})=>{if(void 0===e&&!n)return[];if(!Array.isArray(e)||e.some(e=>"string"!=typeof e||""===e))return i(`${t} must be a list of non-empty strings`),[];n&&0===e.length&&i(`${t} must name at least one entry`);for(const n of e)(n.startsWith("/")||n.startsWith("./")||n.includes("\\")||n.split("/").includes(".."))&&i(`${t}: "${n}" must be a path from the repository root, written with / (no ./, .. or \\)`);return e},s=(e,t)=>"string"!=typeof e||e.trim().length<10?(i(`${t} needs a "reason" a reviewer can read (a sentence, not a word)`),""):e,r=(e,t)=>void 0===e?[]:!Array.isArray(e)||e.some(e=>!N(e))?(i(`${t} must be a list of objects`),[]):e;if(!N(e))throw new O(`${t}: must be a JSON object`);for(const t of Object.keys(e))D.has(t)||i(`unknown key "${t}"`);1!==e.schema&&i("number"==typeof e.schema&&e.schema>1?`"schema": ${e.schema} is newer than this efficient-shell reads (1); upgrade efficient-shell`:'"schema" must be 1');const c=[];if(Array.isArray(e.kinds)&&0!==e.kinds.length)for(const t of e.kinds)l(t)?c.includes(t)?i(`"kinds": "${t}" is listed twice`):c.push(t):i(`"kinds": unknown kind ${JSON.stringify(t)} (this efficient-shell knows: ${a.join(", ")})`);else i(`"kinds" must list the kinds this repository checks, from: ${a.join(", ")}`);const u=o(e.include,'"include"'),d=o(e.exclude,'"exclude"'),h=r(e.includeImporting,'"includeImporting"').map((e,t)=>({files:o(e.files,`"includeImporting"[${t}].files`,{required:!0}),modules:o(e.modules,`"includeImporting"[${t}].modules`,{required:!0}),reason:s(e.reason,`"includeImporting"[${t}]`)}));0===u.length&&0===h.length&&i('"include" must name the files that are operator UI (for example ["src/**/*.tsx"])');const f=r(e.output,'"output"').map((e,t)=>({files:o(e.files,`"output"[${t}].files`,{required:!0}),reason:s(e.reason,`"output"[${t}]`)})),p=[],m=new Set;if(r(e.allow,'"allow"').forEach((e,t)=>{const n=`"allow"[${t}]`,[r]=o([e.file],`${n}.file`),u=s(e.reason,n);if(!l(e.kind))return void i(`${n}.kind must be one of: ${a.join(", ")}`);if(c.includes(e.kind)||i(`${n}: kind "${e.kind}" is not in "kinds"`),"number"!=typeof e.count||!Number.isInteger(e.count)||e.count<1)return void i(`${n}.count must be a whole number, 1 or more`);if(!r)return;const d=`${r}:${e.kind}`;m.has(d)&&i(`${n}: ${r} already has an allow entry for "${e.kind}"`),m.add(d),p.push({file:r,kind:e.kind,count:e.count,reason:u})}),n.length)throw new O(`${t}:\n - ${n.join("\n - ")}`);return{schema:1,kinds:a.filter(e=>c.includes(e)),include:u,exclude:d,includeImporting:h,output:f,allow:p}}(JSON.parse(o(f,"utf8")),tt)}catch(e){return c(e instanceof O?e.message:`${tt} is not valid JSON: ${e.message}`)}try{m=t.loadTypeScript()}catch{return c('this check reads the TypeScript AST and found no "typescript" package here. Install it as a devDependency.')}const g=function(e){const t=[],n=d,i=[["fixture.tsx",We,_e],["fixture.ts","\nimport { toast } from 'sonner';\nimport { extent } from 'd3-array';\nexport const tone = { warn: '#f59e0b' };\nexport const cls = 'ring-1 dark:ring-white rounded-[3px]';\nexport const box = { borderRadius: '0.25rem', radius: 4 };\nexport function ask(confirm: (message: string) => boolean) {\n return confirm('a parameter binds the name');\n}\nexport const mount = (node: unknown) => ReactDOM.createPortal(node, document.body);\n",He],["tokens.tsx",Ge,Ze],["labels.tsx","\n// <Button>Save…</Button> in a comment is not a label\nconst l1 = <Button>Extend trial…</Button>;\nconst l2 = <PopupMenuItem onClick={go}><span>Read from a PDF...</span></PopupMenuItem>;\nconst l3 = <Button>{busy ? 'Saving…' : 'Duplicate site…'}</Button>;\nconst l4 = <Item label=\"Translate…\" aria-label={'More…'} />;\nconst l5 = [{ label: 'Reject…' }, { value: CUSTOM, label: 'Custom…' }];\nconst l6 = <option value={CUSTOM}>Different address…</option>;\nconst l7 = <PopupMenuLabel>{say(\"Duplicate to page…\")}</PopupMenuLabel>;\nconst n7 = <Button>{t('team:menu.remove')}</Button>;\nconst n1 = <Button>{`${name.slice(0, 9)}…`}</Button>;\nconst n2 = <p>Loading weather…</p>;\nconst n3 = <Input placeholder=\"Search…\" />;\nconst n4 = <option value=\"\">Pick a carrier…</option>;\nconst n5 = [{ value: '', label: 'Select…' }];\nconst n6 = <Button>Extend trial</Button>;\n",Qe],["copies.tsx",Xe,Ye]];for(const[o,s,r]of i){const i=Me(Ce(e,o,s,n));n.some(e=>(i[e]??0)!==(r[e]??0))&&t.push(`${o}: read ${et(i)}; it holds ${et(r)}`)}const o=Me(Te('\n/* #fff in a comment */\n.a:hover { color: #111; border: 1px solid white; }\n[data-x="#fff"] { mask-image: linear-gradient(#000, transparent); color: var(--ink); }\n.b { --mine: rgb(0 0 0 / .5); background: var(--surface, #fff); }\n',n));n.some(e=>(o[e]??0)!==(Ve[e]??0))&&t.push(`style.css: read ${et(o)}; it holds ${et(Ve)}`);const s=Me(Ce(e,"fixture.tsx",We,["button"]));return"button"!==Object.keys(s).join()&&t.push(`asked for button alone, the reader reported ${et(s)}`),t}(m);if(g.length)return c(`the reader misread its own fixtures with typescript ${m.version}, so nothing it says about this repository can be trusted:\n - `+g.join("\n - "));const x=function(e,t,s){const r=[],a=v(s.exclude),l=v(s.output.flatMap(e=>e.files)),c=new Map,d=e=>{let i=c.get(e);return void 0===i&&c.set(e,i=o(n(t,e),"utf8")),i},h=(e,n)=>{for(const i of e)0===I(t,[i]).length&&r.push(`${n}: "${i}" matches no file. Delete the line, or fix the path.`)};h(s.include,'"include"'),s.output.forEach((e,t)=>h(e.files,`"output"[${t}]`)),s.includeImporting.forEach((e,t)=>h(e.files,`"includeImporting"[${t}]`));const f=new Set,p=s.kinds.includes("colour"),m=e=>(Ae(e)||p&&Le(e))&&!a(e)&&!l(e);for(const e of I(t,s.include))m(e)&&f.add(e);for(const n of s.includeImporting)for(const i of I(t,n.files))m(i)&&Ae(i)&&!f.has(i)&&Ne(Oe(e,i,d(i)),n.modules)&&f.add(i);const g=[...f].sort(),x=s.kinds.filter(e=>!u(e)),k=new Map,y=new Map,$=new Set;for(const t of g){const n=Le(t)?Te(d(t),x):Ce(e,t,d(t),x,$);let i=!1;for(const e of x){const o=n[e]?.length??0;o&&(y.set(L(t,e),o),i=!0)}i&&k.set(t,n)}let S=[],z=[],E=[];const j=s.kinds.filter(u);if(j.length){const e=n(t,F);if(i(e)){const t=JSON.parse(o(e,"utf8")),n=["dependencies","peerDependencies","optionalDependencies"].flatMap(e=>Object.keys(t[e]??{})),i=new Set([...$].flatMap(e=>w[e]??[])),r=[...new Set(n)].sort();if(s.kinds.includes("kit-dep")){const e=r.filter(e=>"kit-dep"===b(e));S=e.filter(e=>!i.has(e)),z=e.filter(e=>i.has(e)),S.length&&y.set(L(F,"kit-dep"),S.length)}s.kinds.includes("chart-dep")&&(E=r.filter(e=>"chart-dep"===b(e)),E.length&&y.set(L(F,"chart-dep"),E.length))}else for(const e of j)r.push(`"kinds" includes "${e}", and there is no ${F} here to read.`)}for(const e of s.allow)(u(e.kind)?e.file===F:f.has(e.file))||r.push(`"allow": ${e.file} (${e.kind}) is not a file this check reads. Delete the entry, or fix the path.`);return{files:g,hits:k,counts:y,kitDeps:S,shellPeers:z,chartDeps:E,problems:r}}(m,t.cwd,p);if(0===x.files.length)return c(`read no files. "include" in ${tt} matches nothing, so a pass would mean nothing.`);const k=n(t.cwd,nt),y=r.json,$=e=>{y||t.out(e)};if(r.print)return t.out(B(Ue(p,x,p.kinds)).trimEnd()),0;if(r.summary){for(const e of function(e,t){const n=new Map,i=new Map;for(const[e,o]of t.counts){const{file:t,kind:s}=R(e);if(!l(s))continue;const r=n.get(s)??{count:0,files:new Set};r.count+=o,r.files.add(t),n.set(s,r);const a=t.split("/"),c=a.length>2?a.slice(0,2).join("/"):2===a.length?a[0]:".",u=i.get(c)??{};u[s]=(u[s]??0)+o,i.set(c,u)}const o=e.kinds.filter(e=>n.has(e)),s=[`**UI kit check (harness UI-24):** ${new Set([...t.counts.keys()].map(e=>R(e).file)).size} of ${st(t.files.length,"file")} still draw UI of their own.`,"","| Kind | Count | Files | The shell has |","|---|---:|---:|---|",...e.kinds.map(e=>{const t=n.get(e);return`| \`${e}\` | ${t?.count??0} | ${t?.files.size??0} | ${h[e].instead} |`})];if(o.length&&i.size){const e=e=>o.reduce((t,n)=>t+(e[n]??0),0),t=[...i].sort((t,n)=>e(n[1])-e(t[1])||(t[0]<n[0]?-1:1));s.push("",`| Folder | ${o.map(e=>`\`${e}\``).join(" | ")} | Total |`,`|---|${o.map(()=>"---:").join("|")}|---:|`,...t.map(([t,n])=>`| \`${t}\` | ${o.map(e=>n[e]??0).join(" | ")} | ${e(n)} |`))}return s}(p,x))t.out(e);return 0}let S=null;if(i(k))try{S=P(o(k,"utf8"),nt)}catch(e){return c(e instanceof A?e.message:String(e))}if(r.init){const e=r.kinds.filter(e=>!l(e)||!p.kinds.includes(e));if(e.length)return c(`--kind ${e.join(", ")}: not in "kinds" in ${tt}. Add it there first.`);const t=r.kinds;if(S){if(0===t.length)return c(`${nt} already exists, and --init would overwrite what it holds. It is for the adoption pull request only. To start checking a kind, add it to "kinds" and run --init --kind <kind>.`);const e=t.filter(e=>S.kinds.includes(e));if(e.length)return c(`the baseline was already taken for ${e.join(", ")}. Its lines only go down; use --update.`);const n=Ue(p,x,t);S={kinds:[...S.kinds,...t],counts:new Map([...S.counts,...n.counts])}}else{if(t.length)return c(`there is no ${nt} yet. Run --init on its own first.`);S=Ue(p,x,p.kinds)}s(k,B(S)),$(`${it}: wrote ${nt} (${st(S.counts.size,"line")}: ${rt(S.counts,S.kinds)})`)}if(!S)return c(`no ${nt}. This repository has not adopted the check yet: run ${it} --init, and commit the file.`);if(r.update){const e=function(e,t,n,{allowMove:i=!1}={}){const o=Fe(e,t),s=Ue(e,n,o),r=new Map([...t.counts].filter(([e])=>o.includes(R(e).kind)));if(i){const e=M(r),n=M(s.counts),i=o.filter(t=>(n[t]??0)>(e[t]??0)).map(t=>`${t}: ${n[t]??0} across the repository, and the baseline holds ${e[t]??0}`);return i.length?{baseline:t,lowered:0,refused:i}:{baseline:s,lowered:qe(r,s.counts),refused:[]}}const a=new Map;for(const[e,t]of r){const n=Math.min(t,s.counts.get(e)??0);n>0&&a.set(e,n)}return{baseline:{kinds:o,counts:a},lowered:qe(r,a),refused:[]}}(p,S,x,{allowMove:r.allowMove});if(e.refused.length)return c(`--allow-move follows code that moved, and this is more of it than before:\n - ${e.refused.join("\n - ")}\nNothing was written.`);S=e.baseline,s(k,B(S)),$(`${it}: ${e.lowered?`changed ${st(e.lowered,"line")} in`:"nothing to change in"} ${nt}`)}const z=function(e,t,n){const i=[],o=[],s=[...n.problems],r=De(e),a=new Set(Fe(e,t)),c=e.kinds.filter(e=>!t.kinds.includes(e));c.length&&s.push(`"kinds" names ${c.map(e=>`"${e}"`).join(", ")}, and the baseline was never taken for ${1===c.length?"it":"them"}. Run: efficient-shell-ui-check --init ${c.map(e=>`--kind ${e}`).join(" ")}`);const u=t.kinds.filter(t=>!e.kinds.includes(t));u.length&&o.push(`the baseline still carries ${u.map(e=>`"${e}"`).join(", ")}, which "kinds" no longer names`);const d=new Set([...n.counts.keys(),...t.counts.keys(),...r.keys()]);for(const e of[...d].sort(C)){const{file:c,kind:u}=R(e);if(!l(u)||!a.has(u))continue;const d=n.counts.get(e)??0,f=r.get(e)??0,p=t.counts.get(e)??0;d>f+p?i.push(`${c}: ${u} ${d}, and its line allows ${f+p}${Je(n,c,u)}. ${h[u].counts} is counted; use ${h[u].instead}.`):d<f?s.push(`${c}: ${u} ${d}, and "allow" in ui-kit.config.json says ${f}. ${0===d?"Delete the entry":`Lower its count to ${d}`}: an exception does not outlive what it excused.`):d<f+p&&o.push(`${c}: ${u} ${d}, and its line says ${f+p}`)}return{grown:i,shrunk:o,other:s,updateFixes:0===i.length&&0===s.length&&o.length>0}}(p,S,x),E=r.noBase?{problems:[],note:""}:function(e,t,n){const i=e.env.GITHUB_BASE_REF;if(!i)return{problems:[],note:""};const o=e.git(["rev-parse","--show-prefix"]);if(null===o)return{problems:[],note:"not a git checkout; the base branch was not compared"};const s=`origin/${i}`;if(null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])&&(e.git(["fetch","--no-tags","--depth=1","origin",`+refs/heads/${i}:refs/remotes/origin/${i}`]),null===e.git(["rev-parse","--verify","--quiet",`${s}^{commit}`])))return{problems:[],note:`${s} could not be fetched; the base branch was not compared`};const r=e.git(["show",`${s}:${o.trim()}${nt}`]);if(null===r)return{problems:[],note:`${s} has no ${nt} yet (adoption)`};let a;try{a=P(r,`${s}:${nt}`)}catch{return{problems:[],note:`${s}'s ${nt} could not be read; the base branch was not compared`}}const l=M(a.counts),c=M(t.counts);return{problems:n.filter(e=>a.kinds.includes(e)&&(c[e]??0)>(l[e]??0)).map(e=>`${nt} holds ${c[e]??0} of "${e}", and ${s} holds ${l[e]??0}. The baseline only goes down: use ${h[e].instead}. A count that is meant to stay goes in "allow" in ${tt}, with its reason.`),note:`compared with ${s}`}}(t,S,p.kinds),j=p.kinds.filter(e=>S.kinds.includes(e)),T=`${it} --update`,J=[...z.other,...z.grown,...z.shrunk.map(e=>`${e}. Run: ${T}`),...E.problems],U=0===J.length;if(r.json){const e=new Map(p.allow.map(e=>[`${e.file}:${e.kind}`,e.count]));return t.out(JSON.stringify({tool:it,version:t.version,ok:U,schema:p.schema,kinds:p.kinds,files:x.files.length,counts:M(x.counts),baseline:M(S.counts),allowed:M(e),kitDeps:x.kitDeps,shellPeers:x.shellPeers,chartDeps:x.chartDeps,failures:J},null,2)),U?0:1}t.out(`UI kit check (harness UI-24), efficient-shell ${t.version}\n`);const q=(e,n,i="")=>{if(0===n.length)return t.out(` ok ${e}`);t.err(` FAIL ${e}`);for(const e of n)t.err(` ${e}`);i&&t.err(` ${i}`)};t.out(` ok the reader reads its own fixtures (typescript ${m.version})`),t.out(` ok read ${st(x.files.length,"file")}`),q(`${tt} and ${nt} describe this repository`,z.other),q("no file draws more of its own UI than its line allows",z.grown),q("every line is exact: a count that fell is a line to lower",z.shrunk,`Run: ${T}${z.updateFixes?"":" (after the failures above are fixed)"}`),E.note&&q(`the baseline is no higher than the base branch (${E.note})`,E.problems);const W=new Set([...x.counts.keys()].map(e=>R(e).file));return t.out(` ok PROGRESS: ${W.size} of ${st(x.files.length,"file")} still draw UI of their own: `+rt(x.counts,j)),t.out(""),U?t.out("UI kit check: ok"):t.err(`UI kit check: FAILED (${st(J.length,"problem")})`),U?0:1}(process.argv.slice(2),{cwd:process.cwd(),env:process.env,out:e=>console.log(e),err:e=>console.error(e),loadTypeScript:()=>function(e){for(const i of[n(process.cwd(),"package.json"),e])try{return t(i)("typescript")}catch{}throw new Error("typescript is not installed")}(import.meta.url),git:function(t){try{return e("git",t,{cwd:process.cwd(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:6e4,maxBuffer:67108864})}catch{return null}},version:"12.34.0"});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{PieChart as default}from"../chunk-DYOFTZOC.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
2
+ export{PieChart as default}from"../chunk-CUJA3HBZ.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-DGFFDZCY.js";import"../chunk-HY6CBG4M.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
2
+ export{RADAR_SERIES_CAP,RadarChart as default}from"../chunk-OZV5P5A7.js";import"../chunk-HY6CBG4M.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{RadialBarChart as default}from"../chunk-KZQRUVII.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-CNYAHYE6.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
2
+ export{RadialBarChart as default}from"../chunk-TZBNN6HD.js";import"../chunk-465RRWBY.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
@@ -1 +1 @@
1
- export{SpecChart as default}from"../chunk-APGIPXR7.js";import"../chunk-GEYM4WN3.js";import"../chunk-Y3JW2GW5.js";import"../chunk-36BRD5J3.js";import"../chunk-LF27WIN2.js";import"../chunk-EEFUXXYJ.js";import"../chunk-FEQQMRHJ.js";import"../chunk-CK2YOGUS.js";import"../chunk-VWYICGVA.js";import"../chunk-VFC6QUEN.js";import"../chunk-PA3OU3Y7.js";import"../chunk-465RRWBY.js";import"../chunk-NLHGFQ54.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-D53FU245.js";import"../chunk-2UBR4YUF.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
1
+ export{SpecChart as default}from"../chunk-YHABPVWU.js";import"../chunk-GEYM4WN3.js";import"../chunk-Y3JW2GW5.js";import"../chunk-36BRD5J3.js";import"../chunk-LF27WIN2.js";import"../chunk-UF76AFFY.js";import"../chunk-PA3OU3Y7.js";import"../chunk-465RRWBY.js";import"../chunk-FEQQMRHJ.js";import"../chunk-CK2YOGUS.js";import"../chunk-VWYICGVA.js";import"../chunk-NLHGFQ54.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-G67CJAQ2.js";import"../chunk-SOZCWT6I.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-D53FU245.js";import"../chunk-2UBR4YUF.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TimeSeriesChart as default}from"../chunk-EEFUXXYJ.js";import"../chunk-FEQQMRHJ.js";import"../chunk-CK2YOGUS.js";import"../chunk-VFC6QUEN.js";import"../chunk-465RRWBY.js";import"../chunk-NLHGFQ54.js";import"../chunk-CNYAHYE6.js";import"../chunk-2UBR4YUF.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
2
+ export{TimeSeriesChart as default}from"../chunk-UF76AFFY.js";import"../chunk-465RRWBY.js";import"../chunk-FEQQMRHJ.js";import"../chunk-CK2YOGUS.js";import"../chunk-NLHGFQ54.js";import"../chunk-VFC6QUEN.js";import"../chunk-CNYAHYE6.js";import"../chunk-2UBR4YUF.js";import"../chunk-MAFUXCPZ.js";import"../chunk-2JWPNR2U.js";import"../chunk-WDQI3FV6.js";import"../chunk-TZFACUMR.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-DEJIH3ZQ.js";import"../chunk-C3QOHMR6.js";
@@ -0,0 +1 @@
1
+ var r="12.34.0",a=r;export{a as APP_VERSION,r as VERSION};
@@ -1,8 +1,8 @@
1
- import{arcPath as e}from"./chunk-VFC6QUEN.js";import{MOTION as t,stagger as l}from"./chunk-465RRWBY.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{usePlotWidth as r}from"./chunk-MAFUXCPZ.js";import{angleScale as n}from"./chunk-2JWPNR2U.js";import{ChartTooltip as o}from"./chunk-WDQI3FV6.js";import{CHART_INK as s,resolveSeriesColor as i}from"./chunk-TZFACUMR.js";import{useShellStrings as h,useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{formatPercent as m,formatPlain as u}from"./chunk-C3QOHMR6.js";import{useId as d,useState as f,useRef as y}from"react";import{jsx as p,jsxs as g}from"react/jsx-runtime";function x({segments:x,variant:v="pie",size:k=280,innerRadius:M,padAngle:b=.012,maxSegments:N=6,otherLabel:I,formatValue:$,centerLabel:j,animate:F=!0,labels:w="none",labelMinShare:P=.04,className:S,emptyLabel:A}){const C=h().charts,W=c(),E=$??(e=>u(e,W)),R=I??C.other,z=A??C.nothingToBreakDown,T=d(),[V,_]=f(null),{highlighted:L}=a(),Q=y(null),U=r(Q,Number.POSITIVE_INFINITY),Y=x.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===Y.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${S??""}`,children:z});const B=[...Y].sort((e,t)=>t.value-e.value),D=B.slice(0,N),H=B.slice(N),O=H.length>0?[...D,{key:"__other__",label:R,value:H.reduce((e,t)=>e+t.value,0),slot:-1,color:s.muted}]:D,Z=e=>i(e.slot,e.color,e.tone),J=O.reduce((e,t)=>e+t.value,0),q=Math.ceil(.62*Math.max(...O.map(e=>String(e.label).length),4)*11)+24,X="outside"===w&&U>=120+2*q,G=X?q:0,K=X?Math.max(120,Math.min(k,U-2*G)):k,ee=K+2*G,te=G+K/2,le=K/2,ae=K/2-12,re=M??("ring"===v?.58*ae:0),ne=n(O.length,b),oe=Math.max(...O.map(e=>e.value)),se=e=>re+(ae-re)*Math.sqrt(Math.max(0,e)/oe);let ie=-Math.PI/2;const he=(()=>{if(!X)return[];let e=-Math.PI/2;const t=O.map((t,l)=>{const a="rose"===v?n(O.length,b).step:t.value/J*Math.PI*2,r="rose"===v?n(O.length,b).center(l):e+a/2;e+=a;const o="rose"===v?se(t.value):ae;return{key:t.key,label:t.label,share:t.value/J,right:Math.cos(r)>=0,anchor:[te+o*Math.cos(r),le+o*Math.sin(r)],y:le+(o+14)*Math.sin(r),index:l}}).filter(e=>e.share>=P),l=Math.max(1,Math.floor((K-11-13)/26)+1),a=/* @__PURE__ */new Set;for(const e of[!0,!1]){const r=t.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,l).sort((e,t)=>e.y-t.y);for(let e=1;e<r.length;e+=1)r[e].y-r[e-1].y<26&&(r[e].y=r[e-1].y+26);for(let e=r.length-1;e>=0;e-=1){const t=e===r.length-1?K-13:r[e+1].y-26;r[e].y=Math.min(r[e].y,t)}r.forEach((e,t)=>{e.y=Math.max(e.y,0===t?11:r[t-1].y+26),a.add(e.key)})}return t.filter(e=>a.has(e.key))})(),ce=(e,t)=>null!==V?V!==e:null!==L&&L!==t,me=null!==V?O[V]:void 0;/* @__PURE__ */
1
+ import{MOTION as e,stagger as t}from"./chunk-465RRWBY.js";import{arcPath as l}from"./chunk-VFC6QUEN.js";import{useHighlight as a}from"./chunk-CNYAHYE6.js";import{usePlotWidth as r}from"./chunk-MAFUXCPZ.js";import{angleScale as n}from"./chunk-2JWPNR2U.js";import{ChartTooltip as o}from"./chunk-WDQI3FV6.js";import{CHART_INK as s,resolveSeriesColor as i}from"./chunk-TZFACUMR.js";import{useShellStrings as h,useShellLocale as c}from"./chunk-DEJIH3ZQ.js";import{formatPercent as m,formatPlain as u}from"./chunk-C3QOHMR6.js";import{useId as d,useState as f,useRef as y}from"react";import{jsx as p,jsxs as g}from"react/jsx-runtime";function x({segments:x,variant:v="pie",size:k=280,innerRadius:M,padAngle:b=.012,maxSegments:N=6,otherLabel:I,formatValue:$,centerLabel:j,animate:F=!0,labels:w="none",labelMinShare:P=.04,className:S,emptyLabel:A}){const C=h().charts,W=c(),E=$??(e=>u(e,W)),R=I??C.other,z=A??C.nothingToBreakDown,T=d(),[V,_]=f(null),{highlighted:L}=a(),Q=y(null),U=r(Q,Number.POSITIVE_INFINITY),Y=x.map((e,t)=>({...e,slot:t})).filter(e=>e.value>0);if(0===Y.length)/* @__PURE__ */return p("p",{className:`text-sm text-gray-500 ${S??""}`,children:z});const B=[...Y].sort((e,t)=>t.value-e.value),D=B.slice(0,N),H=B.slice(N),O=H.length>0?[...D,{key:"__other__",label:R,value:H.reduce((e,t)=>e+t.value,0),slot:-1,color:s.muted}]:D,Z=e=>i(e.slot,e.color,e.tone),J=O.reduce((e,t)=>e+t.value,0),q=Math.ceil(.62*Math.max(...O.map(e=>String(e.label).length),4)*11)+24,X="outside"===w&&U>=120+2*q,G=X?q:0,K=X?Math.max(120,Math.min(k,U-2*G)):k,ee=K+2*G,te=G+K/2,le=K/2,ae=K/2-12,re=M??("ring"===v?.58*ae:0),ne=n(O.length,b),oe=Math.max(...O.map(e=>e.value)),se=e=>re+(ae-re)*Math.sqrt(Math.max(0,e)/oe);let ie=-Math.PI/2;const he=(()=>{if(!X)return[];let e=-Math.PI/2;const t=O.map((t,l)=>{const a="rose"===v?n(O.length,b).step:t.value/J*Math.PI*2,r="rose"===v?n(O.length,b).center(l):e+a/2;e+=a;const o="rose"===v?se(t.value):ae;return{key:t.key,label:t.label,share:t.value/J,right:Math.cos(r)>=0,anchor:[te+o*Math.cos(r),le+o*Math.sin(r)],y:le+(o+14)*Math.sin(r),index:l}}).filter(e=>e.share>=P),l=Math.max(1,Math.floor((K-11-13)/26)+1),a=/* @__PURE__ */new Set;for(const e of[!0,!1]){const r=t.filter(t=>t.right===e).sort((e,t)=>t.share-e.share).slice(0,l).sort((e,t)=>e.y-t.y);for(let e=1;e<r.length;e+=1)r[e].y-r[e-1].y<26&&(r[e].y=r[e-1].y+26);for(let e=r.length-1;e>=0;e-=1){const t=e===r.length-1?K-13:r[e+1].y-26;r[e].y=Math.min(r[e].y,t)}r.forEach((e,t)=>{e.y=Math.max(e.y,0===t?11:r[t-1].y+26),a.add(e.key)})}return t.filter(e=>a.has(e.key))})(),ce=(e,t)=>null!==V?V!==e:null!==L&&L!==t,me=null!==V?O[V]:void 0;/* @__PURE__ */
2
2
  return g("div",{className:`relative ${S??""}`,ref:Q,children:[
3
3
  /* @__PURE__ */g("svg",{width:"100%",height:K,viewBox:`0 0 ${ee} ${K}`,role:"img","aria-labelledby":T,onMouseLeave:()=>_(null),children:[
4
4
  /* @__PURE__ */p("title",{id:T,children:C.breakdown(E(J),O.length)}),O.map((a,r)=>{const n=Z(a),o="rose"===v?ne(r):ie,i="rose"===v?ne.step:a.value/J*Math.PI*2-b;"rose"!==v&&(ie+=a.value/J*Math.PI*2);const h=o+Math.max(.001,i),c="rose"===v?se(a.value):ae;/* @__PURE__ */
5
- return p("path",{d:e(te,le,re,c,o,h),fill:n,fillOpacity:ce(r,a.key)?.4:1,stroke:s.surface,strokeWidth:1,className:F?t.sweep:void 0,style:F?l(r,55):void 0,onMouseEnter:()=>_(r)},a.key)}),he.map(e=>{const t=e.right?ee-6:6,l=e.right?te+ae+14:te-ae-14;/* @__PURE__ */
5
+ return p("path",{d:l(te,le,re,c,o,h),fill:n,fillOpacity:ce(r,a.key)?.4:1,stroke:s.surface,strokeWidth:1,className:F?e.sweep:void 0,style:F?t(r,55):void 0,onMouseEnter:()=>_(r)},a.key)}),he.map(e=>{const t=e.right?ee-6:6,l=e.right?te+ae+14:te-ae-14;/* @__PURE__ */
6
6
  return g("g",{children:[
7
7
  /* @__PURE__ */p("polyline",{points:`${e.anchor[0].toFixed(1)},${e.anchor[1].toFixed(1)} ${l},${e.y.toFixed(1)} ${t},${e.y.toFixed(1)}`,fill:"none",stroke:s.grid,strokeWidth:1}),
8
8
  /* @__PURE__ */p("text",{x:t,y:e.y-2,fontSize:11,fill:s.label,textAnchor:e.right?"end":"start",children:e.label}),
@@ -1,20 +1,20 @@
1
- import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-FCWBO7I3.js";import{ImageLightbox as r}from"./chunk-HWJQLLJA.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{EmptyState as i}from"./chunk-3TCGXYUC.js";import{DescriptionList as t}from"./chunk-SACUSHVN.js";import{Drawer as o}from"./chunk-3RX5KCUH.js";import{Breadcrumbs as d}from"./chunk-YM7AWNMY.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-3YCU6V3U.js";import{useMediaMoveItems as u}from"./chunk-JWUNK2PW.js";import{RenameField as m}from"./chunk-QIPO4EVJ.js";import{NativeSelect as p}from"./chunk-KITSIQCV.js";import{MediaUploadGrid as h}from"./chunk-BNPJHOAC.js";import{MediaUsedInList as f}from"./chunk-ZDDMFFQK.js";import{useGridSelection as g}from"./chunk-VLKDWKVR.js";import{useMarquee as v}from"./chunk-OLFYNMTD.js";import{Segmented as k}from"./chunk-HNIIDDLJ.js";import{copyToClipboard as y}from"./chunk-HTHNDX32.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as C}from"./chunk-QMBMK6PP.js";import{Banner as x}from"./chunk-ID35S5Y6.js";import{Input_default as I}from"./chunk-PT4GMPUB.js";import{DropdownMenu as N}from"./chunk-3DSGJIC7.js";import{IconButton_default as D}from"./chunk-SV5RRBVA.js";import{useFileIntake as S,FileIntakeAlert as j}from"./chunk-ITEOA45V.js";import{setModalDragAside as T,modalIdHolding as z}from"./chunk-EIFNESXS.js";import{ColoredBadge as F}from"./chunk-ZGIAMYTI.js";import{Button_default as L}from"./chunk-EVYD6UFQ.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-SOZCWT6I.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as A}from"./chunk-MAFUXCPZ.js";import{useShellStrings as M}from"./chunk-DEJIH3ZQ.js";import{useRef as U,useMemo as R,useCallback as K,useState as B,useEffect as V}from"react";import{jsxs as J,Fragment as H,jsx as W}from"react/jsx-runtime";var Y="application/x-efficient-media-files",Q="application/x-efficient-media-folder",G="application/x-efficient-media-file";function $(e){if(!e||!Array.from(e.types).includes(G))return null;try{const n=JSON.parse(e.getData(G));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var Z={type:"all",use:"any",sort:"newest"},X={lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */W(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:$="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=Z,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:Ce,onNewFolder:xe,onRename:Ie,onMove:Ne,onTrash:De,onDeleteFolder:Se,onRestore:je,onDeleteForever:Te,onEmptyTrash:ze,onReplace:Fe,onCropEdit:Le,onOpenInDesign:Oe,onChoose:Ee,onCancel:Pe,pickNote:Ae,onDragOut:Me,className:Ue=""}=O,Re=M().mediaLibrary,Ke=M().media,Be="pick"===$,Ve=!Be,Je=U(null),He=A(Je,"phone"===_?343:1200),We="phone"===_||"auto"===_&&He<640,Ye=R(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),Qe=R(()=>new Map(le.map(e=>[e.id,e])),[le]),Ge=R(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Qe.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Qe]),$e=K(e=>{const n=[];for(let l=e?Qe.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Qe.get(l.parentId):void 0);return n},[Qe,le.length]),Ze=K((e,n)=>$e(e).some(e=>e.id===n),[$e]),[Xe,qe]=B(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>qe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=K(e=>{qe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;V(()=>{if("files"===ee.place)en(["@files",...$e(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Ye.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Re.readOnly} ${Re.editedAtHq(e.sharedFrom)}`:Re.readOnly,cn=R(()=>te.map(e=>e.id),[te]),un=R(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=g(cn),pn=R(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=U(!0);V(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");V(()=>{he&&mn.setSelection(he)},[gn]);const vn=U(gn??""),kn=pn.join("\0");V(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Be?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=B(null),Cn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Qe.get(n.id)?.name:un.get(n.id)?.name)&&Ie?.(n,e)},xn=async e=>{if(!xe)return;const n=await xe(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},In=K(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Re.alreadyHere:void 0;const l=Qe.get(e.id);return n===e.id||n&&Ze(n,e.id)?Re.notIntoItself:(l?.parentId??null)===n?Re.folderAlreadyHere:void 0};n.push({key:s,label:Re.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Ge.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[Ge,Qe,tn,Ze,on,Re]),Nn=K(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=B(null),jn={words:Re,media:Ke,denied:ve,moveTargets:In,kindOf:Nn,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&Ve?e=>{xn(e)}:void 0,rename:Ie&&Ve?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ne&&Ve?Ne:void 0,trash:De&&Ve?De:void 0,deleteFolder:Se&&Ve?Se:void 0,folderNotEmpty:e=>!!Qe.get(e)?.notEmpty,replace:Fe&&Ve?Fe:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Re.urlLabel,n)},openInDesign:Oe,restore:je,deleteForever:Te},Tn=e=>c(e,jn),zn=w(),Fn=(e,n)=>{Be||(mn.isSelected(e)||mn.select(e),zn.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Ln,On]=B(null),[En,Pn]=B(null),[An,Mn]=B(null);V(()=>{if(!En&&!Ln)return;const e=()=>{Pn(null),On(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[En,Ln]);const Un=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Rn=(e,n)=>!(!Ne||ve.move||Be)&&(!!Un(e,Y)||!(!Un(e,Q)||!An)&&(n!==An&&!(n&&Ze(n,An)))),Kn=(e,n)=>({onDragEnter:l=>{Rn(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Rn(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Ln!==e&&On(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||On(n=>n===e?null:n)},onDrop:e=>{if(Rn(e,n))if(e.preventDefault(),On(null),Un(e,Y)){let l;try{l=JSON.parse(e.dataTransfer.getData(Y))}catch{l=null}Array.isArray(l)&&l.length&&Ne({kind:"files",ids:l.map(String)},n)}else An&&(Ne({kind:"folder",id:An},n),Mn(null))}}),Bn=e=>{const n=e=>Un(e,Y)||Un(e,Q)||Un(e,"Files");return{onDragEnter:l=>{n(l)&&Pn(e)},onDragOver:l=>{n(l)&&En!==e&&Pn(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Pn(n=>n===e?null:n)}}},Vn=(e,n,l)=>/* @__PURE__ */W(E,{side:"right",content:En===e?Re.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */W("span",{children:n})}),Jn=e=>({onContextMenu:n=>{zn.open(n,e)}}),Hn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Xe.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
1
+ import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-FCWBO7I3.js";import{ImageLightbox as r}from"./chunk-HWJQLLJA.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{EmptyState as i}from"./chunk-3TCGXYUC.js";import{DescriptionList as t}from"./chunk-SACUSHVN.js";import{Drawer as o}from"./chunk-3RX5KCUH.js";import{Breadcrumbs as d}from"./chunk-YM7AWNMY.js";import{useGridSelection as s}from"./chunk-VLKDWKVR.js";import{useMarquee as c}from"./chunk-OLFYNMTD.js";import{ROOT_KEY as u,mediaLibraryMenu as m}from"./chunk-3YCU6V3U.js";import{useMediaMoveItems as p}from"./chunk-JWUNK2PW.js";import{RenameField as h}from"./chunk-QIPO4EVJ.js";import{NativeSelect as f}from"./chunk-KITSIQCV.js";import{MediaUploadGrid as g}from"./chunk-BNPJHOAC.js";import{MediaUsedInList as v}from"./chunk-ZDDMFFQK.js";import{Segmented as k}from"./chunk-HNIIDDLJ.js";import{copyToClipboard as y}from"./chunk-HTHNDX32.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as C}from"./chunk-QMBMK6PP.js";import{Banner as x}from"./chunk-ID35S5Y6.js";import{Input_default as I}from"./chunk-PT4GMPUB.js";import{DropdownMenu as N}from"./chunk-3DSGJIC7.js";import{IconButton_default as D}from"./chunk-SV5RRBVA.js";import{useFileIntake as S,FileIntakeAlert as j}from"./chunk-ITEOA45V.js";import{setModalDragAside as T,modalIdHolding as z}from"./chunk-EIFNESXS.js";import{ColoredBadge as F}from"./chunk-ZGIAMYTI.js";import{Button_default as L}from"./chunk-EVYD6UFQ.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-SOZCWT6I.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as A}from"./chunk-MAFUXCPZ.js";import{useShellStrings as M}from"./chunk-DEJIH3ZQ.js";import{useRef as U,useMemo as R,useCallback as K,useState as B,useEffect as V}from"react";import{jsxs as J,Fragment as H,jsx as W}from"react/jsx-runtime";var Y="application/x-efficient-media-files",Q="application/x-efficient-media-folder",G="application/x-efficient-media-file";function $(e){if(!e||!Array.from(e.types).includes(G))return null;try{const n=JSON.parse(e.getData(G));if(n&&"string"==typeof n.id&&"string"==typeof n.url&&"string"==typeof n.name&&("image"===n.kind||"video"===n.kind))return{id:n.id,url:n.url,kind:n.kind,name:n.name}}catch{}return null}var Z={type:"all",use:"any",sort:"newest"},X={lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */W(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:$="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=Z,onFiltersChange:ce,extraFilters:ue,view:me="grid",onViewChange:pe,selectedIds:he,onSelectionChange:fe,usedIn:ge,denied:ve={},accept:ke="image/*,video/*",maxSizeBytes:ye,busy:be,progress:we,onUpload:Ce,onNewFolder:xe,onRename:Ie,onMove:Ne,onTrash:De,onDeleteFolder:Se,onRestore:je,onDeleteForever:Te,onEmptyTrash:ze,onReplace:Fe,onCropEdit:Le,onOpenInDesign:Oe,onChoose:Ee,onCancel:Pe,pickNote:Ae,onDragOut:Me,className:Ue=""}=O,Re=M().mediaLibrary,Ke=M().media,Be="pick"===$,Ve=!Be,Je=U(null),He=A(Je,"phone"===_?343:1200),We="phone"===_||"auto"===_&&He<640,Ye=R(()=>function(e=[]){const n=/* @__PURE__ */new Map,l=(e,r)=>{for(const a of e){const e=[...r,a];n.set(a.id,{node:a,path:e}),a.children&&l(a.children,e)}};return l(e,[]),n}(re),[re]),Qe=R(()=>new Map(le.map(e=>[e.id,e])),[le]),Ge=R(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Qe.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Qe]),$e=K(e=>{const n=[];for(let l=e?Qe.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Qe.get(l.parentId):void 0);return n},[Qe,le.length]),Ze=K((e,n)=>$e(e).some(e=>e.id===n),[$e]),[Xe,qe]=B(()=>/* @__PURE__ */new Set(["@files"])),_e=e=>qe(n=>{const l=new Set(n);return l.has(e)?l.delete(e):l.add(e),l}),en=K(e=>{qe(n=>e.every(e=>n.has(e))?n:/* @__PURE__ */new Set([...n,...e]))},[]),nn="files"===(ln=ee).place?`files:${ln.folderId??""}`:"products"===ln.place?`products:${ln.nodeId??""}`:"trash";var ln;V(()=>{if("files"===ee.place)en(["@files",...$e(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];en(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[nn]);const rn="products"===ee.place,an="trash"===ee.place,tn="files"===ee.place,on=tn?ee.folderId:null,dn=rn&&ee.nodeId?Ye.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Re.readOnly} ${Re.editedAtHq(e.sharedFrom)}`:Re.readOnly,cn=R(()=>te.map(e=>e.id),[te]),un=R(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=s(cn),pn=R(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=U(!0);V(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");V(()=>{he&&mn.setSelection(he)},[gn]);const vn=U(gn??""),kn=pn.join("\0");V(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Be?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=B(null),Cn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Qe.get(n.id)?.name:un.get(n.id)?.name)&&Ie?.(n,e)},xn=async e=>{if(!xe)return;const n=await xe(e);en(["@files",...e?[e]:[]]),"string"==typeof n&&wn({kind:"folder",id:n})},In=K(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Re.alreadyHere:void 0;const l=Qe.get(e.id);return n===e.id||n&&Ze(n,e.id)?Re.notIntoItself:(l?.parentId??null)===n?Re.folderAlreadyHere:void 0};n.push({key:u,label:Re.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Ge.get(e)??[])n.push({key:i.id,label:i.name,depth:a,disabledReason:l(i.id)}),r(i.id,a+1)};return r(null,1),n},[Ge,Qe,tn,Ze,on,Re]),Nn=K(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=B(null),jn={words:Re,media:Ke,denied:ve,moveTargets:In,kindOf:Nn,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&Ve?e=>{xn(e)}:void 0,rename:Ie&&Ve?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ne&&Ve?Ne:void 0,trash:De&&Ve?De:void 0,deleteFolder:Se&&Ve?Se:void 0,folderNotEmpty:e=>!!Qe.get(e)?.notEmpty,replace:Fe&&Ve?Fe:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Re.urlLabel,n)},openInDesign:Oe,restore:je,deleteForever:Te},Tn=e=>m(e,jn),zn=w(),Fn=(e,n)=>{Be||(mn.isSelected(e)||mn.select(e),zn.open(n,(e=>{const n=mn.isSelected(e)?pn:[e];return rn?{kind:"render",id:e}:an?{kind:"trashed",ids:n}:{kind:"files",ids:n}})(e)))},[Ln,On]=B(null),[En,Pn]=B(null),[An,Mn]=B(null);V(()=>{if(!En&&!Ln)return;const e=()=>{Pn(null),On(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[En,Ln]);const Un=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Rn=(e,n)=>!(!Ne||ve.move||Be)&&(!!Un(e,Y)||!(!Un(e,Q)||!An)&&(n!==An&&!(n&&Ze(n,An)))),Kn=(e,n)=>({onDragEnter:l=>{Rn(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Rn(l,n)&&(l.preventDefault(),l.dataTransfer.dropEffect="move",Ln!==e&&On(e))},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||On(n=>n===e?null:n)},onDrop:e=>{if(Rn(e,n))if(e.preventDefault(),On(null),Un(e,Y)){let l;try{l=JSON.parse(e.dataTransfer.getData(Y))}catch{l=null}Array.isArray(l)&&l.length&&Ne({kind:"files",ids:l.map(String)},n)}else An&&(Ne({kind:"folder",id:An},n),Mn(null))}}),Bn=e=>{const n=e=>Un(e,Y)||Un(e,Q)||Un(e,"Files");return{onDragEnter:l=>{n(l)&&Pn(e)},onDragOver:l=>{n(l)&&En!==e&&Pn(e)},onDragLeave:n=>{const l=n.relatedTarget;l&&n.currentTarget.contains(l)||Pn(n=>n===e?null:n)}}},Vn=(e,n,l)=>/* @__PURE__ */W(E,{side:"right",content:En===e?Re.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */W("span",{children:n})}),Jn=e=>({onContextMenu:n=>{zn.open(n,e)}}),Hn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Xe.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
2
2
  return J("div",{role:"none",className:"contents",children:[
3
3
  /* @__PURE__ */W(n,{label:Vn(i,e.name,t),level:r,icon:d&&o?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Re.fileCount(e.count):void 0,selected:rn&&ee.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>_e(i):void 0,onSelect:()=>ne({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Bn(i),...Ve?Jn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(l,{children:Hn(d,r+1,t)})]},e.id)}),Wn=(e,r)=>(Ge.get(e)??[]).map(e=>{const a=Ge.get(e.id),i=Xe.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=Tn({kind:"folder",id:e.id});/* @__PURE__ */
4
4
  return J("div",{role:"none",className:"contents",children:[
5
- /* @__PURE__ */W(n,{label:e.name,level:r,icon:a&&i?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Re.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:Ln===e.id?"into":void 0,dragging:An===e.id,draggable:Ve&&!!Ne&&!ve.move,rename:t?/* @__PURE__ */W(m,{value:e.name,label:Re.folderName,onDone:Cn}):void 0,actions:Ve&&o.length?/* @__PURE__ */W(N,{align:"end","aria-label":Re.folderActions,trigger:X.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Kn(e.id,e.id),...Ve?Jn({kind:"folder",id:e.id}):{},...Ve&&Ne&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(Q,e.id),Mn(e.id)},onDragEnd:()=>{Mn(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */W(l,{children:Wn(e.id,r+1)})]},e.id)}),Yn=Xe.has("@files"),Qn=Xe.has("@products"),Gn=/* @__PURE__ */J(e,{"aria-label":Re.folders,children:[re&&/* @__PURE__ */J(H,{children:[
5
+ /* @__PURE__ */W(n,{label:e.name,level:r,icon:a&&i?X.folderOpen:X.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Re.fileCount(e.count):void 0,selected:t||tn&&ee.folderId===e.id,expanded:a?i:void 0,onToggle:a?()=>_e(e.id):void 0,onSelect:()=>ne({place:"files",folderId:e.id}),drop:Ln===e.id?"into":void 0,dragging:An===e.id,draggable:Ve&&!!Ne&&!ve.move,rename:t?/* @__PURE__ */W(h,{value:e.name,label:Re.folderName,onDone:Cn}):void 0,actions:Ve&&o.length?/* @__PURE__ */W(N,{align:"end","aria-label":Re.folderActions,trigger:X.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Kn(e.id,e.id),...Ve?Jn({kind:"folder",id:e.id}):{},...Ve&&Ne&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(Q,e.id),Mn(e.id)},onDragEnd:()=>{Mn(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */W(l,{children:Wn(e.id,r+1)})]},e.id)}),Yn=Xe.has("@files"),Qn=Xe.has("@products"),Gn=/* @__PURE__ */J(e,{"aria-label":Re.folders,children:[re&&/* @__PURE__ */J(H,{children:[
6
6
  /* @__PURE__ */W(n,{label:Vn("@products",Re.products),level:1,icon:X.lock,badge:{label:Re.readOnlyBadge,tone:"neutral"},expanded:re.length?Qn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Bn("@products")}}),Qn&&re.length>0&&/* @__PURE__ */W(l,{children:Hn(re,2)})]}),
7
- /* @__PURE__ */W(n,{label:Re.allFiles,level:1,icon:Yn?X.folderOpen:X.folder,count:ae,countLabel:null!=ae?Re.fileCount(ae):void 0,expanded:Ge.get(null)?.length?Yn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===Ln?"into":void 0,rowProps:{"data-media-row":"@files",...Kn("@files",null)}}),Yn&&(Ge.get(null)?.length??0)>0&&/* @__PURE__ */W(l,{children:Wn(null,2)}),Ve&&/* @__PURE__ */W(n,{label:Re.trash,level:1,icon:X.trash,count:ie,countLabel:null!=ie?Re.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),$n=(()=>{if(an)return[{label:Re.trash}];if(rn){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];return[{label:Re.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=$e(on);return[{label:Re.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),Zn=rn?Re.readOnly:ve.upload,Xn=!!Ce&&!an&&!Zn,qn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Xn,onAccept:e=>Ce?.(e,on)}),_n=rn?Re.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[Ve&&xe&&!an&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Re.newFolder}),Ce&&!an&&/* @__PURE__ */W(L,{variant:"primary",size:"sm",leftIcon:X.upload,onClick:()=>qn.open(),...el(Zn),children:Re.upload}),Ve&&an&&ze&&te.length>0&&/* @__PURE__ */W(L,{variant:"danger",size:"sm",onClick:ze,...el(ve.deleteForever),children:Re.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */W("div",{style:{width:We?void 0:a,flex:We?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(p,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(I,{size:"sm",type:"search",leftIcon:X.search,placeholder:rn?Re.searchProducts:Re.search,"aria-label":rn?Re.searchProducts:Re.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Re.mediaType,se.type,[{value:"all",label:Re.allTypes},{value:"image",label:Re.images},{value:"video",label:Re.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Re.use,se.use,[{value:"any",label:Re.anyUse},{value:"email",label:Re.emailOnly},{value:"website",label:Re.websiteOnly},{value:"unused",label:Re.notUsed}],rl("use"),130),ce&&Ve&&ll(Re.sort,se.sort,[{value:"newest",label:Re.newest},{value:"name",label:Re.byName},{value:"size",label:Re.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */W(k,{size:"sm",label:Re.view,value:me,onChange:pe,options:[{value:"grid",label:Re.grid,icon:X.grid},{value:"list",label:Re.list,icon:X.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Re.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Re.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Re.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Re.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */W(F,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=Ve&&tn&&!!Ne&&!ve.move,dl=!!Me&&!an,sl=U(""),cl=U(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=U(Me);ml.current=Me;const pl=K(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),T(sl.current,!1),e&&ml.current?.(e))},[]),hl=K(e=>{pl(ul());const n=Je.current?.ownerDocument;if(!n)return;sl.current=z(Je.current);const l=Je.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&T(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,T(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);V(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Me(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[G]:gl(e)}}:{}})),kl=We?Math.max(72,Math.floor((He-24-16-1)/3)):112,yl=U(null),bl=v({containerRef:yl,enabled:Ve&&!We&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Be){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Cl=te.length?null:oe?/* @__PURE__ */W(i,{variant:"dashed",title:Re.noMatches}):rn?/* @__PURE__ */W(i,{variant:"dashed",title:Re.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */W(i,{variant:"dashed",title:Re.trashEmpty}):!Xn||Be?/* @__PURE__ */W(i,{variant:"dashed",title:Re.emptyFolder}):null,xl="list"===me&&te.length>0,Il=Cl??(xl?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Ve||void 0,"aria-label":Re.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */J("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>Fn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(G,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
7
+ /* @__PURE__ */W(n,{label:Re.allFiles,level:1,icon:Yn?X.folderOpen:X.folder,count:ae,countLabel:null!=ae?Re.fileCount(ae):void 0,expanded:Ge.get(null)?.length?Yn:void 0,onToggle:()=>_e("@files"),selected:tn&&null==ee.folderId,onSelect:()=>ne({place:"files",folderId:null}),drop:"@files"===Ln?"into":void 0,rowProps:{"data-media-row":"@files",...Kn("@files",null)}}),Yn&&(Ge.get(null)?.length??0)>0&&/* @__PURE__ */W(l,{children:Wn(null,2)}),Ve&&/* @__PURE__ */W(n,{label:Re.trash,level:1,icon:X.trash,count:ie,countLabel:null!=ie?Re.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),$n=(()=>{if(an)return[{label:Re.trash}];if(rn){const e=ee.nodeId?Ye.get(ee.nodeId)?.path??[]:[];return[{label:Re.products,onClick:e.length?()=>ne({place:"products",nodeId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"products",nodeId:n.id}):void 0}))]}const e=$e(on);return[{label:Re.allFiles,onClick:e.length?()=>ne({place:"files",folderId:null}):void 0},...e.map((n,l)=>({label:n.name,onClick:l<e.length-1?()=>ne({place:"files",folderId:n.id}):void 0}))]})(),Zn=rn?Re.readOnly:ve.upload,Xn=!!Ce&&!an&&!Zn,qn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Xn,onAccept:e=>Ce?.(e,on)}),_n=rn?Re.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[Ve&&xe&&!an&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Re.newFolder}),Ce&&!an&&/* @__PURE__ */W(L,{variant:"primary",size:"sm",leftIcon:X.upload,onClick:()=>qn.open(),...el(Zn),children:Re.upload}),Ve&&an&&ze&&te.length>0&&/* @__PURE__ */W(L,{variant:"danger",size:"sm",onClick:ze,...el(ve.deleteForever),children:Re.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */W("div",{style:{width:We?void 0:a,flex:We?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(f,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */J("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(I,{size:"sm",type:"search",leftIcon:X.search,placeholder:rn?Re.searchProducts:Re.search,"aria-label":rn?Re.searchProducts:Re.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Re.mediaType,se.type,[{value:"all",label:Re.allTypes},{value:"image",label:Re.images},{value:"video",label:Re.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Re.use,se.use,[{value:"any",label:Re.anyUse},{value:"email",label:Re.emailOnly},{value:"website",label:Re.websiteOnly},{value:"unused",label:Re.notUsed}],rl("use"),130),ce&&Ve&&ll(Re.sort,se.sort,[{value:"newest",label:Re.newest},{value:"name",label:Re.byName},{value:"size",label:Re.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */W(k,{size:"sm",label:Re.view,value:me,onChange:pe,options:[{value:"grid",label:Re.grid,icon:X.grid},{value:"list",label:Re.list,icon:X.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Re.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Re.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Re.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Re.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */W(F,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=Ve&&tn&&!!Ne&&!ve.move,dl=!!Me&&!an,sl=U(""),cl=U(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=U(Me);ml.current=Me;const pl=K(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),T(sl.current,!1),e&&ml.current?.(e))},[]),hl=K(e=>{pl(ul());const n=Je.current?.ownerDocument;if(!n)return;sl.current=z(Je.current);const l=Je.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&T(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,T(sl.current,!1)}},t=e=>{const n=e.dataTransfer?.dropEffect;pl(n&&"none"!==n?"dropped":a()?ul():"cancelled")},o=()=>{a()&&pl(ul())},d=["pointermove","pointerdown","mousemove","mousedown"];n.addEventListener("dragover",r,!0),n.addEventListener("drop",i,!0),n.addEventListener("dragend",t,!0);for(const e of d)n.addEventListener(e,o,!0);cl.current={dropped:!1,stop:()=>{n.removeEventListener("dragover",r,!0),n.removeEventListener("drop",i,!0),n.removeEventListener("dragend",t,!0);for(const e of d)n.removeEventListener(e,o,!0)}}},[pl]);V(()=>()=>pl(ul()),[pl]);const fl=(e,n,l)=>{if("start"!==e)return;const r=un.get(n);r&&gl(r)&&(hl(l??null),Me(e))},gl=e=>!dl||e.private||e.pickDisabledReason?void 0:JSON.stringify({id:e.id,url:e.url,kind:"video"===e.kind?"video":"image",name:e.name}),vl=te.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:il(e),dragData:ol?JSON.stringify(mn.isSelected(e.id)?pn:[e.id]):gl(e),...ol&&gl(e)?{dragAlso:{[G]:gl(e)}}:{}})),kl=We?Math.max(72,Math.floor((He-24-16-1)/3)):112,yl=U(null),bl=c({containerRef:yl,enabled:Ve&&!We&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Be){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Cl=te.length?null:oe?/* @__PURE__ */W(i,{variant:"dashed",title:Re.noMatches}):rn?/* @__PURE__ */W(i,{variant:"dashed",title:Re.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */W(i,{variant:"dashed",title:Re.trashEmpty}):!Xn||Be?/* @__PURE__ */W(i,{variant:"dashed",title:Re.emptyFolder}):null,xl="list"===me&&te.length>0,Il=Cl??(xl?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Ve||void 0,"aria-label":Re.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */J("li",{role:"option","aria-selected":mn.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:n=>yn(e.id,n),onDoubleClick:()=>wl(e.id),onContextMenu:n=>Fn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(G,gl(e)),fl("start",e.id,n.currentTarget)}:void 0,onKeyDown:n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),yn(e.id,n))},className:"flex h-12 cursor-pointer items-center gap-3 rounded-md px-2 text-sm rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(mn.isSelected(e.id)?"bg-accent-tint text-blue-700":"text-ink hover:bg-gray-100"),children:[
8
8
  /* @__PURE__ */W("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
9
9
  /* @__PURE__ */W("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
10
- /* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(h,{items:vl,readOnly:!Xn||Be,onFiles:Xn&&!Be?e=>Ce(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?Y:dl?G:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:Ve?Fn:void 0,menuOnMedia:Ve})),Nl=u({count:pn.length,kind:Nn(pn),targets:In({kind:"files",ids:pn}),onPick:e=>Ne?.({kind:"files",ids:pn},e.key===s?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */W(N,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(H,{children:[X.folder,Re.moveTo]}),items:Nl,disabled:!!ve.move}),jl=Ve&&pn.length>1&&!rn?/* @__PURE__ */J("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
10
+ /* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(g,{items:vl,readOnly:!Xn||Be,onFiles:Xn&&!Be?e=>Ce(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?Y:dl?G:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:Ve?Fn:void 0,menuOnMedia:Ve})),Nl=p({count:pn.length,kind:Nn(pn),targets:In({kind:"files",ids:pn}),onPick:e=>Ne?.({kind:"files",ids:pn},e.key===u?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */W(N,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(H,{children:[X.folder,Re.moveTo]}),items:Nl,disabled:!!ve.move}),jl=Ve&&pn.length>1&&!rn?/* @__PURE__ */J("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
11
11
  /* @__PURE__ */W(b,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Re.selected(pn.length)}),/* @__PURE__ */J(H,an?{children:[je&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.undo,onClick:()=>je(pn),...el(ve.restore),children:Re.restore}),Te&&/* @__PURE__ */W(L,{variant:"secondary-danger",size:"sm",onClick:()=>Te(pn),...el(ve.deleteForever),children:Re.deleteForever})]}:{children:[Ne&&Sl,Ie&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.edit,disabled:!0,children:Re.rename}),De&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Re.moveFilesToTrash(pn.length)})]}),
12
- /* @__PURE__ */W(L,{variant:"ghost",size:"sm",onClick:mn.clear,children:Re.clearSelection})]}):null,Tl=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Re.name,r?/* @__PURE__ */W(m,{value:e.name,label:Re.fileName,onDone:Cn}):e.name),l("type",Re.type,e.typeLabel),l("size",Re.size,e.sizeLabel),l("resolution",Re.resolution,e.resolution),rn?(l("design",Re.design,e.design),l("finish",Re.finish,e.finish),l("angle",Re.angleLug,e.angleLug),l("owner",Re.owner,e.owner)):(l("added",Re.addedBy,e.addedBy),l("folder",Re.folder,e.folderPath)),l("used",Re.usedIn,null!=e.usedCount?Re.places(e.usedCount):void 0);const a=c({kind:"files",ids:[e.id]},jn).find(e=>"submenu"===e.type);/* @__PURE__ */
12
+ /* @__PURE__ */W(L,{variant:"ghost",size:"sm",onClick:mn.clear,children:Re.clearSelection})]}):null,Tl=e=>{const n=[],l=(e,l,r)=>{null!=r&&""!==r&&n.push({key:e,label:l,value:r})},r="file"===bn?.kind&&bn.id===e.id;l("name",Re.name,r?/* @__PURE__ */W(h,{value:e.name,label:Re.fileName,onDone:Cn}):e.name),l("type",Re.type,e.typeLabel),l("size",Re.size,e.sizeLabel),l("resolution",Re.resolution,e.resolution),rn?(l("design",Re.design,e.design),l("finish",Re.finish,e.finish),l("angle",Re.angleLug,e.angleLug),l("owner",Re.owner,e.owner)):(l("added",Re.addedBy,e.addedBy),l("folder",Re.folder,e.folderPath)),l("used",Re.usedIn,null!=e.usedCount?Re.places(e.usedCount):void 0);const a=m({kind:"files",ids:[e.id]},jn).find(e=>"submenu"===e.type);/* @__PURE__ */
13
13
  return J("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
14
14
  /* @__PURE__ */W("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */W(x,{tone:"neutral",title:Re.readOnlyBadge,children:sn(dn)}),
15
15
  /* @__PURE__ */W(t,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */J("div",{className:"flex gap-2",children:[
16
16
  /* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(I,{size:"sm",readOnly:!0,value:e.url,"aria-label":Re.fileUrl,onFocus:e=>e.currentTarget.select()})}),
17
- /* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.copy,onClick:()=>jn.copyUrl(e.id),children:Re.copyUrl})]}),tn&&Ve&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[Fe&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.swap,onClick:()=>Fe(e.id),...el(ve.replace),children:Re.replace}),Le&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.crop,onClick:()=>Le(e.id),children:Re.cropEdit}),Ne&&"submenu"===a?.type&&/* @__PURE__ */W(N,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(H,{children:[X.folder,Re.moveTo]}),items:a.items,disabled:!!ve.move}),Ie&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Re.rename}),De&&/* @__PURE__ */W(D,{"aria-label":Re.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:X.trash})]}),an&&Ve&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(L,{variant:"primary",size:"sm",leftIcon:X.undo,onClick:()=>je([e.id]),...el(ve.restore),children:Re.restore}),Te&&/* @__PURE__ */W(L,{variant:"danger",size:"sm",onClick:()=>Te([e.id]),...el(ve.deleteForever),children:Re.deleteForever})]}),rn&&Oe&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Re.openInDesign}),ge&&/* @__PURE__ */W(f,{items:ge})]})},zl=hn?hn.private?Re.privateNoPick:hn.pickDisabledReason:void 0,Fl=Be?/* @__PURE__ */J("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
17
+ /* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.copy,onClick:()=>jn.copyUrl(e.id),children:Re.copyUrl})]}),tn&&Ve&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[Fe&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.swap,onClick:()=>Fe(e.id),...el(ve.replace),children:Re.replace}),Le&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.crop,onClick:()=>Le(e.id),children:Re.cropEdit}),Ne&&"submenu"===a?.type&&/* @__PURE__ */W(N,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */J(H,{children:[X.folder,Re.moveTo]}),items:a.items,disabled:!!ve.move}),Ie&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Re.rename}),De&&/* @__PURE__ */W(D,{"aria-label":Re.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:X.trash})]}),an&&Ve&&/* @__PURE__ */J("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(L,{variant:"primary",size:"sm",leftIcon:X.undo,onClick:()=>je([e.id]),...el(ve.restore),children:Re.restore}),Te&&/* @__PURE__ */W(L,{variant:"danger",size:"sm",onClick:()=>Te([e.id]),...el(ve.deleteForever),children:Re.deleteForever})]}),rn&&Oe&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",leftIcon:X.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Re.openInDesign}),ge&&/* @__PURE__ */W(v,{items:ge})]})},zl=hn?hn.private?Re.privateNoPick:hn.pickDisabledReason:void 0,Fl=Be?/* @__PURE__ */J("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-3 py-2",children:[
18
18
  /* @__PURE__ */W("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Re.oneChosen(hn.name):Re.noneChosen}),
19
19
  /* @__PURE__ */J("div",{className:"flex gap-2",children:[Pe&&/* @__PURE__ */W(L,{variant:"secondary",size:"sm",onClick:Pe,children:Re.cancel}),
20
20
  /* @__PURE__ */W(L,{variant:"primary",size:"sm",disabled:!hn,...el(zl),onClick:()=>{hn&&!zl&&Ee?.(hn)},children:Re.chooseImage})]})]}):null,Ll=Ve&&!!hn,Ol=/* @__PURE__ */J("div",{className:"flex min-w-0 flex-col gap-3",children:[Ae&&/* @__PURE__ */W(x,{tone:"neutral",children:Ae}),
@@ -1,9 +1,9 @@
1
- import{CountBadge as e}from"./chunk-F3MO56N4.js";import{SettingRowNameContext as i,SettingAutoContext as n}from"./chunk-2NMW66P5.js";import{isShown as a}from"./chunk-HCP7WOAL.js";import{useShellStrings as t}from"./chunk-DEJIH3ZQ.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:A,className:F=""}){const I=t();if(!a(j,P,A))return null;const T="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:I.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
1
+ import{CountBadge as e}from"./chunk-F3MO56N4.js";import{isShown as i}from"./chunk-HCP7WOAL.js";import{SettingRowNameContext as n,SettingAutoContext as a}from"./chunk-2NMW66P5.js";import{useShellStrings as t}from"./chunk-DEJIH3ZQ.js";import{isValidElement as l}from"react";import{jsx as s,jsxs as r,Fragment as d}from"react/jsx-runtime";var c={pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},m=e=>Array.isArray(e)?e.some(m):l(e);function o({label:l,icon:o,action:h,value:u,readout:f,changed:p=!1,description:x,children:N,controlId:v,labelId:g,unknownText:b="—",quiet:y=!1,size:k="default",viewState:w,divider:$=!0,showWhen:j,values:P,context:A,className:F=""}){const I=t();if(!i(j,P,A))return null;const T="auto"===w?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-line px-1 text-2xs font-normal leading-4 text-ink-faint",children:I.settingView.auto}):"edited"===w?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
2
2
  /* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
3
- /* @__PURE__ */s("span",{className:"sr-only",children:I.settingView.edited})]}):null,W=null!=f&&!1!==f;if("compact"===k){const e=m(u),a=m(h);if(!e&&!a)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),F&&c.push(F);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
- /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),T]}),y=e=>/* @__PURE__ */s(i.Provider,{value:t,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
3
+ /* @__PURE__ */s("span",{className:"sr-only",children:I.settingView.edited})]}):null,W=null!=f&&!1!==f;if("compact"===k){const e=m(u),i=m(h);if(!e&&!i)return null;const t=g,c=["es-field"];e||c.push("is-inline"),p&&c.push("is-changed"),F&&c.push(F);const b=/* @__PURE__ */r(d,{children:[null!=o&&/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:o}),
4
+ /* @__PURE__ */s("span",{className:"es-field-label",id:t,children:l}),T]}),y=e=>/* @__PURE__ */s(n.Provider,{value:t,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:e})});/* @__PURE__ */
5
5
  return r("div",{className:c.join(" "),children:[
6
- /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),W&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),a&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const H=c,M=void 0!==u||void 0===N&&null==h,O=null==u||""===u,V=y?"text-gray-500":"text-gray-800",q=O?"text-gray-400":y?"text-gray-500":"text-gray-900",z=`${H.text} font-medium ${V}`,B=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:z,children:l}):/* @__PURE__ */s("span",{id:g,className:z,children:l}),C=/* @__PURE__ */s(i.Provider,{value:g,children:/* @__PURE__ */s(n.Provider,{value:"auto"===w,children:O?b:u})}),D=[$?"border-t border-line-subtle first:border-t-0":"",H.pad,F].filter(Boolean).join(" "),E=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${H.bodyTop} border-t border-line-subtle ${H.bodyPad}`,children:N});/* @__PURE__ */
6
+ /* @__PURE__ */r("div",{className:"es-field-head",children:[v?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:v,children:b}):/* @__PURE__ */s("span",{className:"es-field-name",children:b}),W&&/* @__PURE__ */s("span",{className:"es-field-value",children:f}),i&&y(h)]}),e&&/* @__PURE__ */s("div",{className:"es-field-ctl",children:y(u)}),x?/* @__PURE__ */s("p",{className:"es-field-hint",children:x}):null,N]})}const H=c,M=void 0!==u||void 0===N&&null==h,O=null==u||""===u,V=y?"text-gray-500":"text-gray-800",q=O?"text-gray-400":y?"text-gray-500":"text-gray-900",z=`${H.text} font-medium ${V}`,B=v?/* @__PURE__ */s("label",{htmlFor:v,id:g,className:z,children:l}):/* @__PURE__ */s("span",{id:g,className:z,children:l}),C=/* @__PURE__ */s(n.Provider,{value:g,children:/* @__PURE__ */s(a.Provider,{value:"auto"===w,children:O?b:u})}),D=[$?"border-t border-line-subtle first:border-t-0":"",H.pad,F].filter(Boolean).join(" "),E=null!=N&&!1!==N&&/* @__PURE__ */s("div",{className:`${H.bodyTop} border-t border-line-subtle ${H.bodyPad}`,children:N});/* @__PURE__ */
7
7
  return r("div",W?{className:D,children:[
8
8
  /* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
9
9
  /* @__PURE__ */s("div",{className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${V}`,children:[null!=o&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:o}),B,T]})}),