efficient-shell 8.30.0 → 8.31.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 (100) hide show
  1. package/dist/{Browser-5DL5WHEM.js → Browser-CFASYHEO.js} +13 -13
  2. package/dist/Calculator-4JDJKSA7.js +29 -0
  3. package/dist/{CurrencyConverter-XBC732QI.js → CurrencyConverter-S7LG5PMX.js} +6 -6
  4. package/dist/{Documents-7MFHD73Z.js → Documents-OHA5LY2W.js} +7 -7
  5. package/dist/{Files-4DKRC3S2.js → Files-7QHP4BLV.js} +34 -34
  6. package/dist/{Notepad-BCK4LMG2.js → Notepad-63WDR4UZ.js} +9 -9
  7. package/dist/{PomodoroTimer-KH4PYCYQ.js → PomodoroTimer-ZR2VLO6G.js} +32 -32
  8. package/dist/{Preview-FP6XMPQR.js → Preview-GC4TXEJ5.js} +22 -22
  9. package/dist/{Sidebar-3HM646LN.js → Sidebar-YB4OVUG5.js} +34 -34
  10. package/dist/{Spreadsheet-FSDGQCKT.js → Spreadsheet-XWQZBPUS.js} +12 -12
  11. package/dist/{Stock-M4EEWA57.js → Stock-VNFYS73L.js} +7 -7
  12. package/dist/{Weather-WLAS7FBY.js → Weather-DS4YZ6SH.js} +17 -17
  13. package/dist/{WorldClock-WRD7DV2S.js → WorldClock-7S4TITSF.js} +6 -6
  14. package/dist/ai/index.d.ts +7 -1
  15. package/dist/ai/index.js +37 -37
  16. package/dist/apps/index.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/chunk-2NRQJ3SC.js +1 -0
  20. package/dist/chunk-37JDUDCO.js +22 -0
  21. package/dist/{chunk-VEO34YZK.js → chunk-3EEA6MWV.js} +1 -1
  22. package/dist/chunk-3JJFBUK6.js +3 -0
  23. package/dist/{chunk-Z37R2OCE.js → chunk-4AAGZQX7.js} +1 -1
  24. package/dist/{chunk-REOSJZED.js → chunk-74TPCYHX.js} +15 -15
  25. package/dist/{chunk-WSODT2L5.js → chunk-AX7KPMDV.js} +2 -2
  26. package/dist/{chunk-53ROHXAV.js → chunk-B55IXYDR.js} +2 -2
  27. package/dist/{chunk-I62MCTYI.js → chunk-DCUBOLIR.js} +3 -3
  28. package/dist/{chunk-3H74IBFS.js → chunk-F64DN4BV.js} +3 -3
  29. package/dist/{chunk-ETNNJUAX.js → chunk-GWIPZKZJ.js} +3 -3
  30. package/dist/{chunk-MXVJHVVI.js → chunk-JCMP5KMS.js} +5 -5
  31. package/dist/{chunk-Q4TGK2K6.js → chunk-JOIWDQRJ.js} +4 -4
  32. package/dist/{chunk-E6ZXYTTQ.js → chunk-KNVE7CMS.js} +1 -1
  33. package/dist/{chunk-WPTG7ZC5.js → chunk-L3NYH4QV.js} +32 -32
  34. package/dist/{chunk-GECH6THP.js → chunk-LLLAIPFX.js} +1 -1
  35. package/dist/{chunk-4SQNLU2Q.js → chunk-MTXTJLFK.js} +1 -1
  36. package/dist/{chunk-ZZNOQQWE.js → chunk-NFR4QZL2.js} +4 -4
  37. package/dist/chunk-NT26CWMZ.js +5 -0
  38. package/dist/{chunk-O6JX6RDX.js → chunk-PJCVNFWM.js} +7 -7
  39. package/dist/{chunk-6YH7JKRE.js → chunk-QFA5COE6.js} +2 -2
  40. package/dist/{chunk-2OLSY4GE.js → chunk-QPX35URZ.js} +11 -11
  41. package/dist/{chunk-VP3CMJTT.js → chunk-UX6HNRFV.js} +7 -7
  42. package/dist/chunk-W7S56JZ7.js +7 -0
  43. package/dist/{chunk-OVVXSAGE.js → chunk-X7XJBK2E.js} +4 -4
  44. package/dist/{chunk-6CNFVUT6.js → chunk-XC55NMXR.js} +1 -1
  45. package/dist/{chunk-3IYMTPGR.js → chunk-YGZMD6TZ.js} +12 -12
  46. package/dist/{chunk-3ZRZWOFZ.js → chunk-Z7BZBDOI.js} +3 -3
  47. package/dist/{chunk-M2AIC7IK.js → chunk-ZEKM6HAA.js} +2 -2
  48. package/dist/data/ListLoadError.js +1 -1
  49. package/dist/format/index.js +1 -1
  50. package/dist/forms/BorderInput.js +1 -1
  51. package/dist/forms/BrandAssetEditor.js +1 -1
  52. package/dist/forms/ColorPicker.js +1 -1
  53. package/dist/forms/ComposerAttachments.js +1 -1
  54. package/dist/forms/CornersInput.js +1 -1
  55. package/dist/forms/DisplayChips.js +1 -1
  56. package/dist/forms/IconPicker.js +1 -1
  57. package/dist/forms/InputNumber.js +1 -1
  58. package/dist/forms/LinkPicker.js +1 -1
  59. package/dist/forms/MediaLibrary.js +1 -1
  60. package/dist/forms/MediaUploadField.js +1 -1
  61. package/dist/forms/MediaUsedInList.js +1 -1
  62. package/dist/forms/PositionInput.js +1 -1
  63. package/dist/forms/SidesInput.js +1 -1
  64. package/dist/forms/Slider.js +1 -1
  65. package/dist/forms/Snippet.js +1 -1
  66. package/dist/forms/SplitButton.js +1 -1
  67. package/dist/forms/TextToolbar.js +1 -1
  68. package/dist/forms/WidthsBar.js +1 -1
  69. package/dist/icons/index.js +1 -1
  70. package/dist/index.js +142 -142
  71. package/dist/map/index.js +1 -1
  72. package/dist/page-tabs/index.js +5 -5
  73. package/dist/shell/AppUpdateBanner.js +1 -1
  74. package/dist/shell/ContextMenu.js +1 -1
  75. package/dist/shell/DropdownMenu.js +1 -1
  76. package/dist/shell/HelpCenter.js +1 -1
  77. package/dist/shell/ImageLightbox.js +1 -1
  78. package/dist/shell/LanguageSelect.js +1 -1
  79. package/dist/shell/Markdown.d.ts +9 -2
  80. package/dist/shell/Markdown.js +1 -1
  81. package/dist/shell/PopupMenu.js +1 -1
  82. package/dist/shell/SearchableSelect.js +1 -1
  83. package/dist/shell/SettingReset.js +1 -1
  84. package/dist/shell/SettingRow.js +1 -1
  85. package/dist/shell/TopNav.js +1 -1
  86. package/dist/telemetry/index.js +1 -1
  87. package/dist/templates/ChatTemplate.js +1 -1
  88. package/dist/templates/CheckoutTemplate.js +1 -1
  89. package/dist/templates/DataTablePage.js +1 -1
  90. package/dist/templates/EmailTemplate.js +1 -1
  91. package/dist/templates/FormLayoutPage.js +1 -1
  92. package/dist/ui/index.js +1 -1
  93. package/dist/version.js +1 -1
  94. package/package.json +1 -1
  95. package/dist/Calculator-WW7WTG43.js +0 -29
  96. package/dist/chunk-7FI6NVC7.js +0 -3
  97. package/dist/chunk-DPDA3AJL.js +0 -1
  98. package/dist/chunk-EMXR74QM.js +0 -7
  99. package/dist/chunk-U6BEF6GQ.js +0 -5
  100. package/dist/chunk-V3UIAX5G.js +0 -21
