efficient-shell 13.16.0 → 13.18.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 (132) hide show
  1. package/README.md +7 -0
  2. package/dist/{Browser-4KWGT3FG.js → Browser-ORLSC6T4.js} +15 -15
  3. package/dist/Calculator-4UBMDAJO.js +29 -0
  4. package/dist/{CurrencyConverter-X5ENBDLK.js → CurrencyConverter-H3HHXXKT.js} +6 -6
  5. package/dist/{Files-NT76VUHQ.js → Files-PI3Z4TAO.js} +53 -53
  6. package/dist/Notepad-6FPZHJQ7.js +24 -0
  7. package/dist/PdfViewer-EELX35ZI.js +1 -0
  8. package/dist/{PomodoroTimer-KDXH5M3Q.js → PomodoroTimer-JVCYYGRD.js} +16 -16
  9. package/dist/{Preview-QNJD5PVD.js → Preview-4XSAIYMZ.js} +21 -21
  10. package/dist/{Stock-JR77FPOD.js → Stock-S266KGAF.js} +4 -4
  11. package/dist/{Weather-MGSDU3M5.js → Weather-TE4TTTQA.js} +19 -19
  12. package/dist/{WorldClock-GGAYPYIO.js → WorldClock-5TPBHBYA.js} +6 -6
  13. package/dist/ai/index.js +23 -23
  14. package/dist/apps/ImageAnnotator.js +1 -1
  15. package/dist/apps/index.js +1 -1
  16. package/dist/bin/browser-check.js +1 -1
  17. package/dist/bin/media-host-check.js +1 -1
  18. package/dist/bin/ui-check.js +1 -1
  19. package/dist/brand.css +1 -1
  20. package/dist/charts/BoxPlotChart.js +1 -1
  21. package/dist/charts/CandlestickChart.js +1 -1
  22. package/dist/charts/CartesianPlot.js +1 -1
  23. package/dist/charts/ColumnChart.js +1 -1
  24. package/dist/charts/FunnelChart.js +1 -1
  25. package/dist/charts/HeatmapChart.js +1 -1
  26. package/dist/charts/HistogramChart.js +1 -1
  27. package/dist/charts/PieChart.js +1 -1
  28. package/dist/charts/RangeChart.js +1 -1
  29. package/dist/charts/SankeyChart.js +1 -1
  30. package/dist/charts/ScatterChart.js +1 -1
  31. package/dist/charts/SpecChart.js +1 -1
  32. package/dist/charts/TimeSeriesChart.js +1 -1
  33. package/dist/charts/TreemapChart.js +1 -1
  34. package/dist/charts/WaterfallChart.js +1 -1
  35. package/dist/chunk-2WBKQOLF.js +2 -0
  36. package/dist/{chunk-QE2JX7D4.js → chunk-34HRPEQD.js} +1 -1
  37. package/dist/{chunk-OWAYSIQH.js → chunk-42DF7CDB.js} +5 -5
  38. package/dist/chunk-43JCG6EB.js +1 -0
  39. package/dist/{chunk-J4CVYOY3.js → chunk-4SYPNE3P.js} +1 -1
  40. package/dist/{chunk-OEPQIIYL.js → chunk-63E4ZZYI.js} +1 -1
  41. package/dist/{chunk-CKTFXTJL.js → chunk-6OCA7RKQ.js} +1 -1
  42. package/dist/{chunk-NISLELJF.js → chunk-6UGMQZTF.js} +1 -1
  43. package/dist/{chunk-VYHVIKP6.js → chunk-7SVSHJOO.js} +10 -10
  44. package/dist/{chunk-W6NGPSMM.js → chunk-ABPVCVCT.js} +12 -12
  45. package/dist/{chunk-FKMARSJZ.js → chunk-BNI3N4TT.js} +2 -2
  46. package/dist/{chunk-IJNQ2BUY.js → chunk-CILE3ZCC.js} +2 -2
  47. package/dist/{chunk-XHD6Q6JV.js → chunk-EFO72DEI.js} +1 -1
  48. package/dist/{chunk-IJJNJJ6I.js → chunk-EG5MU7XL.js} +1 -1
  49. package/dist/{chunk-UC5IC3AM.js → chunk-EHM3ZVVT.js} +4 -4
  50. package/dist/{chunk-SHHRC5XK.js → chunk-ENVANMHI.js} +7 -7
  51. package/dist/{chunk-UFWBPTCM.js → chunk-F5F5RKB5.js} +5 -5
  52. package/dist/{chunk-OLSA36VX.js → chunk-FUPU7Z2G.js} +6 -6
  53. package/dist/{chunk-YDFDTRZF.js → chunk-G7SILKUY.js} +5 -5
  54. package/dist/{chunk-BVX7LUAW.js → chunk-GEQZUCEO.js} +6 -6
  55. package/dist/{chunk-J6QC45OS.js → chunk-HC5KQZFG.js} +5 -5
  56. package/dist/{chunk-GNXAVDZD.js → chunk-J5NBRYBF.js} +1 -1
  57. package/dist/chunk-KBQXXPFK.js +1 -0
  58. package/dist/{chunk-MHQW6NAE.js → chunk-KBZMOPPH.js} +10 -10
  59. package/dist/{chunk-N5KJLHYI.js → chunk-LADP6AJY.js} +5 -5
  60. package/dist/{chunk-IG3K6AGW.js → chunk-LUCO5PS6.js} +1 -1
  61. package/dist/chunk-M6UKCZHT.js +2 -0
  62. package/dist/{chunk-H5PSCQJ2.js → chunk-NVKRYUCM.js} +6 -6
  63. package/dist/{chunk-7IXU4YT4.js → chunk-OFFJHTNM.js} +4 -4
  64. package/dist/chunk-OTEAWX2C.js +1 -0
  65. package/dist/chunk-OUYGLDQN.js +24 -0
  66. package/dist/{chunk-7TJZ5AJE.js → chunk-QNXTVDIC.js} +6 -6
  67. package/dist/{chunk-PY4DTB6Y.js → chunk-QSJMLHBD.js} +1 -1
  68. package/dist/{chunk-IUQJGFEO.js → chunk-QTDR2CTB.js} +3 -3
  69. package/dist/{chunk-K2FVP22A.js → chunk-S43DEWMZ.js} +1 -1
  70. package/dist/{chunk-XXTAMF3O.js → chunk-S7YUQLBN.js} +6 -6
  71. package/dist/chunk-SHBZTW7P.js +5 -0
  72. package/dist/chunk-SM3N5UJ2.js +69 -0
  73. package/dist/{chunk-J4KPBR5B.js → chunk-TKCCJRPE.js} +1 -1
  74. package/dist/{chunk-YTDMCUL7.js → chunk-U5RG34NE.js} +10 -10
  75. package/dist/{chunk-NW5NSV7N.js → chunk-V6HKE4HV.js} +2 -2
  76. package/dist/{chunk-OIEFMLYI.js → chunk-VR6LMREE.js} +3 -3
  77. package/dist/{chunk-EJOKROMB.js → chunk-WHPYQOXA.js} +5 -5
  78. package/dist/{chunk-WLBWACKP.js → chunk-WJTNQ7YD.js} +1 -1
  79. package/dist/{chunk-P5C7DI5A.js → chunk-WPGSU4QG.js} +5 -5
  80. package/dist/{chunk-75R3EKWZ.js → chunk-XD3M5ZXM.js} +3 -3
  81. package/dist/chunk-ZI2FDUYJ.js +99 -0
  82. package/dist/data/EntityList.js +1 -1
  83. package/dist/data/ResizableTable.js +1 -1
  84. package/dist/forms/BorderInput.js +1 -1
  85. package/dist/forms/BrandAssetEditor.js +1 -1
  86. package/dist/forms/ColorPicker.js +1 -1
  87. package/dist/forms/CornersInput.js +1 -1
  88. package/dist/forms/InputNumber.js +1 -1
  89. package/dist/forms/MediaLibrary.js +1 -1
  90. package/dist/forms/MediaUploadField.js +1 -1
  91. package/dist/forms/PositionInput.js +1 -1
  92. package/dist/forms/SidesInput.js +1 -1
  93. package/dist/forms/Slider.js +1 -1
  94. package/dist/forms/UnitMenu.js +1 -1
  95. package/dist/forms/WidestLabel.d.ts +26 -0
  96. package/dist/forms/WidestLabel.js +1 -0
  97. package/dist/forms/WidthsBar.js +1 -1
  98. package/dist/icons/brands.node.js +1 -1
  99. package/dist/icons/efficient-glyphs.js +1 -1
  100. package/dist/icons/efficient-looks.js +1 -1
  101. package/dist/icons/efficient.js +1 -1
  102. package/dist/icons/index.js +1 -1
  103. package/dist/icons/looks/map.js +1 -1
  104. package/dist/icons/payment.js +3 -3
  105. package/dist/icons/sets.js +1 -1
  106. package/dist/index.d.ts +2 -0
  107. package/dist/index.js +117 -117
  108. package/dist/pdf/index.js +1 -1
  109. package/dist/shell/FitFrame.d.ts +46 -0
  110. package/dist/shell/FitFrame.js +2 -0
  111. package/dist/shell/LanguageSelect.js +1 -1
  112. package/dist/shell/SettingRow.js +1 -1
  113. package/dist/shell/SidebarLayout.js +1 -1
  114. package/dist/telemetry/index.js +1 -1
  115. package/dist/templates/ChatTemplate.js +1 -1
  116. package/dist/templates/DashboardTemplate.js +1 -1
  117. package/dist/templates/EmailTemplate.js +1 -1
  118. package/dist/ui/index.d.ts +2 -0
  119. package/dist/ui/index.js +1 -1
  120. package/dist/version.js +1 -1
  121. package/package.json +1 -1
  122. package/dist/Calculator-VURS4NAT.js +0 -29
  123. package/dist/Notepad-6AMNAYQQ.js +0 -24
  124. package/dist/PdfViewer-PFQGQRQX.js +0 -1
  125. package/dist/chunk-6QKTQOEV.js +0 -69
  126. package/dist/chunk-74SCWPQF.js +0 -1
  127. package/dist/chunk-JFOMAXD2.js +0 -99
  128. package/dist/chunk-OMOAD5LL.js +0 -1
  129. package/dist/chunk-QAAHFU2I.js +0 -1
  130. package/dist/chunk-XQVGBVHC.js +0 -5
  131. package/dist/chunk-YGKLZBWC.js +0 -24
  132. /package/dist/{chunk-VG6BT2UG.js → chunk-7UCZAUAU.js} +0 -0
@@ -1,9 +1,9 @@
1
- import{AccessibleTable as e}from"./chunk-ZDFMYAQB.js";import{bumpPath as t}from"./chunk-VFC6QUEN.js";import{useHighlight as n}from"./chunk-CNYAHYE6.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{ChartTooltip as l}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as r,CHART_INK as a}from"./chunk-TZFACUMR.js";import{useShellStrings as i,useShellLocale as s}from"./chunk-IUVGHHR3.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useRef as c,useState as m}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function f({nodes:f,links:k,height:p=320,width:x,nodeWidth:g=14,nodePadding:y=12,formatValue:v,className:M,emptyLabel:w}){const b=i().charts,j=s(),$=v??(e=>h(e,j)),N=w??b.noFlows,F=c(null),A=o(F),C=x??A,[E,H]=m(null),{highlighted:Q}=n();if(0===f.length||0===k.length)/* @__PURE__ */
1
+ import{AccessibleTable as e}from"./chunk-ZDFMYAQB.js";import{bumpPath as t}from"./chunk-VFC6QUEN.js";import{useHighlight as n}from"./chunk-CNYAHYE6.js";import{ChartTooltip as o}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as l,CHART_INK as r}from"./chunk-TZFACUMR.js";import{usePlotWidth as a}from"./chunk-MAFUXCPZ.js";import{useShellStrings as i,useShellLocale as s}from"./chunk-IUVGHHR3.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{useRef as c,useState as m}from"react";import{jsx as d,jsxs as u}from"react/jsx-runtime";function f({nodes:f,links:k,height:p=320,width:x,nodeWidth:g=14,nodePadding:y=12,formatValue:v,className:M,emptyLabel:w}){const b=i().charts,j=s(),$=v??(e=>h(e,j)),N=w??b.noFlows,F=c(null),A=a(F),C=x??A,[E,H]=m(null),{highlighted:Q}=n();if(0===f.length||0===k.length)/* @__PURE__ */
2
2
  return d("div",{className:M,ref:F,children:/* @__PURE__ */d("p",{className:"py-8 text-center text-sm text-gray-500",children:N})});const U=[...new Set(f.map(e=>e.depth))].sort((e,t)=>e-t),V=e=>U.length<=1?0:U.indexOf(e)/(U.length-1)*(C-g-140)+70,z=new Map(f.map(e=>{const t=k.filter(t=>t.from===e.key).reduce((e,t)=>e+t.value,0),n=k.filter(t=>t.to===e.key).reduce((e,t)=>e+t.value,0);return[e.key,Math.max(t,n,e.value??0)]})),O=/* @__PURE__ */new Map;for(const e of f)O.set(e.depth,[...O.get(e.depth)??[],e]);const R=Math.max(...[...O.values()].map(e=>e.reduce((e,t)=>e+(z.get(t.key)??0),0))),W=p-20,Y=R>0?(W-y*(Math.max(...[...O.values()].map(e=>e.length))-1))/R:0,Z=/* @__PURE__ */new Map;for(const[e,t]of O){const n=t.map(e=>Math.max(2,(z.get(e.key)??0)*Y)),o=n.reduce((e,t)=>e+t,0)+y*(t.length-1),l=n.reduce((e,t)=>e+Math.max(0,t-2),0),r=o>W&&l>0?Math.max(0,1-(o-W)/l):1;let a=10;t.forEach((t,o)=>{const l=2+Math.max(0,n[o]-2)*r;Z.set(t.key,{x:V(e),y:a,h:l,index:o}),a+=l+y})}const B=/* @__PURE__ */new Map,D=/* @__PURE__ */new Map,I=/* @__PURE__ */new Map,L=(e,t)=>e.from===t||e.to===t,P="link"===E?.kind?k[E.index]:void 0,S="node"===E?.kind?f.find(e=>e.key===E.key):void 0;/* @__PURE__ */
3
3
  return u("div",{className:`relative ${M??""}`,ref:F,children:[
4
- /* @__PURE__ */u("svg",{width:"100%",height:p,viewBox:`0 0 ${C} ${p}`,role:"img","aria-label":b.sankey(f.length,k.length),onMouseLeave:()=>H(null),children:[k.map((e,n)=>{const o=Z.get(e.from),l=Z.get(e.to);if(!o||!l)return null;const a=Math.max(1,e.value*Y),i=o.y+(B.get(e.from)??0)+a/2,s=l.y+(D.get(e.to)??0)+a/2;B.set(e.from,(B.get(e.from)??0)+a),D.set(e.to,(D.get(e.to)??0)+a);const h=o.x+g,c=l.x,m=r(o.index,e.color),u=`${e.from}→${e.to}`,f=I.get(u)??0;I.set(u,f+1);const k=((e,t)=>E?"link"===E.kind?E.index===t:L(e,E.key):null!==Q?L(e,Q):null)(e,n);/* @__PURE__ */
5
- return d("path",{d:t([[h,i],[c,s]]),fill:"none",stroke:m,strokeWidth:a,strokeOpacity:null===k||k?.42:.12,onMouseEnter:()=>H({kind:"link",index:n})},f?`${u}#${f}`:u)}),f.map(e=>{const t=Z.get(e.key);if(!t)return null;const n=t.x>C/2,o=(l=e.key,E?"node"===E.kind?E.key===l:L(k[E.index],l):null!==Q?Q===l:null);var l;/* @__PURE__ */
4
+ /* @__PURE__ */u("svg",{width:"100%",height:p,viewBox:`0 0 ${C} ${p}`,role:"img","aria-label":b.sankey(f.length,k.length),onMouseLeave:()=>H(null),children:[k.map((e,n)=>{const o=Z.get(e.from),r=Z.get(e.to);if(!o||!r)return null;const a=Math.max(1,e.value*Y),i=o.y+(B.get(e.from)??0)+a/2,s=r.y+(D.get(e.to)??0)+a/2;B.set(e.from,(B.get(e.from)??0)+a),D.set(e.to,(D.get(e.to)??0)+a);const h=o.x+g,c=r.x,m=l(o.index,e.color),u=`${e.from}→${e.to}`,f=I.get(u)??0;I.set(u,f+1);const k=((e,t)=>E?"link"===E.kind?E.index===t:L(e,E.key):null!==Q?L(e,Q):null)(e,n);/* @__PURE__ */
5
+ return d("path",{d:t([[h,i],[c,s]]),fill:"none",stroke:m,strokeWidth:a,strokeOpacity:null===k||k?.42:.12,onMouseEnter:()=>H({kind:"link",index:n})},f?`${u}#${f}`:u)}),f.map(e=>{const t=Z.get(e.key);if(!t)return null;const n=t.x>C/2,o=(a=e.key,E?"node"===E.kind?E.key===a:L(k[E.index],a):null!==Q?Q===a:null);var a;/* @__PURE__ */
6
6
  return u("g",{opacity:null===o||o?1:.45,onMouseEnter:()=>H({kind:"node",key:e.key}),children:[
7
- /* @__PURE__ */d("rect",{x:t.x,y:t.y,width:g,height:t.h,rx:2,fill:r(t.index,e.color,e.tone)}),
8
- /* @__PURE__ */d("text",{x:n?t.x-8:t.x+g+8,y:t.y+t.h/2+4,textAnchor:n?"end":"start",fontSize:11,fill:a.label,children:e.label})]},e.key)})]}),P&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(l,{title:`${P.from} → ${P.to}`,rows:[{key:"value",label:b.flow,color:r(Z.get(P.from)?.index??0,P.color),value:$(P.value)}]})}),S&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(l,{title:S.label,rows:[{key:"value",label:b.throughput,color:r(Z.get(S.key)?.index??0,S.color,S.tone),value:$(z.get(S.key)??0)}]})}),
7
+ /* @__PURE__ */d("rect",{x:t.x,y:t.y,width:g,height:t.h,rx:2,fill:l(t.index,e.color,e.tone)}),
8
+ /* @__PURE__ */d("text",{x:n?t.x-8:t.x+g+8,y:t.y+t.h/2+4,textAnchor:n?"end":"start",fontSize:11,fill:r.label,children:e.label})]},e.key)})]}),P&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(o,{title:`${P.from} → ${P.to}`,rows:[{key:"value",label:b.flow,color:l(Z.get(P.from)?.index??0,P.color),value:$(P.value)}]})}),S&&/* @__PURE__ */d("div",{className:"pointer-events-none absolute top-2 left-2 z-10",children:/* @__PURE__ */d(o,{title:S.label,rows:[{key:"value",label:b.throughput,color:l(Z.get(S.key)?.index??0,S.color,S.tone),value:$(z.get(S.key)??0)}]})}),
9
9
  /* @__PURE__ */d(e,{caption:b.sankey(f.length,k.length),head:[b.tableFrom,b.tableTo,b.value],rows:k.map(e=>[e.from,e.to,$(e.value)])})]})}export{f as SankeyChart};