@@ -0,0 +1,22 @@
1
+ import{isSafeLinkHref as e}from"./chunk-PJPK2ADX.js";import{Button_default as t}from"./chunk-4IU5BSVE.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as l,useContext as s}from"react";import{jsx as a,jsxs as c}from"react/jsx-runtime";var o=/!\[([^\]]*)\]\(([^)]+)\)|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*/g,i=l(void 0);function d({href:t,children:r}){const n=s(i),l=(t=>e(t.trim()))(t)?t:void 0;/* @__PURE__ */
2
+ return a("a",{href:l,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline",onClick:l&&n?e=>{(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey))(e)&&n(l)&&e.preventDefault()}:void 0,children:r})}function m(e){const t=[];let r,n=0,l=0;const s=new RegExp(o.source,"g");for(;null!==(r=s.exec(e));)r.index>n&&t.push(e.slice(n,r.index)),void 0!==r[1]?t.push(
3
+ /* @__PURE__ */c("span",{className:"text-gray-400",children:["[",r[1],"]"]},l++)):void 0!==r[3]?t.push(
4
+ /* @__PURE__ */a(d,{href:r[4],children:r[3]},l++)):void 0!==r[5]?t.push(
5
+ /* @__PURE__ */a("strong",{className:"font-semibold text-gray-900",children:m(r[5])},l++)):void 0!==r[6]?t.push(
6
+ /* @__PURE__ */a("code",{className:"rounded bg-gray-200 px-1 py-0.5 font-mono text-[0.85em] text-gray-800",children:r[6]},l++)):void 0!==r[7]&&t.push(/* @__PURE__ */a("em",{children:m(r[7])},l++)),n=s.lastIndex;return n<e.length&&t.push(e.slice(n)),t}function u({alt:e}){const t=e.replace(/^screenshot:\s*/i,""),l=n().markdown;/* @__PURE__ */
7
+ return c("div",{className:"my-1 flex items-start gap-2 rounded-lg border border-dashed border-gray-300 bg-gray-50 px-3 py-3 text-gray-500",children:[
8
+ /* @__PURE__ */a(r,{name:"camera",look:"mini",className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),
9
+ /* @__PURE__ */c("span",{className:"text-xs",children:[
10
+ /* @__PURE__ */a("span",{className:"font-medium text-gray-600",children:`${l.screenshot} — `}),t]})]})}function h(e,t){const r=[];for(const n of e){const e=t.exec(n);e?r.push(e[1]):r.length&&(r[r.length-1]+=" "+n.trim())}return r}var p=e=>e.replace(/^\s*\|/,"").replace(/\|\s*$/,"").split("|").map(e=>e.trim());function g(e){return e.length>=2&&e[0].includes("|")&&/^\s*\|?[\s:|-]*-[\s:|-]*\|?\s*$/.test(e[1])&&e[1].includes("-")}function f(e){return e.replace(o,(e,t,r,n,l,s,a,c)=>t??n??s??a??c??"").trim()}function x({header:e,rows:t}){const r=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e;return[e,...t].map(e=>e.map(r).join(",")).join("\r\n")}function b(e,n,l){const s=p(e[0]),o=e.slice(2).map(p),i=/* @__PURE__ */a("div",{className:"my-1 overflow-x-auto rounded-lg border border-gray-200",children:/* @__PURE__ */c("table",{className:"w-full border-collapse text-sm",children:[
11
+ /* @__PURE__ */a("thead",{children:/* @__PURE__ */a("tr",{className:"bg-gray-50",children:s.map((e,t)=>/* @__PURE__ */a("th",{className:"border-b border-gray-200 px-3 py-2 text-left font-semibold text-gray-700",children:m(e)},t))})}),
12
+ /* @__PURE__ */a("tbody",{children:o.map((e,t)=>/* @__PURE__ */a("tr",{className:"even:bg-gray-50/50",children:e.map((e,t)=>/* @__PURE__ */a("td",{className:"border-t border-gray-100 px-3 h-8 align-top text-gray-700",children:m(e)},t))},t))})]})},n);return l?.length?/* @__PURE__ */c("div",{children:[i,
13
+ /* @__PURE__ */a("div",{className:"flex flex-wrap justify-end gap-1",children:l.map(e=>/* @__PURE__ */a(t,{size:"sm",variant:"secondary",leftIcon:e.icon?/* @__PURE__ */a(r,{name:e.icon,look:"mini",className:"h-4 w-4","aria-hidden":"true"}):void 0,onClick:()=>e.onSelect({header:s.map(f),rows:o.map(e=>e.map(f))}),children:e.label},e.label))})]},n):i}var y=/^( {0,3})(`{3,}|~{3,})[ \t]*(.*?)[ \t]*$/,v=/^[-*]\s+/,N=/^\d+\.\s+/,k=/^#{2,4}\s+/;function $(e){const t=e.split("\n"),r=[];let n=null;for(let e=0;e<t.length;e+=1){const l=t[e];let s=null;k.test(l)?s="heading":"table"!==n&&g(t.slice(e,e+2))?s="table":"bullet"!==n&&v.test(l)?s="bullet":"ordered"!==n&&N.test(l)&&("text"!==n||/^1\./.test(l))?s="ordered":"table"!==n||l.includes("|")?"heading"===n&&(s="text"):s="text",null!==s||null===n?(r.push([l]),n=s??"text"):r[r.length-1].push(l)}return r.map(e=>e.join("\n"))}function j(e){const t=e.replace(/\r\n/g,"\n").split("\n"),r=[];let n=[];const l=()=>{for(const e of n.join("\n").split(/\n{2,}/))for(const t of $(e.replace(/\s+$/,"")))""!==t.trim()&&r.push({text:t});n=[]};for(let e=0;e<t.length;e+=1){const s=y.exec(t[e]);if(!(null!==s&&!("`"===s[2][0]&&s[3].includes("`")))){n.push(t[e]);continue}l();const[,a,c,o]=s,i=[];let d=!1;for(e+=1;e<t.length;e+=1){const r=y.exec(t[e]);if(null!==r&&r[2][0]===c[0]&&r[2].length>=c.length&&""===r[3]){d=!0;break}i.push(a?t[e].replace(new RegExp(`^ {0,${a.length}}`),""):t[e])}r.push({fence:{lang:o.split(/[ \t]/)[0],code:i.join("\n"),closed:d}})}return l(),r}function w(e,t,r){if(r){let n=null;try{n=r(e)}catch{n=null}if(null!=n)/* @__PURE__ */return a("div",{children:n},t)}return function({lang:e,code:t},r){/* @__PURE__ */
14
+ return a("pre",{"data-language":e||void 0,className:"my-1 overflow-x-auto rounded-lg border border-gray-200 bg-gray-50 p-3 font-mono text-xs text-gray-800",children:/* @__PURE__ */a("code",{children:t})},r)}(e,t)}function C({children:e,className:t,renderFence:r,tableActions:n,onLinkClick:l}){/* @__PURE__ */
15
+ return a(i.Provider,{value:l,children:/* @__PURE__ */a("div",{className:`space-y-3 text-sm leading-relaxed text-gray-700 ${t??""}`.trim(),children:j(e??"").map((e,t)=>"fence"in e?w(e.fence,t,r):function(e,t,r){const n=e.split("\n"),l=n[0],s=/^(#{2,4})\s+(.*)$/.exec(l);if(s&&1===n.length){const e=s[1].length;/* @__PURE__ */
16
+ return a(`h${e}`,{className:2===e?"mt-2 text-sm font-semibold uppercase tracking-wide text-gray-500":3===e?"mt-1 text-base font-semibold text-gray-900":"mt-1 text-sm font-semibold text-gray-900",children:m(s[2])},t)}if(1===n.length&&/^---+$/.test(l))/* @__PURE__ */
17
+ return a("hr",{className:"border-gray-200"},t);if(g(n))return b(n,t,r);if(/^>\s?/.test(l)){const e=n.map(e=>e.replace(/^>\s?/,"")).join(" ");/* @__PURE__ */
18
+ return a("div",{className:"my-1 rounded-r-lg border-l-4 border-blue-300 bg-blue-50/60 px-3 py-2 text-gray-700",children:m(e)},t)}const c=/^!\[([^\]]*)\]\(([^)]+)\)$/.exec(l);if(c&&1===n.length)/* @__PURE__ */
19
+ return a(u,{alt:c[1]},t);if(/^[-*]\s+/.test(l)){const e=h(n,/^[-*]\s+(.*)$/);/* @__PURE__ */
20
+ return a("ul",{className:"list-disc space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */a("li",{children:m(e)},t))},t)}const o=/^(\d+)\.\s+/.exec(l);if(o){const e=h(n,/^\d+\.\s+(.*)$/);/* @__PURE__ */
21
+ return a("ol",{start:Number(o[1]),className:"list-decimal space-y-1 pl-5 marker:text-gray-400",children:e.map((e,t)=>/* @__PURE__ */a("li",{className:"pl-1",children:m(e)},t))},t)}/* @__PURE__ */
22
+ return a("p",{children:m(n.join(" "))},t)}(e.text,t,n))})})}export{C as Markdown,f as plainCell,x as tableToCsv};
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-DPDA3AJL.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,D=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,K=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(D,"[redacted]").replace(K,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-2NRQJ3SC.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},R=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],F=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{R(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],N=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,O=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,V=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,W=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&O.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;R(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),F(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,N,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,N,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,N,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(V,"[url]").replace(W,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
@@ -0,0 +1,3 @@
1
+ import{DropdownMenu as e}from"./chunk-W7S56JZ7.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{iconButtonClasses as n}from"./chunk-K7U4RWXJ.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{Tooltip as a}from"./chunk-22S6LG6D.js";import{forwardRef as l,useId as o}from"react";import{jsxs as s,jsx as t}from"react/jsx-runtime";var d="relative focus-visible:z-10",m={secondary:"border-l-0",primary:"border-l border-white/30",warning:"border-l border-white/30"},c=l(function({children:l,onClick:c,type:b="button",items:h,menuLabel:u,variant:f="primary",size:p="md",loading:v=!1,leftIcon:k,disabled:g=!1,disabledReason:N,tooltip:w,menuDisabled:x=!1,menuDisabledReason:j,onMenuOpenChange:y,menuFooter:W,menuFooterLabel:C,align:L="end",side:z="bottom",menuMinWidth:I,linkAs:R,block:B=!1,className:D=""},M){const S=g&&(null!=N&&""!==N&&!1!==N)&&!v,$=x&&null!=j&&""!==j&&!1!==j,A=o(),F=/* @__PURE__ */t(i,{ref:M,type:b,variant:f,size:p,loading:v,leftIcon:k,block:B,disabled:g&&!S,"aria-disabled":!!S||void 0,disabledReason:S?N:void 0,onClick:c,className:`rounded-r-none ${d}`,children:l}),J=B?"relative flex min-w-0 flex-1":"relative inline-flex",K=p.startsWith("touch")?"h-5 w-5":"h-4 w-4";/* @__PURE__ */
2
+ return s("div",{className:[B?"flex w-full":"inline-flex","items-stretch",D].filter(Boolean).join(" "),children:[null==w||""===w||S?F:/* @__PURE__ */t(a,{content:w,className:J,children:F}),
3
+ /* @__PURE__ */t(a,{content:$?j:u,describe:!1,className:"relative inline-flex shrink-0",children:/* @__PURE__ */t(e,{"aria-label":u,"aria-describedby":$?A:void 0,items:h,align:L,side:z,minWidth:I,linkAs:R,disabled:x&&!$,"aria-disabled":$,onOpenChange:y,footer:W,footerLabel:C,triggerClassName:n({variant:f,size:p,className:`rounded-l-none ${m[f]} ${d}`}),trigger:/* @__PURE__ */t(r,{name:"chevron-down",className:K,strokeWidth:2,"aria-hidden":"true"})})}),$&&/* @__PURE__ */t("span",{id:A,className:"sr-only",children:j})]})});export{c as SplitButton_default};
@@ -1,4 +1,4 @@
1
- import{DropdownMenu as e}from"./chunk-EMXR74QM.js";import{Fragment as t}from"react";import{jsxs as a,jsx as r,Fragment as n}from"react/jsx-runtime";var i="relative inline-flex items-center gap-2 px-4 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",s="bg-blue-50 text-blue-600",l="text-gray-600 hover:bg-gray-50 hover:text-gray-900";function c(){/* @__PURE__ */
1
+ import{DropdownMenu as e}from"./chunk-W7S56JZ7.js";import{Fragment as t}from"react";import{jsxs as a,jsx as r,Fragment as n}from"react/jsx-runtime";var i="relative inline-flex items-center gap-2 px-4 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-40",s="bg-blue-50 text-blue-600",l="text-gray-600 hover:bg-gray-50 hover:text-gray-900";function c(){/* @__PURE__ */
2
2
  return r("span",{className:"my-3 w-px shrink-0 bg-gray-200","aria-hidden":!0})}function m({item:e,active:t,caret:i}){/* @__PURE__ */
3
3
  return a(n,{children:[e.icon&&/* @__PURE__ */r("span",{className:"h-4 w-4 shrink-0",children:e.icon}),
4
4
  /* @__PURE__ */r("span",{className:"whitespace-nowrap",children:e.label}),null!=e.badge&&/* @__PURE__ */r("span",{className:"ml-0.5 inline-flex min-w-[1.25rem] items-center justify-center rounded-full bg-gray-100 px-2 text-2xs font-semibold leading-5 text-gray-600",children:e.badge}),i&&/* @__PURE__ */r("span",{className:"-ml-1 text-xs","aria-hidden":!0,children:"▾"}),t&&/* @__PURE__ */r("span",{className:"absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-blue-600","aria-hidden":!0})]})}function d({items:n,activeKey:d,onSelect:o,brand:u,actions:b,linkAs:h,className:g}){/* @__PURE__ */
@@ -1,29 +1,29 @@
1
- import{Tree as e,TreeRow as l,TreeGroup as n}from"./chunk-G433MKIN.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{ImageLightbox as r}from"./chunk-RGBX3EVC.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-YW2DH6YQ.js";import{EmptyState as o}from"./chunk-KDZUWQEG.js";import{Breadcrumbs as d}from"./chunk-WJ3XSJ6B.js";import{ROOT_KEY as s,mediaLibraryMenu as c}from"./chunk-7CFH6Y4T.js";import{useMediaMoveItems as m}from"./chunk-DFDDRKIJ.js";import{copyToClipboard as u}from"./chunk-5PY4H4ZJ.js";import{DropdownMenu as h}from"./chunk-EMXR74QM.js";import{MediaUploadGrid as p}from"./chunk-V4KQUOUP.js";import{MediaUsedInList as f}from"./chunk-EZGY6CFN.js";import{NativeSelect as g}from"./chunk-HJH4WIBC.js";import{Input_default as v}from"./chunk-UNEJ2ABD.js";import{Segmented as y}from"./chunk-N6DTTOB6.js";import{useFileIntake as k,FileIntakeAlert as b}from"./chunk-YDYDR72S.js";import{useGridSelection as w}from"./chunk-VLKDWKVR.js";import{useMarquee as x}from"./chunk-OLFYNMTD.js";import{Checkbox_default as C}from"./chunk-CGZBDI6C.js";import{useContextMenu as N,ContextMenu as I}from"./chunk-WSODT2L5.js";import{Banner as D}from"./chunk-WTY3SXO7.js";import{IconButton_default as S}from"./chunk-4CANQ3B3.js";import{ColoredBadge as j}from"./chunk-XWLWG4HS.js";import{Button_default as z}from"./chunk-4IU5BSVE.js";import{buttonClasses as T}from"./chunk-K7U4RWXJ.js";import{Icon as F}from"./chunk-KIBL6M3T.js";import{Tooltip as O}from"./chunk-22S6LG6D.js";import{usePlotWidth as E}from"./chunk-MAFUXCPZ.js";import{useShellStrings as P}from"./chunk-E6UCGCOC.js";import{useRef as L,useMemo as M,useCallback as A,useState as U,useEffect as B}from"react";import{jsxs as K,Fragment as R,jsx as W}from"react/jsx-runtime";var G="application/x-efficient-media-files",H="application/x-efficient-media-folder",J={type:"all",use:"any",sort:"newest"},Y={lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(F,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(F,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(F,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(F,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(F,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(F,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(F,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(F,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(F,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(F,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(F,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(F,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(F,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(F,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(F,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},V={link:/* @__PURE__ */W(F,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(F,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(F,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(F,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function X({value:e,label:l,onDone:n}){const[a,r]=U(e),i=L(!1),t=e=>{i.current||(i.current=!0,n(e))};/* @__PURE__ */
2
- return W(v,{size:"sm",autoFocus:!0,"aria-label":l,value:a,onChange:e=>r(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:l=>{l.stopPropagation(),"Enter"===l.key?(l.preventDefault(),t(a.trim()||e)):"Escape"===l.key&&(l.preventDefault(),t(null))},onBlur:()=>t(a.trim()||e),onClick:e=>e.stopPropagation()})}function $(F){const{mode:$="manage",layout:Q="auto",location:Z,onLocationChange:q,folders:_,products:ee,allFilesCount:le,trashCount:ne,files:ae,query:re,onQueryChange:ie,filters:te=J,onFiltersChange:oe,extraFilters:de,view:se="grid",onViewChange:ce,selectedIds:me,onSelectionChange:ue,usedIn:he,denied:pe={},accept:fe="image/*,video/*",maxSizeBytes:ge,busy:ve,progress:ye,onUpload:ke,onNewFolder:be,onRename:we,onMove:xe,onTrash:Ce,onDeleteFolder:Ne,onRestore:Ie,onDeleteForever:De,onEmptyTrash:Se,onReplace:je,onCropEdit:ze,onOpenInDesign:Te,onChoose:Fe,onCancel:Oe,pickNote:Ee,className:Pe=""}=F,Le=P().mediaLibrary,Me=P().media,Ae="pick"===$,Ue=!Ae,Be=L(null),Ke=E(Be,"phone"===Q?343:1200),Re="phone"===Q||"auto"===Q&&Ke<640,We=M(()=>function(e=[]){const l=/* @__PURE__ */new Map,n=(e,a)=>{for(const r of e){const e=[...a,r];l.set(r.id,{node:r,path:e}),r.children&&n(r.children,e)}};return n(e,[]),l}(ee),[ee]),Ge=M(()=>new Map(_.map(e=>[e.id,e])),[_]),He=M(()=>{const e=/* @__PURE__ */new Map;for(const l of _){const n=l.parentId&&Ge.has(l.parentId)?l.parentId:null;e.set(n,[...e.get(n)??[],l])}return e},[_,Ge]),Je=A(e=>{const l=[];for(let n=e?Ge.get(e):void 0;n&&(l.unshift(n),!(l.length>_.length));n=n.parentId?Ge.get(n.parentId):void 0);return l},[Ge,_.length]),Ye=A((e,l)=>Je(e).some(e=>e.id===l),[Je]),[Ve,Xe]=U(()=>/* @__PURE__ */new Set(["@files"])),$e=e=>Xe(l=>{const n=new Set(l);return n.has(e)?n.delete(e):n.add(e),n}),Qe=A(e=>{Xe(l=>e.every(e=>l.has(e))?l:/* @__PURE__ */new Set([...l,...e]))},[]),Ze="files"===(qe=Z).place?`files:${qe.folderId??""}`:"products"===qe.place?`products:${qe.nodeId??""}`:"trash";var qe;B(()=>{if("files"===Z.place)Qe(["@files",...Je(Z.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===Z.place){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];Qe(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[Ze]);const _e="products"===Z.place,el="trash"===Z.place,ll="files"===Z.place,nl=ll?Z.folderId:null,al=_e&&Z.nodeId?We.get(Z.nodeId)?.path[0]:void 0,rl=e=>e?.sharedFrom?`${Le.readOnly} ${Le.editedAtHq(e.sharedFrom)}`:Le.readOnly,il=M(()=>ae.map(e=>e.id),[ae]),tl=M(()=>new Map(ae.map(e=>[e.id,e])),[ae]),ol=w(il),dl=M(()=>il.filter(e=>ol.selected.has(e)),[il,ol.selected]),sl=1===dl.length?tl.get(dl[0]):void 0,cl=L(!0);B(()=>{cl.current?cl.current=!1:ol.clear()},[Ze]);const ml=me?.join("\0");B(()=>{me&&ol.setSelection(me)},[ml]);const ul=L(ml??""),hl=dl.join("\0");B(()=>{ul.current!==hl&&(ul.current=hl,ue?.(dl))},[hl]);const pl=(e,l={})=>{Ae?ol.select(e):ol.select(e,{ctrl:!(!l.ctrlKey&&!l.metaKey),shift:!!l.shiftKey})},[fl,gl]=U(null),vl=e=>{const l=fl;if(gl(null),!l||null==e)return;e!==("folder"===l.kind?Ge.get(l.id)?.name:tl.get(l.id)?.name)&&we?.(l,e)},yl=async e=>{if(!be)return;const l=await be(e);Qe(["@files",...e?[e]:[]]),"string"==typeof l&&gl({kind:"folder",id:l})},kl=A(e=>{const l=[],n=l=>{if("files"===e.kind)return l===nl&&ll?Le.alreadyHere:void 0;const n=Ge.get(e.id);return l===e.id||l&&Ye(l,e.id)?Le.notIntoItself:(n?.parentId??null)===l?Le.folderAlreadyHere:void 0};l.push({key:s,label:Le.allFiles,disabledReason:n(null)});const a=(e,r)=>{for(const i of He.get(e)??[])l.push({key:i.id,label:i.name,depth:r,disabledReason:n(i.id)}),a(i.id,r+1)};return a(null,1),l},[He,Ge,ll,Ye,nl,Le]),bl=A(e=>{const l=new Set(e.map(e=>tl.get(e)?.kind??"image"));return 1===l.size?[...l][0]:"file"},[tl]),[wl,xl]=U(null),Cl={words:Le,media:Me,denied:pe,moveTargets:kl,kindOf:bl,urlOf:e=>tl.get(e)?.url,newSubfolder:be&&Ue?e=>{yl(e)}:void 0,rename:we&&Ue?e=>{"file"!==e.kind||ol.isSelected(e.id)||ol.select(e.id),gl(e)}:void 0,move:xe&&Ue?xe:void 0,trash:Ce&&Ue?Ce:void 0,deleteFolder:Ne&&Ue?Ne:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:je&&Ue?je:void 0,copyUrl:e=>{const l=tl.get(e)?.url;l&&u(Le.urlLabel,l)},openInDesign:Te,restore:Ie,deleteForever:De},Nl=e=>c(e,Cl),Il=N(),Dl=(e,l)=>{Ae||(ol.isSelected(e)||ol.select(e),Il.open(l,(e=>{const l=ol.isSelected(e)?dl:[e];return _e?{kind:"render",id:e}:el?{kind:"trashed",ids:l}:{kind:"files",ids:l}})(e)))},[Sl,jl]=U(null),[zl,Tl]=U(null),[Fl,Ol]=U(null);B(()=>{if(!zl&&!Sl)return;const e=()=>{Tl(null),jl(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[zl,Sl]);const El=(e,l)=>Array.from(e.dataTransfer?.types??[]).includes(l),Pl=(e,l)=>!(!xe||pe.move||Ae)&&(!!El(e,G)||!(!El(e,H)||!Fl)&&(l!==Fl&&!(l&&Ye(l,Fl)))),Ll=(e,l)=>({onDragEnter:n=>{Pl(n,l)&&(n.preventDefault(),jl(e))},onDragOver:n=>{Pl(n,l)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",Sl!==e&&jl(e))},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||jl(l=>l===e?null:l)},onDrop:e=>{if(Pl(e,l))if(e.preventDefault(),jl(null),El(e,G)){let n;try{n=JSON.parse(e.dataTransfer.getData(G))}catch{n=null}Array.isArray(n)&&n.length&&xe({kind:"files",ids:n.map(String)},l)}else Fl&&(xe({kind:"folder",id:Fl},l),Ol(null))}}),Ml=e=>{const l=e=>El(e,G)||El(e,H)||El(e,"Files");return{onDragEnter:n=>{l(n)&&Tl(e)},onDragOver:n=>{l(n)&&zl!==e&&Tl(e)},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||Tl(l=>l===e?null:l)}}},Al=(e,l,n)=>/* @__PURE__ */W(O,{side:"right",content:zl===e?Le.noDropProducts:rl(n),open:zl===e||!zl&&void 0,children:/* @__PURE__ */W("span",{children:l})}),Ul=e=>({onContextMenu:l=>{Il.open(l,e)}}),Bl=(e,a,r)=>e.map(e=>{const i=`p:${e.id}`,t=r??e,o=Ve.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
1
+ import{Tree as e,TreeRow as l,TreeGroup as n}from"./chunk-G433MKIN.js";import{MarqueeBox as a}from"./chunk-IC72MGON.js";import{ImageLightbox as r}from"./chunk-RGBX3EVC.js";import{DescriptionList as i}from"./chunk-SACUSHVN.js";import{Drawer as t}from"./chunk-YW2DH6YQ.js";import{EmptyState as o}from"./chunk-KDZUWQEG.js";import{Breadcrumbs as d}from"./chunk-WJ3XSJ6B.js";import{useGridSelection as s}from"./chunk-VLKDWKVR.js";import{useMarquee as c}from"./chunk-OLFYNMTD.js";import{ROOT_KEY as m,mediaLibraryMenu as u}from"./chunk-7CFH6Y4T.js";import{useMediaMoveItems as h}from"./chunk-DFDDRKIJ.js";import{copyToClipboard as p}from"./chunk-5PY4H4ZJ.js";import{DropdownMenu as f}from"./chunk-W7S56JZ7.js";import{NativeSelect as g}from"./chunk-HJH4WIBC.js";import{MediaUploadGrid as v}from"./chunk-V4KQUOUP.js";import{MediaUsedInList as y}from"./chunk-EZGY6CFN.js";import{Input_default as k}from"./chunk-UNEJ2ABD.js";import{useFileIntake as b,FileIntakeAlert as w}from"./chunk-YDYDR72S.js";import{Segmented as x}from"./chunk-N6DTTOB6.js";import{Checkbox_default as C}from"./chunk-CGZBDI6C.js";import{useContextMenu as N,ContextMenu as I}from"./chunk-AX7KPMDV.js";import{Banner as D}from"./chunk-WTY3SXO7.js";import{IconButton_default as S}from"./chunk-4CANQ3B3.js";import{ColoredBadge as j}from"./chunk-XWLWG4HS.js";import{Button_default as z}from"./chunk-4IU5BSVE.js";import{buttonClasses as F}from"./chunk-K7U4RWXJ.js";import{Icon as T}from"./chunk-KIBL6M3T.js";import{Tooltip as O}from"./chunk-22S6LG6D.js";import{usePlotWidth as E}from"./chunk-MAFUXCPZ.js";import{useShellStrings as P}from"./chunk-E6UCGCOC.js";import{useRef as L,useMemo as A,useCallback as M,useState as U,useEffect as B}from"react";import{jsxs as K,Fragment as R,jsx as W}from"react/jsx-runtime";var G="application/x-efficient-media-files",H="application/x-efficient-media-folder",J={type:"all",use:"any",sort:"newest"},V={lock:/* @__PURE__ */W(T,{name:"lock","aria-hidden":"true",className:"h-4 w-4"}),folder:/* @__PURE__ */W(T,{name:"folder","aria-hidden":"true",className:"h-4 w-4"}),folderOpen:/* @__PURE__ */W(T,{name:"folder-open","aria-hidden":"true",className:"h-4 w-4"}),folderPlus:/* @__PURE__ */W(T,{name:"folder-plus","aria-hidden":"true",className:"h-4 w-4"}),trash:/* @__PURE__ */W(T,{name:"trash","aria-hidden":"true",className:"h-4 w-4"}),upload:/* @__PURE__ */W(T,{name:"upload","aria-hidden":"true",className:"h-4 w-4"}),search:/* @__PURE__ */W(T,{name:"search","aria-hidden":"true",className:"h-4 w-4"}),grid:/* @__PURE__ */W(T,{name:"grid","aria-hidden":"true",className:"h-4 w-4"}),list:/* @__PURE__ */W(T,{name:"list","aria-hidden":"true",className:"h-4 w-4"}),more:/* @__PURE__ */W(T,{name:"more","aria-hidden":"true",className:"h-4 w-4"}),copy:/* @__PURE__ */W(T,{name:"copy","aria-hidden":"true",className:"h-4 w-4"}),edit:/* @__PURE__ */W(T,{name:"edit","aria-hidden":"true",className:"h-4 w-4"}),swap:/* @__PURE__ */W(T,{name:"swap","aria-hidden":"true",className:"h-4 w-4"}),crop:/* @__PURE__ */W(T,{name:"crop","aria-hidden":"true",className:"h-4 w-4"}),external:/* @__PURE__ */W(T,{name:"external","aria-hidden":"true",className:"h-4 w-4"}),undo:/* @__PURE__ */W(T,{name:"undo","aria-hidden":"true",className:"h-4 w-4"})},Y={link:/* @__PURE__ */W(T,{name:"link","aria-hidden":"true",className:"h-3 w-3"}),email:/* @__PURE__ */W(T,{name:"email","aria-hidden":"true",className:"h-3 w-3"}),lock:/* @__PURE__ */W(T,{name:"lock","aria-hidden":"true",className:"h-3 w-3"}),clock:/* @__PURE__ */W(T,{name:"clock","aria-hidden":"true",className:"h-3 w-3"})};function X({value:e,label:l,onDone:n}){const[a,r]=U(e),i=L(!1),t=e=>{i.current||(i.current=!0,n(e))};/* @__PURE__ */
2
+ return W(k,{size:"sm",autoFocus:!0,"aria-label":l,value:a,onChange:e=>r(e.target.value),onFocus:e=>e.currentTarget.select(),onKeyDown:l=>{l.stopPropagation(),"Enter"===l.key?(l.preventDefault(),t(a.trim()||e)):"Escape"===l.key&&(l.preventDefault(),t(null))},onBlur:()=>t(a.trim()||e),onClick:e=>e.stopPropagation()})}function $(T){const{mode:$="manage",layout:Z="auto",location:Q,onLocationChange:q,folders:_,products:ee,allFilesCount:le,trashCount:ne,files:ae,query:re,onQueryChange:ie,filters:te=J,onFiltersChange:oe,extraFilters:de,view:se="grid",onViewChange:ce,selectedIds:me,onSelectionChange:ue,usedIn:he,denied:pe={},accept:fe="image/*,video/*",maxSizeBytes:ge,busy:ve,progress:ye,onUpload:ke,onNewFolder:be,onRename:we,onMove:xe,onTrash:Ce,onDeleteFolder:Ne,onRestore:Ie,onDeleteForever:De,onEmptyTrash:Se,onReplace:je,onCropEdit:ze,onOpenInDesign:Fe,onChoose:Te,onCancel:Oe,pickNote:Ee,className:Pe=""}=T,Le=P().mediaLibrary,Ae=P().media,Me="pick"===$,Ue=!Me,Be=L(null),Ke=E(Be,"phone"===Z?343:1200),Re="phone"===Z||"auto"===Z&&Ke<640,We=A(()=>function(e=[]){const l=/* @__PURE__ */new Map,n=(e,a)=>{for(const r of e){const e=[...a,r];l.set(r.id,{node:r,path:e}),r.children&&n(r.children,e)}};return n(e,[]),l}(ee),[ee]),Ge=A(()=>new Map(_.map(e=>[e.id,e])),[_]),He=A(()=>{const e=/* @__PURE__ */new Map;for(const l of _){const n=l.parentId&&Ge.has(l.parentId)?l.parentId:null;e.set(n,[...e.get(n)??[],l])}return e},[_,Ge]),Je=M(e=>{const l=[];for(let n=e?Ge.get(e):void 0;n&&(l.unshift(n),!(l.length>_.length));n=n.parentId?Ge.get(n.parentId):void 0);return l},[Ge,_.length]),Ve=M((e,l)=>Je(e).some(e=>e.id===l),[Je]),[Ye,Xe]=U(()=>/* @__PURE__ */new Set(["@files"])),$e=e=>Xe(l=>{const n=new Set(l);return n.has(e)?n.delete(e):n.add(e),n}),Ze=M(e=>{Xe(l=>e.every(e=>l.has(e))?l:/* @__PURE__ */new Set([...l,...e]))},[]),Qe="files"===(qe=Q).place?`files:${qe.folderId??""}`:"products"===qe.place?`products:${qe.nodeId??""}`:"trash";var qe;B(()=>{if("files"===Q.place)Ze(["@files",...Je(Q.folderId).slice(0,-1).map(e=>e.id)]);else if("products"===Q.place){const e=Q.nodeId?We.get(Q.nodeId)?.path??[]:[];Ze(["@products",...e.slice(0,-1).map(e=>`p:${e.id}`)])}},[Qe]);const _e="products"===Q.place,el="trash"===Q.place,ll="files"===Q.place,nl=ll?Q.folderId:null,al=_e&&Q.nodeId?We.get(Q.nodeId)?.path[0]:void 0,rl=e=>e?.sharedFrom?`${Le.readOnly} ${Le.editedAtHq(e.sharedFrom)}`:Le.readOnly,il=A(()=>ae.map(e=>e.id),[ae]),tl=A(()=>new Map(ae.map(e=>[e.id,e])),[ae]),ol=s(il),dl=A(()=>il.filter(e=>ol.selected.has(e)),[il,ol.selected]),sl=1===dl.length?tl.get(dl[0]):void 0,cl=L(!0);B(()=>{cl.current?cl.current=!1:ol.clear()},[Qe]);const ml=me?.join("\0");B(()=>{me&&ol.setSelection(me)},[ml]);const ul=L(ml??""),hl=dl.join("\0");B(()=>{ul.current!==hl&&(ul.current=hl,ue?.(dl))},[hl]);const pl=(e,l={})=>{Me?ol.select(e):ol.select(e,{ctrl:!(!l.ctrlKey&&!l.metaKey),shift:!!l.shiftKey})},[fl,gl]=U(null),vl=e=>{const l=fl;if(gl(null),!l||null==e)return;e!==("folder"===l.kind?Ge.get(l.id)?.name:tl.get(l.id)?.name)&&we?.(l,e)},yl=async e=>{if(!be)return;const l=await be(e);Ze(["@files",...e?[e]:[]]),"string"==typeof l&&gl({kind:"folder",id:l})},kl=M(e=>{const l=[],n=l=>{if("files"===e.kind)return l===nl&&ll?Le.alreadyHere:void 0;const n=Ge.get(e.id);return l===e.id||l&&Ve(l,e.id)?Le.notIntoItself:(n?.parentId??null)===l?Le.folderAlreadyHere:void 0};l.push({key:m,label:Le.allFiles,disabledReason:n(null)});const a=(e,r)=>{for(const i of He.get(e)??[])l.push({key:i.id,label:i.name,depth:r,disabledReason:n(i.id)}),a(i.id,r+1)};return a(null,1),l},[He,Ge,ll,Ve,nl,Le]),bl=M(e=>{const l=new Set(e.map(e=>tl.get(e)?.kind??"image"));return 1===l.size?[...l][0]:"file"},[tl]),[wl,xl]=U(null),Cl={words:Le,media:Ae,denied:pe,moveTargets:kl,kindOf:bl,urlOf:e=>tl.get(e)?.url,newSubfolder:be&&Ue?e=>{yl(e)}:void 0,rename:we&&Ue?e=>{"file"!==e.kind||ol.isSelected(e.id)||ol.select(e.id),gl(e)}:void 0,move:xe&&Ue?xe:void 0,trash:Ce&&Ue?Ce:void 0,deleteFolder:Ne&&Ue?Ne:void 0,folderNotEmpty:e=>!!Ge.get(e)?.notEmpty,replace:je&&Ue?je:void 0,copyUrl:e=>{const l=tl.get(e)?.url;l&&p(Le.urlLabel,l)},openInDesign:Fe,restore:Ie,deleteForever:De},Nl=e=>u(e,Cl),Il=N(),Dl=(e,l)=>{Me||(ol.isSelected(e)||ol.select(e),Il.open(l,(e=>{const l=ol.isSelected(e)?dl:[e];return _e?{kind:"render",id:e}:el?{kind:"trashed",ids:l}:{kind:"files",ids:l}})(e)))},[Sl,jl]=U(null),[zl,Fl]=U(null),[Tl,Ol]=U(null);B(()=>{if(!zl&&!Sl)return;const e=()=>{Fl(null),jl(null)};return window.addEventListener("dragend",e),window.addEventListener("drop",e),()=>{window.removeEventListener("dragend",e),window.removeEventListener("drop",e)}},[zl,Sl]);const El=(e,l)=>Array.from(e.dataTransfer?.types??[]).includes(l),Pl=(e,l)=>!(!xe||pe.move||Me)&&(!!El(e,G)||!(!El(e,H)||!Tl)&&(l!==Tl&&!(l&&Ve(l,Tl)))),Ll=(e,l)=>({onDragEnter:n=>{Pl(n,l)&&(n.preventDefault(),jl(e))},onDragOver:n=>{Pl(n,l)&&(n.preventDefault(),n.dataTransfer.dropEffect="move",Sl!==e&&jl(e))},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||jl(l=>l===e?null:l)},onDrop:e=>{if(Pl(e,l))if(e.preventDefault(),jl(null),El(e,G)){let n;try{n=JSON.parse(e.dataTransfer.getData(G))}catch{n=null}Array.isArray(n)&&n.length&&xe({kind:"files",ids:n.map(String)},l)}else Tl&&(xe({kind:"folder",id:Tl},l),Ol(null))}}),Al=e=>{const l=e=>El(e,G)||El(e,H)||El(e,"Files");return{onDragEnter:n=>{l(n)&&Fl(e)},onDragOver:n=>{l(n)&&zl!==e&&Fl(e)},onDragLeave:l=>{const n=l.relatedTarget;n&&l.currentTarget.contains(n)||Fl(l=>l===e?null:l)}}},Ml=(e,l,n)=>/* @__PURE__ */W(O,{side:"right",content:zl===e?Le.noDropProducts:rl(n),open:zl===e||!zl&&void 0,children:/* @__PURE__ */W("span",{children:l})}),Ul=e=>({onContextMenu:l=>{Il.open(l,e)}}),Bl=(e,a,r)=>e.map(e=>{const i=`p:${e.id}`,t=r??e,o=Ye.has(i),d=e.children?.length?e.children:null;/* @__PURE__ */
3
3
  return K("div",{role:"none",className:"contents",children:[
4
- /* @__PURE__ */W(l,{label:Al(i,e.name,t),level:a,icon:d&&o?Y.folderOpen:Y.folder,badge:null!=e.count?e.count:void 0,selected:_e&&Z.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>$e(i):void 0,onSelect:()=>q({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Ml(i),...Ue?Ul({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(n,{children:Bl(d,a+1,t)})]},e.id)}),Kl=(e,a)=>(He.get(e)??[]).map(e=>{const r=He.get(e.id),i=Ve.has(e.id),t="folder"===fl?.kind&&fl.id===e.id,o=Nl({kind:"folder",id:e.id});/* @__PURE__ */
4
+ /* @__PURE__ */W(l,{label:Ml(i,e.name,t),level:a,icon:d&&o?V.folderOpen:V.folder,badge:null!=e.count?e.count:void 0,selected:_e&&Q.nodeId===e.id,expanded:d?o:void 0,onToggle:d?()=>$e(i):void 0,onSelect:()=>q({place:"products",nodeId:e.id}),rowProps:{"data-media-row":i,...Al(i),...Ue?Ul({kind:"product-node",id:e.id}):{}}}),d&&o&&/* @__PURE__ */W(n,{children:Bl(d,a+1,t)})]},e.id)}),Kl=(e,a)=>(He.get(e)??[]).map(e=>{const r=He.get(e.id),i=Ye.has(e.id),t="folder"===fl?.kind&&fl.id===e.id,o=Nl({kind:"folder",id:e.id});/* @__PURE__ */
5
5
  return K("div",{role:"none",className:"contents",children:[
6
- /* @__PURE__ */W(l,{label:e.name,level:a,icon:r&&i?Y.folderOpen:Y.folder,badge:null!=e.count?e.count:void 0,selected:t||ll&&Z.folderId===e.id,expanded:r?i:void 0,onToggle:r?()=>$e(e.id):void 0,onSelect:()=>q({place:"files",folderId:e.id}),drop:Sl===e.id?"into":void 0,dragging:Fl===e.id,draggable:Ue&&!!xe&&!pe.move,rename:t?/* @__PURE__ */W(X,{value:e.name,label:Le.folderName,onDone:vl}):void 0,actions:Ue&&o.length?/* @__PURE__ */W(h,{align:"end","aria-label":Le.folderActions,trigger:Y.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Ll(e.id,e.id),...Ue?Ul({kind:"folder",id:e.id}):{},...Ue&&xe&&!pe.move?{draggable:!0,onDragStart:l=>{l.dataTransfer.effectAllowed="move",l.dataTransfer.setData(H,e.id),Ol(e.id)},onDragEnd:()=>{Ol(null),jl(null)}}:{}}}),r&&i&&/* @__PURE__ */W(n,{children:Kl(e.id,a+1)})]},e.id)}),Rl=Ve.has("@files"),Wl=Ve.has("@products"),Gl=/* @__PURE__ */K(e,{"aria-label":Le.folders,children:[ee&&/* @__PURE__ */K(R,{children:[
7
- /* @__PURE__ */W(l,{label:Al("@products",Le.products),level:1,icon:Y.lock,badge:{label:Le.readOnlyBadge,tone:"neutral"},expanded:ee.length?Wl:void 0,onToggle:()=>$e("@products"),selected:_e&&null==Z.nodeId,onSelect:()=>q({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Ml("@products")}}),Wl&&ee.length>0&&/* @__PURE__ */W(n,{children:Bl(ee,2)})]}),
8
- /* @__PURE__ */W(l,{label:Le.allFiles,level:1,icon:Rl?Y.folderOpen:Y.folder,badge:null!=le?le:void 0,expanded:He.get(null)?.length?Rl:void 0,onToggle:()=>$e("@files"),selected:ll&&null==Z.folderId,onSelect:()=>q({place:"files",folderId:null}),drop:"@files"===Sl?"into":void 0,rowProps:{"data-media-row":"@files",...Ll("@files",null)}}),Rl&&(He.get(null)?.length??0)>0&&/* @__PURE__ */W(n,{children:Kl(null,2)}),Ue&&/* @__PURE__ */W(l,{label:Le.trash,level:1,icon:Y.trash,badge:null!=ne?ne:void 0,selected:el,onSelect:()=>q({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Hl=(()=>{if(el)return[{label:Le.trash}];if(_e){const e=Z.nodeId?We.get(Z.nodeId)?.path??[]:[];return[{label:Le.products,onClick:e.length?()=>q({place:"products",nodeId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"products",nodeId:l.id}):void 0}))]}const e=Je(nl);return[{label:Le.allFiles,onClick:e.length?()=>q({place:"files",folderId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"files",folderId:l.id}):void 0}))]})(),Jl=_e?Le.readOnly:pe.upload,Yl=!!ke&&!el&&!Jl,Vl=k({accept:fe,maxSizeBytes:ge,multiple:!0,disabled:!Yl,onAccept:e=>ke?.(e,nl)}),Xl=_e?Le.noProductFolder:pe.newFolder,$l=e=>e?{"aria-disabled":!0,disabledReason:e}:{},Ql=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[Ue&&be&&!el&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.folderPlus,onClick:()=>{yl(nl)},...$l(Xl),children:Le.newFolder}),ke&&!el&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:Y.upload,onClick:()=>Vl.open(),...$l(Jl),children:Le.upload}),Ue&&el&&Se&&ae.length>0&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:Se,...$l(pe.deleteForever),children:Le.emptyTrash})]}),Zl=(e,l,n,a,r)=>/* @__PURE__ */W("div",{style:{width:Re?void 0:r,flex:Re?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(g,{size:"sm","aria-label":e,value:l,onChange:a,options:n})},e),ql=e=>l=>oe?.({...te,[e]:l}),_l=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[ie&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(v,{size:"sm",type:"search",leftIcon:Y.search,placeholder:_e?Le.searchProducts:Le.search,"aria-label":_e?Le.searchProducts:Le.search,value:re??"",onChange:e=>ie(e.target.value)})}),oe&&Zl(Le.mediaType,te.type,[{value:"all",label:Le.allTypes},{value:"image",label:Le.images},{value:"video",label:Le.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],ql("type"),130),oe&&!_e&&!el&&Zl(Le.use,te.use,[{value:"any",label:Le.anyUse},{value:"email",label:Le.emailOnly},{value:"website",label:Le.websiteOnly},{value:"unused",label:Le.notUsed}],ql("use"),130),oe&&Ue&&Zl(Le.sort,te.sort,[{value:"newest",label:Le.newest},{value:"name",label:Le.byName},{value:"size",label:Le.bySize}],ql("sort"),110),de?.map(e=>Zl(e.label,e.value,e.options,e.onChange,120)),ce&&/* @__PURE__ */W(y,{size:"sm",label:Le.view,value:se,onChange:ce,options:[{value:"grid",label:Le.grid,icon:Y.grid},{value:"list",label:Le.list,icon:Y.list}]})]}),en=e=>{const l=[];return null!=e.trashedDaysAgo&&l.push({key:"t",label:Le.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:V.clock,tone:"neutral"}),e.usedCount&&l.push({key:"u",label:Le.used(e.usedCount),count:e.usedCount,icon:V.link,tone:"active"}),e.email&&l.push({key:"e",label:Le.email,icon:V.email,tone:"queued"}),e.private&&l.push({key:"p",label:Le.private,icon:V.lock,tone:"neutral"}),l},ln=e=>en(e).map(e=>/* @__PURE__ */W(j,{tone:e.tone,size:"xs",children:e.label},e.key)),nn=Ue&&ll&&!!xe&&!pe.move,an=ae.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:en(e),dragData:nn?JSON.stringify(ol.isSelected(e.id)?dl:[e.id]):void 0})),rn=Re?Math.max(72,Math.floor((Ke-24-16-1)/3)):112,tn=L(null),on=x({containerRef:tn,enabled:Ue&&!Re&&ae.length>0,selected:ol.selected,setSelection:e=>ol.setSelection(e),clearSelection:ol.clear}),dn=e=>{if(Ae){const l=tl.get(e);return void(!l||l.private||l.pickDisabledReason||Fe?.(l))}const l=il.indexOf(e);l>=0&&xl(l)},sn=ae.length?null:re?/* @__PURE__ */W(o,{variant:"dashed",title:Le.noMatches}):_e?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyProducts,description:rl(al)}):el?/* @__PURE__ */W(o,{variant:"dashed",title:Le.trashEmpty}):!Yl||Ae?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyFolder}):null,cn="list"===se&&ae.length>0,mn=sn??(cn?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Ue||void 0,"aria-label":Le.folders,className:"flex flex-col gap-1",children:ae.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":ol.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:l=>pl(e.id,l),onDoubleClick:()=>dn(e.id),onContextMenu:l=>Dl(e.id,l),onKeyDown:l=>{"Enter"!==l.key&&" "!==l.key||(l.preventDefault(),pl(e.id,l))},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)] "+(ol.isSelected(e.id)?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
6
+ /* @__PURE__ */W(l,{label:e.name,level:a,icon:r&&i?V.folderOpen:V.folder,badge:null!=e.count?e.count:void 0,selected:t||ll&&Q.folderId===e.id,expanded:r?i:void 0,onToggle:r?()=>$e(e.id):void 0,onSelect:()=>q({place:"files",folderId:e.id}),drop:Sl===e.id?"into":void 0,dragging:Tl===e.id,draggable:Ue&&!!xe&&!pe.move,rename:t?/* @__PURE__ */W(X,{value:e.name,label:Le.folderName,onDone:vl}):void 0,actions:Ue&&o.length?/* @__PURE__ */W(f,{align:"end","aria-label":Le.folderActions,trigger:V.more,items:o}):void 0,rowProps:{"data-media-row":e.id,...Ll(e.id,e.id),...Ue?Ul({kind:"folder",id:e.id}):{},...Ue&&xe&&!pe.move?{draggable:!0,onDragStart:l=>{l.dataTransfer.effectAllowed="move",l.dataTransfer.setData(H,e.id),Ol(e.id)},onDragEnd:()=>{Ol(null),jl(null)}}:{}}}),r&&i&&/* @__PURE__ */W(n,{children:Kl(e.id,a+1)})]},e.id)}),Rl=Ye.has("@files"),Wl=Ye.has("@products"),Gl=/* @__PURE__ */K(e,{"aria-label":Le.folders,children:[ee&&/* @__PURE__ */K(R,{children:[
7
+ /* @__PURE__ */W(l,{label:Ml("@products",Le.products),level:1,icon:V.lock,badge:{label:Le.readOnlyBadge,tone:"neutral"},expanded:ee.length?Wl:void 0,onToggle:()=>$e("@products"),selected:_e&&null==Q.nodeId,onSelect:()=>q({place:"products",nodeId:null}),rowProps:{"data-media-row":"@products",...Al("@products")}}),Wl&&ee.length>0&&/* @__PURE__ */W(n,{children:Bl(ee,2)})]}),
8
+ /* @__PURE__ */W(l,{label:Le.allFiles,level:1,icon:Rl?V.folderOpen:V.folder,badge:null!=le?le:void 0,expanded:He.get(null)?.length?Rl:void 0,onToggle:()=>$e("@files"),selected:ll&&null==Q.folderId,onSelect:()=>q({place:"files",folderId:null}),drop:"@files"===Sl?"into":void 0,rowProps:{"data-media-row":"@files",...Ll("@files",null)}}),Rl&&(He.get(null)?.length??0)>0&&/* @__PURE__ */W(n,{children:Kl(null,2)}),Ue&&/* @__PURE__ */W(l,{label:Le.trash,level:1,icon:V.trash,badge:null!=ne?ne:void 0,selected:el,onSelect:()=>q({place:"trash"}),rowProps:{"data-media-row":"@trash"}})]}),Hl=(()=>{if(el)return[{label:Le.trash}];if(_e){const e=Q.nodeId?We.get(Q.nodeId)?.path??[]:[];return[{label:Le.products,onClick:e.length?()=>q({place:"products",nodeId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"products",nodeId:l.id}):void 0}))]}const e=Je(nl);return[{label:Le.allFiles,onClick:e.length?()=>q({place:"files",folderId:null}):void 0},...e.map((l,n)=>({label:l.name,onClick:n<e.length-1?()=>q({place:"files",folderId:l.id}):void 0}))]})(),Jl=_e?Le.readOnly:pe.upload,Vl=!!ke&&!el&&!Jl,Yl=b({accept:fe,maxSizeBytes:ge,multiple:!0,disabled:!Vl,onAccept:e=>ke?.(e,nl)}),Xl=_e?Le.noProductFolder:pe.newFolder,$l=e=>e?{"aria-disabled":!0,disabledReason:e}:{},Zl=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[Ue&&be&&!el&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.folderPlus,onClick:()=>{yl(nl)},...$l(Xl),children:Le.newFolder}),ke&&!el&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:V.upload,onClick:()=>Yl.open(),...$l(Jl),children:Le.upload}),Ue&&el&&Se&&ae.length>0&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:Se,...$l(pe.deleteForever),children:Le.emptyTrash})]}),Ql=(e,l,n,a,r)=>/* @__PURE__ */W("div",{style:{width:Re?void 0:r,flex:Re?"1 1 120px":"0 0 auto",minWidth:0},children:/* @__PURE__ */W(g,{size:"sm","aria-label":e,value:l,onChange:a,options:n})},e),ql=e=>l=>oe?.({...te,[e]:l}),_l=/* @__PURE__ */K("div",{className:"flex flex-wrap items-center gap-2",children:[ie&&/* @__PURE__ */W("div",{style:{flex:"1 1 200px",minWidth:0},children:/* @__PURE__ */W(k,{size:"sm",type:"search",leftIcon:V.search,placeholder:_e?Le.searchProducts:Le.search,"aria-label":_e?Le.searchProducts:Le.search,value:re??"",onChange:e=>ie(e.target.value)})}),oe&&Ql(Le.mediaType,te.type,[{value:"all",label:Le.allTypes},{value:"image",label:Le.images},{value:"video",label:Le.videos},{value:"svg",label:"SVG"},{value:"gif",label:"GIF"}],ql("type"),130),oe&&!_e&&!el&&Ql(Le.use,te.use,[{value:"any",label:Le.anyUse},{value:"email",label:Le.emailOnly},{value:"website",label:Le.websiteOnly},{value:"unused",label:Le.notUsed}],ql("use"),130),oe&&Ue&&Ql(Le.sort,te.sort,[{value:"newest",label:Le.newest},{value:"name",label:Le.byName},{value:"size",label:Le.bySize}],ql("sort"),110),de?.map(e=>Ql(e.label,e.value,e.options,e.onChange,120)),ce&&/* @__PURE__ */W(x,{size:"sm",label:Le.view,value:se,onChange:ce,options:[{value:"grid",label:Le.grid,icon:V.grid},{value:"list",label:Le.list,icon:V.list}]})]}),en=e=>{const l=[];return null!=e.trashedDaysAgo&&l.push({key:"t",label:Le.daysAgo(e.trashedDaysAgo),count:e.trashedDaysAgo,icon:Y.clock,tone:"neutral"}),e.usedCount&&l.push({key:"u",label:Le.used(e.usedCount),count:e.usedCount,icon:Y.link,tone:"active"}),e.email&&l.push({key:"e",label:Le.email,icon:Y.email,tone:"queued"}),e.private&&l.push({key:"p",label:Le.private,icon:Y.lock,tone:"neutral"}),l},ln=e=>en(e).map(e=>/* @__PURE__ */W(j,{tone:e.tone,size:"xs",children:e.label},e.key)),nn=Ue&&ll&&!!xe&&!pe.move,an=ae.map(e=>({id:e.id,url:e.thumbUrl??e.url,name:e.name,kind:e.kind,caption:e.name,badges:en(e),dragData:nn?JSON.stringify(ol.isSelected(e.id)?dl:[e.id]):void 0})),rn=Re?Math.max(72,Math.floor((Ke-24-16-1)/3)):112,tn=L(null),on=c({containerRef:tn,enabled:Ue&&!Re&&ae.length>0,selected:ol.selected,setSelection:e=>ol.setSelection(e),clearSelection:ol.clear}),dn=e=>{if(Me){const l=tl.get(e);return void(!l||l.private||l.pickDisabledReason||Te?.(l))}const l=il.indexOf(e);l>=0&&xl(l)},sn=ae.length?null:re?/* @__PURE__ */W(o,{variant:"dashed",title:Le.noMatches}):_e?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyProducts,description:rl(al)}):el?/* @__PURE__ */W(o,{variant:"dashed",title:Le.trashEmpty}):!Vl||Me?/* @__PURE__ */W(o,{variant:"dashed",title:Le.emptyFolder}):null,cn="list"===se&&ae.length>0,mn=sn??(cn?/* @__PURE__ */W("ul",{role:"listbox","aria-multiselectable":Ue||void 0,"aria-label":Le.folders,className:"flex flex-col gap-1",children:ae.map(e=>/* @__PURE__ */K("li",{role:"option","aria-selected":ol.isSelected(e.id),tabIndex:0,"data-grid-item":"","data-grid-id":e.id,onClick:l=>pl(e.id,l),onDoubleClick:()=>dn(e.id),onContextMenu:l=>Dl(e.id,l),onKeyDown:l=>{"Enter"!==l.key&&" "!==l.key||(l.preventDefault(),pl(e.id,l))},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)] "+(ol.isSelected(e.id)?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-gray-100"),children:[
9
9
  /* @__PURE__ */W("img",{src:e.thumbUrl??e.url,alt:"",className:"h-10 w-10 shrink-0 rounded bg-gray-100 object-contain"}),
10
10
  /* @__PURE__ */W("span",{className:"min-w-0 flex-1 truncate",children:e.name}),
11
- /* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:ln(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-gray-500",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(p,{items:an,readOnly:!Yl||Ae,onFiles:Yl&&!Ae?e=>ke(e,nl):void 0,accept:fe,maxSizeBytes:ge,busy:ve,progress:ye,fit:"contain",thumbSize:rn,dragType:nn?G:void 0,selected:ol.selected,onItemClick:pl,onItemDoubleClick:dn,onItemContextMenu:Ue?Dl:void 0,menuOnMedia:Ue})),un=m({count:dl.length,kind:bl(dl),targets:kl({kind:"files",ids:dl}),onPick:e=>xe?.({kind:"files",ids:dl},e.key===s?null:e.key)}),hn=T({variant:"secondary",size:"sm"}),pn=/* @__PURE__ */W(h,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[Y.folder,Le.moveTo]}),items:un,disabled:!!pe.move}),fn=Ue&&dl.length>1&&!_e?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-gray-200 px-3 py-2",children:[
12
- /* @__PURE__ */W(C,{checked:dl.length===ae.length,indeterminate:dl.length<ae.length,onChange:e=>e?ol.selectAll():ol.clear(),label:Le.selected(dl.length)}),/* @__PURE__ */K(R,el?{children:[Ie&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.undo,onClick:()=>Ie(dl),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"secondary-danger",size:"sm",onClick:()=>De(dl),...$l(pe.deleteForever),children:Le.deleteForever})]}:{children:[xe&&pn,we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.edit,disabled:!0,children:Le.rename}),Ce&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.trash,onClick:()=>Ce({kind:"files",ids:dl}),...$l(pe.trash),children:Le.moveFilesToTrash(dl.length)})]}),
13
- /* @__PURE__ */W(z,{variant:"ghost",size:"sm",onClick:ol.clear,children:Le.clearSelection})]}):null,gn=e=>{const l=[],n=(e,n,a)=>{null!=a&&""!==a&&l.push({key:e,label:n,value:a})},a="file"===fl?.kind&&fl.id===e.id;n("name",Le.name,a?/* @__PURE__ */W(X,{value:e.name,label:Le.fileName,onDone:vl}):e.name),n("type",Le.type,e.typeLabel),n("size",Le.size,e.sizeLabel),n("resolution",Le.resolution,e.resolution),_e?(n("design",Le.design,e.design),n("finish",Le.finish,e.finish),n("angle",Le.angleLug,e.angleLug),n("owner",Le.owner,e.owner)):(n("added",Le.addedBy,e.addedBy),n("folder",Le.folder,e.folderPath)),n("used",Le.usedIn,null!=e.usedCount?Le.places(e.usedCount):void 0);const r=c({kind:"files",ids:[e.id]},Cl).find(e=>"submenu"===e.type);/* @__PURE__ */
11
+ /* @__PURE__ */W("span",{className:"flex shrink-0 items-center gap-1",children:ln(e)}),e.sizeLabel&&/* @__PURE__ */W("span",{className:"w-16 shrink-0 text-right text-xs text-gray-500",children:e.sizeLabel})]},e.id))}):/* @__PURE__ */W(v,{items:an,readOnly:!Vl||Me,onFiles:Vl&&!Me?e=>ke(e,nl):void 0,accept:fe,maxSizeBytes:ge,busy:ve,progress:ye,fit:"contain",thumbSize:rn,dragType:nn?G:void 0,selected:ol.selected,onItemClick:pl,onItemDoubleClick:dn,onItemContextMenu:Ue?Dl:void 0,menuOnMedia:Ue})),un=h({count:dl.length,kind:bl(dl),targets:kl({kind:"files",ids:dl}),onPick:e=>xe?.({kind:"files",ids:dl},e.key===m?null:e.key)}),hn=F({variant:"secondary",size:"sm"}),pn=/* @__PURE__ */W(f,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[V.folder,Le.moveTo]}),items:un,disabled:!!pe.move}),fn=Ue&&dl.length>1&&!_e?/* @__PURE__ */K("div",{"data-media-bulk":"",className:"flex flex-wrap items-center gap-2 rounded-lg border border-gray-200 px-3 py-2",children:[
12
+ /* @__PURE__ */W(C,{checked:dl.length===ae.length,indeterminate:dl.length<ae.length,onChange:e=>e?ol.selectAll():ol.clear(),label:Le.selected(dl.length)}),/* @__PURE__ */K(R,el?{children:[Ie&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.undo,onClick:()=>Ie(dl),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"secondary-danger",size:"sm",onClick:()=>De(dl),...$l(pe.deleteForever),children:Le.deleteForever})]}:{children:[xe&&pn,we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.edit,disabled:!0,children:Le.rename}),Ce&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.trash,onClick:()=>Ce({kind:"files",ids:dl}),...$l(pe.trash),children:Le.moveFilesToTrash(dl.length)})]}),
13
+ /* @__PURE__ */W(z,{variant:"ghost",size:"sm",onClick:ol.clear,children:Le.clearSelection})]}):null,gn=e=>{const l=[],n=(e,n,a)=>{null!=a&&""!==a&&l.push({key:e,label:n,value:a})},a="file"===fl?.kind&&fl.id===e.id;n("name",Le.name,a?/* @__PURE__ */W(X,{value:e.name,label:Le.fileName,onDone:vl}):e.name),n("type",Le.type,e.typeLabel),n("size",Le.size,e.sizeLabel),n("resolution",Le.resolution,e.resolution),_e?(n("design",Le.design,e.design),n("finish",Le.finish,e.finish),n("angle",Le.angleLug,e.angleLug),n("owner",Le.owner,e.owner)):(n("added",Le.addedBy,e.addedBy),n("folder",Le.folder,e.folderPath)),n("used",Le.usedIn,null!=e.usedCount?Le.places(e.usedCount):void 0);const r=u({kind:"files",ids:[e.id]},Cl).find(e=>"submenu"===e.type);/* @__PURE__ */
14
14
  return K("div",{"data-media-details":"",className:"flex flex-col gap-3",children:[
15
15
  /* @__PURE__ */W("img",{src:e.url,alt:e.name,className:"aspect-square w-full rounded-lg bg-gray-100 object-contain"}),_e&&/* @__PURE__ */W(D,{tone:"neutral",title:Le.readOnlyBadge,children:rl(al)}),
16
16
  /* @__PURE__ */W(i,{size:"sm",columns:1,items:l}),!el&&/* @__PURE__ */K("div",{className:"flex gap-2",children:[
17
- /* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(v,{size:"sm",readOnly:!0,value:e.url,"aria-label":Le.fileUrl,onFocus:e=>e.currentTarget.select()})}),
18
- /* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.copy,onClick:()=>Cl.copyUrl(e.id),children:Le.copyUrl})]}),ll&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.swap,onClick:()=>je(e.id),...$l(pe.replace),children:Le.replace}),ze&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.crop,onClick:()=>ze(e.id),children:Le.cropEdit}),xe&&"submenu"===r?.type&&/* @__PURE__ */W(h,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[Y.folder,Le.moveTo]}),items:r.items,disabled:!!pe.move}),we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.edit,onClick:()=>gl({kind:"file",id:e.id}),...$l(pe.rename),children:Le.rename}),Ce&&/* @__PURE__ */W(S,{"aria-label":Le.moveToTrash,size:"sm",onClick:()=>Ce({kind:"files",ids:[e.id]}),disabledReason:pe.trash,"aria-disabled":!!pe.trash||void 0,children:Y.trash})]}),el&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[Ie&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:Y.undo,onClick:()=>Ie([e.id]),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:()=>De([e.id]),...$l(pe.deleteForever),children:Le.deleteForever})]}),_e&&Te&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:Y.external,onClick:()=>Te({kind:"render",id:e.id}),children:Le.openInDesign}),he&&/* @__PURE__ */W(f,{items:he})]})},vn=sl?sl.private?Le.privateNoPick:sl.pickDisabledReason:void 0,yn=Ae?/* @__PURE__ */K("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 px-3 py-2",children:[
17
+ /* @__PURE__ */W("div",{style:{flex:"1 1 0",minWidth:0},children:/* @__PURE__ */W(k,{size:"sm",readOnly:!0,value:e.url,"aria-label":Le.fileUrl,onFocus:e=>e.currentTarget.select()})}),
18
+ /* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.copy,onClick:()=>Cl.copyUrl(e.id),children:Le.copyUrl})]}),ll&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[je&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.swap,onClick:()=>je(e.id),...$l(pe.replace),children:Le.replace}),ze&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.crop,onClick:()=>ze(e.id),children:Le.cropEdit}),xe&&"submenu"===r?.type&&/* @__PURE__ */W(f,{align:"start",triggerClassName:hn,trigger:/* @__PURE__ */K(R,{children:[V.folder,Le.moveTo]}),items:r.items,disabled:!!pe.move}),we&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.edit,onClick:()=>gl({kind:"file",id:e.id}),...$l(pe.rename),children:Le.rename}),Ce&&/* @__PURE__ */W(S,{"aria-label":Le.moveToTrash,size:"sm",onClick:()=>Ce({kind:"files",ids:[e.id]}),disabledReason:pe.trash,"aria-disabled":!!pe.trash||void 0,children:V.trash})]}),el&&Ue&&/* @__PURE__ */K("div",{className:"flex flex-wrap gap-2",children:[Ie&&/* @__PURE__ */W(z,{variant:"primary",size:"sm",leftIcon:V.undo,onClick:()=>Ie([e.id]),...$l(pe.restore),children:Le.restore}),De&&/* @__PURE__ */W(z,{variant:"danger",size:"sm",onClick:()=>De([e.id]),...$l(pe.deleteForever),children:Le.deleteForever})]}),_e&&Fe&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",leftIcon:V.external,onClick:()=>Fe({kind:"render",id:e.id}),children:Le.openInDesign}),he&&/* @__PURE__ */W(y,{items:he})]})},vn=sl?sl.private?Le.privateNoPick:sl.pickDisabledReason:void 0,yn=Me?/* @__PURE__ */K("div",{"data-media-picker-footer":"",className:"flex flex-wrap items-center justify-between gap-2 border-t border-gray-200 px-3 py-2",children:[
19
19
  /* @__PURE__ */W("span",{className:"min-w-0 truncate text-sm text-gray-500",children:sl?Le.oneChosen(sl.name):Le.noneChosen}),
20
20
  /* @__PURE__ */K("div",{className:"flex gap-2",children:[Oe&&/* @__PURE__ */W(z,{variant:"secondary",size:"sm",onClick:Oe,children:Le.cancel}),
21
- /* @__PURE__ */W(z,{variant:"primary",size:"sm",disabled:!sl,...$l(vn),onClick:()=>{sl&&!vn&&Fe?.(sl)},children:Le.chooseImage})]})]}):null,kn=Ue&&!!sl,bn=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Ee&&/* @__PURE__ */W(D,{tone:"neutral",children:Ee}),
21
+ /* @__PURE__ */W(z,{variant:"primary",size:"sm",disabled:!sl,...$l(vn),onClick:()=>{sl&&!vn&&Te?.(sl)},children:Le.chooseImage})]})]}):null,kn=Ue&&!!sl,bn=/* @__PURE__ */K("div",{className:"flex min-w-0 flex-col gap-3",children:[Ee&&/* @__PURE__ */W(D,{tone:"neutral",children:Ee}),
22
22
  /* @__PURE__ */K("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[
23
- /* @__PURE__ */W(d,{items:Hl}),Ql]}),_l,fn,
23
+ /* @__PURE__ */W(d,{items:Hl}),Zl]}),_l,fn,
24
24
  /* @__PURE__ */K("div",{ref:tn,className:"relative",onPointerDown:on.onPointerDown,onKeyDown:e=>{Ue&&(e.ctrlKey||e.metaKey)&&"a"===e.key.toLowerCase()?(e.preventDefault(),ol.selectAll()):"Escape"===e.key&&ol.size&&ol.clear()},children:[mn,
25
- /* @__PURE__ */W(a,{rect:on.rect})]}),Yl&&/* @__PURE__ */W("input",{...Vl.inputProps}),
26
- /* @__PURE__ */W(b,{rejections:Vl.rejections})]});/* @__PURE__ */
25
+ /* @__PURE__ */W(a,{rect:on.rect})]}),Vl&&/* @__PURE__ */W("input",{...Yl.inputProps}),
26
+ /* @__PURE__ */W(w,{rejections:Yl.rejections})]});/* @__PURE__ */
27
27
  return K("div",{ref:Be,"data-media-library":"","data-layout":Re?"phone":"wide",className:`flex h-full min-h-0 min-w-0 flex-col ${Pe}`.trim(),children:[/* @__PURE__ */K("div",Re?{className:"flex flex-col gap-3 p-3",children:[Gl,bn]}:{className:"flex min-h-0 min-w-0 flex-1",children:[
28
28
  /* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-r border-gray-200 p-3",style:{width:280,"--rosh-tree-ground":"var(--surface)"},children:Gl}),
29
29
  /* @__PURE__ */W("div",{className:"min-w-0 flex-1 overflow-y-auto p-3",children:bn}),kn&&/* @__PURE__ */W("div",{className:"shrink-0 overflow-y-auto border-l border-gray-200 p-3",style:{width:300},children:gn(sl)})]}),yn,Re&&/* @__PURE__ */W(t,{open:kn,onClose:ol.clear,side:"bottom",title:sl?.name,children:sl&&gn(sl)}),Il.state&&/* @__PURE__ */W(I,{...Il.props,items:Nl(Il.state.data)}),null!=wl&&ae.length>0&&/* @__PURE__ */W(r,{images:ae.map(e=>({url:e.url,caption:e.name})),startIndex:Math.min(wl,ae.length-1),onClose:()=>xl(null)})]})}export{G as MEDIA_FILES_DRAG_TYPE,H as MEDIA_FOLDER_DRAG_TYPE,$ as MediaLibrary};
@@ -1,2 +1,2 @@
1
- import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-53ROHXAV.js";import{PopupMenu as n,MenuSemanticsContext as r}from"./chunk-O6JX6RDX.js";import{leavesContextMenuAlone as o}from"./chunk-5QFPTDQF.js";import{placeAtPoint as i,popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useRef as s,useId as a,useState as d,useEffect as m,useCallback as f}from"react";import{jsx as p,jsxs as v}from"react/jsx-runtime";function h(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function w({at:o,onClose:w,items:y,linkAs:g,children:k,owner:E,"aria-label":b,minWidth:x=180,className:H="",autoFocus:D=!0}){const L=s(null),A=a(),[j,S]=d(null),U=s(w);U.current=w,c(()=>{const e=L.current?.closest("[data-popup-menu-tree]");if(!e)return;const t={width:e.offsetWidth,height:e.offsetHeight},n=i({point:o,menu:t,bounds:l(E??null)});S(e=>e&&e.left===n.left&&e.top===n.top&&e.maxHeight===n.maxHeight?e:{left:n.left,top:n.top,maxHeight:n.maxHeight,scroll:t.height>n.maxHeight})},[o.x,o.y,E]);const C=s(null),T=s(!1);m(()=>(C.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!L.current?.contains(e)||C.current?.focus?.({preventScroll:!0})}),[]),m(()=>{j&&!T.current&&D&&(T.current=!0,h(L.current)[0]?.focus({preventScroll:!0}))},[j,D]),m(()=>{if(D)return;const e=e=>{if(L.current?.contains(document.activeElement))return;const t=h(L.current),n="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;n&&(e.preventDefault(),n.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[D]),m(()=>u(e=>"Escape"===e.key&&(U.current(),!0),()=>L.current),[]),m(()=>{const e=()=>U.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const W=f(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void U.current();const t=h(L.current);if(0===t.length)return;const n=t.indexOf(document.activeElement),r="ArrowDown"===e.key?(n+1)%t.length:"ArrowUp"===e.key?n<=0?t.length-1:n-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;r<0||(e.preventDefault(),t[r].focus())},[]),X=j?{left:j.left,top:j.top,maxHeight:j.maxHeight,...j.scroll?{overflowY:"auto"}:{}}:{left:o.x,top:o.y,visibility:"hidden"};/* @__PURE__ */
2
- return p(n,{portal:!0,minWidth:x,style:X,onClose:w,className:H,children:/* @__PURE__ */p(r.Provider,{value:!0,children:/* @__PURE__ */v("div",{ref:L,id:A,role:"menu","aria-label":b,"aria-describedby":y?t(y,A):void 0,"data-context-menu":"",onKeyDown:W,children:[y&&e(y,{menuId:A,choose:e=>{e.disabled||(U.current(),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>U.current(),linkAs:g}),k]})})})}function y(){const[e,t]=d(null),n=f(()=>t(null),[]),r=f((e,n)=>{const r="nativeEvent"in e?e.nativeEvent:e;if(o(r))return!1;e.preventDefault();const i=e.target instanceof Element?e.target:null;let{clientX:l,clientY:c}=e;if(0===l&&0===c&&i){const e=i.getBoundingClientRect();l=e.left,c=e.bottom}return t({x:l,y:c,data:n,owner:i}),!0},[]),i=f(e=>{r(e,void 0)},[r]);return{open:r,onContextMenu:i,close:n,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:n}}}export{w as ContextMenu,y as useContextMenu};
1
+ import{renderMenuEntries as e,menuStatusIds as t}from"./chunk-B55IXYDR.js";import{PopupMenu as n,MenuSemanticsContext as r}from"./chunk-PJCVNFWM.js";import{leavesContextMenuAlone as o}from"./chunk-5QFPTDQF.js";import{placeAtPoint as i,popupBounds as l}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as c}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as u}from"./chunk-TWVUQUUD.js";import{useRef as s,useId as a,useState as d,useEffect as m,useCallback as f}from"react";import{jsx as p,jsxs as v}from"react/jsx-runtime";function h(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(e=>!e.closest("[data-popup-submenu-panel]")):[]}function w({at:o,onClose:w,items:y,linkAs:g,children:k,owner:E,"aria-label":b,minWidth:x=180,className:D="",autoFocus:H=!0}){const L=s(null),j=a(),[A,S]=d(null),C=s(w);C.current=w,c(()=>{const e=L.current?.closest("[data-popup-menu-tree]");if(!e)return;const t={width:e.offsetWidth,height:e.offsetHeight},n=i({point:o,menu:t,bounds:l(E??null)});S(e=>e&&e.left===n.left&&e.top===n.top&&e.maxHeight===n.maxHeight?e:{left:n.left,top:n.top,maxHeight:n.maxHeight,scroll:t.height>n.maxHeight})},[o.x,o.y,E]);const U=s(null),W=s(!1);m(()=>(U.current=document.activeElement,()=>{const e=document.activeElement;e&&e!==document.body&&!L.current?.contains(e)||U.current?.focus?.({preventScroll:!0})}),[]),m(()=>{A&&!W.current&&H&&(W.current=!0,h(L.current)[0]?.focus({preventScroll:!0}))},[A,H]),m(()=>{if(H)return;const e=e=>{if(L.current?.contains(document.activeElement))return;const t=h(L.current),n="ArrowDown"===e.key||"Home"===e.key?t[0]:"ArrowUp"===e.key||"End"===e.key?t[t.length-1]:void 0;n&&(e.preventDefault(),n.focus({preventScroll:!0}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H]),m(()=>u(e=>"Escape"===e.key&&(C.current(),!0),()=>L.current),[]),m(()=>{const e=()=>C.current();return window.addEventListener("resize",e),window.addEventListener("blur",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("blur",e),window.removeEventListener("scroll",e,!0)}},[]);const F=f(e=>{if(e.target.closest("[data-popup-submenu-panel]"))return;if("Tab"===e.key)return e.preventDefault(),void C.current();const t=h(L.current);if(0===t.length)return;const n=t.indexOf(document.activeElement),r="ArrowDown"===e.key?(n+1)%t.length:"ArrowUp"===e.key?n<=0?t.length-1:n-1:"Home"===e.key?0:"End"===e.key?t.length-1:-1;r<0||(e.preventDefault(),t[r].focus())},[]),T=A?{left:A.left,top:A.top,maxHeight:A.maxHeight,...A.scroll?{overflowY:"auto"}:{}}:{left:o.x,top:o.y,visibility:"hidden"};/* @__PURE__ */
2
+ return p(n,{portal:!0,minWidth:x,style:T,onClose:w,className:D,children:/* @__PURE__ */p(r.Provider,{value:!0,children:/* @__PURE__ */v("div",{ref:L,id:j,role:"menu","aria-label":b,"aria-describedby":y?t(y,j):void 0,"data-context-menu":"",onKeyDown:F,children:[y&&e(y,{menuId:j,choose:e=>{e.disabled||(C.current(),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>C.current(),linkAs:g}),k]})})})}function y(){const[e,t]=d(null),n=f(()=>t(null),[]),r=f((e,n)=>{const r="nativeEvent"in e?e.nativeEvent:e;if(o(r))return!1;e.preventDefault();const i=e.target instanceof Element?e.target:null;let{clientX:l,clientY:c}=e;if(0===l&&0===c&&i){const e=i.getBoundingClientRect();l=e.left,c=e.bottom}return t({x:l,y:c,data:n,owner:i}),!0},[]),i=f(e=>{r(e,void 0)},[r]);return{open:r,onContextMenu:i,close:n,state:e,props:{at:{x:e?.x??0,y:e?.y??0},owner:e?.owner??null,onClose:n}}}export{w as ContextMenu,y as useContextMenu};
@@ -1,4 +1,4 @@
1
- import{PopupMenuDivider as e,PopupMenuLabel as l,menuTextRowStyle as t,PopupSubmenu as i,itemLook as a,MenuCheckMark as r}from"./chunk-O6JX6RDX.js";import{jsx as n,jsxs as s}from"react/jsx-runtime";var d=e=>!!e&&"label"!==e.type&&"status"!==e.type&&"divider"!==e.type&&!e.disabled,c=(e,l)=>`${e}-status-${l}`;function o(e,l){return e.flatMap((e,t)=>"status"===e.type?[c(l,t)]:[]).join(" ")||void 0}function u(d,o){const{menuId:y,choose:b,toggle:h,followLink:p,rowProps:m=()=>({}),linkAs:k}=o,f=k??"a",v=(d,k)=>{if("divider"===d.type)/* @__PURE__ */
1
+ import{PopupMenuDivider as e,PopupMenuLabel as l,menuTextRowStyle as t,PopupSubmenu as i,itemLook as a,MenuCheckMark as r}from"./chunk-PJCVNFWM.js";import{jsx as n,jsxs as s}from"react/jsx-runtime";var d=e=>!!e&&"label"!==e.type&&"status"!==e.type&&"divider"!==e.type&&!e.disabled,c=(e,l)=>`${e}-status-${l}`;function o(e,l){return e.flatMap((e,t)=>"status"===e.type?[c(l,t)]:[]).join(" ")||void 0}function u(d,o){const{menuId:y,choose:b,toggle:h,followLink:p,rowProps:m=()=>({}),linkAs:k}=o,f=k??"a",v=(d,k)=>{if("divider"===d.type)/* @__PURE__ */
2
2
  return n("div",{role:"separator",children:/* @__PURE__ */n(e,{})},d.key);if("label"===d.type)/* @__PURE__ */
3
3
  return n("div",{id:`${y}-label-${k}`,children:/* @__PURE__ */n(l,{children:d.label})},d.key);if("status"===d.type)/* @__PURE__ */
4
4
  return n("div",{id:c(y,k),className:"text-xs",style:t(),children:d.label},d.key);if("submenu"===d.type)/* @__PURE__ */
@@ -7,4 +7,4 @@ return s("button",{type:"button",role:"menuitemcheckbox","aria-checked":d.checke
7
7
  /* @__PURE__ */n(r,{kind:"checkbox",checked:d.checked}),d.icon,d.label]},d.key)}if("radio"===d.type){const e=a(!1,d.disabled,"");/* @__PURE__ */
8
8
  return s("button",{type:"button",role:"menuitemradio","aria-checked":d.checked,disabled:d.disabled,className:e.className,style:e.style,onClick:()=>b(d),...m(k,d),children:[
9
9
  /* @__PURE__ */n(r,{kind:"radio",checked:d.checked}),d.icon,d.label]},d.key)}if((e=>"link"===e.type||void 0===e.type&&"string"==typeof e.href)(d)){const e=a(!1,d.disabled,"no-underline "+(d.current?"font-medium":""));return d.disabled?/* @__PURE__ */s("a",{role:"menuitem","aria-disabled":"true",className:e.className,style:e.style,...m(k,d),children:[d.icon,d.label]},d.key):/* @__PURE__ */s(f,{href:d.href,role:"menuitem","aria-current":d.current?"page":void 0,className:e.className,style:e.style,onClick:p,...m(k,d),children:[d.icon,d.label]},d.key)}const v=a(d.danger,d.disabled,"");/* @__PURE__ */
10
- return s("button",{type:"button",role:"menuitem",disabled:d.disabled,className:v.className,style:v.style,onClick:()=>b(d),...m(k,d),children:[d.icon,d.label]},d.key)},g=[];for(let e=0;e<d.length;){const l=d[e];if("radio"!==l.type&&"checkbox"!==l.type){g.push(v(l,e)),e+=1;continue}const t=l.type,i=e,a=[];for(;e<d.length&&d[e].type===t;)a.push(v(d[e],e)),e+=1;const r="label"===d[i-1]?.type?`${y}-label-${i-1}`:void 0;g.push(/* @__PURE__ */n("div",{role:"group","aria-labelledby":r,children:a},`group:${l.key}`))}return g}export{d as isFocusableEntry,o as menuStatusIds,u as renderMenuEntries};
10
+ return s("button",{type:"button",role:"menuitem",disabled:d.disabled,className:v.className,style:v.style,onClick:()=>b(d),...m(k,d),children:[d.icon,d.label]},d.key)},N=[];for(let e=0;e<d.length;){const l=d[e];if("radio"!==l.type&&"checkbox"!==l.type){N.push(v(l,e)),e+=1;continue}const t=l.type,i=e,a=[];for(;e<d.length&&d[e].type===t;)a.push(v(d[e],e)),e+=1;const r="label"===d[i-1]?.type?`${y}-label-${i-1}`:void 0;N.push(/* @__PURE__ */n("div",{role:"group","aria-labelledby":r,children:a},`group:${l.key}`))}return N}export{d as isFocusableEntry,o as menuStatusIds,u as renderMenuEntries};
@@ -1,4 +1,4 @@
1
- import{Markdown as e}from"./chunk-V3UIAX5G.js";import{PLACEHOLDER_INK as t}from"./chunk-JFSYWEHD.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as s,useMemo as n}from"react";import{jsxs as o,jsx as i,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */i(r,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:y,emptyMessage:f}){const b=a(),[v,w]=s(""),[N,k]=s(null),[C,j]=s({}),M=v.trim().toLowerCase(),L=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let r=e.get(t.category);r||(r={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,r)),r.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>(t.get(e.key)??1/0)-(t.get(r.key)??1/0))},[h,p]),_=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),E=n(()=>L.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[L,M]),A=n(()=>E.flatMap(e=>e.docs),[E]),B=(N?A.find(e=>e.slug===N):void 0)??A[0]??null,z=e=>!!M||(C[e]??e===B?.category);/* @__PURE__ */
1
+ import{Markdown as e}from"./chunk-37JDUDCO.js";import{PLACEHOLDER_INK as t}from"./chunk-JFSYWEHD.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{LoadingSpinner as l}from"./chunk-Q5MD3VY6.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as s,useMemo as n}from"react";import{jsxs as o,jsx as i,Fragment as c}from"react/jsx-runtime";var d=({open:e})=>/* @__PURE__ */i(r,{name:"chevron-right",look:"mini",className:"h-3.5 w-3.5 shrink-0 transition-transform "+(e?"rotate-90":""),"aria-hidden":"true"});function h({docs:h,loading:m=!1,categoryOrder:p,canEdit:u=!1,onNew:g,onEdit:x,renderBody:y,emptyMessage:f}){const b=a(),[v,w]=s(""),[N,k]=s(null),[C,j]=s({}),M=v.trim().toLowerCase(),L=n(()=>{const e=/* @__PURE__ */new Map;for(const t of h){let r=e.get(t.category);r||(r={key:t.category,label:t.category_label||t.category,docs:[]},e.set(t.category,r)),r.docs.push(t)}if(!p?.length)return[...e.values()];const t=new Map(p.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>(t.get(e.key)??1/0)-(t.get(r.key)??1/0))},[h,p]),_=e=>!M||e.title.toLowerCase().includes(M)||e.body.toLowerCase().includes(M)||e.category_label.toLowerCase().includes(M),D=n(()=>L.map(e=>({...e,docs:e.docs.filter(_)})).filter(e=>e.docs.length>0),[L,M]),E=n(()=>D.flatMap(e=>e.docs),[D]),B=(N?E.find(e=>e.slug===N):void 0)??E[0]??null,O=e=>!!M||(C[e]??e===B?.category);/* @__PURE__ */
2
2
  return o("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
3
3
  /* @__PURE__ */o("aside",{className:"w-64 shrink-0 flex flex-col bg-white rounded-lg shadow overflow-hidden",children:[
4
4
  /* @__PURE__ */o("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-gray-200 bg-gray-50 shrink-0",children:[
@@ -6,9 +6,9 @@ return o("div",{className:"flex h-full gap-4 px-4 py-3 min-h-0",children:[
6
6
  /* @__PURE__ */i("div",{className:"px-3 py-2 border-b border-gray-100 shrink-0",children:/* @__PURE__ */o("div",{className:"relative",children:[
7
7
  /* @__PURE__ */i(r,{name:"search",look:"mini",className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 ${t}`,"aria-hidden":"true"}),
8
8
  /* @__PURE__ */i("input",{type:"text",value:v,onChange:e=>w(e.target.value),placeholder:b.help.searchPlaceholder,className:"w-full rounded-md border border-gray-300 bg-white h-8 pl-8 pr-2 text-sm shadow-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})}),
9
- /* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===E.length?/* @__PURE__ */i("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?b.help.noResults:f??b.help.empty}):E.map(e=>{const t=z(e.key);/* @__PURE__ */
9
+ /* @__PURE__ */i("div",{className:"flex-1 overflow-y-auto py-1",children:m?/* @__PURE__ */i(l,{size:"sm",padding:"py-6",label:b.help.loading}):0===D.length?/* @__PURE__ */i("p",{className:"px-3 py-6 text-center text-xs text-gray-500",children:M?b.help.noResults:f??b.help.empty}):D.map(e=>{const t=O(e.key);/* @__PURE__ */
10
10
  return o("div",{className:"py-0.5",children:[
11
- /* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!z(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600",children:[
11
+ /* @__PURE__ */o("button",{type:"button",onClick:()=>{return t=e.key,j(e=>({...e,[t]:!O(t)}));var t},className:"w-full flex items-center gap-2 h-8 px-3 text-left text-3xs font-semibold uppercase tracking-wide text-gray-400 hover:text-gray-600",children:[
12
12
  /* @__PURE__ */i(d,{open:t}),
13
13
  /* @__PURE__ */i("span",{className:"truncate",children:e.label})]}),t&&e.docs.map(e=>{const t=B?.slug===e.slug;/* @__PURE__ */
14
14
  return o("button",{type:"button",onClick:()=>k(e.slug),className:"w-full text-left pl-8 pr-3 min-h-(--row-height-menu) py-2 text-sm flex items-center gap-2 transition-colors "+(t?"bg-blue-50 text-blue-700 font-medium":"text-gray-700 hover:bg-gray-50"),children:[
@@ -1,4 +1,4 @@
1
- import{Segmented as e}from"./chunk-N6DTTOB6.js";import{ColorPicker as t}from"./chunk-2OLSY4GE.js";import{InputNumber_default as l}from"./chunk-4SQNLU2Q.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:N=20,step:v=1,readOnly:x}){const S=e=>"number"==typeof d[e]?d[e]:null,j=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===S(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},k=(e,t,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(l,{value:a,onChange:i,min:g,max:N,step:v,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":t})}),O=n.map(S),C="number"==typeof d.width?d.width:O.every(e=>null!==e&&e===O[0])?O[0]:null,L=null===C&&O.some(e=>null!==e),T=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",z=e=>S(e)??("number"==typeof d.width?d.width:null),B=d.style??u.style;/* @__PURE__ */
2
- return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[k("left",b.sides.left,h.left,z("left"),String(u.sides.left),e=>j("left",e)),k("top",b.sides.top,h.top,z("top"),String(u.sides.top),e=>j("top",e)),k("right",b.sides.right,h.right,z("right"),String(u.sides.right),e=>j("right",e)),k("bottom",b.sides.bottom,h.bottom,z("bottom"),String(u.sides.bottom),e=>j("bottom",e))]}):k("all",b.width,h.all,C,L?"–":T,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(e,{block:!0,size:"sm",label:b.style,value:B,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
1
+ import{ColorPicker as e}from"./chunk-QPX35URZ.js";import{InputNumber_default as t}from"./chunk-MTXTJLFK.js";import{Segmented as l}from"./chunk-N6DTTOB6.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{jsxs as a,Fragment as o,jsx as s}from"react/jsx-runtime";var i=["solid","dashed","dotted"],n=["top","right","bottom","left"];function d(e){const t=e??{},l="number"==typeof t.width?t.width:0;return Object.fromEntries(n.map(e=>[e,"number"==typeof t[e]?t[e]:l]))}function m(e,t){const l=e??{},r=d(t),a=n.some(e=>"number"==typeof l[e]),o=n.map(e=>"number"==typeof l[e]?l[e]:"number"==typeof l.width?l.width:a?0:r[e]);return!o.every(e=>e===o[0])}var c="h-3.5 w-3.5",h={all:/* @__PURE__ */s(r,{name:"border-all","aria-hidden":"true",className:c}),top:/* @__PURE__ */s(r,{name:"border-top","aria-hidden":"true",className:c}),right:/* @__PURE__ */s(r,{name:"border-right","aria-hidden":"true",className:c}),bottom:/* @__PURE__ */s(r,{name:"border-bottom","aria-hidden":"true",className:c}),left:/* @__PURE__ */s(r,{name:"border-left","aria-hidden":"true",className:c})},p={solid:/* @__PURE__ */s(r,{name:"line-solid","aria-hidden":"true",className:c}),dashed:/* @__PURE__ */s(r,{name:"line-dashed","aria-hidden":"true",className:c}),dotted:/* @__PURE__ */s(r,{name:"line-dotted","aria-hidden":"true",className:c})};function u({label:r,value:d,onChange:m,each:c,placeholder:u,presets:f,words:b,widths:w=!0,styles:y=!0,min:g=0,max:v=20,step:N=1,readOnly:x}){const j=e=>"number"==typeof d[e]?d[e]:null,k=(e,t)=>{const l={...d};if("number"==typeof d.width)for(const e of n)null===j(e)&&(l[e]=d.width);l[e]=t,delete l.width,m(l)},S=(e,l,r,a,o,i)=>/* @__PURE__ */s("div",{"data-side":e,className:"all"===e?"col-span-2 min-w-0":"min-w-0",children:/* @__PURE__ */s(t,{value:a,onChange:i,min:g,max:v,step:N,precision:0,steppers:"compact",readOnly:x,placeholder:o,prefix:r,suffix:b.unit,"aria-label":l})}),T=n.map(j),C="number"==typeof d.width?d.width:T.every(e=>null!==e&&e===T[0])?T[0]:null,O=null===C&&T.some(e=>null!==e),z=n.every(e=>u.sides[e]===u.sides.top)?String(u.sides.top):"–",B=e=>j(e)??("number"==typeof d.width?d.width:null),I=d.style??u.style;/* @__PURE__ */
2
+ return a("div",{role:"group","aria-label":r,"data-border":c?"each":"all",className:"grid w-full min-w-0 grid-cols-2 gap-2",children:[w?c?/* @__PURE__ */a(o,{children:[S("left",b.sides.left,h.left,B("left"),String(u.sides.left),e=>k("left",e)),S("top",b.sides.top,h.top,B("top"),String(u.sides.top),e=>k("top",e)),S("right",b.sides.right,h.right,B("right"),String(u.sides.right),e=>k("right",e)),S("bottom",b.sides.bottom,h.bottom,B("bottom"),String(u.sides.bottom),e=>k("bottom",e))]}):S("all",b.width,h.all,C,O?"–":z,e=>{const t={...d,width:e};for(const e of n)delete t[e];m(t)}):null,y&&/* @__PURE__ */s("div",{"data-border-style":"",className:"col-span-2 min-w-0",children:/* @__PURE__ */s(l,{block:!0,size:"sm",label:b.style,value:I,onChange:e=>{x||m({...d,style:e})},options:i.map(e=>({value:e,label:/* @__PURE__ */a(o,{children:[p[e],
3
3
  /* @__PURE__ */s("span",{className:"sr-only",children:b.styles[e]})]}),title:b.styles[e]}))})}),
4
- /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(t,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
4
+ /* @__PURE__ */s("div",{"data-border-color":"",className:"col-span-2 flex min-w-0 items-center",children:/* @__PURE__ */s(e,{value:d.color??"",onChange:e=>{x||m({...d,color:e})},label:b.color,presets:f,fallback:u.color,showHexInput:!0,size:"sm",disabled:x})})]})}export{i as BORDER_LINE_STYLES,u as BorderInput,d as borderSides,m as borderStartEach};
@@ -1,4 +1,4 @@
1
- import{InputNumber_default as e}from"./chunk-4SQNLU2Q.js";import{IconButton_default as r}from"./chunk-4CANQ3B3.js";import{Icon as a}from"./chunk-KIBL6M3T.js";import{Tooltip as i}from"./chunk-22S6LG6D.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:C,id:j,className:A=""}){const N=n(),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)}(f),[L,M]=l(0),D=o(null);/* @__PURE__ */
1
+ import{InputNumber_default as e}from"./chunk-MTXTJLFK.js";import{IconButton_default as r}from"./chunk-4CANQ3B3.js";import{Icon as a}from"./chunk-KIBL6M3T.js";import{Tooltip as i}from"./chunk-22S6LG6D.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{useState as l,useRef as o}from"react";import{jsxs as t,jsx as s}from"react/jsx-runtime";var d={tl:"",tr:"rotate-90",br:"rotate-180",bl:"-rotate-90"},c=["tl","tr","bl","br"];function u({label:u,value:m,corners:f,onChange:p,radius:h=null,onRadiusChange:v,radiusLabel:b,radiusMin:k=0,radiusMax:g,radiusStep:x=1,radiusPlaceholder:w,disabled:y=!1,disabledReason:C,id:j,className:A=""}){const K=n(),M=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)}(f),[N,L]=l(0),D=o(null);/* @__PURE__ */
2
2
  return t("div",{id:j,role:"group","aria-label":u,className:`flex min-w-0 flex-wrap items-center gap-2 ${A}`.trim(),children:[v&&
3
- /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:N.corners.radiusMark}),suffix:N.corners.unit,steppers:"compact",disabled:y,"aria-label":b??N.corners.radius})}),
4
- /* @__PURE__ */s("div",{ref:D,"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(D.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,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?C:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===L?0:-1,onFocus:()=>M(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};
3
+ /* @__PURE__ */s("div",{className:"w-30 shrink-0",children:/* @__PURE__ */s(e,{value:h,onChange:v,min:k,max:g,step:x,precision:0,placeholder:w,prefix:/* @__PURE__ */s("span",{"data-radius-mark":"","aria-hidden":"true",children:K.corners.radiusMark}),suffix:K.corners.unit,steppers:"compact",disabled:y,"aria-label":b??K.corners.radius})}),
4
+ /* @__PURE__ */s("div",{ref:D,"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(D.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:M.map((e,n)=>{const l=m.includes(e.value),o=y||!0===e.disabled,t=o&&(!0===e.disabled&&e.title||(y?C:void 0))||void 0,c=/* @__PURE__ */s(r,{"aria-pressed":l,"aria-label":e.label,"aria-disabled":o||void 0,disabledReason:t,"data-corner":e.value,size:"sm",tabIndex:n===N?0:-1,onFocus:()=>L(n),onClick:()=>{o||p(l?m.filter(r=>r!==e.value):[...m,e.value])},children:/* @__PURE__ */s(a,{name:"corner",strokeWidth:2,className:["h-4 w-4",d[e.value]??""].filter(Boolean).join(" ")})},e.value);return t?c:/* @__PURE__ */s(i,{content:e.title??e.label,children:c},e.value)})})]})}export{u as CornersInput};
@@ -1,9 +1,9 @@
1
- import{ImageFocusPoint as e}from"./chunk-GATKJSGL.js";import{FormField as a}from"./chunk-MVQBVPWP.js";import{Segmented as i}from"./chunk-N6DTTOB6.js";import{isVideoUrl as t,mediaPromptLine as r,mediaFileName as o,FilenameBadge as n,BusyOverlay as l,UploadGlyph as s,dropzoneClass as c,zoneFocusClass as d}from"./chunk-DTSCO7VM.js";import{TransferProgress as u}from"./chunk-S7VSXUKS.js";import{useFileIntake as m,FileIntakeAlert as h}from"./chunk-YDYDR72S.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{useShellStrings as b}from"./chunk-E6UCGCOC.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as j,Fragment as x}from"react/jsx-runtime";var N=["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:C,onFile:R,label:U,hint:F,error:O,required:S,className:P,accept:$="image/*",maxSizeBytes:z,fit:B="cover",height:T=112,placeholder:V,cta:D,acceptHint:K,showFilename:q=!0,allowReplace:G=!0,allowRemove:H=!0,replaceLabel:I,removeLabel:M,busy:A=!1,busyLabel:W,choosingLabel:Y,pickFailedLabel:_,progress:E,disabled:J=!1,kind:Q,onKindChange:X,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=D??ie.cta,re=Q??(/video/.test($)&&!/image/.test($)?"video":"image"),oe="string"==typeof M&&M?M:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=A||ne,me=ne&&!A?Y??ie.choosing:W??ie.uploading,he=O??(se?_??ie.pickFailed:void 0),pe=e=>{if(!C)return;ce(!1);const a=C(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=J||ue,ke=!!w&&(t(w,$)||w===ve),je=V??r($,ie),xe=I??(ke||"video"===re?ie.changeVideo:ie.changeImage),Ne=e=>{C?pe(e):R?R(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=m({accept:$,maxSizeBytes:z,acceptHint:K,multiple:!1,disabled:ye,onAccept:([e])=>Ne(e)}),{dragOver:Le}=we,Ce=()=>{ye||(C?pe():we.open())},Re=w?o(w):"",Ue=!ke&&!!ee,Fe=J||!G&&!H?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["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:[G&&/* @__PURE__ */k("button",{id:Ue?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Ce(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${N}`,children:[
1
+ import{FormField as e}from"./chunk-MVQBVPWP.js";import{ImageFocusPoint as a}from"./chunk-GATKJSGL.js";import{isVideoUrl as i,mediaPromptLine as t,mediaFileName as r,FilenameBadge as o,BusyOverlay as n,UploadGlyph as l,dropzoneClass as s,zoneFocusClass as c}from"./chunk-DTSCO7VM.js";import{TransferProgress as d}from"./chunk-S7VSXUKS.js";import{useFileIntake as u,FileIntakeAlert as m}from"./chunk-YDYDR72S.js";import{Segmented as h}from"./chunk-N6DTTOB6.js";import{Icon as p}from"./chunk-KIBL6M3T.js";import{useShellStrings as b}from"./chunk-E6UCGCOC.js";import{useState as g,useRef as v,useEffect as f,useId as y}from"react";import{jsxs as k,jsx as j,Fragment as x}from"react/jsx-runtime";var N=["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:C,onFile:R,label:U,hint:F,error:O,required:S,className:P,accept:$="image/*",maxSizeBytes:z,fit:B="cover",height:T=112,placeholder:V,cta:D,acceptHint:K,showFilename:q=!0,allowReplace:G=!0,allowRemove:H=!0,replaceLabel:I,removeLabel:M,busy:A=!1,busyLabel:W,choosingLabel:Y,pickFailedLabel:_,progress:E,disabled:J=!1,kind:Q,onKindChange:X,focus:Z,onFocusChange:ee,focusLabel:ae}){const ie=b().media,te=D??ie.cta,re=Q??(/video/.test($)&&!/image/.test($)?"video":"image"),oe="string"==typeof M&&M?M:ie.remove,[ne,le]=g(!1),[se,ce]=g(!1),de=v(!0);f(()=>()=>{de.current=!1},[]);const ue=A||ne,me=ne&&!A?Y??ie.choosing:W??ie.uploading,he=O??(se?_??ie.pickFailed:void 0),pe=e=>{if(!C)return;ce(!1);const a=C(e);a&&"function"==typeof a.then&&(le(!0),a.then(e=>{de.current&&(le(!1),"string"==typeof e&&e&&L(e))},()=>{de.current&&(le(!1),ce(!0))}))},be=y(),ge=v(null),[ve,fe]=g(null);f(()=>()=>{ge.current&&URL.revokeObjectURL(ge.current)},[]);const ye=J||ue,ke=!!w&&(i(w,$)||w===ve),je=V??t($,ie),xe=I??(ke||"video"===re?ie.changeVideo:ie.changeImage),Ne=e=>{C?pe(e):R?R(e):(e=>{ge.current&&URL.revokeObjectURL(ge.current);const a=URL.createObjectURL(e);ge.current=a,fe(e.type.startsWith("video/")?a:null),L(a)})(e)},we=u({accept:$,maxSizeBytes:z,acceptHint:K,multiple:!1,disabled:ye,onAccept:([e])=>Ne(e)}),{dragOver:Le}=we,Ce=()=>{ye||(C?pe():we.open())},Re=w?r(w):"",Ue=!ke&&!!ee,Fe=J||!G&&!H?null:/* @__PURE__ */k("div",{"data-media-bar":"",className:["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:[G&&/* @__PURE__ */k("button",{id:Ue?void 0:be,type:"button","aria-labelledby":`${be}-change`,onClick:()=>Ce(),disabled:ue,className:`min-w-0 flex-1 gap-1 px-2 text-sm font-medium ${N}`,children:[
2
2
  /* @__PURE__ */j(p,{name:"swap","aria-hidden":"true",className:"h-4 w-4 shrink-0"}),
3
3
  /* @__PURE__ */j("span",{id:`${be}-change`,className:"truncate",children:xe})]}),H&&/* @__PURE__ */j("button",{type:"button","aria-label":oe,onClick:()=>{ge.current&&(URL.revokeObjectURL(ge.current),ge.current=null),fe(null),L("")},disabled:ue,className:`ml-auto w-8 shrink-0 ${N}`,children:/* @__PURE__ */j(p,{name:"trash","aria-hidden":"true",className:"h-4 w-4"})})]}),Oe=/* @__PURE__ */k("div",{...we.zoneProps,"data-media-frame":"",className:["group/media relative overflow-hidden rounded-(--radius-control) border transition-colors",Ue?"":"bg-gray-100",Le?"border-blue-500":"border-gray-200"].join(" "),style:Ue?void 0:{height:T},children:[Ue?
4
- /* @__PURE__ */j(e,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */j("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Re||void 0,className:"h-full w-full",style:{objectFit:B}}):/* @__PURE__ */j("img",{src:w??void 0,alt:Re,className:"h-full w-full",style:{objectFit:B,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */j(n,{children:Re}),Fe,ue&&/* @__PURE__ */j(l,{label:me,progress:E,rounded:"rounded-md"})]}),Se=/* @__PURE__ */j("button",{type:"button",id:be,onClick:()=>Ce(),disabled:ye,"aria-label":"string"==typeof je?je:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":S||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:c(Le,ye,d(ye)),style:{minHeight:T},children:ue?/* @__PURE__ */j(u,{state:"busy",verb:me,pct:E}):/* @__PURE__ */k(x,{children:[
5
- /* @__PURE__ */j("span",{className:"text-gray-400",children:/* @__PURE__ */j(s,{})}),
4
+ /* @__PURE__ */j(a,{value:Z??"",onChange:e=>ee?.(e),label:ae??ie.focus,image:w,hint:null,id:be,disabled:ye,className:"[&_[data-image-focus-picture]]:rounded-none [&_[data-image-focus-picture]]:border-0"}):ke?/* @__PURE__ */j("video",{src:w??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":Re||void 0,className:"h-full w-full",style:{objectFit:B}}):/* @__PURE__ */j("img",{src:w??void 0,alt:Re,className:"h-full w-full",style:{objectFit:B,objectPosition:Z||void 0}}),q&&w&&/* @__PURE__ */j(o,{children:Re}),Fe,ue&&/* @__PURE__ */j(n,{label:me,progress:E,rounded:"rounded-md"})]}),Se=/* @__PURE__ */j("button",{type:"button",id:be,onClick:()=>Ce(),disabled:ye,"aria-label":"string"==typeof je?je:ie.upload,"aria-busy":ue||void 0,"aria-invalid":!!he||void 0,"aria-required":S||void 0,"aria-describedby":he?`${be}-error`:F?`${be}-hint`:void 0,...we.zoneProps,className:s(Le,ye,c(ye)),style:{minHeight:T},children:ue?/* @__PURE__ */j(d,{state:"busy",verb:me,pct:E}):/* @__PURE__ */k(x,{children:[
5
+ /* @__PURE__ */j("span",{className:"text-gray-400",children:/* @__PURE__ */j(l,{})}),
6
6
  /* @__PURE__ */j("span",{className:"px-3 text-xs text-gray-500",children:je}),
7
7
  /* @__PURE__ */j("span",{className:"text-sm font-medium text-blue-600",children:te}),K&&/* @__PURE__ */j("span",{className:"text-xs text-gray-400",children:K})]})});/* @__PURE__ */
8
- return k(a,{label:U,htmlFor:be,hint:F,error:he,required:S,className:P,children:[X&&/* @__PURE__ */j("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */j(i,{value:re,onChange:e=>X(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */j(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */j(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof U&&U?U:ie.upload})}),w?Oe:Se,!C&&/* @__PURE__ */j("input",{...we.inputProps}),
9
- /* @__PURE__ */j(h,{rejections:we.rejections})]})}export{w as MediaUploadField};
8
+ return k(e,{label:U,htmlFor:be,hint:F,error:he,required:S,className:P,children:[X&&/* @__PURE__ */j("div",{"data-media-kind":"",className:"mb-2",children:/* @__PURE__ */j(h,{value:re,onChange:e=>X(e),options:[{value:"image",label:ie.image,icon:/* @__PURE__ */j(p,{name:"image","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye},{value:"video",label:ie.video,icon:/* @__PURE__ */j(p,{name:"play","aria-hidden":"true",className:"h-4 w-4"}),disabled:ye}],block:!0,size:"md",label:"string"==typeof U&&U?U:ie.upload})}),w?Oe:Se,!C&&/* @__PURE__ */j("input",{...we.inputProps}),
9
+ /* @__PURE__ */j(m,{rejections:we.rejections})]})}export{w as MediaUploadField};
@@ -1,11 +1,11 @@
1
- import{MediaUploadField as e}from"./chunk-MXVJHVVI.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-4IU5BSVE.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,U]=l(null),[C,R]=l(""),[I,H]=l(""),[E,O]=l(!1),[V,A]=l(!1),B=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),F=t().brandAsset,G=C||d||g||"",S=L?null:d?o:h,P=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const $=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
1
+ import{MediaUploadField as e}from"./chunk-JCMP5KMS.js";import{BrandMark as r}from"./chunk-MI67DI3H.js";import{Button_default as a}from"./chunk-4IU5BSVE.js";import{useShellStrings as t}from"./chunk-E6UCGCOC.js";import{useRef as i,useState as l,useEffect as s}from"react";import{jsxs as n,jsx as c}from"react/jsx-runtime";function d({committedUrl:d,committedHasAlpha:o=null,committedIsLight:m=null,fallbackUrl:g,fallbackHasAlpha:h=null,fallbackIsLight:u=null,subjectName:b,assetName:p,onSave:x,onRemove:f,accept:v="image/png,image/x-icon,image/vnd.microsoft.icon,.ico,image/svg+xml,image/jpeg,image/webp",acceptHint:y="PNG · ICO · SVG · JPG · WEBP",maxBytes:N=5242880,previews:w=[],disabled:k=!1}){const j=i(null),[L,U]=l(null),[C,R]=l(""),[I,E]=l(""),[H,O]=l(!1),[S,A]=l(!1),B=function(e){return e.trim().toLocaleLowerCase().split(/\s+/).at(-1)||"image"}(p),F=t().brandAsset,G=C||d||g||"",P=L?null:d?o:h,M=L?null:d?m:u;s(()=>()=>{j.current&&URL.revokeObjectURL(j.current)},[]);const $=()=>{j.current&&(URL.revokeObjectURL(j.current),j.current=null)};/* @__PURE__ */
2
2
  return n("section",{"aria-label":F.region(p,b),className:"grid gap-4 lg:grid-cols-2",children:[
3
3
  /* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4",children:[
4
- /* @__PURE__ */c(e,{value:G,onChange:()=>{},onFile:e=>{if(k)return;$();const r=URL.createObjectURL(e);j.current=r,U(e),R(r),H("")},label:p,hint:I||F.usedFor(b),error:I||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:E||V,disabled:k}),
4
+ /* @__PURE__ */c(e,{value:G,onChange:()=>{},onFile:e=>{if(k)return;$();const r=URL.createObjectURL(e);j.current=r,U(e),R(r),E("")},label:p,hint:I||F.usedFor(b),error:I||void 0,accept:v,acceptHint:y,maxSizeBytes:N,fit:"contain",height:180,allowRemove:!1,busy:H||S,disabled:k}),
5
5
  /* @__PURE__ */n("div",{className:"mt-3 flex flex-wrap gap-2",children:[
6
- /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!E){O(!0),H("");try{await x(L),$(),U(null),R("")}catch(e){H(e instanceof Error?e.message:F.saveFailed(B,p))}finally{O(!1)}}},disabled:!L||k,loading:E,children:F.save(B,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!V){if(L)return $(),U(null),R(""),void H("");if(d){A(!0),H("");try{await f()}catch(e){H(e instanceof Error?e.message:F.removeFailed(B,p))}finally{A(!1)}}}},disabled:k,loading:V,children:L?F.discard:F.remove(B,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":F.previews(p),children:[
6
+ /* @__PURE__ */c(a,{onClick:async()=>{if(L&&!k&&!H){O(!0),E("");try{await x(L),$(),U(null),R("")}catch(e){E(e instanceof Error?e.message:F.saveFailed(B,p))}finally{O(!1)}}},disabled:!L||k,loading:H,children:F.save(B,p)}),(L||d)&&/* @__PURE__ */c(a,{variant:"ghost-danger",onClick:async()=>{if(!k&&!S){if(L)return $(),U(null),R(""),void E("");if(d){A(!0),E("");try{await f()}catch(e){E(e instanceof Error?e.message:F.removeFailed(B,p))}finally{A(!1)}}}},disabled:k,loading:S,children:L?F.discard:F.remove(B,p)})]})]}),w.length>0&&/* @__PURE__ */n("div",{className:"rounded-lg border border-gray-200 bg-white p-4","aria-label":F.previews(p),children:[
7
7
  /* @__PURE__ */c("h3",{className:"text-sm font-semibold text-gray-900",children:F.preview}),
8
- /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:G,alt:F.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:S,isLight:P,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
8
+ /* @__PURE__ */c("div",{className:"mt-3 grid gap-3",children:w.map(e=>{const a=/* @__PURE__ */c(r,{src:G,alt:F.alt(b,p),slot:e.slot,surface:e.surface,adaptive:!0,hasAlpha:P,isLight:M,size:"browser-tab"===e.kind?16:void 0});/* @__PURE__ */
9
9
  return n("div",{"data-brand-preview":!0,className:"dark"===e.surface?"text-white":"text-gray-900",children:[
10
10
  /* @__PURE__ */c("div",{className:"mb-2 text-xs font-medium text-gray-500",children:e.label}),"browser-tab"===e.kind?/* @__PURE__ */n("div",{className:"flex items-end gap-1 border-b border-gray-200",children:[
11
11
  /* @__PURE__ */n("div",{className:"flex max-w-[220px] items-center gap-2 rounded-t-lg border border-b-0 border-gray-200 bg-white px-3 py-2",children:[a,
@@ -1,4 +1,4 @@
1
- import{Modal as e}from"./chunk-WPTG7ZC5.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-L3NYH4QV.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"}),