@@ -1,4 +1,4 @@
1
- import{SidebarLayout as e}from"./chunk-YTDMCUL7.js";import{Avatar as t}from"./chunk-W2TPXKCV.js";import{Input_default as a}from"./chunk-3SIRRK3F.js";import{Button_default as i}from"./chunk-UTISUEO4.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
1
+ import{SidebarLayout as e}from"./chunk-U5RG34NE.js";import{Avatar as t}from"./chunk-W2TPXKCV.js";import{Input_default as a}from"./chunk-3SIRRK3F.js";import{Button_default as i}from"./chunk-UTISUEO4.js";import{useState as s}from"react";import{jsx as n,jsxs as l}from"react/jsx-runtime";var r=[{id:1,name:"Priya Patel",last:"Sounds good — shipping it now",time:"9:41",status:"online"},{id:2,name:"Design team",last:"Marco: updated the tokens",time:"9:12",status:"away"},{id:3,name:"Tom Becker",last:"Thanks!",time:"Yest",status:"offline"},{id:4,name:"Sara Lind",last:"See you Friday 🎉",time:"Yest",status:"busy"}],m=[{mine:!1,text:"Hey! Did the latest build go out?"},{mine:!0,text:"Just merged — deploying now."},{mine:!1,text:"Nice. Any breaking changes for the portal?"},{mine:!0,text:"Nope, fully additive. New components only."},{mine:!1,text:"Sounds good — shipping it now"}];function d(){const[d,o]=s(1),c=r.find(e=>e.id===d)??r[0];/* @__PURE__ */
2
2
  return n("div",{className:"h-full",children:/* @__PURE__ */n(e,{side:"left",defaultWidth:260,sidebar:/* @__PURE__ */n("div",{className:"h-full overflow-auto",children:r.map(e=>/* @__PURE__ */l("button",{onClick:()=>o(e.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-3 text-left hover:bg-gray-50 "+(e.id===d?"bg-blue-50/50":""),children:[
3
3
  /* @__PURE__ */n(t,{name:e.name,status:e.status}),
4
4
  /* @__PURE__ */l("div",{className:"min-w-0 flex-1",children:[
@@ -0,0 +1,2 @@
1
+ import{usePlotWidth as i}from"./chunk-MAFUXCPZ.js";import{useRef as t}from"react";import{jsx as e}from"react/jsx-runtime";function r(i,t,e=1/0){return i>0&&t>0?Math.min(i/t,e):1}function n(i,t,e=1/0){return Math.min(r(i.width,t.width,e),r(i.height,t.height,e))}function h(i,t){return{width:i,transform:1!==t?`scale(${t})`:void 0,transformOrigin:"top left"}}function o({width:n,height:o,max:d=1,className:a,children:c}){const s=t(null),l=i(s,0),m=r(l,n,d),f={position:"relative",overflow:"hidden",width:"100%",...l>0?{height:o*m}:{aspectRatio:`${n} / ${o}`}},u={...h(n,m),height:o,visibility:l>0?void 0:"hidden"};/* @__PURE__ */
2
+ return e("div",{ref:s,className:a,style:f,children:/* @__PURE__ */e("div",{style:u,children:c})})}export{o as FitFrame,n as fitBoxScale,h as fitFrameStyle,r as fitScale};
@@ -1,6 +1,6 @@
1
- import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as r,COLUMN_SHARE_MIN as t,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-FKMARSJZ.js";import{textWidth as l}from"./chunk-UVCMV2TL.js";import{Tooltip as i}from"./chunk-F2RAIGCG.js";import{useShellStrings as a}from"./chunk-IUVGHHR3.js";import{useId as s,useRef as c,useState as u,useEffect as d,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,r,t)=>Math.min(t,Math.max(r,e)),g=e=>e.reduce((e,r)=>e+r,0),v=(e,r)=>e.length===r.length&&e.every((e,t)=>e===r[t]);var b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:M=!1,className:R=""}){const j=a().widths,A=s(),z=p(Math.round(x)||1,1,n),S=e($,z),B=S??[...r[z]??[]],K=[...B,100-g(B)],D=P||M,G=c(null),H=c({onChange:k,shown:B,locked:D,n:z,stored:S});H.current={onChange:k,shown:B,locked:D,n:z,stored:S};const I=r=>{const{onChange:t,shown:n,locked:o,n:l}=H.current;if(o)return!1;const i=e(r,l);return!(!i||v(i,n))&&(t(i),!0)},O=(e,r,n)=>{const o=e[r]+e[r+1],l=[...e];l[r]=p(Math.round(n),t,o-t),l[r+1]=o-l[r],I(l.slice(0,-1))&&(ne.current=null)},T=e=>r=>{if(r.altKey||r.ctrlKey||r.metaKey)return;const n=r.shiftKey?10:1,o=K[e]+K[e+1],l="ArrowRight"===r.key?K[e]+n:"ArrowLeft"===r.key?K[e]-n:"PageUp"===r.key?K[e]+10:"PageDown"===r.key?K[e]-10:"Home"===r.key?t:"End"===r.key?o-t:null;null!==l&&(r.preventDefault(),O(K,e,l))},F=c(null),[L,U]=u(null),V=()=>{F.current=null,U(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};d(()=>V,[]);const E=e=>r=>{if(0!==r.button||D)return;r.preventDefault();const t=G.current?.getBoundingClientRect().width??0;t<=0||(F.current={i:e,x:r.clientX,width:t,from:K,moved:!1,pointer:r.pointerId},U(e),r.currentTarget.setPointerCapture?.(r.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},J=e=>{const r=F.current;if(!r)return;if(0===e.buttons)return void V();const t=e.clientX-r.x;if(!r.moved){if(Math.abs(t)<3)return;r.moved=!0}O(r.from,r.i,r.from[r.i]+t/r.width*100)},W=e=>{const r=F.current;r&&(e.currentTarget.hasPointerCapture?.(r.pointer)&&e.currentTarget.releasePointerCapture(r.pointer),V())},X=(e,r)=>{const{shown:n}=H.current,o=function(e,r,n){const o=e.length,l=[...e];if(o<2)return l;const i=p(Math.round(n),t,100-(o-1)*t);let a=i-l[r];l[r]=i;const s=[...Array.from({length:o-1-r},(e,t)=>r+1+t),...Array.from({length:r},(e,t)=>r-1-t)];if(a<0)return l[s[0]]-=a,l;for(const e of s){if(a<=0)break;const r=Math.min(a,l[e]-t);l[e]-=r,a-=r}return l}([...n,100-g(n)],e,r);return I(o.slice(0,-1))?o:null},[q,Z]=u(0);d(()=>{const e=G.current;if(!e||"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(()=>Z(e.getBoundingClientRect().width));return r.observe(e),()=>r.disconnect()},[]);const Q=c(null),[Y,_]=u(null),[ee,re]=u([]),te=(e,r)=>_(t=>r?e:t===e?null:t),ne=c(null),oe=(e,r)=>{const t=ne.current;if(!t||t.column!==e||t.share!==r)return!1;const{onChange:n,locked:o,stored:l}=H.current;var i,a;return o||(i=l,a=t.stored,void 0===i||void 0===a?i===a:v(i,a))||n(t.stored),!0},le=K.join(",");d(()=>{const e=null===Y?[]:function(e,r){if(!e)return[];const t=Array.from(e.querySelectorAll("input[data-widths-label]")),n=t[r]?.getBoundingClientRect();return n&&0!==n.width?null===l("","12px sans-serif")?[]:t.flatMap((e,t)=>{if(t===r)return[];const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=(l(e.value,`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`)??0)/2,s=(o.left+o.right)/2;return s+a>n.left&&s-a<n.right?[t]:[]}):[]}(Q.current,Y);re(r=>v(r,e)?r:e)},[Y,le,q]);const ie=j.hint(z,t),ae=K.slice(0,-1).map((e,r)=>g(K.slice(0,r+1)));/* @__PURE__ */
2
- return f("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":z>1?A:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
3
- /* @__PURE__ */f("div",{ref:Q,"data-widths-bar":"",className:"relative h-8",children:[
4
- /* @__PURE__ */m("div",{ref:G,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:K.map((e,r)=>/* @__PURE__ */m("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${w[r%2]} ${r%2==0?"bg-accent-tint":""}`,children:1===z&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},r))}),
5
- /* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),z>1&&K.map((e,r)=>/* @__PURE__ */f(h,{children:[(()=>{const n=Y===r,l=g(K.slice(0,r)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
6
- return m("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */m(i,{content:ie,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>q>0&&q*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:t,max:100-(z-1)*t,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:M,"aria-label":j.column(r+1),"aria-describedby":A,"data-widths-label":"",onChange:e=>{null===e||oe(r,e)||X(r,e)},onRevert:e=>((e,r)=>{H.current.locked||null===r||oe(e,r)||X(e,r)})(r,e),onFocus:()=>{ne.current={column:r,share:e,stored:H.current.stored},te(r,!0)},onBlur:()=>te(r,!1),className:`absolute inset-0 text-xs font-medium ${w[r%2]} ${ee.includes(r)&&!n?"opacity-0":""}`})})})})(),r<z-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[r]}%`},children:/* @__PURE__ */m(i,{content:j.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */m("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":j.divider(r+1,r+2),"aria-valuenow":K[r],"aria-valuemin":t,"aria-valuemax":K[r]+K[r+1]-t,"aria-valuetext":j.dividerValue(r+1,K[r],r+2,K[r+1]),"aria-disabled":D||void 0,onKeyDown:D?void 0:T(r),onPointerDown:E(r),onPointerMove:J,onPointerUp:W,onPointerCancel:W,onLostPointerCapture:()=>{F.current&&V()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(D?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(D?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${L===r?"w-1":y}`)})})})})]},r))]}),z>1&&/* @__PURE__ */m("span",{id:A,className:"sr-only",children:ie})]})}export{x as WidthsBar};
1
+ import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as r,COLUMN_SHARE_MIN as t,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-BNI3N4TT.js";import{textWidth as l}from"./chunk-UVCMV2TL.js";import{Tooltip as i}from"./chunk-F2RAIGCG.js";import{useShellStrings as a}from"./chunk-IUVGHHR3.js";import{useId as s,useRef as c,useState as u,useEffect as d,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,r,t)=>Math.min(t,Math.max(r,e)),g=e=>e.reduce((e,r)=>e+r,0),v=(e,r)=>e.length===r.length&&e.every((e,t)=>e===r[t]);var b="w-0.5",y=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var w=["text-blue-700","text-gray-600"];function x({count:x,value:$,onChange:k,label:C,"aria-labelledby":N,readOnly:P=!1,disabled:M=!1,className:R=""}){const j=a().widths,z=s(),A=p(Math.round(x)||1,1,n),B=e($,A),T=B??[...r[A]??[]],I=[...T,100-g(T)],S=P||M,D=c(null),G=c({onChange:k,shown:T,locked:S,n:A,stored:B});G.current={onChange:k,shown:T,locked:S,n:A,stored:B};const H=r=>{const{onChange:t,shown:n,locked:o,n:l}=G.current;if(o)return!1;const i=e(r,l);return!(!i||v(i,n))&&(t(i),!0)},K=(e,r,n)=>{const o=e[r]+e[r+1],l=[...e];l[r]=p(Math.round(n),t,o-t),l[r+1]=o-l[r],H(l.slice(0,-1))&&(ne.current=null)},O=e=>r=>{if(r.altKey||r.ctrlKey||r.metaKey)return;const n=r.shiftKey?10:1,o=I[e]+I[e+1],l="ArrowRight"===r.key?I[e]+n:"ArrowLeft"===r.key?I[e]-n:"PageUp"===r.key?I[e]+10:"PageDown"===r.key?I[e]-10:"Home"===r.key?t:"End"===r.key?o-t:null;null!==l&&(r.preventDefault(),K(I,e,l))},L=c(null),[U,V]=u(null),E=()=>{L.current=null,V(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};d(()=>E,[]);const F=e=>r=>{if(0!==r.button||S)return;r.preventDefault();const t=D.current?.getBoundingClientRect().width??0;t<=0||(L.current={i:e,x:r.clientX,width:t,from:I,moved:!1,pointer:r.pointerId},V(e),r.currentTarget.setPointerCapture?.(r.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},W=e=>{const r=L.current;if(!r)return;if(0===e.buttons)return void E();const t=e.clientX-r.x;if(!r.moved){if(Math.abs(t)<3)return;r.moved=!0}K(r.from,r.i,r.from[r.i]+t/r.width*100)},X=e=>{const r=L.current;r&&(e.currentTarget.hasPointerCapture?.(r.pointer)&&e.currentTarget.releasePointerCapture(r.pointer),E())},q=(e,r)=>{const{shown:n}=G.current,o=function(e,r,n){const o=e.length,l=[...e];if(o<2)return l;const i=p(Math.round(n),t,100-(o-1)*t);let a=i-l[r];l[r]=i;const s=[...Array.from({length:o-1-r},(e,t)=>r+1+t),...Array.from({length:r},(e,t)=>r-1-t)];if(a<0)return l[s[0]]-=a,l;for(const e of s){if(a<=0)break;const r=Math.min(a,l[e]-t);l[e]-=r,a-=r}return l}([...n,100-g(n)],e,r);return H(o.slice(0,-1))?o:null},[J,Q]=u(0);d(()=>{const e=D.current;if(!e||"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(()=>Q(e.getBoundingClientRect().width));return r.observe(e),()=>r.disconnect()},[]);const Y=c(null),[Z,_]=u(null),[ee,re]=u([]),te=(e,r)=>_(t=>r?e:t===e?null:t),ne=c(null),oe=(e,r)=>{const t=ne.current;if(!t||t.column!==e||t.share!==r)return!1;const{onChange:n,locked:o,stored:l}=G.current;var i,a;return o||(i=l,a=t.stored,void 0===i||void 0===a?i===a:v(i,a))||n(t.stored),!0},le=I.join(",");d(()=>{const e=null===Z?[]:function(e,r){if(!e)return[];const t=Array.from(e.querySelectorAll("input[data-widths-label]")),n=t[r]?.getBoundingClientRect();return n&&0!==n.width?null===l("","12px sans-serif")?[]:t.flatMap((e,t)=>{if(t===r)return[];const o=e.getBoundingClientRect(),i=getComputedStyle(e),a=(l(e.value,`${i.fontWeight} ${i.fontSize} ${i.fontFamily}`)??0)/2,s=(o.left+o.right)/2;return s+a>n.left&&s-a<n.right?[t]:[]}):[]}(Y.current,Z);re(r=>v(r,e)?r:e)},[Z,le,J]);const ie=j.hint(A,t),ae=I.slice(0,-1).map((e,r)=>g(I.slice(0,r+1)));/* @__PURE__ */
2
+ return f("div",{role:"group","aria-label":N?void 0:C,"aria-labelledby":N,"aria-describedby":A>1?z:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
3
+ /* @__PURE__ */f("div",{ref:Y,"data-widths-bar":"",className:"relative h-8",children:[
4
+ /* @__PURE__ */m("div",{ref:D,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-surface",children:I.map((e,r)=>/* @__PURE__ */m("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${w[r%2]} ${r%2==0?"bg-accent-tint":""}`,children:1===A&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},r))}),
5
+ /* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-line-strong"}),A>1&&I.map((e,r)=>/* @__PURE__ */f(h,{children:[(()=>{const n=Z===r,l=g(I.slice(0,r)),a=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
6
+ return m("div",{"data-widths-tip":"",className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${l+e/2}% - ${a} / 2), calc(100% - ${a}))`,width:a},children:/* @__PURE__ */m(i,{content:ie,delay:600,describe:!1,className:"absolute inset-0",children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>J>0&&J*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:t,max:100-(A-1)*t,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:P,disabled:M,"aria-label":j.column(r+1),"aria-describedby":z,"data-widths-label":"",onChange:e=>{null===e||oe(r,e)||q(r,e)},onRevert:e=>((e,r)=>{G.current.locked||null===r||oe(e,r)||q(e,r)})(r,e),onFocus:()=>{ne.current={column:r,share:e,stored:G.current.stored},te(r,!0)},onBlur:()=>te(r,!1),className:`absolute inset-0 text-xs font-medium ${w[r%2]} ${ee.includes(r)&&!n?"opacity-0":""}`})})})})(),r<A-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${ae[r]}%`},children:/* @__PURE__ */m(i,{content:j.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */m("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":j.divider(r+1,r+2),"aria-valuenow":I[r],"aria-valuemin":t,"aria-valuemax":I[r]+I[r+1]-t,"aria-valuetext":j.dividerValue(r+1,I[r],r+2,I[r+1]),"aria-disabled":S||void 0,onKeyDown:S?void 0:O(r),onPointerDown:F(r),onPointerMove:W,onPointerUp:X,onPointerCancel:X,onLostPointerCapture:()=>{L.current&&E()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(S?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(S?`${b} bg-gray-300`:`bg-accent-fill transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${U===r?"w-1":y}`)})})})})]},r))]}),A>1&&/* @__PURE__ */m("span",{id:z,className:"sr-only",children:ie})]})}export{x as WidthsBar};
@@ -1,4 +1,4 @@
1
- import{InputNumber_default as e,stepRounding as r}from"./chunk-FKMARSJZ.js";import{IconButton_default as a}from"./chunk-NWS5G7FE.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as n}from"./chunk-F2RAIGCG.js";import{useShellStrings as l}from"./chunk-IUVGHHR3.js";import{useState as t,useRef as o}from"react";import{jsxs as s,jsx as d}from"react/jsx-runtime";var u={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function m({label:m,value:f,corners:p,onChange:h,radius:v=null,onRadiusChange:b,radiusLabel:k,radiusMin:g=0,radiusMax:x,radiusStep:w=1,radiusPlaceholder:y,radiusUnit:A,units:R,disabled:j=!1,disabledReason:N,id:S,className:C=""}){const I=l(),K=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(p),[M,D]=t(0),F=o(null);/* @__PURE__ */
2
- return s("div",{id:S,role:"group","aria-label":m,className:`flex min-w-0 flex-wrap items-center gap-2 ${C}`.trim(),children:[b&&
3
- /* @__PURE__ */d("div",{className:"w-30 shrink-0",children:/* @__PURE__ */d(e,{value:v,onChange:b,min:g,max:x,step:w,...r(w),placeholder:y,prefix:/* @__PURE__ */d("span",{"data-radius-mark":"","aria-hidden":"true",children:I.corners.radiusMark}),suffix:A??I.corners.unit,units:R,steppers:"compact",disabled:j,"aria-label":k??I.corners.radius})}),
4
- /* @__PURE__ */d("div",{ref:F,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(F.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:K.map((e,r)=>{const l=f.includes(e.value),t=j||!0===e.disabled,o=t&&(!0===e.disabled&&e.title||(j?N:void 0))||void 0,s=/* @__PURE__ */d(a,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":t||void 0,disabledReason:o,"data-corner":e.value,size:"sm",tabIndex:r===M?0:-1,onFocus:()=>D(r),onClick:()=>{t||h(l?f.filter(r=>r!==e.value):[...f,e.value])},children:/* @__PURE__ */d(i,{name:"corner",strokeWidth:2,className:["h-4 w-4",u[e.value]??""].filter(Boolean).join(" ")})},e.value);return o?s:/* @__PURE__ */d(n,{content:e.title??e.label,children:s},e.value)})})]})}export{m as CornersInput};
1
+ import{InputNumber_default as e,stepRounding as r}from"./chunk-BNI3N4TT.js";import{IconButton_default as a}from"./chunk-NWS5G7FE.js";import{Icon as i}from"./chunk-ISVODSRP.js";import{Tooltip as n}from"./chunk-F2RAIGCG.js";import{useShellStrings as l}from"./chunk-IUVGHHR3.js";import{useState as t,useRef as o}from"react";import{jsxs as s,jsx as d}from"react/jsx-runtime";var u={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function m({label:m,value:f,corners:p,onChange:h,radius:v=null,onRadiusChange:b,radiusLabel:k,radiusMin:g=0,radiusMax:x,radiusStep:w=1,radiusPlaceholder:y,radiusUnit:N,units:j,disabled:A=!1,disabledReason:R,id:I,className:C=""}){const S=l(),D=function(e){const r=c.map(r=>e.find(e=>e.value===r));for(const a of e){if(c.includes(a.value))continue;const e=r.findIndex(e=>void 0===e);-1===e?r.push(a):r[e]=a}return r.filter(e=>void 0!==e)}(p),[G,K]=t(0),M=o(null);/* @__PURE__ */
2
+ return s("div",{id:I,role:"group","aria-label":m,className:`flex min-w-0 flex-wrap items-center gap-2 ${C}`.trim(),children:[b&&
3
+ /* @__PURE__ */d("div",{className:"w-30 shrink-0",children:/* @__PURE__ */d(e,{value:v,onChange:b,min:g,max:x,step:w,...r(w),placeholder:y,prefix:/* @__PURE__ */d("span",{"data-radius-mark":"","aria-hidden":"true",children:S.corners.radiusMark}),suffix:N??S.corners.unit,units:j,steppers:"compact",disabled:A,"aria-label":k??S.corners.radius})}),
4
+ /* @__PURE__ */d("div",{ref:M,"data-corners-grid":"",className:"grid shrink-0 grid-cols-2 gap-1",onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;const r=Array.from(M.current?.querySelectorAll("button[data-corner]")??[]),a=r.indexOf(document.activeElement);if(-1===a)return;const i=a%2,n=Math.floor(a/2),l="ArrowRight"===e.key?2*n+1:"ArrowLeft"===e.key?2*n:"ArrowDown"===e.key?2+i:"ArrowUp"===e.key?i:null;null!==l&&(e.preventDefault(),l<r.length&&r[l].focus())},children:D.map((e,r)=>{const l=f.includes(e.value),t=A||!0===e.disabled,o=t&&(!0===e.disabled&&e.title||(A?R:void 0))||void 0,s=/* @__PURE__ */d(a,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":t||void 0,disabledReason:o,"data-corner":e.value,size:"sm",tabIndex:r===G?0:-1,onFocus:()=>K(r),onClick:()=>{t||h(l?f.filter(r=>r!==e.value):[...f,e.value])},children:/* @__PURE__ */d(i,{name:"corner",strokeWidth:2,className:["h-4 w-4",u[e.value]??""].filter(Boolean).join(" ")})},e.value);return o?s:/* @__PURE__ */d(n,{content:e.title??e.label,children:s},e.value)})})]})}export{m as CornersInput};
@@ -0,0 +1 @@
1
+ import{BrandXIcon as r}from"./chunk-4L7GLO5W.js";import{BrandXeroIcon as o}from"./chunk-FATXXVV3.js";import{BrandYoutubeIcon as n}from"./chunk-VW4FHT46.js";import{BrandZapierIcon as m}from"./chunk-QTM26JQP.js";import{BrandZendeskIcon as a}from"./chunk-77SI7AKG.js";import{BrandZoomIcon as i}from"./chunk-NK7HBFNQ.js";import{BrandUpsIcon as s}from"./chunk-YHYAGJ6V.js";import{BrandVonageIcon as t}from"./chunk-Z5XEAC32.js";import{BrandWhatsappIcon as p}from"./chunk-W5I35GZZ.js";import{BrandWiseIcon as c}from"./chunk-V3GM5NXB.js";import{BrandWixIcon as d}from"./chunk-XUYWUGDM.js";import{BrandWoocommerceIcon as u}from"./chunk-7GB7CVQI.js";import{BrandSamsungIcon as b}from"./chunk-7ELH72YJ.js";import{BrandShopifyIcon as h}from"./chunk-MVJ34HIV.js";import{BrandSquareIcon as k}from"./chunk-OIH56GH5.js";import{BrandSquarespaceIcon as f}from"./chunk-7KCJ77BP.js";import{BrandStripeIcon as j}from"./chunk-IBHBPSQN.js";import{BrandTelegramIcon as e}from"./chunk-ZZIVSJ2B.js";import{BrandTiktokIcon as l}from"./chunk-JREQY3YN.js";import{BrandTrelloIcon as M}from"./chunk-OSXM35MX.js";import{BrandMetaIcon as g}from"./chunk-NEQFHRF3.js";import{BrandMyobIcon as F}from"./chunk-PYW3HX7A.js";import{BrandNotionIcon as N}from"./chunk-4FNGR474.js";import{BrandNvidiaIcon as Z}from"./chunk-TUMURSQU.js";import{BrandPinterestIcon as G}from"./chunk-243NPEG6.js";import{BrandQuickbooksIcon as H}from"./chunk-6IUDFVTN.js";import{BrandSageIcon as V}from"./chunk-ONC3BFFM.js";import{BrandLineIcon as I}from"./chunk-2ZD67TDP.js";import{BrandLinkedinIcon as B}from"./chunk-G4GQOAWS.js";import{BrandMailchimpIcon as E}from"./chunk-INUXPG27.js";import{BrandMailgunIcon as Q}from"./chunk-TI5WUO3V.js";import{BrandMakeIcon as D}from"./chunk-OM5K4WCB.js";import{BrandMessengerIcon as W}from"./chunk-IWQSBA3D.js";import{BrandGoogledriveIcon as X}from"./chunk-R2IXRW5N.js";import{BrandGooglesheetsIcon as A}from"./chunk-75IWV4ZF.js";import{BrandHubspotIcon as P}from"./chunk-NZBQVE3Q.js";import{BrandInstagramIcon as T}from"./chunk-3ER2WJNL.js";import{BrandIntelIcon as U}from"./chunk-HSXNUF53.js";import{BrandIntercomIcon as O}from"./chunk-FUSCAZEK.js";import{BrandEtsyIcon as R}from"./chunk-FMERDO2X.js";import{BrandFacebookIcon as C}from"./chunk-EHMDGAWA.js";import{BrandFedexIcon as J}from"./chunk-4CFQXH5N.js";import{BrandGithubIcon as L}from"./chunk-ZHNKLVWV.js";import{BrandGmailIcon as S}from"./chunk-5HDMPCZP.js";import{BrandGoogleadsIcon as K}from"./chunk-QYEMC2OA.js";import{BrandGoogleanalyticsIcon as Y}from"./chunk-KTMEHSTB.js";import{BrandGooglecalendarIcon as y}from"./chunk-4RDYNULI.js";import{BrandCalendlyIcon as w}from"./chunk-NTME34BP.js";import{BrandCampaignmonitorIcon as x}from"./chunk-47OCVZXD.js";import{BrandCloudflareIcon as v}from"./chunk-4VIRG42K.js";import{BrandDellIcon as q}from"./chunk-L7DBGH2Z.js";import{BrandDhlIcon as z}from"./chunk-ZXU4DEQM.js";import{BrandDropboxIcon as $}from"./chunk-I27TFZJH.js";import{BrandEbayIcon as _}from"./chunk-PBGMVLOF.js";import{BrandAmdIcon as rr}from"./chunk-AFMPM43F.js";import{BrandAnthropicIcon as or}from"./chunk-E3E7DODJ.js";import{BrandAppleIcon as nr}from"./chunk-4TWBDIMX.js";import{BrandAwsIcon as mr}from"./chunk-RWL7F776.js";import{BrandBigcommerceIcon as ar}from"./chunk-ZBL4CN2E.js";import{BrandBrevoIcon as ir}from"./chunk-V6Q2GZAI.js";import{Brand1passwordIcon as sr}from"./chunk-OD2ZMT64.js";import{BrandAdyenIcon as tr}from"./chunk-K4RFJ7P2.js";import{BrandAircallIcon as pr}from"./chunk-PAZU27H5.js";import{PAYMENT_BRAND_DRAWINGS as cr}from"./chunk-6UGMQZTF.js";var dr={...cr,"brand-1password":sr,"brand-adyen":tr,"brand-aircall":pr,"brand-amd":rr,"brand-anthropic":or,"brand-apple":nr,"brand-aws":mr,"brand-bigcommerce":ar,"brand-brevo":ir,"brand-calendly":w,"brand-campaignmonitor":x,"brand-cloudflare":v,"brand-dell":q,"brand-dhl":z,"brand-dropbox":$,"brand-ebay":_,"brand-etsy":R,"brand-facebook":C,"brand-fedex":J,"brand-github":L,"brand-gmail":S,"brand-googleads":K,"brand-googleanalytics":Y,"brand-googlecalendar":y,"brand-googledrive":X,"brand-googlesheets":A,"brand-hubspot":P,"brand-instagram":T,"brand-intel":U,"brand-intercom":O,"brand-line":I,"brand-linkedin":B,"brand-mailchimp":E,"brand-mailgun":Q,"brand-make":D,"brand-messenger":W,"brand-meta":g,"brand-myob":F,"brand-notion":N,"brand-nvidia":Z,"brand-pinterest":G,"brand-quickbooks":H,"brand-sage":V,"brand-samsung":b,"brand-shopify":h,"brand-square":k,"brand-squarespace":f,"brand-stripe":j,"brand-telegram":e,"brand-tiktok":l,"brand-trello":M,"brand-ups":s,"brand-vonage":t,"brand-whatsapp":p,"brand-wise":c,"brand-wix":d,"brand-woocommerce":u,"brand-x":r,"brand-xero":o,"brand-youtube":n,"brand-zapier":m,"brand-zendesk":a,"brand-zoom":i};export{dr as BRAND_MARK_DRAWINGS};
@@ -0,0 +1,24 @@
1
+ import{Icon as e}from"./chunk-ISVODSRP.js";import{LoadingSpinner as t}from"./chunk-R2VKEMZH.js";import{fitBoxScale as n,fitScale as r}from"./chunk-M6UKCZHT.js";import{toast_default as a}from"./chunk-VQ35LXDC.js";import{useShellStrings as o}from"./chunk-IUVGHHR3.js";import{createContext as i,useContext as s,useRef as l,useState as c,useEffect as d}from"react";import*as u from"pdfjs-dist";import{createPortal as m}from"react-dom";import{jsx as h,jsxs as p}from"react/jsx-runtime";function f(e,t,n){return new Error(`The response for ${e} is not a WebAssembly module (got ${function(e){if(0===e.length)return"an empty response";const t=Array.from(e.subarray(0,24)).map(e=>e>=32&&e<127?String.fromCharCode(e):".").join("");return`${e.length} bytes starting "${t}"`}(n)}). The bundler did not emit "${t}" as an asset, and the host answered with a fallback page instead of a 404. Serve pdfjs-dist/wasm/ yourself and point window.__REACT_OS_SHELL_PDF_WASM__ at it.`)}var g=i(null);function w({children:e}){const t=s(g);return t?m(e,t):
2
+ /* @__PURE__ */h("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 bg-gray-50 px-3 py-2 text-xs",children:e})}"undefined"==typeof window||u.GlobalWorkerOptions.workerSrc||(u.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${u.version}/build/pdf.worker.min.mjs`);var y={"jbig2.wasm":new URL("pdfjs-dist/wasm/jbig2.wasm",import.meta.url).href,"openjpeg.wasm":new URL("pdfjs-dist/wasm/openjpeg.wasm",import.meta.url).href},v=class{async fetch({kind:e,filename:t}){if("wasmUrl"!==e)throw new Error(`Ensure that the \`${e}\` API parameter is provided.`);const n=y[t];if(!n)throw new Error(`No bundled pdf.js wasm module for "${t}".`);const r=await fetch(n);if(!r.ok)throw new Error(`Unable to load wasm data at: ${n}`);const a=new Uint8Array(await r.arrayBuffer());if(!function(e){return e.length>=4&&0===e[0]&&97===e[1]&&115===e[2]&&109===e[3]}(a))throw f(n,t,a);return a}};function b(e){const t=e||("undefined"!=typeof window?window.__REACT_OS_SHELL_PDF_WASM__:void 0);return"string"==typeof t&&t?{wasmUrl:t.endsWith("/")?t:`${t}/`}:{BinaryDataFactory:v}}var x=[50,75,100,125,150,200,300,400];function k(e,t,a){const o={width:t.width-40,height:t.height-40};if(o.width<=0||"page"===e&&o.height<=0)return.3;const i="page"===e?n(o,a):r(o.width,a.width);return Math.min(Math.max(i,.3),4)}function C({url:n,filename:r,fit:i="width",onDownload:s,onEmail:m,workerSrc:f,wasmUrl:g}){const y=o().pdf,v=l(null),C=l(null),N=l(null),[j,M]=c(null),[E,P]=c(1),[z,D]=c(0),[_,S]=c(1),[L,W]=c(!0),[T,$]=c(!0),O=l(y.loadFailed);O.current=y.loadFailed,d(()=>{let e=!1;return $(!0),P(1),f&&(u.GlobalWorkerOptions.workerSrc=f),u.getDocument({url:n,...b(g)}).promise.then(t=>{e||(M(t),D(t.numPages),$(!1))}).catch(()=>{e||(a.error(O.current),$(!1))}),()=>{e=!0}},[n,f,g]),d(()=>{if(!j||!L||!N.current)return;const e=()=>{const e=N.current;e&&j.getPage(E).then(t=>{if(!N.current)return;const n=t.getViewport({scale:1}),r=k(i,{width:e.clientWidth,height:e.clientHeight},{width:n.width,height:n.height});S(e=>Math.abs(e-r)<.005?e:r)})};e();const t=new ResizeObserver(e);return t.observe(N.current),()=>t.disconnect()},[j,E,L,i]),d(()=>{if(!j||!v.current)return;let e=!1,t=null,n=null;return j.getPage(E).then(r=>{if(e||!v.current)return;const a=r.getViewport({scale:_}),o=v.current;o.width=a.width,o.height=a.height,o.style.width=`${a.width}px`,o.style.height=`${a.height}px`;const i=o.getContext("2d");t=r.render({canvas:o,canvasContext:i,viewport:a}),t.promise.catch(()=>{});const s=C.current;s&&(s.replaceChildren(),s.style.setProperty("--total-scale-factor",String(a.scale)),n=new u.TextLayer({textContentSource:r.streamTextContent(),container:s,viewport:a}),n.render().then(()=>{if(e)return;const t=document.createElement("div");t.className="endOfContent",s.append(t)}).catch(()=>{}))}),()=>{e=!0,t?.cancel(),n?.cancel()}},[j,E,_]),d(()=>{const e=()=>C.current?.classList.remove("selecting");return window.addEventListener("pointerup",e),()=>window.removeEventListener("pointerup",e)},[]);const A="page"===i?y.fitPage:y.fitWidth,H="px-2 py-1 rounded hover:bg-gray-200 transition-colors text-gray-600 flex items-center gap-1";/* @__PURE__ */
3
+ return p("div",{className:"flex flex-col h-full",children:[
4
+ /* @__PURE__ */p(w,{children:[
5
+ /* @__PURE__ */h("button",{type:"button","aria-label":y.previousPage,onClick:()=>P(e=>Math.max(1,e-1)),disabled:E<=1,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */h(e,{name:"chevron-left",className:"h-3.5 w-3.5",strokeWidth:2})}),
6
+ /* @__PURE__ */h("span",{className:"text-gray-600 font-medium tabular-nums whitespace-nowrap",children:y.pageOf(E,z)}),
7
+ /* @__PURE__ */h("button",{type:"button","aria-label":y.nextPage,onClick:()=>P(e=>Math.min(z,e+1)),disabled:E>=z,className:"px-1 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-600",children:/* @__PURE__ */h(e,{name:"chevron-right",className:"h-3.5 w-3.5",strokeWidth:2})}),
8
+ /* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
9
+ /* @__PURE__ */h("button",{type:"button","aria-label":y.zoomOut,title:y.zoomOut,onClick:()=>{W(!1),S(e=>Math.max(.3,Math.round(100*(e-.25))/100))},className:H,children:/* @__PURE__ */h("span",{"aria-hidden":"true",children:"−"})}),
10
+ /* @__PURE__ */p("select",{value:L?"fit":x.includes(Math.round(100*_))?Math.round(100*_):"custom",onChange:e=>{const t=e.target.value;"fit"!==t?"custom"!==t&&(W(!1),S(Number(t)/100)):W(!0)},className:"bg-transparent hover:bg-gray-200 rounded px-1 py-1 text-gray-600 tabular-nums cursor-pointer focus:outline-none focus:ring-1 focus:ring-blue-400","aria-label":y.zoom,title:y.zoom,children:[
11
+ /* @__PURE__ */h("option",{value:"fit",children:A}),!L&&!x.includes(Math.round(100*_))&&/* @__PURE__ */p("option",{value:"custom",children:[Math.round(100*_),"%"]}),x.map(e=>/* @__PURE__ */p("option",{value:e,children:[e,"%"]},e))]}),
12
+ /* @__PURE__ */h("button",{type:"button","aria-label":y.zoomIn,title:y.zoomIn,onClick:()=>{W(!1),S(e=>Math.min(4,Math.round(100*(e+.25))/100))},className:H,children:/* @__PURE__ */h("span",{"aria-hidden":"true",children:"+"})}),
13
+ /* @__PURE__ */h("button",{type:"button",onClick:()=>W(!0),"aria-pressed":L,className:H+(L?" bg-gray-200 text-gray-900":""),title:y.fitHint,children:y.fit}),
14
+ /* @__PURE__ */h("div",{className:"h-4 w-px bg-gray-300 mx-1"}),
15
+ /* @__PURE__ */p("button",{type:"button",onClick:()=>{if(!j)return;const e=window.open("","_blank");if(!e)return void a.error(y.allowPopups);const t=[];for(let e=1;e<=z;e++)t.push(j.getPage(e).then(e=>{const t=e.getViewport({scale:2}),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,e.render({canvas:n,canvasContext:n.getContext("2d"),viewport:t}).promise.then(()=>n.toDataURL())}));Promise.all(t).then(t=>{var n;e.document.write(`<html><head><title>${n=r,n.replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[e]))}</title><style>@media print{body{margin:0}img{width:100%;page-break-after:always}}</style></head><body>`),e.document.write(t.map(e=>`<img src="${e}"/>`).join("")),e.document.write("</body></html>"),e.document.close(),setTimeout(()=>{e.print(),e.close()},300)})},className:H,children:[
16
+ /* @__PURE__ */h(e,{name:"print",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.print]}),
17
+ /* @__PURE__ */p("button",{type:"button",onClick:s??(()=>{const e=document.createElement("a");e.href=n,e.download=r,e.click()}),className:H,children:[
18
+ /* @__PURE__ */h(e,{name:"download",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.download]}),m&&/* @__PURE__ */p("button",{type:"button",onClick:m,className:H,children:[
19
+ /* @__PURE__ */h(e,{name:"email",className:"h-3.5 w-3.5",strokeWidth:1.5}),y.email]})]}),
20
+ /* @__PURE__ */h("div",{ref:N,className:"flex-1 overflow-auto bg-gray-100 outline-none",tabIndex:0,onWheel:e=>{if(!j)return;if(e.ctrlKey||e.metaKey)return;const t=N.current;if(!t)return;const n=t.scrollTop<=0,r=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY>0&&r&&E<z?(e.preventDefault(),P(e=>Math.min(z,e+1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=0)})):e.deltaY<0&&n&&E>1&&(e.preventDefault(),P(e=>Math.max(1,e-1)),requestAnimationFrame(()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)}))},onKeyDown:e=>{if(!j)return;if(e.defaultPrevented)return;const t=(document.activeElement?.tagName||"").toLowerCase();"input"===t||"textarea"===t||document.activeElement?.isContentEditable||("PageDown"===e.key||"ArrowRight"===e.key?E<z&&(e.preventDefault(),P(e=>Math.min(z,e+1))):"PageUp"===e.key||"ArrowLeft"===e.key?E>1&&(e.preventDefault(),P(e=>Math.max(1,e-1))):"Home"===e.key?(e.preventDefault(),P(1)):"End"===e.key&&(e.preventDefault(),P(z)))},children:T?/* @__PURE__ */h(t,{size:"sm",padding:"",className:"h-full",label:y.loading}):/* @__PURE__ */p("div",{className:"min-h-full flex items-center justify-center p-4",children:[
21
+ /* @__PURE__ */h("style",{children:'\n.preview-pdf-textlayer {\n position: absolute;\n inset: 0;\n overflow: clip;\n line-height: 1;\n text-align: initial;\n text-size-adjust: none;\n forced-color-adjust: none;\n transform-origin: 0 0;\n caret-color: CanvasText;\n --min-font-size: 1;\n --text-scale-factor: calc(var(--total-scale-factor, 1) * var(--min-font-size));\n --min-font-size-inv: calc(1 / var(--min-font-size));\n}\n.preview-pdf-textlayer :is(span, br) {\n color: transparent;\n position: absolute;\n white-space: pre;\n cursor: text;\n transform-origin: 0% 0%;\n}\n.preview-pdf-textlayer > :not(.markedContent),\n.preview-pdf-textlayer .markedContent span:not(.markedContent) {\n z-index: 1;\n --font-height: 0;\n font-size: calc(var(--text-scale-factor) * var(--font-height));\n --scale-x: 1;\n --rotate: 0deg;\n transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));\n}\n.preview-pdf-textlayer .markedContent {\n display: contents;\n}\n.preview-pdf-textlayer span[role="img"] {\n user-select: none;\n cursor: default;\n}\n.preview-pdf-textlayer ::selection {\n background: rgba(0, 80, 255, 0.25);\n}\n.preview-pdf-textlayer br::selection {\n background: transparent;\n}\n.preview-pdf-textlayer .endOfContent {\n display: block;\n position: absolute;\n inset: 100% 0 0;\n z-index: 0;\n cursor: default;\n user-select: none;\n}\n.preview-pdf-textlayer.selecting .endOfContent {\n top: 0;\n}\n'}),
22
+ /* @__PURE__ */p("div",{className:"relative shadow-lg rounded",children:[
23
+ /* @__PURE__ */h("canvas",{ref:v,className:"block rounded"}),
24
+ /* @__PURE__ */h("div",{ref:C,className:"preview-pdf-textlayer",onPointerDown:e=>e.currentTarget.classList.add("selecting")})]})]})})]})}export{w as PanelActions,C as PdfViewer,g as ToolbarSlotContext,k as pageFitScale,b as pdfWasmParams};
@@ -1,11 +1,11 @@
1
- import{usePlotWidth as e}from"./chunk-MAFUXCPZ.js";import{ChartTooltip as t}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as l,CHART_INK as r}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as n}from"./chunk-TWVUQUUD.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-IUVGHHR3.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:N=2}){const j=i().charts,U=a(),z=$??(e=>o(e,U)),C=b??j.intensity,D=w??j.noActivity,F=h(null),R=e(F),V=g??R,S=c(),[G,H]=s(null);if(m(()=>{if(null!==G)return n(e=>"Escape"===e.key&&(H(null),!0))},[G]),0===x.length||0===d.length)/* @__PURE__ */
2
- return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const I=y??l(0),L=v??Math.max(1,...p.flat().filter(Number.isFinite)),Q=96,B=26*x.length,E=M??B+26+26,T=Math.max(2,(Math.max(97,V)-Q)/d.length),W=e=>{const t=L>0?Math.max(0,Math.min(1,e/L)):0;return`color-mix(in oklab, ${I} ${(8+92*t).toFixed(1)}%, ${r.surface})`};/* @__PURE__ */
1
+ import{ChartTooltip as e}from"./chunk-WDQI3FV6.js";import{resolveSeriesColor as t,CHART_INK as l}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as r}from"./chunk-TWVUQUUD.js";import{usePlotWidth as n}from"./chunk-MAFUXCPZ.js";import{useShellStrings as i,useShellLocale as a}from"./chunk-IUVGHHR3.js";import{formatPlain as o}from"./chunk-C3QOHMR6.js";import{useRef as h,useId as c,useState as s,useEffect as m}from"react";import{jsx as f,jsxs as u}from"react/jsx-runtime";function x({rows:x,columns:d,cells:p,height:M,width:g,color:y,max:v,formatValue:$,label:b,className:k,emptyLabel:w,cellGap:A=2,cellRadius:N=2}){const j=i().charts,U=a(),z=$??(e=>o(e,U)),C=b??j.intensity,D=w??j.noActivity,F=h(null),R=n(F),V=g??R,S=c(),[G,H]=s(null);if(m(()=>{if(null!==G)return r(e=>"Escape"===e.key&&(H(null),!0))},[G]),0===x.length||0===d.length)/* @__PURE__ */
2
+ return f("div",{className:k,ref:F,children:/* @__PURE__ */f("p",{className:"py-8 text-center text-sm text-gray-500",children:D})});const I=y??t(0),L=v??Math.max(1,...p.flat().filter(Number.isFinite)),Q=96,B=26*x.length,E=M??B+26+26,T=Math.max(2,(Math.max(97,V)-Q)/d.length),W=e=>{const t=L>0?Math.max(0,Math.min(1,e/L)):0;return`color-mix(in oklab, ${I} ${(8+92*t).toFixed(1)}%, ${l.surface})`};/* @__PURE__ */
3
3
  return u("div",{className:`relative ${k??""}`,ref:F,children:[
4
4
  /* @__PURE__ */u("svg",{width:"100%",height:E,viewBox:`0 0 ${V} ${E}`,role:"img","aria-label":j.heatmap(C,x.length,d.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>H(null),onBlur:()=>H(null),onKeyDown:e=>{const t="ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0,l="ArrowRight"===e.key?1:"ArrowLeft"===e.key?-1:0;0===t&&0===l||(e.preventDefault(),H(e=>({r:Math.min(x.length-1,Math.max(0,(e?.r??0)+t)),c:Math.min(d.length-1,Math.max(0,(e?.c??0)+l))})))},children:[
5
5
  /* @__PURE__ */f("defs",{children:/* @__PURE__ */u("linearGradient",{id:S,x1:"0",x2:"1",children:[
6
6
  /* @__PURE__ */f("stop",{offset:"0",stopColor:W(0)}),
7
- /* @__PURE__ */f("stop",{offset:"1",stopColor:W(L)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:r.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=G&&(G.r!==t||G.c!==r);/* @__PURE__ */
8
- return f("rect",{x:Q+r*T+A/2,y:26*t+A/2,width:Math.max(1,T-A),height:26-A,rx:N,fill:W(n),opacity:i?.55:1,onMouseEnter:()=>H({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${z(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((V-Q)/56))))===0?/* @__PURE__ */f("text",{x:Q+t*T+T/2,y:B+15,textAnchor:"middle",fontSize:11,fill:r.label,children:e},`c${t}`):null),
7
+ /* @__PURE__ */f("stop",{offset:"1",stopColor:W(L)})]})}),x.map((e,t)=>/* @__PURE__ */f("text",{x:86,y:26*t+13+4,textAnchor:"end",fontSize:11,fill:l.label,children:e},`r${t}`)),x.map((e,t)=>d.map((l,r)=>{const n=p[t]?.[r]??0,i=G&&(G.r!==t||G.c!==r);/* @__PURE__ */
8
+ return f("rect",{x:Q+r*T+A/2,y:26*t+A/2,width:Math.max(1,T-A),height:26-A,rx:N,fill:W(n),opacity:i?.55:1,onMouseEnter:()=>H({r:t,c:r}),children:/* @__PURE__ */f("title",{children:`${e} · ${l}: ${z(n)}`})},`${t}-${r}`)})),d.map((e,t)=>t%Math.max(1,Math.ceil(d.length/Math.max(1,Math.floor((V-Q)/56))))===0?/* @__PURE__ */f("text",{x:Q+t*T+T/2,y:B+15,textAnchor:"middle",fontSize:11,fill:l.label,children:e},`c${t}`):null),
9
9
  /* @__PURE__ */f("rect",{x:Q,y:B+26,width:Math.min(180,Math.max(40,V-Q)),height:8,rx:4,fill:`url(#${S})`}),
10
- /* @__PURE__ */f("text",{x:Q,y:B+48,fontSize:11,fill:r.label,children:"0"}),
11
- /* @__PURE__ */f("text",{x:Q+Math.min(180,Math.max(40,V-Q)),y:B+48,textAnchor:"end",fontSize:11,fill:r.label,style:{fontVariantNumeric:"tabular-nums"},children:z(L)})]}),G&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(t,{title:`${x[G.r]} · ${d[G.c]}`,rows:[{key:"v",label:C,color:I,value:null==p[G.r]?.[G.c]?void 0:z(p[G.r][G.c])}]})})]})}export{x as HeatmapChart};
10
+ /* @__PURE__ */f("text",{x:Q,y:B+48,fontSize:11,fill:l.label,children:"0"}),
11
+ /* @__PURE__ */f("text",{x:Q+Math.min(180,Math.max(40,V-Q)),y:B+48,textAnchor:"end",fontSize:11,fill:l.label,style:{fontVariantNumeric:"tabular-nums"},children:z(L)})]}),G&&/* @__PURE__ */f("div",{className:"pointer-events-none absolute top-1 right-1 z-10",children:/* @__PURE__ */f(e,{title:`${x[G.r]} · ${d[G.c]}`,rows:[{key:"v",label:C,color:I,value:null==p[G.r]?.[G.c]?void 0:z(p[G.r][G.c])}]})})]})}export{x as HeatmapChart};
@@ -1,4 +1,4 @@
1
- import{Modal as e}from"./chunk-JFOMAXD2.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
1
+ import{Modal as e}from"./chunk-ZI2FDUYJ.js";import{keepsNativeMenu as a}from"./chunk-5QFPTDQF.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";var t={activeOpacity:70,inactiveOpacity:50,activeBlur:0,inactiveBlur:0};function r(e){try{const a=JSON.parse(localStorage.getItem(e)||"");return null!=a.blur&&null==a.activeBlur&&(a.activeBlur=a.blur,a.inactiveBlur=a.blur,delete a.blur),{...t,...a}}catch{return t}}function l({open:t,onClose:r,title:l,appearance:c,onAppearanceChange:s,onSave:d,children:o}){if(!t)return null;const u="w-full h-1.5 rounded-full appearance-none bg-gray-200 cursor-pointer accent-blue-500",p="flex items-center justify-between text-xs text-gray-500";/* @__PURE__ */
2
2
  return i("div",{onPointerDown:e=>e.stopPropagation(),onContextMenu:e=>{e.stopPropagation(),a(e.target)||e.preventDefault()},children:/* @__PURE__ */i(e,{open:t,onClose:r,title:l,size:"sm",children:/* @__PURE__ */n("div",{className:"space-y-4",children:[o,
3
3
  /* @__PURE__ */n("div",{children:[
4
4
  /* @__PURE__ */i("h3",{className:"text-sm font-semibold text-gray-700 mb-3",children:"Appearance"}),
@@ -1,11 +1,11 @@
1
- import{ImageFocusPoint as e}from"./chunk-5POQCJL6.js";import{FormField as i}from"./chunk-6KBDNYRW.js";import{Segmented as a}from"./chunk-TNALBYLY.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as s,UploadGlyph as l,zoneFocusClass as c,dropzoneClass as d}from"./chunk-YWMCW5BN.js";import{TransferProgress as u}from"./chunk-GUSENWAH.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-VFSAJMNX.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{useShellStrings as b}from"./chunk-IUVGHHR3.js";import{useState as f,useRef as g,useEffect as v,useId as y}from"react";import{jsxs as k,jsx as x,Fragment as N}from"react/jsx-runtime";var j=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:R,onFile:C,label:U,hint:$,error:F,required:z,className:P,accept:O="image/*",maxSizeBytes:H,fit:S="cover",height:B,shape:W="rect",placeholder:q,cta:A,acceptHint:I,showFilename:V=!0,allowReplace:Y=!0,allowRemove:D=!0,replaceLabel:G,removeLabel:J,busy:K=!1,busyLabel:M,choosingLabel:_,pickFailedLabel:E,progress:Q,disabled:T=!1,kind:X,onKindChange:Z,focus:ee,onFocusChange:ie,focusLabel:ae}){const te=b().media,re="circle"===W,oe=B??(re?96:112),ne=A??te.cta,se=X??(/video/.test(O)&&!/image/.test(O)?"video":"image"),le="string"==typeof J&&J?J:te.remove,[ce,de]=f(!1),[ue,me]=f(!1),he=g(!0);v(()=>()=>{he.current=!1},[]);const pe=K||ce,be=ce&&!K?_??te.choosing:M??te.uploading,fe=F??(ue?E??te.pickFailed:void 0),ge=e=>{if(!R)return;me(!1);const i=R(e);i&&"function"==typeof i.then&&(de(!0),i.then(e=>{he.current&&(de(!1),"string"==typeof e&&e&&L(e))},()=>{he.current&&(de(!1),me(!0))}))},ve=y(),ye=g(null),[ke,xe]=f(null);v(()=>()=>{ye.current&&URL.revokeObjectURL(ye.current)},[]);const Ne=T||pe,je=!!w&&(t(w,O)||w===ke),we=q??r(O,te),Le=G??(je||"video"===se?te.changeVideo:te.changeImage),Re=e=>{R?ge(e):C?C(e):(e=>{ye.current&&URL.revokeObjectURL(ye.current);const i=URL.createObjectURL(e);ye.current=i,xe(e.type.startsWith("video/")?i:null),L(i)})(e)},Ce=m({accept:O,maxSizeBytes:H,acceptHint:I,multiple:!1,disabled:Ne,onAccept:([e])=>Re(e)}),{dragOver:Ue}=Ce,$e=()=>{Ne||(R?ge():Ce.open())},Fe=w?o(w):"",ze=!re&&!je&&!!ie,Pe=T||!Y&&!D?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:[re?"absolute inset-0 flex items-center justify-center gap-1 p-1 text-(--status-on-solid)":"absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[Y&&/* @__PURE__ */k("button",{id:ze?void 0:ve,type:"button","aria-labelledby":`${ve}-change`,onClick:()=>$e(),disabled:pe,className:re?`w-8 shrink-0 ${j}`:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${j}`,children:[
1
+ import{FormField as e}from"./chunk-6KBDNYRW.js";import{ImageFocusPoint as i}from"./chunk-5POQCJL6.js";import{Segmented as a}from"./chunk-TNALBYLY.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as s,UploadGlyph as l,zoneFocusClass as c,dropzoneClass as d}from"./chunk-YWMCW5BN.js";import{TransferProgress as u}from"./chunk-GUSENWAH.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-VFSAJMNX.js";import{Icon as p}from"./chunk-ISVODSRP.js";import{useShellStrings as b}from"./chunk-IUVGHHR3.js";import{useState as f,useRef as g,useEffect as v,useId as y}from"react";import{jsxs as k,jsx as x,Fragment as N}from"react/jsx-runtime";var j=["flex h-8 items-center justify-center rounded-(--radius-control) text-(--status-on-solid)","not-disabled:hover:bg-white/10 disabled:cursor-not-allowed disabled:opacity-60","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]"].join(" ");function w({value:w,onChange:L,onPick:R,onFile:C,label:U,hint:$,error:F,required:z,className:P,accept:O="image/*",maxSizeBytes:H,fit:S="cover",height:B,shape:W="rect",placeholder:q,cta:A,acceptHint:I,showFilename:V=!0,allowReplace:Y=!0,allowRemove:D=!0,replaceLabel:G,removeLabel:J,busy:K=!1,busyLabel:M,choosingLabel:_,pickFailedLabel:E,progress:Q,disabled:T=!1,kind:X,onKindChange:Z,focus:ee,onFocusChange:ie,focusLabel:ae}){const te=b().media,re="circle"===W,oe=B??(re?96:112),ne=A??te.cta,se=X??(/video/.test(O)&&!/image/.test(O)?"video":"image"),le="string"==typeof J&&J?J:te.remove,[ce,de]=f(!1),[ue,me]=f(!1),he=g(!0);v(()=>()=>{he.current=!1},[]);const pe=K||ce,be=ce&&!K?_??te.choosing:M??te.uploading,fe=F??(ue?E??te.pickFailed:void 0),ge=e=>{if(!R)return;me(!1);const i=R(e);i&&"function"==typeof i.then&&(de(!0),i.then(e=>{he.current&&(de(!1),"string"==typeof e&&e&&L(e))},()=>{he.current&&(de(!1),me(!0))}))},ve=y(),ye=g(null),[ke,xe]=f(null);v(()=>()=>{ye.current&&URL.revokeObjectURL(ye.current)},[]);const Ne=T||pe,je=!!w&&(t(w,O)||w===ke),we=q??r(O,te),Le=G??(je||"video"===se?te.changeVideo:te.changeImage),Re=e=>{R?ge(e):C?C(e):(e=>{ye.current&&URL.revokeObjectURL(ye.current);const i=URL.createObjectURL(e);ye.current=i,xe(e.type.startsWith("video/")?i:null),L(i)})(e)},Ce=m({accept:O,maxSizeBytes:H,acceptHint:I,multiple:!1,disabled:Ne,onAccept:([e])=>Re(e)}),{dragOver:Ue}=Ce,$e=()=>{Ne||(R?ge():Ce.open())},Fe=w?o(w):"",ze=!re&&!je&&!!ie,Pe=T||!Y&&!D?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:[re?"absolute inset-0 flex items-center justify-center gap-1 p-1 text-(--status-on-solid)":"absolute inset-x-0 bottom-0 flex items-center gap-1 p-1 text-(--status-on-solid)","opacity-0 transition-opacity duration-(--motion-fast)","group-hover/media:opacity-100 group-focus-within/media:opacity-100 [@media(hover:none)]:opacity-100"].join(" "),style:{background:"var(--rosh-media-scrim-button)"},children:[Y&&/* @__PURE__ */k("button",{id:ze?void 0:ve,type:"button","aria-labelledby":`${ve}-change`,onClick:()=>$e(),disabled:pe,className:re?`w-8 shrink-0 ${j}`:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${j}`,children:[
2
2
  /* @__PURE__ */x(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
3
3
  /* @__PURE__ */x("span",{id:`${ve}-change`,className:re?"sr-only":"truncate",children:Le})]}),D&&/* @__PURE__ */x("button",{type:"button","aria-label":le,onClick:()=>{ye.current&&(URL.revokeObjectURL(ye.current),ye.current=null),xe(null),L("")},disabled:pe,className:`${re?"":"ml-auto "}w-8 shrink-0 ${j}`,children:/* @__PURE__ */x(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Oe=/* @__PURE__ */k("div",{...Ce.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden border transition-colors",re?"shrink-0 rounded-full":"rounded-(--radius-control)",ze?"":"bg-gray-100",Ue?"border-blue-500":"border-line"].join(" "),style:ze?void 0:re?{height:oe,width:oe}:{height:oe},children:[ze?
4
- /* @__PURE__ */x(e,{value:ee??"",onChange:e=>ie?.(e),label:ae??te.focus,image:w,hint:null,id:ve,disabled:Ne,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):je?/* @__PURE__ */x("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Fe||void 0,className:"h-full w-full",style:{objectFit:S}}):/* @__PURE__ */x("img",{src:w??void 0,alt:Fe,className:"h-full w-full",style:{objectFit:S,objectPosition:ee||void 0}}),V&&!re&&w&&/* @__PURE__ */x(n,{children:Fe}),Pe,pe&&/* @__PURE__ */x(s,{label:be,progress:Q,rounded:re?"rounded-full":"rounded-md"})]}),He=/* @__PURE__ */k(N,{children:[
4
+ /* @__PURE__ */x(i,{value:ee??"",onChange:e=>ie?.(e),label:ae??te.focus,image:w,hint:null,id:ve,disabled:Ne,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):je?/* @__PURE__ */x("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Fe||void 0,className:"h-full w-full",style:{objectFit:S}}):/* @__PURE__ */x("img",{src:w??void 0,alt:Fe,className:"h-full w-full",style:{objectFit:S,objectPosition:ee||void 0}}),V&&!re&&w&&/* @__PURE__ */x(n,{children:Fe}),Pe,pe&&/* @__PURE__ */x(s,{label:be,progress:Q,rounded:re?"rounded-full":"rounded-md"})]}),He=/* @__PURE__ */k(N,{children:[
5
5
  /* @__PURE__ */x("span",{className:"px-3 text-xs text-ink-faint",children:we}),
6
6
  /* @__PURE__ */x("span",{className:"text-sm font-medium text-blue-600",children:ne}),I&&/* @__PURE__ */x("span",{className:"text-xs text-ink-faintest",children:I})]}),Se=/* @__PURE__ */k("button",{type:"button",id:ve,onClick:()=>$e(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:$?`${ve}-hint`:void 0,...Ce.zoneProps,"data-media-circle":"",className:["group/zone flex w-full items-center gap-4 rounded-lg text-left",Ne?"cursor-not-allowed opacity-60":"cursor-pointer",c(Ne)].join(" "),children:[
7
7
  /* @__PURE__ */x("span",{className:["flex shrink-0 items-center justify-center rounded-full border-2 border-dashed text-ink-faintest transition-colors",Ue?"border-accent-fill bg-accent-tint":"border-line-strong bg-surface-sunken group-hover/zone:bg-accent-tint"].join(" "),style:{height:oe,width:oe},children:/* @__PURE__ */x(l,{})}),
8
8
  /* @__PURE__ */x("span",{className:"flex min-w-0 flex-col items-start gap-1 [&>span]:px-0",children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:Q}):He})]}),Be=re?Se:/* @__PURE__ */x("button",{type:"button",id:ve,onClick:()=>$e(),disabled:Ne,"aria-label":"string"==typeof we?we:te.upload,"aria-busy":pe||void 0,"aria-invalid":!!fe||void 0,"aria-required":z||void 0,"aria-describedby":fe?`${ve}-error`:$?`${ve}-hint`:void 0,...Ce.zoneProps,className:d(Ue,Ne,c(Ne)),style:{minHeight:oe},children:pe?/* @__PURE__ */x(u,{state:"busy",verb:be,pct:Q}):/* @__PURE__ */k(N,{children:[
9
9
  /* @__PURE__ */x("span",{className:"text-ink-faintest",children:/* @__PURE__ */x(l,{})}),He]})});/* @__PURE__ */
10
- return k(i,{label:U,htmlFor:ve,hint:$,error:fe,required:z,className:P,children:[Z&&/* @__PURE__ */x("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */x(a,{value:se,onChange:e=>Z(e),options:[{value:"image",label:te.image,icon:/* @__PURE__ */x(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne},{value:"video",label:te.video,icon:/* @__PURE__ */x(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne}],block:!0,size:"md",label:"string"==typeof U&&U?U:te.upload})}),w?Oe:Be,!R&&/* @__PURE__ */x("input",{...Ce.inputProps}),
10
+ return k(e,{label:U,htmlFor:ve,hint:$,error:fe,required:z,className:P,children:[Z&&/* @__PURE__ */x("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */x(a,{value:se,onChange:e=>Z(e),options:[{value:"image",label:te.image,icon:/* @__PURE__ */x(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne},{value:"video",label:te.video,icon:/* @__PURE__ */x(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:Ne}],block:!0,size:"md",label:"string"==typeof U&&U?U:te.upload})}),w?Oe:Be,!R&&/* @__PURE__ */x("input",{...Ce.inputProps}),
11
11
  /* @__PURE__ */x(h,{rejections:Ce.rejections})]})}export{w as MediaUploadField};
@@ -1,2 +1,2 @@
1
- import{InputNumber_default as a,stepRounding as e}from"./chunk-FKMARSJZ.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
1
+ import{InputNumber_default as a,stepRounding as e}from"./chunk-BNI3N4TT.js";import{Icon as r}from"./chunk-ISVODSRP.js";import{jsxs as n,jsx as i}from"react/jsx-runtime";var l="h-3.5 w-3.5",s={x:/* @__PURE__ */i(r,{name:"nudge-x","aria-hidden":"true",className:l}),y:/* @__PURE__ */i(r,{name:"nudge-y","aria-hidden":"true",className:l})};function m({label:r,value:l,onChange:m,words:t,placeholder:d,min:o=-200,max:c=200,step:u=1,readOnly:p,units:h}){const x=r=>/* @__PURE__ */i("div",{"data-axis":r,className:"min-w-0",children:/* @__PURE__ */i(a,{value:l[r],onChange:a=>m({...l,[r]:a}),min:o,max:c,step:u,...e(u),steppers:"compact",readOnly:p,placeholder:d[r],prefix:s[r],suffix:t.unit,units:h,"aria-label":t[r]})});/* @__PURE__ */
2
2
  return n("div",{role:"group","aria-label":r,className:"grid min-w-0 grid-cols-2 gap-2",children:[x("x"),x("y")]})}export{m as PositionInput};
@@ -1,20 +1,20 @@
1
- import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-6OGX7V7L.js";import{MarqueeBox as r}from"./chunk-IC72MGON.js";import{ImageLightbox as a}from"./chunk-FXSGIT53.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-LQCNIQ3I.js";import{EmptyState as o}from"./chunk-VXSYHTBP.js";import{Breadcrumbs as d}from"./chunk-OZ4R6U2M.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-L2WBCXG7.js";import{useMediaMoveItems as p}from"./chunk-ZCGT5YNR.js";import{MediaUsedInList as h}from"./chunk-FFRJ6QZK.js";import{RenameField as f}from"./chunk-Q4MOT7TY.js";import{NativeSelect as g}from"./chunk-GEITUFYK.js";import{MediaUploadGrid as v}from"./chunk-TPKNHQIE.js";import{Segmented as k}from"./chunk-TNALBYLY.js";import{copyToClipboard as y}from"./chunk-UFX7F3KG.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as N}from"./chunk-VKZC3NPM.js";import{Banner as x}from"./chunk-XWJT6TFU.js";import{Input_default as C}from"./chunk-3SIRRK3F.js";import{DropdownMenu as I}from"./chunk-EX3DARI3.js";import{IconButton_default as D}from"./chunk-NWS5G7FE.js";import{useFileIntake as S,FileIntakeAlert as T}from"./chunk-VFSAJMNX.js";import{setModalDragAside as F,modalIdHolding as j}from"./chunk-EIFNESXS.js";import{ColoredBadge as z}from"./chunk-WRV6QKJN.js";import{Button_default as L}from"./chunk-UTISUEO4.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-F2RAIGCG.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as A}from"./chunk-MAFUXCPZ.js";import{useShellStrings as R}from"./chunk-IUVGHHR3.js";import{useRef as M,useMemo as U,useCallback as K,useState as G,useEffect as V}from"react";import{jsxs as B,Fragment as X,jsx as Y}from"react/jsx-runtime";var H="application/x-efficient-media-files",J="application/x-efficient-media-folder",Q="application/x-efficient-media-file";function W(e){if(!e||!Array.from(e.types).includes(Q))return null;try{const n=JSON.parse(e.getData(Q));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 $={type:"all",use:"any",sort:"newest"},Z={lock:/* @__PURE__ */Y(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */Y(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */Y(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */Y(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */Y(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */Y(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */Y(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */Y(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */Y(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */Y(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */Y(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */Y(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */Y(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */Y(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */Y(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */Y(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */Y(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */Y(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */Y(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */Y(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:W="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,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:Ne,onNewFolder:xe,onRename:Ce,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:Te,onDeleteForever:Fe,onEmptyTrash:je,onReplace:ze,onCropEdit:Le,onOpenInDesign:Oe,onChoose:Ee,onCancel:Pe,pickNote:Ae,onDragOut:Re,className:Me=""}=O,Ue=R().mediaLibrary,Ke=R().media,Ge="pick"===W,Ve=!Ge,Be=M(null),Xe=A(Be,"phone"===_?343:1200),Ye="phone"===_||"auto"===_&&Xe<640,He=U(()=>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]),Je=U(()=>new Map(le.map(e=>[e.id,e])),[le]),Qe=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Je.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Je]),We=K(e=>{const n=[];for(let l=e?Je.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Je.get(l.parentId):void 0);return n},[Je,le.length]),$e=K((e,n)=>We(e).some(e=>e.id===n),[We]),[Ze,qe]=G(()=>/* @__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",...We(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?He.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?He.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=s(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=M(!0);V(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");V(()=>{he&&mn.setSelection(he)},[gn]);const vn=M(gn??""),kn=pn.join("\0");V(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Ge?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=G(null),Nn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Je.get(n.id)?.name:un.get(n.id)?.name)&&Ce?.(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})},Cn=K(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=Je.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:u,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Qe.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},[Qe,Je,tn,$e,on,Ue]),In=K(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=G(null),Tn={words:Ue,media:Ke,denied:ve,moveTargets:Cn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&Ve?e=>{xn(e)}:void 0,rename:Ce&&Ve?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&Ve?Ie:void 0,trash:De&&Ve?De:void 0,deleteFolder:Se&&Ve?Se:void 0,folderNotEmpty:e=>!!Je.get(e)?.notEmpty,replace:ze&&Ve?ze:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Ue.urlLabel,n)},openInDesign:Oe,restore:Te,deleteForever:Fe},Fn=e=>m(e,Tn),jn=w(),zn=(e,n)=>{Ge||(mn.isSelected(e)||mn.select(e),jn.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]=G(null),[En,Pn]=G(null),[An,Rn]=G(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 Mn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Ge)&&(!!Mn(e,H)||!(!Mn(e,J)||!An)&&(n!==An&&!(n&&$e(n,An)))),Kn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Un(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(Un(e,n))if(e.preventDefault(),On(null),Mn(e,H)){let l;try{l=JSON.parse(e.dataTransfer.getData(H))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else An&&(Ie({kind:"folder",id:An},n),Rn(null))}}),Gn=e=>{const n=e=>Mn(e,H)||Mn(e,J)||Mn(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__ */Y(E,{side:"right",content:En===e?Ue.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */Y("span",{children:n})}),Bn=e=>({onContextMenu:n=>{jn.open(n,e)}}),Xn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Ze.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
1
+ import{Tree as e,TreeRow as n,TreeGroup as l}from"./chunk-6OGX7V7L.js";import{MarqueeBox as r}from"./chunk-IC72MGON.js";import{ImageLightbox as a}from"./chunk-FXSGIT53.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-LQCNIQ3I.js";import{EmptyState as o}from"./chunk-VXSYHTBP.js";import{Breadcrumbs as d}from"./chunk-OZ4R6U2M.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-L2WBCXG7.js";import{useMediaMoveItems as u}from"./chunk-ZCGT5YNR.js";import{RenameField as m}from"./chunk-Q4MOT7TY.js";import{NativeSelect as p}from"./chunk-GEITUFYK.js";import{MediaUploadGrid as h}from"./chunk-TPKNHQIE.js";import{MediaUsedInList as f}from"./chunk-FFRJ6QZK.js";import{useGridSelection as g}from"./chunk-VLKDWKVR.js";import{useMarquee as v}from"./chunk-OLFYNMTD.js";import{Segmented as k}from"./chunk-TNALBYLY.js";import{copyToClipboard as y}from"./chunk-UFX7F3KG.js";import{Checkbox_default as b}from"./chunk-CGZBDI6C.js";import{useContextMenu as w,ContextMenu as N}from"./chunk-VKZC3NPM.js";import{Banner as x}from"./chunk-XWJT6TFU.js";import{Input_default as C}from"./chunk-3SIRRK3F.js";import{DropdownMenu as I}from"./chunk-EX3DARI3.js";import{IconButton_default as D}from"./chunk-NWS5G7FE.js";import{useFileIntake as S,FileIntakeAlert as T}from"./chunk-VFSAJMNX.js";import{setModalDragAside as F,modalIdHolding as j}from"./chunk-EIFNESXS.js";import{ColoredBadge as z}from"./chunk-WRV6QKJN.js";import{Button_default as L}from"./chunk-UTISUEO4.js";import{Icon as O}from"./chunk-ISVODSRP.js";import{Tooltip as E}from"./chunk-F2RAIGCG.js";import{buttonClasses as P}from"./chunk-UQYNPYF4.js";import{usePlotWidth as A}from"./chunk-MAFUXCPZ.js";import{useShellStrings as R}from"./chunk-IUVGHHR3.js";import{useRef as M,useMemo as U,useCallback as K,useState as G,useEffect as V}from"react";import{jsxs as B,Fragment as X,jsx as Y}from"react/jsx-runtime";var H="application/x-efficient-media-files",J="application/x-efficient-media-folder",Q="application/x-efficient-media-file";function W(e){if(!e||!Array.from(e.types).includes(Q))return null;try{const n=JSON.parse(e.getData(Q));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 $={type:"all",use:"any",sort:"newest"},Z={lock:/* @__PURE__ */Y(O,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */Y(O,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */Y(O,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */Y(O,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */Y(O,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */Y(O,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */Y(O,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */Y(O,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */Y(O,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */Y(O,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */Y(O,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */Y(O,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */Y(O,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */Y(O,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */Y(O,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */Y(O,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},q={link:/* @__PURE__ */Y(O,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */Y(O,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */Y(O,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */Y(O,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function _(O){const{mode:W="manage",layout:_="auto",location:ee,onLocationChange:ne,folders:le,products:re,allFilesCount:ae,trashCount:ie,files:te,query:oe,onQueryChange:de,filters:se=$,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:Ne,onNewFolder:xe,onRename:Ce,onMove:Ie,onTrash:De,onDeleteFolder:Se,onRestore:Te,onDeleteForever:Fe,onEmptyTrash:je,onReplace:ze,onCropEdit:Le,onOpenInDesign:Oe,onChoose:Ee,onCancel:Pe,pickNote:Ae,onDragOut:Re,className:Me=""}=O,Ue=R().mediaLibrary,Ke=R().media,Ge="pick"===W,Ve=!Ge,Be=M(null),Xe=A(Be,"phone"===_?343:1200),Ye="phone"===_||"auto"===_&&Xe<640,He=U(()=>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]),Je=U(()=>new Map(le.map(e=>[e.id,e])),[le]),Qe=U(()=>{const e=/* @__PURE__ */new Map;for(const n of le){const l=n.parentId&&Je.has(n.parentId)?n.parentId:null;e.set(l,[...e.get(l)??[],n])}return e},[le,Je]),We=K(e=>{const n=[];for(let l=e?Je.get(e):void 0;l&&(n.unshift(l),!(n.length>le.length));l=l.parentId?Je.get(l.parentId):void 0);return n},[Je,le.length]),$e=K((e,n)=>We(e).some(e=>e.id===n),[We]),[Ze,qe]=G(()=>/* @__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",...We(ee.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===ee.place){const e=ee.nodeId?He.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?He.get(ee.nodeId)?.path[0]:void 0,sn=e=>e?.sharedFrom?`${Ue.readOnly} ${Ue.editedAtHq(e.sharedFrom)}`:Ue.readOnly,cn=U(()=>te.map(e=>e.id),[te]),un=U(()=>new Map(te.map(e=>[e.id,e])),[te]),mn=g(cn),pn=U(()=>cn.filter(e=>mn.selected.has(e)),[cn,mn.selected]),hn=1===pn.length?un.get(pn[0]):void 0,fn=M(!0);V(()=>{fn.current?fn.current=!1:mn.clear()},[nn]);const gn=he?.join("\0");V(()=>{he&&mn.setSelection(he)},[gn]);const vn=M(gn??""),kn=pn.join("\0");V(()=>{vn.current!==kn&&(vn.current=kn,fe?.(pn))},[kn]);const yn=(e,n={})=>{Ge?mn.select(e):mn.select(e,{ctrl:!(!n.ctrlKey&&!n.metaKey),shift:!!n.shiftKey})},[bn,wn]=G(null),Nn=e=>{const n=bn;if(wn(null),!n||null==e)return;e!==("folder"===n.kind?Je.get(n.id)?.name:un.get(n.id)?.name)&&Ce?.(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})},Cn=K(e=>{const n=[],l=n=>{if("files"===e.kind)return n===on&&tn?Ue.alreadyHere:void 0;const l=Je.get(e.id);return n===e.id||n&&$e(n,e.id)?Ue.notIntoItself:(l?.parentId??null)===n?Ue.folderAlreadyHere:void 0};n.push({key:s,label:Ue.allFiles,disabledReason:l(null)});const r=(e,a)=>{for(const i of Qe.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},[Qe,Je,tn,$e,on,Ue]),In=K(e=>{const n=new Set(e.map(e=>un.get(e)?.kind??"image"));return 1===n.size?[...n][0]:"file"},[un]),[Dn,Sn]=G(null),Tn={words:Ue,media:Ke,denied:ve,moveTargets:Cn,kindOf:In,urlOf:e=>un.get(e)?.url,newSubfolder:xe&&Ve?e=>{xn(e)}:void 0,rename:Ce&&Ve?e=>{"file"!==e.kind||mn.isSelected(e.id)||mn.select(e.id),wn(e)}:void 0,move:Ie&&Ve?Ie:void 0,trash:De&&Ve?De:void 0,deleteFolder:Se&&Ve?Se:void 0,folderNotEmpty:e=>!!Je.get(e)?.notEmpty,replace:ze&&Ve?ze:void 0,copyUrl:e=>{const n=un.get(e)?.url;n&&y(Ue.urlLabel,n)},openInDesign:Oe,restore:Te,deleteForever:Fe},Fn=e=>c(e,Tn),jn=w(),zn=(e,n)=>{Ge||(mn.isSelected(e)||mn.select(e),jn.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]=G(null),[En,Pn]=G(null),[An,Rn]=G(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 Mn=(e,n)=>Array.from(e.dataTransfer?.types??[]).includes(n),Un=(e,n)=>!(!Ie||ve.move||Ge)&&(!!Mn(e,H)||!(!Mn(e,J)||!An)&&(n!==An&&!(n&&$e(n,An)))),Kn=(e,n)=>({onDragEnter:l=>{Un(l,n)&&(l.preventDefault(),On(e))},onDragOver:l=>{Un(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(Un(e,n))if(e.preventDefault(),On(null),Mn(e,H)){let l;try{l=JSON.parse(e.dataTransfer.getData(H))}catch{l=null}Array.isArray(l)&&l.length&&Ie({kind:"files",ids:l.map(String)},n)}else An&&(Ie({kind:"folder",id:An},n),Rn(null))}}),Gn=e=>{const n=e=>Mn(e,H)||Mn(e,J)||Mn(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__ */Y(E,{side:"right",content:En===e?Ue.noDropProducts:sn(l),open:En===e||!En&&void 0,children:/* @__PURE__ */Y("span",{children:n})}),Bn=e=>({onContextMenu:n=>{jn.open(n,e)}}),Xn=(e,r,a)=>e.map(e=>{const i=`p:${e.id}`,t=a??e,o=Ze.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
2
2
  return B("div",{role:"none",className:"contents",children:[
3
3
  /* @__PURE__ */Y(n,{label:Vn(i,e.name,t),level:r,icon:d&&o?Z.folderOpen:Z.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.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,...Gn(i),...Ve?Bn({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */Y(l,{children:Xn(d,r+1,t)})]},e.id)}),Yn=(e,r)=>(Qe.get(e)??[]).map(e=>{const a=Qe.get(e.id),i=Ze.has(e.id),t="folder"===bn?.kind&&bn.id===e.id,o=Fn({kind:"folder",id:e.id});/* @__PURE__ */
4
4
  return B("div",{role:"none",className:"contents",children:[
5
- /* @__PURE__ */Y(n,{label:e.name,level:r,icon:a&&i?Z.folderOpen:Z.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.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&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */Y(f,{value:e.name,label:Ue.folderName,onDone:Nn}):void 0,actions:Ve&&o.length?/* @__PURE__ */Y(I,{align:"end","aria-label":Ue.folderActions,trigger:Z.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Kn(e.id,e.id),...Ve?Bn({kind:"folder",id:e.id}):{},...Ve&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(J,e.id),Rn(e.id)},onDragEnd:()=>{Rn(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */Y(l,{children:Yn(e.id,r+1)})]},e.id)}),Hn=Ze.has("@files"),Jn=Ze.has("@products"),Qn=/* @__PURE__ */B(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */B(X,{children:[
5
+ /* @__PURE__ */Y(n,{label:e.name,level:r,icon:a&&i?Z.folderOpen:Z.folder,count:e.count,countLabel:null!=e.count?e.countLabel??Ue.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&&!!Ie&&!ve.move,rename:t?/* @__PURE__ */Y(m,{value:e.name,label:Ue.folderName,onDone:Nn}):void 0,actions:Ve&&o.length?/* @__PURE__ */Y(I,{align:"end","aria-label":Ue.folderActions,trigger:Z.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Kn(e.id,e.id),...Ve?Bn({kind:"folder",id:e.id}):{},...Ve&&Ie&&!ve.move?{draggable:!0,onDragStart:n=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData(J,e.id),Rn(e.id)},onDragEnd:()=>{Rn(null),On(null)}}:{}}}),a&&i&&/* @__PURE__ */Y(l,{children:Yn(e.id,r+1)})]},e.id)}),Hn=Ze.has("@files"),Jn=Ze.has("@products"),Qn=/* @__PURE__ */B(e,{"aria-label":Ue.folders,children:[re&&/* @__PURE__ */B(X,{children:[
6
6
  /* @__PURE__ */Y(n,{label:Vn("@products",Ue.products),level:1,icon:Z.lock,badge:{label:Ue.readOnlyBadge,tone:"neutral"},expanded:re.length?Jn:void 0,onToggle:()=>_e("@products"),selected:rn&&null==ee.nodeId,onSelect:()=>ne({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Gn("@products")}}),Jn&&re.length>0&&/* @__PURE__ */Y(l,{children:Xn(re,2)})]}),
7
- /* @__PURE__ */Y(n,{label:Ue.allFiles,level:1,icon:Hn?Z.folderOpen:Z.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:Qe.get(null)?.length?Hn: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)}}),Hn&&(Qe.get(null)?.length??0)>0&&/* @__PURE__ */Y(l,{children:Yn(null,2)}),Ve&&/* @__PURE__ */Y(n,{label:Ue.trash,level:1,icon:Z.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Wn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?He.get(ee.nodeId)?.path??[]:[];return[{label:Ue.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=We(on);return[{label:Ue.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}))]})(),$n=rn?Ue.readOnly:ve.upload,Zn=!!Ne&&!an&&!$n,qn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Zn,onAccept:e=>Ne?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */B("div",{className:"flex flex-wrap items-center gap-2",children:[Ve&&xe&&!an&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Ue.newFolder}),Ne&&!an&&/* @__PURE__ */Y(L,{variant:"primary",size:"sm",leftIcon:Z.upload,onClick:()=>qn.open(),...el($n),children:Ue.upload}),Ve&&an&&je&&te.length>0&&/* @__PURE__ */Y(L,{variant:"danger",size:"sm",onClick:je,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */Y("div",{style:{width:Ye?void 0:a,flex:Ye?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */Y(g,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */B("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */Y("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */Y(C,{size:"sm",type:"search",leftIcon:Z.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&Ve&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */Y(k,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:Z.grid},{value:"list",label:Ue.list,icon:Z.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */Y(z,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=Ve&&tn&&!!Ie&&!ve.move,dl=!!Re&&!an,sl=M(""),cl=M(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=M(Re);ml.current=Re;const pl=K(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),F(sl.current,!1),e&&ml.current?.(e))},[]),hl=K(e=>{pl(ul());const n=Be.current?.ownerDocument;if(!n)return;sl.current=j(Be.current);const l=Be.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&F(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,F(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),Re(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:{[Q]:gl(e)}}:{}})),kl=Ye?Math.max(72,Math.floor((Xe-24-16-1)/3)):112,yl=M(null),bl=c({containerRef:yl,enabled:Ve&&!Ye&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Ge){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Nl=te.length?null:oe?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.trashEmpty}):!Zn||Ge?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.emptyFolder}):null,xl="list"===me&&te.length>0,Cl=Nl??(xl?/* @__PURE__ */Y("ul",{role:"listbox","aria-multiselectable":Ve||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */B("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=>zn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(Q,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__ */Y(n,{label:Ue.allFiles,level:1,icon:Hn?Z.folderOpen:Z.folder,count:ae,countLabel:null!=ae?Ue.fileCount(ae):void 0,expanded:Qe.get(null)?.length?Hn: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)}}),Hn&&(Qe.get(null)?.length??0)>0&&/* @__PURE__ */Y(l,{children:Yn(null,2)}),Ve&&/* @__PURE__ */Y(n,{label:Ue.trash,level:1,icon:Z.trash,count:ie,countLabel:null!=ie?Ue.fileCount(ie):void 0,selected:an,onSelect:()=>ne({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Wn=(()=>{if(an)return[{label:Ue.trash}];if(rn){const e=ee.nodeId?He.get(ee.nodeId)?.path??[]:[];return[{label:Ue.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=We(on);return[{label:Ue.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}))]})(),$n=rn?Ue.readOnly:ve.upload,Zn=!!Ne&&!an&&!$n,qn=S({accept:ke,maxSizeBytes:ye,multiple:!0,disabled:!Zn,onAccept:e=>Ne?.(e,on)}),_n=rn?Ue.noProductFolder:ve.newFolder,el=e=>e?{"aria-disabled":!0,disabledReason:e}:{},nl=/* @__PURE__ */B("div",{className:"flex flex-wrap items-center gap-2",children:[Ve&&xe&&!an&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.folderPlus,onClick:()=>{xn(on)},...el(_n),children:Ue.newFolder}),Ne&&!an&&/* @__PURE__ */Y(L,{variant:"primary",size:"sm",leftIcon:Z.upload,onClick:()=>qn.open(),...el($n),children:Ue.upload}),Ve&&an&&je&&te.length>0&&/* @__PURE__ */Y(L,{variant:"danger",size:"sm",onClick:je,...el(ve.deleteForever),children:Ue.emptyTrash})]}),ll=(e,n,l,r,a)=>/* @__PURE__ */Y("div",{style:{width:Ye?void 0:a,flex:Ye?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */Y(p,{size:"sm","aria-label":e,value:n,onChange:r,options:l})},e),rl=e=>n=>ce?.({...se,[e]:n}),al=/* @__PURE__ */B("div",{className:"flex flex-wrap items-center gap-2",children:[de&&/* @__PURE__ */Y("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */Y(C,{size:"sm",type:"search",leftIcon:Z.search,placeholder:rn?Ue.searchProducts:Ue.search,"aria-label":rn?Ue.searchProducts:Ue.search,value:oe??"",onChange:e=>de(e.target.value)})}),ce&&ll(Ue.mediaType,se.type,[{value:"all",label:Ue.allTypes},{value:"image",label:Ue.images},{value:"video",label:Ue.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],rl("type"),130),ce&&!rn&&!an&&ll(Ue.use,se.use,[{value:"any",label:Ue.anyUse},{value:"email",label:Ue.emailOnly},{value:"website",label:Ue.websiteOnly},{value:"unused",label:Ue.notUsed}],rl("use"),130),ce&&Ve&&ll(Ue.sort,se.sort,[{value:"newest",label:Ue.newest},{value:"name",label:Ue.byName},{value:"size",label:Ue.bySize}],rl("sort"),110),ue?.map(e=>ll(e.label,e.value,e.options,e.onChange,120)),pe&&/* @__PURE__ */Y(k,{size:"sm",label:Ue.view,value:me,onChange:pe,options:[{value:"grid",label:Ue.grid,icon:Z.grid},{value:"list",label:Ue.list,icon:Z.list}]})]}),il=e=>{const n=[];return null!=e.trashedDaysAgo&&n.push({key:"t",label:Ue.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:q.clock,tone:"neutral"}),e.usedCount&&n.push({key:"u",label:Ue.used(e.usedCount),count:e.usedCount,icon:q.link,tone:"active"}),e.email&&n.push({key:"e",label:Ue.email,icon:q.email,tone:"queued"}),e.private&&n.push({key:"p",label:Ue.private,icon:q.lock,tone:"neutral"}),n},tl=e=>il(e).map(e=>/* @__PURE__ */Y(z,{tone:e.tone,size:"xs",children:e.label},e.key)),ol=Ve&&tn&&!!Ie&&!ve.move,dl=!!Re&&!an,sl=M(""),cl=M(null),ul=()=>cl.current?.dropped?"dropped":"cancelled",ml=M(Re);ml.current=Re;const pl=K(e=>{const n=cl.current;n&&(cl.current=null,n.stop(),F(sl.current,!1),e&&ml.current?.(e))},[]),hl=K(e=>{pl(ul());const n=Be.current?.ownerDocument;if(!n)return;sl.current=j(Be.current);const l=Be.current?.closest("[data-modal-panel]"),r=e=>{sl.current&&!l?.contains(e.target)&&F(sl.current,!0)},a=()=>!!e&&!e.isConnected,i=()=>{const e=cl.current;if(e){if(a())return pl("dropped");e.dropped=!0,F(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),Re(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:{[Q]:gl(e)}}:{}})),kl=Ye?Math.max(72,Math.floor((Xe-24-16-1)/3)):112,yl=M(null),bl=v({containerRef:yl,enabled:Ve&&!Ye&&te.length>0,selected:mn.selected,setSelection:e=>mn.setSelection(e),clearSelection:mn.clear}),wl=e=>{if(Ge){const n=un.get(e);return void(!n||n.private||n.pickDisabledReason||Ee?.(n))}const n=cn.indexOf(e);n>=0&&Sn(n)},Nl=te.length?null:oe?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.noMatches}):rn?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.emptyProducts,description:sn(dn)}):an?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.trashEmpty}):!Zn||Ge?/* @__PURE__ */Y(o,{variant:"dashed",title:Ue.emptyFolder}):null,xl="list"===me&&te.length>0,Cl=Nl??(xl?/* @__PURE__ */Y("ul",{role:"listbox","aria-multiselectable":Ve||void 0,"aria-label":Ue.folders,className:"flex flex-col gap-1",children:te.map(e=>/* @__PURE__ */B("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=>zn(e.id,n),draggable:!!gl(e)||void 0,onDragStart:gl(e)?n=>{n.dataTransfer.effectAllowed="link",n.dataTransfer.setData(Q,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__ */Y("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
9
9
  /* @__PURE__ */Y("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
10
- /* @__PURE__ */Y("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */Y("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */Y(v,{items:vl,readOnly:!Zn||Ge,onFiles:Zn&&!Ge?e=>Ne(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?H:dl?Q:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:Ve?zn:void 0,menuOnMedia:Ve})),Il=p({count:pn.length,kind:In(pn),targets:Cn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===u?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */Y(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */B(X,{children:[Z.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),Tl=Ve&&pn.length>1&&!rn?/* @__PURE__ */B("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-line px-3 py-2",children:[
10
+ /* @__PURE__ */Y("span",{className:"flex shrink-0 items-center gap-1",children:tl(e)}),e.sizeLabel&&/* @__PURE__ */Y("span",{className:"w-16 shrink-0 text-right text-xs text-ink-faint",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */Y(h,{items:vl,readOnly:!Zn||Ge,onFiles:Zn&&!Ge?e=>Ne(e,on):void 0,accept:ke,maxSizeBytes:ye,busy:be,progress:we,fit:"contain",thumbSize:kl,dragType:ol?H:dl?Q:void 0,onDragOutChange:dl?(e,n,l)=>fl(e,n,l):void 0,selected:mn.selected,onItemClick:yn,onItemDoubleClick:wl,onItemContextMenu:Ve?zn:void 0,menuOnMedia:Ve})),Il=u({count:pn.length,kind:In(pn),targets:Cn({kind:"files",ids:pn}),onPick:e=>Ie?.({kind:"files",ids:pn},e.key===s?null:e.key)}),Dl=P({variant:"secondary",size:"sm"}),Sl=/* @__PURE__ */Y(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */B(X,{children:[Z.folder,Ue.moveTo]}),items:Il,disabled:!!ve.move}),Tl=Ve&&pn.length>1&&!rn?/* @__PURE__ */B("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__ */Y(b,{checked:pn.length===te.length,indeterminate:pn.length<te.length,onChange:e=>e?mn.selectAll():mn.clear(),label:Ue.selected(pn.length)}),/* @__PURE__ */B(X,an?{children:[Te&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.undo,onClick:()=>Te(pn),...el(ve.restore),children:Ue.restore}),Fe&&/* @__PURE__ */Y(L,{variant:"secondary-danger",size:"sm",onClick:()=>Fe(pn),...el(ve.deleteForever),children:Ue.deleteForever})]}:{children:[Ie&&Sl,Ce&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.edit,disabled:!0,children:Ue.rename}),De&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.trash,onClick:()=>De({kind:"files",ids:pn}),...el(ve.trash),children:Ue.moveFilesToTrash(pn.length)})]}),
12
- /* @__PURE__ */Y(L,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,Fl=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",Ue.name,r?/* @__PURE__ */Y(f,{value:e.name,label:Ue.fileName,onDone:Nn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=m({kind:"files",ids:[e.id]},Tn).find(e=>"submenu"===e.type);/* @__PURE__ */
12
+ /* @__PURE__ */Y(L,{variant:"ghost",size:"sm",onClick:mn.clear,children:Ue.clearSelection})]}):null,Fl=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",Ue.name,r?/* @__PURE__ */Y(m,{value:e.name,label:Ue.fileName,onDone:Nn}):e.name),l("type",Ue.type,e.typeLabel),l("size",Ue.size,e.sizeLabel),l("resolution",Ue.resolution,e.resolution),rn?(l("design",Ue.design,e.design),l("finish",Ue.finish,e.finish),l("angle",Ue.angleLug,e.angleLug),l("owner",Ue.owner,e.owner)):(l("added",Ue.addedBy,e.addedBy),l("folder",Ue.folder,e.folderPath)),l("used",Ue.usedIn,null!=e.usedCount?Ue.places(e.usedCount):void 0);const a=c({kind:"files",ids:[e.id]},Tn).find(e=>"submenu"===e.type);/* @__PURE__ */
13
13
  return B("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
14
14
  /* @__PURE__ */Y("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),rn&&/* @__PURE__ */Y(x,{tone:"neutral",title:Ue.readOnlyBadge,children:sn(dn)}),
15
15
  /* @__PURE__ */Y(i,{size:"sm",columns:1,items:n}),!an&&/* @__PURE__ */B("div",{className:"flex gap-2",children:[
16
16
  /* @__PURE__ */Y("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */Y(C,{size:"sm",readOnly:!0,value:e.url,"aria-label":Ue.fileUrl,onFocus:e=>e.currentTarget.select()})}),
17
- /* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.copy,onClick:()=>Tn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&Ve&&/* @__PURE__ */B("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.swap,onClick:()=>ze(e.id),...el(ve.replace),children:Ue.replace}),Le&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.crop,onClick:()=>Le(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */Y(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */B(X,{children:[Z.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ce&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */Y(D,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:Z.trash})]}),an&&Ve&&/* @__PURE__ */B("div",{className:"flex flex-wrap gap-2",children:[Te&&/* @__PURE__ */Y(L,{variant:"primary",size:"sm",leftIcon:Z.undo,onClick:()=>Te([e.id]),...el(ve.restore),children:Ue.restore}),Fe&&/* @__PURE__ */Y(L,{variant:"danger",size:"sm",onClick:()=>Fe([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Oe&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */Y(h,{items:ge})]})},jl=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,zl=Ge?/* @__PURE__ */B("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__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.copy,onClick:()=>Tn.copyUrl(e.id),children:Ue.copyUrl})]}),tn&&Ve&&/* @__PURE__ */B("div",{className:"flex flex-wrap gap-2",children:[ze&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.swap,onClick:()=>ze(e.id),...el(ve.replace),children:Ue.replace}),Le&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.crop,onClick:()=>Le(e.id),children:Ue.cropEdit}),Ie&&"submenu"===a?.type&&/* @__PURE__ */Y(I,{align:"start",triggerClassName:Dl,trigger:/* @__PURE__ */B(X,{children:[Z.folder,Ue.moveTo]}),items:a.items,disabled:!!ve.move}),Ce&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.edit,onClick:()=>wn({kind:"file",id:e.id}),...el(ve.rename),children:Ue.rename}),De&&/* @__PURE__ */Y(D,{"aria-label":Ue.moveToTrash,size:"sm",onClick:()=>De({kind:"files",ids:[e.id]}),disabledReason:ve.trash,"aria-disabled":!!ve.trash||void 0,children:Z.trash})]}),an&&Ve&&/* @__PURE__ */B("div",{className:"flex flex-wrap gap-2",children:[Te&&/* @__PURE__ */Y(L,{variant:"primary",size:"sm",leftIcon:Z.undo,onClick:()=>Te([e.id]),...el(ve.restore),children:Ue.restore}),Fe&&/* @__PURE__ */Y(L,{variant:"danger",size:"sm",onClick:()=>Fe([e.id]),...el(ve.deleteForever),children:Ue.deleteForever})]}),rn&&Oe&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",leftIcon:Z.external,onClick:()=>Oe({kind:"render",id:e.id}),children:Ue.openInDesign}),ge&&/* @__PURE__ */Y(f,{items:ge})]})},jl=hn?hn.private?Ue.privateNoPick:hn.pickDisabledReason:void 0,zl=Ge?/* @__PURE__ */B("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__ */Y("span",{className:"min-w-0 truncate text-sm text-ink-faint",children:hn?Ue.oneChosen(hn.name):Ue.noneChosen}),
19
19
  /* @__PURE__ */B("div",{className:"flex gap-2",children:[Pe&&/* @__PURE__ */Y(L,{variant:"secondary",size:"sm",onClick:Pe,children:Ue.cancel}),
20
20
  /* @__PURE__ */Y(L,{variant:"primary",size:"sm",disabled:!hn,...el(jl),onClick:()=>{hn&&!jl&&Ee?.(hn)},children:Ue.chooseImage})]})]}):null,Ll=Ve&&!!hn,Ol=/* @__PURE__ */B("div",{className:"flex min-w-0 flex-col gap-3",children:[Ae&&/* @__PURE__ */Y(x,{tone:"neutral",children:Ae}),
@@ -0,0 +1,5 @@
1
+ import{WidestLabel as e}from"./chunk-2WBKQOLF.js";import{DropdownMenu as n,TRIGGER_CLASS as o}from"./chunk-EX3DARI3.js";import{Tooltip as i}from"./chunk-F2RAIGCG.js";import{jsx as r}from"react/jsx-runtime";function t(e,n,o){if(n&&!(n.options.length<2))/* @__PURE__ */
2
+ return r(l,{value:e,options:n.options,onChange:n.onChange,label:n.label,disabled:o})}var a=`${o} -ml-1 h-6 px-1 text-xs`;function l({value:o,options:t,onChange:l,label:s,disabled:m}){
3
+ /* @__PURE__ */
4
+ return r(i,{content:s,describe:!1,children:/* @__PURE__ */r(n,{trigger:
5
+ /* @__PURE__ */r(e,{labels:t,shown:o,align:"end"}),"aria-label":`${s}: ${o}`,align:"end",minWidth:0,disabled:m,triggerClassName:a,items:t.map(e=>({type:"radio",key:e,label:e,checked:e===o,mark:"colour",onSelect:()=>{e!==o&&l(e)}}))})})}export{l as UnitMenu,t as unitBox};
@@ -0,0 +1,69 @@
1
+ import{fitBoxScale as e}from"./chunk-M6UKCZHT.js";import{toast_default as t}from"./chunk-VQ35LXDC.js";import{useShellStrings as r}from"./chunk-IUVGHHR3.js";import{forwardRef as n,useRef as o,useState as i,useMemo as a,useEffect as l,useImperativeHandle as s}from"react";import{jsx as c,jsxs as d,Fragment as h}from"react/jsx-runtime";var u=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],p=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],y=()=>Math.random().toString(36).slice(2,9),x=n(function({src:n,filename:x,onApply:g,onCancel:w},N){const z=o(null),D=o(null),P=o(null),$=o(null),E=r().annotator,I=o(E);I.current=E;const[S,W]=i("select"),[B,R]=i(u[0]),[j,H]=i(4),[T,U]=i(24),[F,A]=i(p[0].id),[O,K]=i(!0),[V,Z]=i(!1),[X,G]=i(!1),[q,Y]=i(null),[_,Q]=i(null),[J,ee]=i(6),[te,re]=i(12),[ne,oe]=i([]),[ie,ae]=i(null),[le,se]=i(null),[ce,de]=i(null),[he,ue]=i(1),[pe,ye]=i(null),[xe,me]=i(null),[ge,we]=i(null),fe=o(null),[ve,be]=i(!1),ke=a(()=>ce?{w:ce.w*he,h:ce.h*he}:null,[ce,he]),Me=ke&&le?ke.w/le.w:1,Ce=a(()=>ne.find(e=>e.id===ie)??null,[ne,ie]);l(()=>{"select"===S&&Ce&&("color"in Ce&&R(Ce.color),"stroke"in Ce&&H(Ce.stroke),"rect"===Ce.type&&re(Ce.radius),"text"===Ce.type&&(U(Ce.size),A(Ce.font),K(Ce.bold),Z(Ce.italic),G(Ce.underline),Y(Ce.borderColor),Q(Ce.background),ee(Ce.padding)))},[ie]),l(()=>{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{$.current=e,se({w:e.naturalWidth,h:e.naturalHeight}),oe([]),ae(null)},e.onerror=()=>t.error(I.current.loadFailed),e.src=n},[n]),l(()=>{if(!le)return;const t=()=>{const t=z.current;if(!t)return;const r=t.getBoundingClientRect(),n=Math.max(0,r.width-32),o=Math.max(0,r.height-32);if(0===n||0===o)return;const i=e({width:n,height:o},{width:le.w,height:le.h},1);de({w:le.w*i,h:le.h*i})};t();const r=new ResizeObserver(t);return z.current&&r.observe(z.current),()=>r.disconnect()},[le]);const Ne=a(()=>ne.filter(e=>"mosaic"===e.type),[ne]);l(()=>{const e=$.current,t=D.current;if(!e||!t||!le)return;t.width=le.w,t.height=le.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of Ne)L(r,e)},[le,Ne,ce]);const Le=e=>{const t=P.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},ze=e=>{fe.current=e,be(!0)};l(()=>{if(!ve)return;const e=e=>{const t=fe.current;if(!t)return;const r=Le(e);if("draw"===t.kind)ye(b(S,t.start,r,B,j,te));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),ye({id:"",type:"draw",points:t.points.slice(),color:B,stroke:j}))}else if("crop"===t.kind)we(C(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;oe(r=>r.map(r=>r.id===t.id?k(t.original,e,n):r))}else"resize"===t.kind&&oe(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=C({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=fe.current;if(fe.current=null,be(!1),"draw"===e?.kind)ye(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:y()};return oe(e=>[...e,r]),ae(r.id),W("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void ye(null);const t={id:y(),type:"draw",points:e.points,color:B,stroke:j};oe(e=>[...e,t]),ae(t.id),W("select"),ye(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[ve,S,B,j,te]);l(()=>{const e=e=>{if(!document.activeElement||!/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName))return!e.metaKey&&!e.ctrlKey||"z"!==e.key&&"Z"!==e.key||e.shiftKey?void(ie&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),oe(e=>e.filter(e=>e.id!==ie)),ae(null)):"Escape"===e.key&&ae(null))):(e.preventDefault(),oe(e=>e.slice(0,-1)),void ae(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ie]);const De=e=>{const t=!{bold:O,italic:V,underline:X}[e];"bold"===e&&K(t),"italic"===e&&Z(t),"underline"===e&&G(t),ie&&oe(r=>r.map(r=>r.id===ie&&"text"===r.type?{...r,[e]:t}:r))},Pe=e=>{Y(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,borderColor:e}:t))},$e=e=>{Q(e),ie&&oe(t=>t.map(t=>t.id===ie&&"text"===t.type?{...t,background:e}:t))},Ee=e=>{if(!xe)return;const t=e??xe.value;if(!t.trim())return xe.editingId&&oe(e=>e.filter(e=>e.id!==xe.editingId)),void me(null);if(xe.editingId)oe(e=>e.map(e=>e.id===xe.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:y(),type:"text",x:xe.x,y:xe.y,text:t,color:B,size:T,font:F,bold:O,italic:V,underline:X,borderColor:q,background:_,padding:J};oe(t=>[...t,e]),ae(e.id),W("select")}me(null)},Ie=async()=>{const e=D.current,t=P.current;if(!e||!t||!le)return null;const r=document.createElement("canvas");r.width=le.w,r.height=le.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,le.w,le.h),URL.revokeObjectURL(l),r};s(N,()=>({save:async()=>{const e=await Ie();e&&e.toBlob(e=>{if(!e)return void t.error(I.current.exportFailed);const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r;const o=x.replace(/\.[^.]+$/,"");n.download=`${o}-annotated.png`,n.click(),URL.revokeObjectURL(r)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void t.error(I.current.clipboardUnsupported);const e=await Ie();e&&e.toBlob(async e=>{if(e)try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),t.success(I.current.copied)}catch{t.error(I.current.copyRefused)}else t.error(I.current.copyFailed)},"image/png")}}),[le,x]);const Se=a(()=>[{id:"select",label:E.toolSelect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:E.toolDraw,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:E.toolRect,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:E.toolEllipse,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:E.toolArrow,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:E.toolMosaic,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:E.toolText,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:E.toolCrop,icon:/* @__PURE__ */c("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */c("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[E]),We=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),Be=Ce?.type??("select"===S?null:S),Re="rect"===Be||"circle"===Be||"arrow"===Be||"draw"===Be,je="rect"===Be,He="text"===Be;/* @__PURE__ */
2
+ return d("div",{className:"flex flex-col h-full bg-gray-100",children:[
3
+ /* @__PURE__ */d("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Se.map(e=>/* @__PURE__ */c("button",{onClick:()=>{W(e.id),ae(null)},title:e.label,className:We(S===e.id),children:e.icon},e.id)),
4
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
5
+ /* @__PURE__ */c("div",{className:"flex items-center gap-1",children:u.map(e=>/* @__PURE__ */c("button",{onClick:()=>(e=>{R(e),ie&&oe(t=>t.map(t=>t.id!==ie||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(B===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Re&&/* @__PURE__ */d(h,{children:[
6
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
7
+ /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
8
+ /* @__PURE__ */c("span",{children:E.weight}),
9
+ /* @__PURE__ */c("input",{type:"range",min:1,max:20,step:1,value:j,onChange:e=>{return t=Number(e.target.value),H(t),void(ie&&oe(e=>e.map(e=>e.id!==ie?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
10
+ /* @__PURE__ */c("span",{className:"tabular-nums w-5 text-right",children:j})]})]}),je&&/* @__PURE__ */d(h,{children:[
11
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
12
+ /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
13
+ /* @__PURE__ */c("span",{children:E.radius}),
14
+ /* @__PURE__ */c("input",{type:"range",min:0,max:48,step:1,value:te,onChange:e=>{return t=Number(e.target.value),re(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
15
+ /* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:te})]})]}),He&&/* @__PURE__ */d(h,{children:[
16
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
17
+ /* @__PURE__ */c("select",{value:F,onChange:e=>{return t=e.target.value,A(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:p.map(e=>/* @__PURE__ */c("option",{value:e.id,children:E[e.name]},e.id))}),
18
+ /* @__PURE__ */c("button",{onClick:()=>De("bold"),className:We(O),title:E.bold,children:/* @__PURE__ */c("span",{className:"font-bold",children:E.boldLetter})}),
19
+ /* @__PURE__ */c("button",{onClick:()=>De("italic"),className:We(V),title:E.italic,children:/* @__PURE__ */c("span",{className:"italic",children:E.italicLetter})}),
20
+ /* @__PURE__ */c("button",{onClick:()=>De("underline"),className:We(X),title:E.underline,children:/* @__PURE__ */c("span",{className:"underline",children:E.underlineLetter})}),
21
+ /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
22
+ /* @__PURE__ */c("span",{children:E.size}),
23
+ /* @__PURE__ */c("input",{type:"range",min:10,max:96,step:1,value:T,onChange:e=>{return t=Number(e.target.value),U(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
24
+ /* @__PURE__ */c("span",{className:"tabular-nums w-7 text-right",children:T})]}),
25
+ /* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
26
+ /* @__PURE__ */c("span",{children:E.border}),q?/* @__PURE__ */d(h,{children:[
27
+ /* @__PURE__ */c("input",{type:"color",value:q,onChange:e=>Pe(e.target.value),title:E.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
28
+ /* @__PURE__ */c("button",{onClick:()=>Pe(null),title:E.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>Pe(B),title:E.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
29
+ /* @__PURE__ */d("label",{className:"flex items-center gap-1 text-gray-600",children:[
30
+ /* @__PURE__ */c("span",{children:E.fill}),_?/* @__PURE__ */d(h,{children:[
31
+ /* @__PURE__ */c("input",{type:"color",value:_,onChange:e=>$e(e.target.value),title:E.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
32
+ /* @__PURE__ */c("button",{onClick:()=>$e(null),title:E.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */c("button",{onClick:()=>$e("#ffffff"),title:E.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:E.add})]}),
33
+ /* @__PURE__ */d("label",{className:"flex items-center gap-2 text-gray-600",children:[
34
+ /* @__PURE__ */c("span",{children:E.padding}),
35
+ /* @__PURE__ */c("input",{type:"range",min:0,max:40,step:1,value:J,onChange:e=>{return t=Number(e.target.value),ee(t),void(ie&&oe(e=>e.map(e=>e.id===ie&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
36
+ /* @__PURE__ */c("span",{className:"tabular-nums w-6 text-right",children:J})]})]}),
37
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
38
+ /* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomOut,children:"−"}),
39
+ /* @__PURE__ */d("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*he),"%"]}),
40
+ /* @__PURE__ */c("button",{onClick:()=>ue(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.zoomIn,children:"+"}),
41
+ /* @__PURE__ */c("button",{onClick:()=>ue(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:E.fitHint,children:E.fit}),
42
+ /* @__PURE__ */c("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
43
+ /* @__PURE__ */c("button",{onClick:()=>{oe(e=>e.slice(0,-1)),ae(null)},disabled:0===ne.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:E.undo}),
44
+ /* @__PURE__ */d("div",{className:"ml-auto flex items-center gap-2",children:[ge&&/* @__PURE__ */d(h,{children:[
45
+ /* @__PURE__ */c("button",{onClick:()=>{if(!ge||!$.current||!le)return;const e=ge,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=le.w,n.height=le.h;const o=n.getContext("2d");o.drawImage($.current,0,0);for(const e of Ne)L(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{$.current=i,se({w:i.naturalWidth,h:i.naturalHeight}),oe(t=>t.filter(e=>"mosaic"!==e.type).map(t=>k(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=M(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),we(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:E.applyCrop}),
46
+ /* @__PURE__ */c("button",{onClick:()=>we(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:E.cancel})]}),g&&!ge&&/* @__PURE__ */d(h,{children:[w&&/* @__PURE__ */c("button",{onClick:w,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:E.cancel}),
47
+ /* @__PURE__ */c("button",{onClick:async()=>{const e=await Ie();e?e.toBlob(e=>{e?g(e):t.error(I.current.exportFailed)},"image/png"):t.error(I.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:E.apply})]})]})]}),
48
+ /* @__PURE__ */c("div",{ref:z,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:ke&&le&&/* @__PURE__ */d("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:ke.w,height:ke.h},children:[
49
+ /* @__PURE__ */c("canvas",{ref:D,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
50
+ /* @__PURE__ */d("svg",{ref:P,viewBox:`0 0 ${le.w} ${le.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===S?"default":"text"===S?"text":"crosshair"},onPointerDown:e=>{if("select"===S)return void ae(null);if("text"===S){if(xe)return void Ee();const t=Le(e);return void me({x:t.x,y:t.y,value:""})}const t=Le(e);if("crop"!==S){if("draw"===S)return ze({kind:"pen",points:[t]}),void ye({id:"",type:"draw",points:[t],color:B,stroke:j});ye(b(S,t,t,B,j,te)),ze({kind:"draw",start:t})}else ze({kind:"crop",start:t})},children:[ne.map(e=>/* @__PURE__ */c(m,{anno:e,selected:ie===e.id,zoom:he,onPointerDown:t=>((e,t)=>{"select"===S&&(e.stopPropagation(),ae(t.id),ze({kind:"move",id:t.id,start:Le(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&me({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),ze({kind:"resize",id:t.id,corner:r,start:Le(e),original:t})})(t,e,r)},e.id)),pe&&/* @__PURE__ */c(m,{anno:{...pe,id:"__preview"},preview:!0}),ge&&/* @__PURE__ */c(f,{rect:ge,imageSize:le})]}),xe&&/* @__PURE__ */c(v,{pendingText:xe,color:B,size:T,font:p.find(e=>e.id===F)?.css??p[0].css,bold:O,italic:V,underline:X,borderColor:q,background:_,padding:J,scale:Me,onChange:e=>me({...xe,value:e}),onCommit:Ee,onCancel:()=>me(null)})]})}),
51
+ /* @__PURE__ */c("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===S?ie?E.hintSelected:E.hintSelect:"text"===S?E.hintText:"crop"===S?E.hintCrop:"draw"===S?E.hintDraw:E.hintShape})]})});function m({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=M(e),s=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},u=i?{onDoubleClick:i}:{};let y;if("rect"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("circle"===e.type)y=/* @__PURE__ */c("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...s});else if("arrow"===e.type)y=/* @__PURE__ */c(w,{anno:e,interactive:s});else if("draw"===e.type)y=/* @__PURE__ */c("path",{d:N(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("mosaic"===e.type)y=/* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...s,style:t?{...s.style,stroke:"var(--rosh-annotator-selection)"}:s.style});else{const t=p.find(t=>t.id===e.font)?.css??p[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=M(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;y=/* @__PURE__ */d("g",{...s,...u,children:[n&&/* @__PURE__ */c("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
52
+ /* @__PURE__ */c("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */c("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
53
+ return d("g",{children:[y,t&&!r&&/* @__PURE__ */d(h,{children:[
54
+ /* @__PURE__ */c("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */c(g,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function g({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
55
+ return d(h,{children:[
56
+ /* @__PURE__ */c("circle",{cx:e.x1,cy:e.y1,r:n,...i("grab"),onPointerDown:e=>r(e,"start")}),
57
+ /* @__PURE__ */c("circle",{cx:e.x2,cy:e.y2,r:n,...i("grab"),onPointerDown:e=>r(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,s=e.w,u=e.h;/* @__PURE__ */
58
+ return d(h,{children:[
59
+ /* @__PURE__ */c("circle",{cx:a,cy:l,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"nw")}),
60
+ /* @__PURE__ */c("circle",{cx:a+s,cy:l,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"ne")}),
61
+ /* @__PURE__ */c("circle",{cx:a+s,cy:l+u,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"se")}),
62
+ /* @__PURE__ */c("circle",{cx:a,cy:l+u,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"sw")})]})}function w({anno:e,interactive:t}){const r=Math.max(12,4*e.stroke),n=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=n+Math.PI-Math.PI/7,i=n+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+r*Math.cos(o)},${e.y2+r*Math.sin(o)} L${e.x2+r*Math.cos(i)},${e.y2+r*Math.sin(i)} Z`;/* @__PURE__ */
63
+ return d("g",{...t,children:[
64
+ /* @__PURE__ */c("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
65
+ /* @__PURE__ */c("path",{d:a,fill:e.color})]})}function f({rect:e,imageSize:t}){/* @__PURE__ */
66
+ return d("g",{pointerEvents:"none",children:[
67
+ /* @__PURE__ */c("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
68
+ /* @__PURE__ */c("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function v({pendingText:e,color:t,size:n,font:i,bold:a,italic:s,underline:d,borderColor:h,background:u,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=o(null),f=r().annotator;l(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const v=()=>m(w.current?.value),b=h?Math.max(1,Math.round(n/12)):0;/* @__PURE__ */
69
+ return c("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */c("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:v,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),v())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:n*y+"px",fontFamily:i,fontWeight:a?700:400,fontStyle:s?"italic":"normal",textDecoration:d?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:h?`${b*y}px solid ${h}`:"1px dashed var(--rosh-annotator-edit-hint)",background:u??"var(--rosh-annotator-edit-surface)"}})})}function b(e,t,r,n,o,i){if("rect"===e){const e=C(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=C(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=C(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function k(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function M(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function C(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function N(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function L(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{x as ImageAnnotator_default};