@grapesjs/studio-sdk-plugins 1.0.37 → 1.0.38

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 (93) hide show
  1. package/dist/accordionComponent/index.cjs.js +3 -3
  2. package/dist/accordionComponent/index.es.js +12 -12
  3. package/dist/accordionComponent/index.umd.js +3 -3
  4. package/dist/aiChat/index.cjs.js +85 -85
  5. package/dist/aiChat/index.es.js +9759 -9332
  6. package/dist/aiChat/index.js +85 -85
  7. package/dist/aiChat/index.umd.js +86 -86
  8. package/dist/aiChat/locales/en.d.ts +11 -0
  9. package/dist/aiChat/server/index.cjs.js +1 -1
  10. package/dist/aiChat/server/index.es.js +1 -1
  11. package/dist/aiChat/server/index.js +1 -1
  12. package/dist/aiChat/server/index.umd.js +1 -1
  13. package/dist/aiChat/types.d.ts +1 -1
  14. package/dist/animationComponent/index.cjs.js +3 -3
  15. package/dist/animationComponent/index.es.js +10 -10
  16. package/dist/animationComponent/index.umd.js +3 -3
  17. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  18. package/dist/canvasAbsoluteMode/index.es.js +10 -10
  19. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  20. package/dist/canvasEmptyState/index.cjs.js +1 -1
  21. package/dist/canvasEmptyState/index.es.js +1 -1
  22. package/dist/canvasEmptyState/index.umd.js +1 -1
  23. package/dist/canvasFullSize/index.cjs.js +4 -4
  24. package/dist/canvasFullSize/index.es.js +15 -15
  25. package/dist/canvasFullSize/index.umd.js +3 -3
  26. package/dist/canvasGridMode/index.cjs.js +2 -2
  27. package/dist/canvasGridMode/index.es.js +233 -228
  28. package/dist/canvasGridMode/index.umd.js +2 -2
  29. package/dist/canvasScreenshot/index.cjs.js +1 -1
  30. package/dist/canvasScreenshot/index.es.js +11 -11
  31. package/dist/canvasScreenshot/index.umd.js +1 -1
  32. package/dist/dataSourceEjs/index.cjs.js +2 -2
  33. package/dist/dataSourceEjs/index.es.js +5 -5
  34. package/dist/dataSourceEjs/index.umd.js +1 -1
  35. package/dist/dataSourceHandlebars/index.cjs.js +1 -1
  36. package/dist/dataSourceHandlebars/index.es.js +105 -105
  37. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  38. package/dist/dialogComponent/index.cjs.js +3 -3
  39. package/dist/dialogComponent/index.es.js +18 -18
  40. package/dist/dialogComponent/index.umd.js +3 -3
  41. package/dist/flexComponent/index.cjs.js +1 -1
  42. package/dist/flexComponent/index.es.js +1 -1
  43. package/dist/flexComponent/index.umd.js +3 -3
  44. package/dist/fsLightboxComponent/index.cjs.js +1 -1
  45. package/dist/fsLightboxComponent/index.es.js +7 -7
  46. package/dist/fsLightboxComponent/index.umd.js +2 -2
  47. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  48. package/dist/googleFontsAssetProvider/index.es.js +12 -12
  49. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  50. package/dist/iconifyComponent/index.cjs.js +2 -2
  51. package/dist/iconifyComponent/index.es.js +61 -61
  52. package/dist/iconifyComponent/index.umd.js +2 -2
  53. package/dist/index.cjs.js +24 -24
  54. package/dist/index.es.js +335 -330
  55. package/dist/index.umd.js +25 -25
  56. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  57. package/dist/layoutSidebarButtons/index.es.js +15 -15
  58. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  59. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  60. package/dist/lightGalleryComponent/index.es.js +20 -20
  61. package/dist/lightGalleryComponent/index.umd.js +1 -1
  62. package/dist/linkImageComponent/index.cjs.js +1 -1
  63. package/dist/linkImageComponent/index.es.js +1 -1
  64. package/dist/linkImageComponent/index.umd.js +2 -2
  65. package/dist/listPagesComponent/index.cjs.js +2 -2
  66. package/dist/listPagesComponent/index.es.js +10 -10
  67. package/dist/listPagesComponent/index.umd.js +2 -2
  68. package/dist/presetPrintable/index.cjs.js +5 -5
  69. package/dist/presetPrintable/index.es.js +47 -47
  70. package/dist/presetPrintable/index.umd.js +4 -4
  71. package/dist/prosemirror/index.cjs.js +1 -1
  72. package/dist/prosemirror/index.es.js +1 -1
  73. package/dist/prosemirror/index.umd.js +1 -1
  74. package/dist/rendererReact/index.cjs.js +1 -1
  75. package/dist/rendererReact/index.es.js +16 -16
  76. package/dist/rendererReact/index.js +1 -1
  77. package/dist/rendererReact/index.umd.js +1 -1
  78. package/dist/rteTinyMce/index.cjs.js +2 -2
  79. package/dist/rteTinyMce/index.es.js +27 -27
  80. package/dist/rteTinyMce/index.umd.js +1 -1
  81. package/dist/shapeDividerComponent/index.cjs.js +1 -1
  82. package/dist/shapeDividerComponent/index.es.js +10 -10
  83. package/dist/shapeDividerComponent/index.umd.js +2 -2
  84. package/dist/swiperComponent/index.cjs.js +1 -1
  85. package/dist/swiperComponent/index.es.js +1 -1
  86. package/dist/swiperComponent/index.umd.js +1 -1
  87. package/dist/tableComponent/index.cjs.js +1 -1
  88. package/dist/tableComponent/index.es.js +9 -9
  89. package/dist/tableComponent/index.umd.js +1 -1
  90. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  91. package/dist/youtubeAssetProvider/index.es.js +5 -5
  92. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  93. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- "use strict";const Mv=require("@ai-sdk/react"),jo=require("ai"),c=require("react/jsx-runtime"),h=require("react"),$n=require("react-dom"),Xw=require("react-dom/client"),Jw=require("marked"),Qw=require("react-markdown"),eS=require("remark-gfm");function Nv(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const rt=Nv(h),tS=Nv($n),$v="app.grapesjs.com",kv="app-stage.grapesjs.com",nS="app2.grapesjs.com",sS="app-stage2.grapesjs.com",ag=[$v,nS,kv,sS,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],rS="license:check:start",dp="license:check:end",os=()=>typeof window<"u",Oo=e=>e&&e.stopPropagation(),oS=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),iS=(e,t)=>{const n=s=>s.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},aS=(e="")=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},lS=e=>iS("Escape",e),cS=(e,t={})=>{const n=dt(e)?{id:e,src:e}:e;return new Promise((s,r)=>{var f,g;const{loadedScripts:o}=t,{id:i,src:a}=n,l=document.querySelector(`script[src="${a}"]`);if(l){if((f=t.onScript)==null||f.call(t,l),o&&!o.get(a)){l.addEventListener("load",()=>s(i)),l.addEventListener("error",()=>r(i));return}return s(i)}const u=window.define;window.define=void 0;const d=()=>{o==null||o.set(a,!0),window.define=u},p=document.createElement("script");p.src=a,p.onload=()=>{s(i),d()},p.onerror=()=>{r(i),d()},document.head.appendChild(p),(g=t.onScript)==null||g.call(t,p)})},uS=e=>{const t=e.map(n=>cS(n));return Promise.allSettled(t)};function dS(e){const t=e.ownerDocument.createElement("script");return t.text=e.innerHTML,Array.from(e.attributes).forEach(n=>t.setAttribute(n.nodeName,n.nodeValue)),t}function lg(e){const t=s=>{var r;if(s.length){const o=s.shift(),i=dS(o);i.onerror=i.onload=t.bind(null,s),(r=o.parentNode)==null||r.replaceChild(i,o)}},n=Array.from(e.querySelectorAll("script"));t(n)}const Rv=e=>new DOMParser().parseFromString(e,"text/html"),pS=(e="")=>Rv(`<body>${e}</body>`).body.innerHTML,fS=(e="")=>Rv(`<head>${e}</head>`).head.innerHTML,hS=(e="",t)=>{const s=new DOMParser().parseFromString(e,"text/html");if(t){const o=s.querySelectorAll("svg")[0].style||{},i=wS(t)?`${t}px`:t;o.width=i,o.height=i,o.fill="currentColor"}return new XMLSerializer().serializeToString(s)},mf=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?kv:$v}`}/${n?"platform-api":"api"}`,gS=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},Iv=(e={})=>{const{width:t=300,height:n,text:s="IMAGE",bg:r="777",fg:o="white"}=e,i=n?`x${n}`:"";return`https://placehold.co/${t}${i}/${r}/${o}.png?text=${s}`},mS=Iv(),vS=()=>{if(!os())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},vf=()=>{const e=vS();return!!e&&(ag.includes(e)||ag.some(t=>e.endsWith(t)))},Is=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),bS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),yS=()=>{},xS=240,Dt=e=>typeof e<"u",dt=e=>typeof e=="string",wS=e=>typeof e=="number";function tt(e){return typeof e=="function"}function yr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const SS=e=>!e||Object.keys(e).length===0,pi=(e,t)=>{const n=(e||"").toLocaleLowerCase(),s=(t||"").toLocaleLowerCase();return n.includes(s)},CS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},jS=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=n.length;for(let r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*s));return t},Vv=e=>!!e.Components.getType("mjml"),Kc=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),ES=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(o,i)=>{const a=i.trim();return!a||!n.has(a)?"":`__var__${a}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(o,i)=>`{{ ${i} }}`)};async function PS({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const a=`${t||mf({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...s}};o&&(l.body=JSON.stringify(o));const u=r?new URLSearchParams(r).toString():"",d=u?`?${u}`:"",p=await fetch(`${a}${d}`,l);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var oi=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(oi||{}),un=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(un||{}),ne=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(ne||{}),Hn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Hn||{}),Hr=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(Hr||{}),jt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(jt||{});const cg={[oi.free]:0,[oi.startup]:10,[oi.business]:20,[oi.enterprise]:30};function TS(e){const t=e;return t.init=n=>s=>e(s,n),t}const OS=e=>TS(e);async function _S({editor:e,plan:t,pluginName:n,licenseKey:s,onLicenseCheckResponse:r,cleanup:o}){let i="",a;const l=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),o()},u=(p={})=>{var b;const{error:f,sdkLicense:g}=p,m=(b=p.plan)==null?void 0:b.category;if(!(g||p.license)||f)l(f||"Invalid license");else if(m){const x=cg[t],y=cg[m];x>y&&l({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(ne.settings)&&(a=e.runCommand(ne.settings),i=(a==null?void 0:a.baseUrl)||"");const d=p=>{r==null||r(p),p&&u(p)};if(!a){e.onReady(async()=>{if(!vf())if(s){const p=await LS({licenseKey:s,pluginName:n,baseApiUrl:i});d(p)}else l("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const p=AS(a);d(p);return}e.on(dp,p=>d(p))}const AS=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function LS(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await PS({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}var MS="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M11 7H13V13H11V7M11 15H13V17H11V15Z",NS="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",$S="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",kS="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",RS="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z",IS="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",VS="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z",HS="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",DS="M20 13.5C20 17.09 17.09 20 13.5 20H6V18H13.5C16 18 18 16 18 13.5S16 9 13.5 9H7.83L10.91 12.09L9.5 13.5L4 8L9.5 2.5L10.92 3.91L7.83 7H13.5C17.09 7 20 9.91 20 13.5Z",FS="M10.5 18H18V20H10.5C6.91 20 4 17.09 4 13.5S6.91 7 10.5 7H16.17L13.08 3.91L14.5 2.5L20 8L14.5 13.5L13.09 12.09L16.17 9H10.5C8 9 6 11 6 13.5S8 18 10.5 18Z",BS="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",zS="M3,21V3H21V21H3M5,5V19H19V5H5Z",US="M3 16C3 18.8 5.2 21 8 21H10V19H8C6.3 19 5 17.7 5 16V14H3V16M21 8C21 5.2 18.8 3 16 3H14V5H16C17.7 5 19 6.3 19 8V10H21V8M16 21C18.8 21 21 18.8 21 16V14H19V16C19 17.7 17.7 19 16 19H14V21H16M8 3C5.2 3 3 5.2 3 8V10H5V8C5 6.3 6.3 5 8 5H10V3H8Z",WS="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",GS="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",qS="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z",KS="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z",Hv="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",ZS="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",YS="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",XS="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",JS="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",QS="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",eC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Dv="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",tC="M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z",nC="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",sC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",rC="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M12.5,11H11.5A1.5,1.5 0 0,1 10,9.5A1.5,1.5 0 0,1 11.5,8H12.5A1.5,1.5 0 0,1 14,9.5H16A3.5,3.5 0 0,0 12.5,6H11.5A3.5,3.5 0 0,0 8,9.5A3.5,3.5 0 0,0 11.5,13H12.5A1.5,1.5 0 0,1 14,14.5A1.5,1.5 0 0,1 12.5,16H11.5A1.5,1.5 0 0,1 10,14.5H8A3.5,3.5 0 0,0 11.5,18H12.5A3.5,3.5 0 0,0 16,14.5A3.5,3.5 0 0,0 12.5,11Z",oC="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",iC="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",aC="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",lC="M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74",cC="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z",uC="M23 19C22.9 19.2 22.8 19.4 22.7 19.5L18.3 15.1C20.5 15.6 22.2 17.1 23 19M12 5C15.9 5 18 6.5 18 7C18 7.5 15.9 8.9 12.2 9L14.1 10.9C15.6 10.7 17 10.3 18 9.7V12.5C17.7 12.7 17.4 12.9 17 13.1C18 13.1 19 13.3 20 13.7V7C20 4.8 16.4 3 12 3C10.1 3 8.4 3.3 7.1 3.9L8.7 5.5C9.5 5.2 10.7 5 12 5M22.1 21.5L20.8 22.8L20.2 22.2C19.2 22.7 18.1 23.1 17 23.1C14.3 23.1 11.9 21.4 11 19.1C11.6 17.7 12.6 16.6 13.9 15.9L12.4 14.4C11.7 14.8 11.1 15.4 10.5 16C8.8 15.9 7.2 15.5 5.9 14.8V17C5.9 17.3 7 18.2 8.9 18.6L8.8 19L9.1 19.7C9.3 20.1 9.4 20.4 9.6 20.8C6.4 20.3 4 18.8 4 17V7C4 6.7 4.1 6.4 4.2 6.1L1.1 3L2.4 1.7L22.1 21.5M12.1 14L8.7 10.6C7.6 10.4 6.7 10 5.9 9.6V12.4C7.2 13.4 9.5 13.9 11.9 13.9C12 14 12.1 14 12.1 14M18.8 20.7L17.7 19.6C17.6 19.9 17.3 20 17 20C16.4 20 16 19.6 16 19C16 18.7 16.1 18.4 16.4 18.2L15.3 17.1C14.8 17.6 14.5 18.2 14.5 18.9C14.5 20.3 15.6 21.4 17 21.4C17.7 21.5 18.4 21.2 18.8 20.7Z",dC="M9.1 19.7L8.8 19L9 18.6C7.1 18.1 6 17.3 6 17V14.8C7.3 15.4 8.8 15.8 10.6 16C11.3 15.2 12.2 14.5 13.1 14H12C9.6 14 7.3 13.4 6 12.5V9.6C7.5 10.4 9.6 11 12 11S16.5 10.5 18 9.6V12.4C17.7 12.6 17.4 12.8 17 13C18 13 19 13.2 20 13.6V7C20 4.8 16.4 3 12 3S4 4.8 4 7V17C4 18.8 6.4 20.3 9.7 20.8C9.5 20.5 9.3 20.1 9.1 19.7M12 5C15.9 5 18 6.5 18 7S15.9 9 12 9 6 7.5 6 7 8.1 5 12 5M17 18C17.6 18 18 18.4 18 19S17.6 20 17 20 16 19.6 16 19 16.4 18 17 18M17 15C14.3 15 11.9 16.7 11 19C11.9 21.3 14.3 23 17 23S22.1 21.3 23 19C22.1 16.7 19.7 15 17 15M17 21.5C15.6 21.5 14.5 20.4 14.5 19S15.6 16.5 17 16.5 19.5 17.6 19.5 19 18.4 21.5 17 21.5Z",pC="M12 3C7.58 3 4 4.79 4 7V17C4 19.21 7.59 21 12 21S20 19.21 20 17V7C20 4.79 16.42 3 12 3M18 17C18 17.5 15.87 19 12 19S6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16S16.39 15.55 18 14.77V17M18 12.45C16.7 13.4 14.42 14 12 14C9.58 14 7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11C14.39 11 16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5C15.87 5 18 6.5 18 7S15.87 9 12 9Z",fC="M20 13.09V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.46 21 12.9 21 13.33 20.94C13.12 20.33 13 19.68 13 19L13 18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.65 16 13.27 15.96 13.88 15.89C14.93 14.16 16.83 13 19 13C19.34 13 19.67 13.04 20 13.09M18 12.45C16.7 13.4 14.42 14 12 14S7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5 18 6.5 18 7 15.87 9 12 9M20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88L20.41 19",hC="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",gC="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",mC="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",vC="M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z",bC="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",yC="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",xC="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z",wC="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z",SC="M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z",CC="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",jC="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",EC="M7,11H1V13H7V11M9.17,7.76L7.05,5.64L5.64,7.05L7.76,9.17L9.17,7.76M13,1H11V7H13V1M18.36,7.05L16.95,5.64L14.83,7.76L16.24,9.17L18.36,7.05M17,11V13H23V11H17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M14.83,16.24L16.95,18.36L18.36,16.95L16.24,14.83L14.83,16.24M5.64,16.95L7.05,18.36L9.17,16.24L7.76,14.83L5.64,16.95M11,23H13V17H11V23Z",PC="M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5.5L18.5,3H17V9A1,1 0 0,1 16,10H8A1,1 0 0,1 7,9V3H5M12,4V9H15V4H12M7,12H17A1,1 0 0,1 18,13V19H6V13A1,1 0 0,1 7,12Z",TC="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",OC="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",_C="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",AC="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",LC="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",MC="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",NC="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6",$C="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",kC="M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z",RC="M12,16L19.36,10.27L21,9L12,2L3,9L4.63,10.27M12,18.54L4.62,12.81L3,14.07L12,21.07L21,14.07L19.37,12.8L12,18.54Z",IC="M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",VC="M11 15H6L13 1V9H18L11 23V15Z",HC="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",DC="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",FC="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",BC="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z",zC="M7,10L12,15L17,10H7Z",UC="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",WC="M19,11C19,12.19 18.66,13.3 18.1,14.28L16.87,13.05C17.14,12.43 17.3,11.74 17.3,11H19M15,11.16L9,5.18V5A3,3 0 0,1 12,2A3,3 0 0,1 15,5V11L15,11.16M4.27,3L21,19.73L19.73,21L15.54,16.81C14.77,17.27 13.91,17.58 13,17.72V21H11V17.72C7.72,17.23 5,14.41 5,11H6.7C6.7,14 9.24,16.1 12,16.1C12.81,16.1 13.6,15.91 14.31,15.58L12.65,13.92L12,14A3,3 0 0,1 9,11V10.28L3,4.27L4.27,3Z",GC="M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z",qC="M12,2C13.85,2 15.55,2.78 16.9,4.1L18.6,1.93L20.18,3.16L18.2,5.68C19.33,7.41 20,9.6 20,12C20,17.5 16.42,22 12,22C10.15,22 8.45,21.22 7.1,19.9L5.4,22.07L3.82,20.84L5.8,18.32C4.67,16.59 4,14.4 4,12C4,6.5 7.58,2 12,2M12,4C8.69,4 6,7.58 6,12C6,13.73 6.41,15.33 7.11,16.64L15.67,5.67C14.66,4.62 13.38,4 12,4M12,20C15.31,20 18,16.42 18,12C18,10.27 17.59,8.67 16.89,7.36L8.33,18.33C9.34,19.38 10.62,20 12,20Z",KC="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",Fv="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",ZC="M2.53,19.65L3.87,20.21V11.18L1.44,17.04C1.03,18.06 1.5,19.23 2.53,19.65M22.03,15.95L17.07,4C16.76,3.23 16.03,2.77 15.26,2.75C15,2.75 14.73,2.79 14.47,2.9L7.1,5.95C6.35,6.26 5.89,7 5.87,7.75C5.86,8 5.91,8.29 6,8.55L11,20.5C11.29,21.28 12.03,21.74 12.81,21.75C13.07,21.75 13.33,21.7 13.58,21.6L20.94,18.55C21.96,18.13 22.45,16.96 22.03,15.95M7.88,8.75A1,1 0 0,1 6.88,7.75A1,1 0 0,1 7.88,6.75C8.43,6.75 8.88,7.2 8.88,7.75C8.88,8.3 8.43,8.75 7.88,8.75M5.88,19.75A2,2 0 0,0 7.88,21.75H9.33L5.88,13.41V19.75Z",YC="M12,2.5L8,7H16L12,2.5M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M8,17L12,21.5L16,17H8Z",XC="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",JC="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",QC="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",e2="M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",t2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",n2="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",s2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L20 12L12 20L4 12Z",r2="M12 2C11.5 2 11 2.19 10.59 2.59L7.29 5.88L12 10.58L16.71 5.88L13.41 2.59C13 2.19 12.5 2 12 2M5.88 7.29L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L5.88 16.71L10.58 12L5.88 7.29M18.12 7.29L13.42 12L18.12 16.71L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L18.12 7.29M12 13.42L7.29 18.12L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L16.71 18.12L12 13.42Z",o2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L15.29 7.29L12 10.59L8.71 7.29L12 4M7.29 8.71L10.59 12L7.29 15.29L4 12L7.29 8.71M16.71 8.71L20 12L16.71 15.29L13.41 12L16.71 8.71M12 13.41L15.29 16.71L12 20L8.71 16.71L12 13.41Z",i2="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",a2="M18,18H6V6H18V18Z",l2="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",c2="M11,2V4.07C7.38,4.53 4.53,7.38 4.07,11H2V13H4.07C4.53,16.62 7.38,19.47 11,19.93V22H13V19.93C16.62,19.47 19.47,16.62 19.93,13H22V11H19.93C19.47,7.38 16.62,4.53 13,4.07V2M11,6.08V8H13V6.09C15.5,6.5 17.5,8.5 17.92,11H16V13H17.91C17.5,15.5 15.5,17.5 13,17.92V16H11V17.91C8.5,17.5 6.5,15.5 6.08,13H8V11H6.09C6.5,8.5 8.5,6.5 11,6.08M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11Z",u2="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",d2="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",p2="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",f2="M17 6H7C3.69 6 1 8.69 1 12S3.69 18 7 18H17C20.31 18 23 15.31 23 12S20.31 6 17 6M17 16H7C4.79 16 3 14.21 3 12S4.79 8 7 8H17C19.21 8 21 9.79 21 12S19.21 16 17 16M17 9C15.34 9 14 10.34 14 12S15.34 15 17 15 20 13.66 20 12 18.66 9 17 9Z",h2="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z",g2="M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z",m2="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z",v2="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",b2="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z",y2="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",x2="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",w2="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const ie=Y;function Y(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(r=>typeof r=="string"?r.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const i=o.split(":"),a=i.pop(),l=i.join(":"),u=a==null?void 0:a.startsWith("!"),p=`gs-utl-${u?a==null?void 0:a.slice(1):a}`,f=u?`!${p}`:p;return l?`${l}:${f}`:f}return o}):r).join(" ")}const S2=Number.parseInt(h.version,10)||0,Zt=e=>{if(S2>=19){const t=n=>e(n,n.ref??null);return t.displayName=e.displayName??e.name,t}return h.forwardRef(e)},$=Zt(function({as:t,children:n,className:s,col:r,revert:o,full:i,nowrap:a,space:l,gap:u,justify:d,items:p,...f},g){const m=t||"div";return c.jsx(m,{ref:g,className:Y([s,"gs-utl-flex",r&&!o&&"gs-utl-flex-col",r&&o&&"gs-utl-flex-col-reverse",!r&&o&&"gs-utl-flex-row-reverse",i&&!r&&"gs-utl-w-full",i&&r&&"gs-utl-h-full",a?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(r?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(r?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(r?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(r?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(r?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(r?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",p==="start"&&"gs-utl-items-start",p==="end"&&"gs-utl-items-end",p==="center"&&"gs-utl-items-center",d==="start"&&"gs-utl-justify-start",d==="end"&&"gs-utl-justify-end",d==="center"&&"gs-utl-justify-center",d==="between"&&"gs-utl-justify-between"]),...f,children:n})}),F=Zt(function({children:t,className:n,grow:s,...r},o){return c.jsx("div",{ref:o,className:Y([n,s&&"flex-1"]),...r,children:t})});function bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zu={exports:{}},Yu,ug;function C2(){if(ug)return Yu;ug=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Yu=e,Yu}var Xu,dg;function j2(){if(dg)return Xu;dg=1;var e=C2();function t(){}function n(){}return n.resetWarningCache=t,Xu=function(){function s(i,a,l,u,d,p){if(p!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}s.isRequired=s;function r(){return s}var o={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:r,element:s,elementType:s,instanceOf:r,node:s,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Xu}var pg;function E2(){return pg||(pg=1,Zu.exports=j2()()),Zu.exports}var P2=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(s,r,o){n.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:o})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,r){if(1&r&&(s=n(s)),8&r||4&r&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&r&&typeof s!="string")for(var i in s)n.d(o,i,(function(a){return s[a]}).bind(null,i));return o},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=2)}([function(e,t){e.exports=E2()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var s=n(1),r=n(0),o=function(){return(o=Object.assign||function(m){for(var v,b=1,x=arguments.length;b<x;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},i=function(m,v){var b={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&v.indexOf(x)<0&&(b[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)v.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(b[x[y]]=m[x[y]])}return b},a=0,l=s.forwardRef(function(m,v){var b=m.title,x=b===void 0?null:b,y=m.description,w=y===void 0?null:y,S=m.size,C=S===void 0?null:S,j=m.color,E=j===void 0?"currentColor":j,O=m.horizontal,P=O===void 0?null:O,T=m.vertical,A=T===void 0?null:T,_=m.rotate,N=_===void 0?null:_,D=m.spin,L=D===void 0?null:D,V=m.style,U=V===void 0?{}:V,H=m.children,B=i(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var k,I=L!==null&&L,R=s.Children.map(H,function(J){var Q=J;I!==!0&&(I=(L===null?Q.props.spin:L)===!0);var G=Q.props.size;typeof C=="number"&&typeof Q.props.size=="number"&&(G=Q.props.size/C);var ee={size:G,color:E===null?Q.props.color:E,horizontal:P===null?Q.props.horizontal:P,vertical:A===null?Q.props.vertical:A,rotate:N===null?Q.props.rotate:N,spin:L===null?Q.props.spin:L,inStack:!0};return s.cloneElement(Q,ee)});C!==null&&(U.width=typeof C=="string"?C:1.5*C+"rem");var W,Z="stack_labelledby_"+a,X="stack_describedby_"+a;if(x)k=w?Z+" "+X:Z;else if(W="presentation",w)throw new Error("title attribute required when description is set");return s.createElement("svg",o({ref:v,viewBox:"0 0 24 24",style:U,role:W,"aria-labelledby":k},B),x&&s.createElement("title",{id:Z},x),w&&s.createElement("desc",{id:X},w),I&&s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),R)});l.displayName="Stack",l.propTypes={size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),children:r.oneOfType([r.arrayOf(r.node),r.node]).isRequired,className:r.string,style:r.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var v,b=1,x=arguments.length;b<x;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},p=function(m,v){var b={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&v.indexOf(x)<0&&(b[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)v.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(b[x[y]]=m[x[y]])}return b},f=0,g=s.forwardRef(function(m,v){var b=m.path,x=m.id,y=x===void 0?++f:x,w=m.title,S=w===void 0?null:w,C=m.description,j=C===void 0?null:C,E=m.size,O=E===void 0?null:E,P=m.color,T=P===void 0?"currentColor":P,A=m.horizontal,_=A!==void 0&&A,N=m.vertical,D=N!==void 0&&N,L=m.rotate,V=L===void 0?0:L,U=m.spin,H=U!==void 0&&U,B=m.style,k=B===void 0?{}:B,I=m.inStack,R=I!==void 0&&I,W=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Z={},X=[];O!==null&&(R?X.push("scale("+O+")"):(k.width=typeof O=="string"?O:1.5*O+"rem",k.height=k.width)),_&&X.push("scaleX(-1)"),D&&X.push("scaleY(-1)"),V!==0&&X.push("rotate("+V+"deg)"),T!==null&&(Z.fill=T);var J=s.createElement("path",d({d:b,style:Z},R?W:{})),Q=J;X.length>0&&(k.transform=X.join(" "),k.transformOrigin="center",R&&(Q=s.createElement("g",{style:k},J,s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var G,ee=Q,ae=H===!0||typeof H!="number"?2:H,ge=!R&&(_||D);if(ae<0&&(ge=!ge),H&&(ee=s.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(ae)+"s infinite",transformOrigin:"center"}},Q,!(_||D||V!==0)&&s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),R)return ee;var je,Se="icon_labelledby_"+y,et="icon_describedby_"+y;if(S)G=j?Se+" "+et:Se;else if(je="presentation",j)throw new Error("title attribute required when description is set");return s.createElement("svg",d({ref:v,viewBox:"0 0 24 24",style:k,role:je,"aria-labelledby":G},W),S&&s.createElement("title",{id:Se},S),j&&s.createElement("desc",{id:et},j),!R&&H&&(ge?s.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),ee)});g.displayName="Icon",g.propTypes={path:r.string.isRequired,size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),style:r.object,inStack:r.bool,className:r.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const ta=bf(P2);var Bv={exports:{}};/*!
1
+ "use strict";const Hb=require("@ai-sdk/react"),Eo=require("ai"),c=require("react/jsx-runtime"),g=require("react"),kn=require("react-dom"),pS=require("react-dom/client"),fS=require("marked"),gS=require("react-markdown"),hS=require("remark-gfm");function Db(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const it=Db(g),mS=Db(kn),Fb="app.grapesjs.com",Bb="app-stage.grapesjs.com",ph="gs-utl-dark",bS="app2.grapesjs.com",vS="app-stage2.grapesjs.com",fh=[Fb,bS,Bb,vS,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],yS="license:check:start",hp="license:check:end",is=()=>typeof window<"u",_o=e=>e&&e.stopPropagation(),xS=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),wS=(e,t)=>{const n=s=>s.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},SS=(e="")=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},CS=e=>wS("Escape",e),jS=(e,t={})=>{const n=pt(e)?{id:e,src:e}:e;return new Promise((s,r)=>{var f,h;const{loadedScripts:o}=t,{id:i,src:a}=n,l=document.querySelector(`script[src="${a}"]`);if(l){if((f=t.onScript)==null||f.call(t,l),o&&!o.get(a)){l.addEventListener("load",()=>s(i)),l.addEventListener("error",()=>r(i));return}return s(i)}const u=window.define;window.define=void 0;const d=()=>{o==null||o.set(a,!0),window.define=u},p=document.createElement("script");p.src=a,p.onload=()=>{s(i),d()},p.onerror=()=>{r(i),d()},document.head.appendChild(p),(h=t.onScript)==null||h.call(t,p)})},zb=e=>{const t=e.map(n=>jS(n));return Promise.allSettled(t)},ES=async e=>{const t=window.define;window.define=void 0;const n=await zb(e);return window.define=t,n};function PS(e){const t=e.ownerDocument.createElement("script");return t.text=e.innerHTML,Array.from(e.attributes).forEach(n=>t.setAttribute(n.nodeName,n.nodeValue)),t}function gh(e){const t=s=>{var r;if(s.length){const o=s.shift(),i=PS(o);i.onerror=i.onload=t.bind(null,s),(r=o.parentNode)==null||r.replaceChild(i,o)}},n=Array.from(e.querySelectorAll("script"));t(n)}const Ub=e=>new DOMParser().parseFromString(e,"text/html"),TS=(e="")=>Ub(`<body>${e}</body>`).body.innerHTML,OS=(e="")=>Ub(`<head>${e}</head>`).head.innerHTML,_S=(e="",t)=>{const s=new DOMParser().parseFromString(e,"text/html");if(t){const o=s.querySelectorAll("svg")[0].style||{},i=RS(t)?`${t}px`:t;o.width=i,o.height=i,o.fill="currentColor"}return new XMLSerializer().serializeToString(s)},wf=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?Bb:Fb}`}/${n?"platform-api":"api"}`,AS=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},Wb=(e={})=>{const{width:t=300,height:n,text:s="IMAGE",bg:r="777",fg:o="white"}=e,i=n?`x${n}`:"";return`https://placehold.co/${t}${i}/${r}/${o}.png?text=${s}`},MS=Wb(),LS=()=>{if(!is())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},Sf=()=>{const e=LS();return!!e&&(fh.includes(e)||fh.some(t=>e.endsWith(t)))},Ds=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),NS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),$S=()=>{},kS=240,Dt=e=>typeof e<"u",pt=e=>typeof e=="string",RS=e=>typeof e=="number";function rt(e){return typeof e=="function"}function wr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const Gb=e=>!e||Object.keys(e).length===0,gi=(e,t)=>{const n=(e||"").toLocaleLowerCase(),s=(t||"").toLocaleLowerCase();return n.includes(s)},IS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},VS=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=n.length;for(let r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*s));return t},qb=e=>!!e.Components.getType("mjml"),Jc=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),HS=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(o,i)=>{const a=i.trim();return!a||!n.has(a)?"":`__var__${a}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(o,i)=>`{{ ${i} }}`)};async function DS({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const a=`${t||wf({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...s}};o&&(l.body=JSON.stringify(o));const u=r?new URLSearchParams(r).toString():"",d=u?`?${u}`:"",p=await fetch(`${a}${d}`,l);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var ai=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(ai||{}),un=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(un||{}),te=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(te||{}),Dn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Dn||{}),Fr=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(Fr||{}),Et=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(Et||{});const hh={[ai.free]:0,[ai.startup]:10,[ai.business]:20,[ai.enterprise]:30};function FS(e){const t=e;return t.init=n=>s=>e(s,n),t}const BS=e=>FS(e);async function zS({editor:e,plan:t,pluginName:n,licenseKey:s,onLicenseCheckResponse:r,cleanup:o}){let i="",a;const l=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),o()},u=(p={})=>{var v;const{error:f,sdkLicense:h}=p,m=(v=p.plan)==null?void 0:v.category;if(!(h||p.license)||f)l(f||"Invalid license");else if(m){const x=hh[t],y=hh[m];x>y&&l({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(te.settings)&&(a=e.runCommand(te.settings),i=(a==null?void 0:a.baseUrl)||"");const d=p=>{r==null||r(p),p&&u(p)};if(!a){e.onReady(async()=>{if(!Sf())if(s){const p=await WS({licenseKey:s,pluginName:n,baseApiUrl:i});d(p)}else l("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const p=US(a);d(p);return}e.on(hp,p=>d(p))}const US=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function WS(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await DS({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}var GS="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M11 7H13V13H11V7M11 15H13V17H11V15Z",qS="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",KS="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",ZS="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",YS="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z",XS="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",JS="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z",QS="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",eC="M20 13.5C20 17.09 17.09 20 13.5 20H6V18H13.5C16 18 18 16 18 13.5S16 9 13.5 9H7.83L10.91 12.09L9.5 13.5L4 8L9.5 2.5L10.92 3.91L7.83 7H13.5C17.09 7 20 9.91 20 13.5Z",tC="M10.5 18H18V20H10.5C6.91 20 4 17.09 4 13.5S6.91 7 10.5 7H16.17L13.08 3.91L14.5 2.5L20 8L14.5 13.5L13.09 12.09L16.17 9H10.5C8 9 6 11 6 13.5S8 18 10.5 18Z",nC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",sC="M3,21V3H21V21H3M5,5V19H19V5H5Z",rC="M3 16C3 18.8 5.2 21 8 21H10V19H8C6.3 19 5 17.7 5 16V14H3V16M21 8C21 5.2 18.8 3 16 3H14V5H16C17.7 5 19 6.3 19 8V10H21V8M16 21C18.8 21 21 18.8 21 16V14H19V16C19 17.7 17.7 19 16 19H14V21H16M8 3C5.2 3 3 5.2 3 8V10H5V8C5 6.3 6.3 5 8 5H10V3H8Z",oC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",iC="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z",aC="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z",lC="M12,3C17.5,3 22,6.58 22,11C22,15.42 17.5,19 12,19C10.76,19 9.57,18.82 8.47,18.5C5.55,21 2,21 2,21C4.33,18.67 4.7,17.1 4.75,16.5C3.05,15.07 2,13.13 2,11C2,6.58 6.5,3 12,3Z",Kb="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",cC="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",uC="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",dC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",pC="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",fC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",gC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Zb="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",hC="M11 20H6.5Q4.22 20 2.61 18.43 1 16.85 1 14.58 1 12.63 2.17 11.1 3.35 9.57 5.25 9.15 5.88 6.85 7.75 5.43 9.63 4 12 4 14.93 4 16.96 6.04 19 8.07 19 11 20.73 11.2 21.86 12.5 23 13.78 23 15.5 23 17.38 21.69 18.69 20.38 20 18.5 20H13V12.85L14.6 14.4L16 13L12 9L8 13L9.4 14.4L11 12.85Z",mC="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",bC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",vC="M3,5A2,2 0 0,1 5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5C3.89,21 3,20.1 3,19V5M12.5,11H11.5A1.5,1.5 0 0,1 10,9.5A1.5,1.5 0 0,1 11.5,8H12.5A1.5,1.5 0 0,1 14,9.5H16A3.5,3.5 0 0,0 12.5,6H11.5A3.5,3.5 0 0,0 8,9.5A3.5,3.5 0 0,0 11.5,13H12.5A1.5,1.5 0 0,1 14,14.5A1.5,1.5 0 0,1 12.5,16H11.5A1.5,1.5 0 0,1 10,14.5H8A3.5,3.5 0 0,0 11.5,18H12.5A3.5,3.5 0 0,0 16,14.5A3.5,3.5 0 0,0 12.5,11Z",yC="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",xC="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",wC="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z",SC="M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74",CC="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z",jC="M23 19C22.9 19.2 22.8 19.4 22.7 19.5L18.3 15.1C20.5 15.6 22.2 17.1 23 19M12 5C15.9 5 18 6.5 18 7C18 7.5 15.9 8.9 12.2 9L14.1 10.9C15.6 10.7 17 10.3 18 9.7V12.5C17.7 12.7 17.4 12.9 17 13.1C18 13.1 19 13.3 20 13.7V7C20 4.8 16.4 3 12 3C10.1 3 8.4 3.3 7.1 3.9L8.7 5.5C9.5 5.2 10.7 5 12 5M22.1 21.5L20.8 22.8L20.2 22.2C19.2 22.7 18.1 23.1 17 23.1C14.3 23.1 11.9 21.4 11 19.1C11.6 17.7 12.6 16.6 13.9 15.9L12.4 14.4C11.7 14.8 11.1 15.4 10.5 16C8.8 15.9 7.2 15.5 5.9 14.8V17C5.9 17.3 7 18.2 8.9 18.6L8.8 19L9.1 19.7C9.3 20.1 9.4 20.4 9.6 20.8C6.4 20.3 4 18.8 4 17V7C4 6.7 4.1 6.4 4.2 6.1L1.1 3L2.4 1.7L22.1 21.5M12.1 14L8.7 10.6C7.6 10.4 6.7 10 5.9 9.6V12.4C7.2 13.4 9.5 13.9 11.9 13.9C12 14 12.1 14 12.1 14M18.8 20.7L17.7 19.6C17.6 19.9 17.3 20 17 20C16.4 20 16 19.6 16 19C16 18.7 16.1 18.4 16.4 18.2L15.3 17.1C14.8 17.6 14.5 18.2 14.5 18.9C14.5 20.3 15.6 21.4 17 21.4C17.7 21.5 18.4 21.2 18.8 20.7Z",EC="M9.1 19.7L8.8 19L9 18.6C7.1 18.1 6 17.3 6 17V14.8C7.3 15.4 8.8 15.8 10.6 16C11.3 15.2 12.2 14.5 13.1 14H12C9.6 14 7.3 13.4 6 12.5V9.6C7.5 10.4 9.6 11 12 11S16.5 10.5 18 9.6V12.4C17.7 12.6 17.4 12.8 17 13C18 13 19 13.2 20 13.6V7C20 4.8 16.4 3 12 3S4 4.8 4 7V17C4 18.8 6.4 20.3 9.7 20.8C9.5 20.5 9.3 20.1 9.1 19.7M12 5C15.9 5 18 6.5 18 7S15.9 9 12 9 6 7.5 6 7 8.1 5 12 5M17 18C17.6 18 18 18.4 18 19S17.6 20 17 20 16 19.6 16 19 16.4 18 17 18M17 15C14.3 15 11.9 16.7 11 19C11.9 21.3 14.3 23 17 23S22.1 21.3 23 19C22.1 16.7 19.7 15 17 15M17 21.5C15.6 21.5 14.5 20.4 14.5 19S15.6 16.5 17 16.5 19.5 17.6 19.5 19 18.4 21.5 17 21.5Z",PC="M12 3C7.58 3 4 4.79 4 7V17C4 19.21 7.59 21 12 21S20 19.21 20 17V7C20 4.79 16.42 3 12 3M18 17C18 17.5 15.87 19 12 19S6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16S16.39 15.55 18 14.77V17M18 12.45C16.7 13.4 14.42 14 12 14C9.58 14 7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11C14.39 11 16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5C15.87 5 18 6.5 18 7S15.87 9 12 9Z",TC="M20 13.09V7C20 4.79 16.42 3 12 3S4 4.79 4 7V17C4 19.21 7.59 21 12 21C12.46 21 12.9 21 13.33 20.94C13.12 20.33 13 19.68 13 19L13 18.95C12.68 19 12.35 19 12 19C8.13 19 6 17.5 6 17V14.77C7.61 15.55 9.72 16 12 16C12.65 16 13.27 15.96 13.88 15.89C14.93 14.16 16.83 13 19 13C19.34 13 19.67 13.04 20 13.09M18 12.45C16.7 13.4 14.42 14 12 14S7.3 13.4 6 12.45V9.64C7.47 10.47 9.61 11 12 11S16.53 10.47 18 9.64V12.45M12 9C8.13 9 6 7.5 6 7S8.13 5 12 5 18 6.5 18 7 15.87 9 12 9M20.41 19L22.54 21.12L21.12 22.54L19 20.41L16.88 22.54L15.47 21.12L17.59 19L15.47 16.88L16.88 15.47L19 17.59L21.12 15.47L22.54 16.88L20.41 19",OC="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",_C="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",AC="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",MC="M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z",LC="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",NC="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",$C="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z",kC="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z",RC="M6.92,19L5,17.08L13.06,9L15,10.94M20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L13.84,6.41L11.91,4.5L10.5,5.91L11.92,7.33L3,16.25V21H7.75L16.67,12.08L18.09,13.5L19.5,12.09L17.58,10.17L20.7,7.05C21.1,6.65 21.1,6 20.71,5.63Z",IC="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",VC="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",HC="M7,11H1V13H7V11M9.17,7.76L7.05,5.64L5.64,7.05L7.76,9.17L9.17,7.76M13,1H11V7H13V1M18.36,7.05L16.95,5.64L14.83,7.76L16.24,9.17L18.36,7.05M17,11V13H23V11H17M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M14.83,16.24L16.95,18.36L18.36,16.95L16.24,14.83L14.83,16.24M5.64,16.95L7.05,18.36L9.17,16.24L7.76,14.83L5.64,16.95M11,23H13V17H11V23Z",DC="M5,3A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5.5L18.5,3H17V9A1,1 0 0,1 16,10H8A1,1 0 0,1 7,9V3H5M12,4V9H15V4H12M7,12H17A1,1 0 0,1 18,13V19H6V13A1,1 0 0,1 7,12Z",FC="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",BC="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",zC="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",UC="M15.07,11.25L14.17,12.17C13.45,12.89 13,13.5 13,15H11V14.5C11,13.39 11.45,12.39 12.17,11.67L13.41,10.41C13.78,10.05 14,9.55 14,9C14,7.89 13.1,7 12,7A2,2 0 0,0 10,9H8A4,4 0 0,1 12,5A4,4 0 0,1 16,9C16,9.88 15.64,10.67 15.07,11.25M13,19H11V17H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",WC="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",GC="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",qC="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6",KC="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",ZC="M13.5,4A1.5,1.5 0 0,0 12,5.5A1.5,1.5 0 0,0 13.5,7A1.5,1.5 0 0,0 15,5.5A1.5,1.5 0 0,0 13.5,4M13.14,8.77C11.95,8.87 8.7,11.46 8.7,11.46C8.5,11.61 8.56,11.6 8.72,11.88C8.88,12.15 8.86,12.17 9.05,12.04C9.25,11.91 9.58,11.7 10.13,11.36C12.25,10 10.47,13.14 9.56,18.43C9.2,21.05 11.56,19.7 12.17,19.3C12.77,18.91 14.38,17.8 14.54,17.69C14.76,17.54 14.6,17.42 14.43,17.17C14.31,17 14.19,17.12 14.19,17.12C13.54,17.55 12.35,18.45 12.19,17.88C12,17.31 13.22,13.4 13.89,10.71C14,10.07 14.3,8.67 13.14,8.77Z",YC="M12,16L19.36,10.27L21,9L12,2L3,9L4.63,10.27M12,18.54L4.62,12.81L3,14.07L12,21.07L21,14.07L19.37,12.8L12,18.54Z",XC="M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",JC="M11 15H6L13 1V9H18L11 23V15Z",QC="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z",e2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",t2="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",n2="M18 1C15.24 1 13 3.24 13 6V8H4C2.9 8 2 8.89 2 10V20C2 21.11 2.9 22 4 22H16C17.11 22 18 21.11 18 20V10C18 8.9 17.11 8 16 8H15V6C15 4.34 16.34 3 18 3C19.66 3 21 4.34 21 6V8H23V6C23 3.24 20.76 1 18 1M10 13C11.1 13 12 13.89 12 15C12 16.11 11.11 17 10 17C8.9 17 8 16.11 8 15C8 13.9 8.9 13 10 13Z",s2="M7,10L12,15L17,10H7Z",r2="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",o2="M19,11C19,12.19 18.66,13.3 18.1,14.28L16.87,13.05C17.14,12.43 17.3,11.74 17.3,11H19M15,11.16L9,5.18V5A3,3 0 0,1 12,2A3,3 0 0,1 15,5V11L15,11.16M4.27,3L21,19.73L19.73,21L15.54,16.81C14.77,17.27 13.91,17.58 13,17.72V21H11V17.72C7.72,17.23 5,14.41 5,11H6.7C6.7,14 9.24,16.1 12,16.1C12.81,16.1 13.6,15.91 14.31,15.58L12.65,13.92L12,14A3,3 0 0,1 9,11V10.28L3,4.27L4.27,3Z",i2="M20 5L20 19L4 19L4 5H20M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M18 15H6V17H18V15M10 7H6V13H10V7M12 9H18V7H12V9M18 11H12V13H18V11Z",a2="M12,2C13.85,2 15.55,2.78 16.9,4.1L18.6,1.93L20.18,3.16L18.2,5.68C19.33,7.41 20,9.6 20,12C20,17.5 16.42,22 12,22C10.15,22 8.45,21.22 7.1,19.9L5.4,22.07L3.82,20.84L5.8,18.32C4.67,16.59 4,14.4 4,12C4,6.5 7.58,2 12,2M12,4C8.69,4 6,7.58 6,12C6,13.73 6.41,15.33 7.11,16.64L15.67,5.67C14.66,4.62 13.38,4 12,4M12,20C15.31,20 18,16.42 18,12C18,10.27 17.59,8.67 16.89,7.36L8.33,18.33C9.34,19.38 10.62,20 12,20Z",l2="M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",Yb="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",c2="M2.53,19.65L3.87,20.21V11.18L1.44,17.04C1.03,18.06 1.5,19.23 2.53,19.65M22.03,15.95L17.07,4C16.76,3.23 16.03,2.77 15.26,2.75C15,2.75 14.73,2.79 14.47,2.9L7.1,5.95C6.35,6.26 5.89,7 5.87,7.75C5.86,8 5.91,8.29 6,8.55L11,20.5C11.29,21.28 12.03,21.74 12.81,21.75C13.07,21.75 13.33,21.7 13.58,21.6L20.94,18.55C21.96,18.13 22.45,16.96 22.03,15.95M7.88,8.75A1,1 0 0,1 6.88,7.75A1,1 0 0,1 7.88,6.75C8.43,6.75 8.88,7.2 8.88,7.75C8.88,8.3 8.43,8.75 7.88,8.75M5.88,19.75A2,2 0 0,0 7.88,21.75H9.33L5.88,13.41V19.75Z",u2="M12,2.5L8,7H16L12,2.5M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M8,17L12,21.5L16,17H8Z",d2="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",p2="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",f2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",g2="M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z",h2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",m2="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z",b2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L20 12L12 20L4 12Z",v2="M12 2C11.5 2 11 2.19 10.59 2.59L7.29 5.88L12 10.58L16.71 5.88L13.41 2.59C13 2.19 12.5 2 12 2M5.88 7.29L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L5.88 16.71L10.58 12L5.88 7.29M18.12 7.29L13.42 12L18.12 16.71L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L18.12 7.29M12 13.42L7.29 18.12L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L16.71 18.12L12 13.42Z",y2="M12 2C11.5 2 11 2.19 10.59 2.59L2.59 10.59C1.8 11.37 1.8 12.63 2.59 13.41L10.59 21.41C11.37 22.2 12.63 22.2 13.41 21.41L21.41 13.41C22.2 12.63 22.2 11.37 21.41 10.59L13.41 2.59C13 2.19 12.5 2 12 2M12 4L15.29 7.29L12 10.59L8.71 7.29L12 4M7.29 8.71L10.59 12L7.29 15.29L4 12L7.29 8.71M16.71 8.71L20 12L16.71 15.29L13.41 12L16.71 8.71M12 13.41L15.29 16.71L12 20L8.71 16.71L12 13.41Z",x2="M13.13 22.19L11.5 18.36C13.07 17.78 14.54 17 15.9 16.09L13.13 22.19M5.64 12.5L1.81 10.87L7.91 8.1C7 9.46 6.22 10.93 5.64 12.5M21.61 2.39C21.61 2.39 16.66 .269 11 5.93C8.81 8.12 7.5 10.53 6.65 12.64C6.37 13.39 6.56 14.21 7.11 14.77L9.24 16.89C9.79 17.45 10.61 17.63 11.36 17.35C13.5 16.53 15.88 15.19 18.07 13C23.73 7.34 21.61 2.39 21.61 2.39M14.54 9.46C13.76 8.68 13.76 7.41 14.54 6.63S16.59 5.85 17.37 6.63C18.14 7.41 18.15 8.68 17.37 9.46C16.59 10.24 15.32 10.24 14.54 9.46M8.88 16.53L7.47 15.12L8.88 16.53M6.24 22L9.88 18.36C9.54 18.27 9.21 18.12 8.91 17.91L4.83 22H6.24M2 22H3.41L8.18 17.24L6.76 15.83L2 20.59V22M2 19.17L6.09 15.09C5.88 14.79 5.73 14.47 5.64 14.12L2 17.76V19.17Z",w2="M18,18H6V6H18V18Z",S2="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z",C2="M11,2V4.07C7.38,4.53 4.53,7.38 4.07,11H2V13H4.07C4.53,16.62 7.38,19.47 11,19.93V22H13V19.93C16.62,19.47 19.47,16.62 19.93,13H22V11H19.93C19.47,7.38 16.62,4.53 13,4.07V2M11,6.08V8H13V6.09C15.5,6.5 17.5,8.5 17.92,11H16V13H17.91C17.5,15.5 15.5,17.5 13,17.92V16H11V17.91C8.5,17.5 6.5,15.5 6.08,13H8V11H6.09C6.5,8.5 8.5,6.5 11,6.08M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11Z",j2="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",E2="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",P2="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zM7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",T2="M17 6H7C3.69 6 1 8.69 1 12S3.69 18 7 18H17C20.31 18 23 15.31 23 12S20.31 6 17 6M17 16H7C4.79 16 3 14.21 3 12S4.79 8 7 8H17C19.21 8 21 9.79 21 12S19.21 16 17 16M17 9C15.34 9 14 10.34 14 12S15.34 15 17 15 20 13.66 20 12 18.66 9 17 9Z",O2="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z",_2="M16.59,5.41L15.17,4L12,7.17L8.83,4L7.41,5.41L12,10M7.41,18.59L8.83,20L12,16.83L15.17,20L16.58,18.59L12,14L7.41,18.59Z",A2="M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z",M2="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",L2="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z",N2="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",$2="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",k2="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const le=J;function J(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(r=>typeof r=="string"?r.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const i=o.split(":"),a=i.pop(),l=i.join(":"),u=a==null?void 0:a.startsWith("!"),p=`gs-utl-${u?a==null?void 0:a.slice(1):a}`,f=u?`!${p}`:p;return l?`${l}:${f}`:f}return o}):r).join(" ")}const R2=Number.parseInt(g.version,10)||0,Yt=e=>{if(R2>=19){const t=n=>e(n,n.ref??null);return t.displayName=e.displayName??e.name,t}return g.forwardRef(e)},k=Yt(function({as:t,children:n,className:s,col:r,revert:o,full:i,nowrap:a,space:l,gap:u,justify:d,items:p,...f},h){const m=t||"div";return c.jsx(m,{ref:h,className:J([s,"gs-utl-flex",r&&!o&&"gs-utl-flex-col",r&&o&&"gs-utl-flex-col-reverse",!r&&o&&"gs-utl-flex-row-reverse",i&&!r&&"gs-utl-w-full",i&&r&&"gs-utl-h-full",a?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(r?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(r?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(r?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(r?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(r?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(r?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",p==="start"&&"gs-utl-items-start",p==="end"&&"gs-utl-items-end",p==="center"&&"gs-utl-items-center",d==="start"&&"gs-utl-justify-start",d==="end"&&"gs-utl-justify-end",d==="center"&&"gs-utl-justify-center",d==="between"&&"gs-utl-justify-between"]),...f,children:n})}),D=Yt(function({children:t,className:n,grow:s,...r},o){return c.jsx("div",{ref:o,className:J([n,s&&"flex-1"]),...r,children:t})});function Cf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},ed,mh;function I2(){if(mh)return ed;mh=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ed=e,ed}var td,bh;function V2(){if(bh)return td;bh=1;var e=I2();function t(){}function n(){}return n.resetWarningCache=t,td=function(){function s(i,a,l,u,d,p){if(p!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}s.isRequired=s;function r(){return s}var o={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:r,element:s,elementType:s,instanceOf:r,node:s,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},td}var vh;function H2(){return vh||(vh=1,Qu.exports=V2()()),Qu.exports}var D2=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(s,r,o){n.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:o})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,r){if(1&r&&(s=n(s)),8&r||4&r&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&r&&typeof s!="string")for(var i in s)n.d(o,i,(function(a){return s[a]}).bind(null,i));return o},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=2)}([function(e,t){e.exports=H2()},function(e,t){e.exports=g},function(e,t,n){n.r(t);var s=n(1),r=n(0),o=function(){return(o=Object.assign||function(m){for(var b,v=1,x=arguments.length;v<x;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},i=function(m,b){var v={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&b.indexOf(x)<0&&(v[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)b.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(v[x[y]]=m[x[y]])}return v},a=0,l=s.forwardRef(function(m,b){var v=m.title,x=v===void 0?null:v,y=m.description,w=y===void 0?null:y,S=m.size,j=S===void 0?null:S,C=m.color,E=C===void 0?"currentColor":C,O=m.horizontal,P=O===void 0?null:O,T=m.vertical,A=T===void 0?null:T,_=m.rotate,N=_===void 0?null:_,V=m.spin,M=V===void 0?null:V,I=m.style,U=I===void 0?{}:I,F=m.children,W=i(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var H,R=M!==null&&M,$=s.Children.map(F,function(ee){var X=ee;R!==!0&&(R=(M===null?X.props.spin:M)===!0);var G=X.props.size;typeof j=="number"&&typeof X.props.size=="number"&&(G=X.props.size/j);var Q={size:G,color:E===null?X.props.color:E,horizontal:P===null?X.props.horizontal:P,vertical:A===null?X.props.vertical:A,rotate:N===null?X.props.rotate:N,spin:M===null?X.props.spin:M,inStack:!0};return s.cloneElement(X,Q)});j!==null&&(U.width=typeof j=="string"?j:1.5*j+"rem");var B,Z="stack_labelledby_"+a,Y="stack_describedby_"+a;if(x)H=w?Z+" "+Y:Z;else if(B="presentation",w)throw new Error("title attribute required when description is set");return s.createElement("svg",o({ref:b,viewBox:"0 0 24 24",style:U,role:B,"aria-labelledby":H},W),x&&s.createElement("title",{id:Z},x),w&&s.createElement("desc",{id:Y},w),R&&s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),$)});l.displayName="Stack",l.propTypes={size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),children:r.oneOfType([r.arrayOf(r.node),r.node]).isRequired,className:r.string,style:r.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return h}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var b,v=1,x=arguments.length;v<x;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},p=function(m,b){var v={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&b.indexOf(x)<0&&(v[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)b.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(v[x[y]]=m[x[y]])}return v},f=0,h=s.forwardRef(function(m,b){var v=m.path,x=m.id,y=x===void 0?++f:x,w=m.title,S=w===void 0?null:w,j=m.description,C=j===void 0?null:j,E=m.size,O=E===void 0?null:E,P=m.color,T=P===void 0?"currentColor":P,A=m.horizontal,_=A!==void 0&&A,N=m.vertical,V=N!==void 0&&N,M=m.rotate,I=M===void 0?0:M,U=m.spin,F=U!==void 0&&U,W=m.style,H=W===void 0?{}:W,R=m.inStack,$=R!==void 0&&R,B=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Z={},Y=[];O!==null&&($?Y.push("scale("+O+")"):(H.width=typeof O=="string"?O:1.5*O+"rem",H.height=H.width)),_&&Y.push("scaleX(-1)"),V&&Y.push("scaleY(-1)"),I!==0&&Y.push("rotate("+I+"deg)"),T!==null&&(Z.fill=T);var ee=s.createElement("path",d({d:v,style:Z},$?B:{})),X=ee;Y.length>0&&(H.transform=Y.join(" "),H.transformOrigin="center",$&&(X=s.createElement("g",{style:H},ee,s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var G,Q=X,ie=F===!0||typeof F!="number"?2:F,ae=!$&&(_||V);if(ie<0&&(ae=!ae),F&&(Q=s.createElement("g",{style:{animation:"spin"+(ae?"-inverse":"")+" linear "+Math.abs(ie)+"s infinite",transformOrigin:"center"}},X,!(_||V||I!==0)&&s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),$)return Q;var me,ve="icon_labelledby_"+y,ke="icon_describedby_"+y;if(S)G=C?ve+" "+ke:ve;else if(me="presentation",C)throw new Error("title attribute required when description is set");return s.createElement("svg",d({ref:b,viewBox:"0 0 24 24",style:H,role:me,"aria-labelledby":G},B),S&&s.createElement("title",{id:ve},S),C&&s.createElement("desc",{id:ke},C),!$&&F&&(ae?s.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),Q)});h.displayName="Icon",h.propTypes={path:r.string.isRequired,size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),style:r.object,inStack:r.bool,className:r.string},h.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=h}]);const sa=Cf(D2);var Xb={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=r(o,s(a)))}return o}function s(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)t.call(o,a)&&o[a]&&(i=r(i,a));return i}function r(o,i){return i?o?o+" "+i:o+i:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Bv);var T2=Bv.exports;const M=bf(T2);var Qt={NODE_ENV:"production"};function Ge(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var O2={};function Zc(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:O2}var zv=Object.assign,wc=Object.getOwnPropertyDescriptor,Fs=Object.defineProperty,Ua=Object.prototype,pp=[];Object.freeze(pp);var Uv={};Object.freeze(Uv);var _2=typeof Proxy<"u",A2=Object.toString();function Wv(){_2||Ge("Proxy not available")}function Gv(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var ii=function(){};function vs(e){return typeof e=="function"}function _o(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Yc(e){return e!==null&&typeof e=="object"}function fr(e){if(!Yc(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===A2}function qv(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Wa(e,t,n){Fs(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Kv(e,t,n){Fs(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Xr(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(s){return Yc(s)&&s[n]===!0}}function Oi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function L2(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),s=Object.getPrototypeOf(n);return s===null}function or(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Zv=typeof Object.getOwnPropertySymbols<"u";function M2(e){var t=Object.keys(e);if(!Zv)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(s){return Ua.propertyIsEnumerable.call(e,s)})):t}var mi=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Zv?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Yv(e){return e===null?null:typeof e=="object"?""+e:e}function ur(e,t){return Ua.hasOwnProperty.call(e,t)}var N2=Object.getOwnPropertyDescriptors||function(t){var n={};return mi(t).forEach(function(s){n[s]=wc(t,s)}),n};function Ln(e,t){return!!(e&t)}function Mn(e,t,n){return n?e|=t:e&=~t,e}function fg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function $2(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,R2(s.key),s)}}function _i(e,t,n){return t&&$2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ai(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=I2(e))||t){n&&(e=n);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ao(){return Ao=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Ao.apply(null,arguments)}function Xv(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,fp(e,t)}function fp(e,t){return fp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},fp(e,t)}function k2(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function R2(e){var t=k2(e,"string");return typeof t=="symbol"?t:t+""}function I2(e,t){if(e){if(typeof e=="string")return fg(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fg(e,t):void 0}}var fs=Symbol("mobx-stored-annotations");function Bs(e){function t(n,s){if(qa(s))return e.decorate_20223_(n,s);Ga(n,s,e)}return Object.assign(t,e)}function Ga(e,t,n){ur(e,fs)||Wa(e,fs,Ao({},e[fs])),G2(n)||(e[fs][t]=n)}function V2(e){return ur(e,fs)||Wa(e,fs,Ao({},e[fs])),e[fs]}function qa(e){return typeof e=="object"&&typeof e.kind=="string"}var Ee=Symbol("mobx administration"),Jr=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Qe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.reportObserved=function(){return fb(this)},t.reportChanged=function(){Zn(),hb(this),Yn()},t.toString=function(){return this.name_},_i(e,[{key:"isBeingObserved",get:function(){return Ln(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return Ln(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Mn(this.flags_,e.diffValueMask_,s===1)}}])}();Jr.isBeingObservedMask_=1;Jr.isPendingUnobservationMask_=2;Jr.diffValueMask_=4;var yf=Xr("Atom",Jr);function Jv(e,t,n){t===void 0&&(t=ii),n===void 0&&(n=ii);var s=new Jr(e);return t!==ii&&Xj(s,t),n!==ii&&yb(s,n),s}function H2(e,t){return e===t}function D2(e,t){return Tf(e,t)}function F2(e,t){return Tf(e,t,1)}function B2(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Sc={identity:H2,structural:D2,default:B2,shallow:F2};function Lo(e,t,n){return jf(e)?e:Array.isArray(e)?Kt.array(e,{name:n}):fr(e)?Kt.object(e,void 0,{name:n}):Oi(e)?Kt.map(e,{name:n}):or(e)?Kt.set(e,{name:n}):typeof e=="function"&&!wa(e)&&!Sa(e)?qv(e)?No(e):xa(n,e):e}function z2(e,t,n){if(e==null||Qa(e)||Ja(e)||Qr(e)||ps(e))return e;if(Array.isArray(e))return Kt.array(e,{name:n,deep:!1});if(fr(e))return Kt.object(e,void 0,{name:n,deep:!1});if(Oi(e))return Kt.map(e,{name:n,deep:!1});if(or(e))return Kt.set(e,{name:n,deep:!1})}function Xc(e){return e}function U2(e,t){return Tf(e,t)?t:e}var W2="override";function G2(e){return e.annotationType_===W2}function Ka(e,t){return{annotationType_:e,options_:t,make_:q2,extend_:K2,decorate_20223_:Z2}}function q2(e,t,n,s){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(wa(n.value))return 1;var o=Qv(e,this,t,n,!1);return Fs(s,t,o),2}function K2(e,t,n,s){var r=Qv(e,this,t,n);return e.defineProperty_(t,r,s)}function Z2(e,t){var n=t.kind,s=t.name,r=t.addInitializer,o=this,i=function(u){var d,p,f,g;return Mo((d=(p=o.options_)==null?void 0:p.name)!=null?d:s.toString(),u,(f=(g=o.options_)==null?void 0:g.autoAction)!=null?f:!1)};if(n=="field")return function(l){var u,d=l;return wa(d)||(d=i(d)),(u=o.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var a;return wa(e)||(e=i(e)),(a=this.options_)!=null&&a.bound&&r(function(){var l=this,u=l[s].bind(l);u.isMobxAction=!0,l[s]=u}),e}Ge("Cannot apply '"+o.annotationType_+"' to '"+String(s)+"' (kind: "+n+"):"+(`
7
- '`+o.annotationType_+"' can only be used on properties with a function value."))}function Y2(e,t,n,s){t.annotationType_,s.value}function Qv(e,t,n,s,r){var o,i,a,l,u,d,p;r===void 0&&(r=fe.safeDescriptors),Y2(e,t,n,s);var f=s.value;if((o=t.options_)!=null&&o.bound){var g;f=f.bind((g=e.proxy_)!=null?g:e.target_)}return{value:Mo((i=(a=t.options_)==null?void 0:a.name)!=null?i:n.toString(),f,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:r?e.isPlainObject_:!0,enumerable:!1,writable:!r}}function eb(e,t){return{annotationType_:e,options_:t,make_:X2,extend_:J2,decorate_20223_:Q2}}function X2(e,t,n,s){var r;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!ur(e.target_,t)||!Sa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Sa(n.value))return 1;var o=tb(e,this,t,n,!1,!1);return Fs(s,t,o),2}function J2(e,t,n,s){var r,o=tb(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,s)}function Q2(e,t){var n,s=t.name,r=t.addInitializer;return Sa(e)||(e=No(e)),(n=this.options_)!=null&&n.bound&&r(function(){var o=this,i=o[s].bind(o);i.isMobXFlow=!0,o[s]=i}),e}function ej(e,t,n,s){t.annotationType_,s.value}function tb(e,t,n,s,r,o){o===void 0&&(o=fe.safeDescriptors),ej(e,t,n,s);var i=s.value;if(Sa(i)||(i=No(i)),r){var a;i=i.bind((a=e.proxy_)!=null?a:e.target_),i.isMobXFlow=!0}return{value:i,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function xf(e,t){return{annotationType_:e,options_:t,make_:tj,extend_:nj,decorate_20223_:sj}}function tj(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function nj(e,t,n,s){return rj(e,this,t,n),e.defineComputedProperty_(t,Ao({},this.options_,{get:n.get,set:n.set}),s)}function sj(e,t){var n=this,s=t.name,r=t.addInitializer;return r(function(){var o=Do(this)[Ee],i=Ao({},n.options_,{get:e,context:this});i.name||(i.name="ObservableObject."+s.toString()),o.values_.set(s,new bs(i))}),function(){return this[Ee].getObservablePropValue_(s)}}function rj(e,t,n,s){t.annotationType_,s.get}function Jc(e,t){return{annotationType_:e,options_:t,make_:oj,extend_:ij,decorate_20223_:aj}}function oj(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function ij(e,t,n,s){var r,o;return lj(e,this),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer)!=null?r:Lo,s)}function aj(e,t){var n=this,s=t.kind,r=t.name,o=new WeakSet;function i(a,l){var u,d,p=Do(a)[Ee],f=new Dr(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:Lo,"ObservableObject."+r.toString(),!1);p.values_.set(r,f),o.add(a)}if(s=="accessor")return{get:function(){return o.has(this)||i(this,e.get.call(this)),this[Ee].getObservablePropValue_(r)},set:function(l){return o.has(this)||i(this,l),this[Ee].setObservablePropValue_(r,l)},init:function(l){return o.has(this)||i(this,l),l}}}function lj(e,t,n,s){t.annotationType_}var cj="true",uj=nb();function nb(e){return{annotationType_:cj,options_:e,make_:dj,extend_:pj,decorate_20223_:fj}}function dj(e,t,n,s){var r,o;if(n.get)return Qc.make_(e,t,n,s);if(n.set){var i=Mo(t.toString(),n.set);return s===e.target_?e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(Fs(s,t,{configurable:!0,set:i}),2)}if(s!==e.target_&&typeof n.value=="function"){var a;if(qv(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?No.bound:No;return u.make_(e,t,n,s)}var d=(a=this.options_)!=null&&a.autoBind?xa.bound:xa;return d.make_(e,t,n,s)}var p=((r=this.options_)==null?void 0:r.deep)===!1?Kt.ref:Kt;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var f;n.value=n.value.bind((f=e.proxy_)!=null?f:e.target_)}return p.make_(e,t,n,s)}function pj(e,t,n,s){var r,o;if(n.get)return Qc.extend_(e,t,n,s);if(n.set)return e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:Mo(t.toString(),n.set)},s);if(typeof n.value=="function"&&(r=this.options_)!=null&&r.autoBind){var i;n.value=n.value.bind((i=e.proxy_)!=null?i:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Kt.ref:Kt;return a.extend_(e,t,n,s)}function fj(e,t){Ge("'"+this.annotationType_+"' cannot be used as a decorator")}var hj="observable",gj="observable.ref",mj="observable.shallow",vj="observable.struct",sb={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(sb);function El(e){return e||sb}var hp=Jc(hj),bj=Jc(gj,{enhancer:Xc}),yj=Jc(mj,{enhancer:z2}),xj=Jc(vj,{enhancer:U2}),rb=Bs(hp);function Pl(e){return e.deep===!0?Lo:e.deep===!1?Xc:Sj(e.defaultDecorator)}function wj(e){var t;return e?(t=e.defaultDecorator)!=null?t:nb(e):void 0}function Sj(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Lo}function ob(e,t,n){if(qa(t))return hp.decorate_20223_(e,t);if(_o(t)){Ga(e,t,hp);return}return jf(e)?e:fr(e)?Kt.object(e,t,n):Array.isArray(e)?Kt.array(e,t):Oi(e)?Kt.map(e,t):or(e)?Kt.set(e,t):typeof e=="object"&&e!==null?e:Kt.box(e,t)}zv(ob,rb);var Cj={box:function(t,n){var s=El(n);return new Dr(t,Pl(s),s.name,!0,s.equals)},array:function(t,n){var s=El(n);return(fe.useProxies===!1||s.proxy===!1?SE:pE)(t,Pl(s),s.name)},map:function(t,n){var s=El(n);return new Eb(t,Pl(s),s.name)},set:function(t,n){var s=El(n);return new Pb(t,Pl(s),s.name)},object:function(t,n,s){return eo(function(){return wb(fe.useProxies===!1||(s==null?void 0:s.proxy)===!1?Do({},s):lE({},s),t,n)})},ref:Bs(bj),shallow:Bs(yj),deep:rb,struct:Bs(xj)},Kt=zv(ob,Cj),ib="computed",jj="computed.struct",gp=xf(ib),Ej=xf(jj,{equals:Sc.structural}),Qc=function(t,n){if(qa(n))return gp.decorate_20223_(t,n);if(_o(n))return Ga(t,n,gp);if(fr(t))return Bs(xf(ib,t));var s=fr(n)?n:{};return s.get=t,s.name||(s.name=t.name||""),new bs(s)};Object.assign(Qc,gp);Qc.struct=Bs(Ej);var hg,gg,Cc=0,Pj=1,Tj=(hg=(gg=wc(function(){},"name"))==null?void 0:gg.configurable)!=null?hg:!1,mg={value:"action",configurable:!0,writable:!1,enumerable:!1};function Mo(e,t,n,s){n===void 0&&(n=!1);function r(){return Oj(e,n,t,s||this,arguments)}return r.isMobxAction=!0,r.toString=function(){return t.toString()},Tj&&(mg.value=e,Fs(r,"name",mg)),r}function Oj(e,t,n,s,r){var o=_j(e,t);try{return n.apply(s,r)}catch(i){throw o.error_=i,i}finally{Aj(o)}}function _j(e,t,n,s){var r=Qt.NODE_ENV!=="production",o=0,i=fe.trackingDerivation,a=!t||!i;Zn();var l=fe.allowStateChanges;a&&(Ho(),l=wf(!0));var u=Cf(!0),d={runAsAction_:a,prevDerivation_:i,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:r,startTime_:o,actionId_:Pj++,parentActionId_:Cc};return Cc=d.actionId_,d}function Aj(e){Cc!==e.actionId_&&Ge(30),Cc=e.parentActionId_,e.error_!==void 0&&(fe.suppressReactionErrors=!0),Sf(e.prevAllowStateChanges_),ia(e.prevAllowStateReads_),Yn(),e.runAsAction_&&dr(e.prevDerivation_),fe.suppressReactionErrors=!1}function wf(e){var t=fe.allowStateChanges;return fe.allowStateChanges=e,t}function Sf(e){fe.allowStateChanges=e}var Dr=function(e){function t(s,r,o,i,a){var l;return o===void 0&&(o="ObservableValue"),a===void 0&&(a=Sc.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=r,l.name_=o,l.equals=a,l.value_=r(s,void 0,o),l}Xv(t,e);var n=t.prototype;return n.dehanceValue=function(r){return this.dehancer!==void 0?this.dehancer(r):r},n.set=function(r){this.value_,r=this.prepareNewValue_(r),r!==fe.UNCHANGED&&this.setNewValue_(r)},n.prepareNewValue_=function(r){if(qn(this)){var o=Kn(this,{object:this,type:zs,newValue:r});if(!o)return fe.UNCHANGED;r=o.newValue}return r=this.enhancer(r,this.value_,this.name_),this.equals(this.value_,r)?fe.UNCHANGED:r},n.setNewValue_=function(r){var o=this.value_;this.value_=r,this.reportChanged(),hs(this)&&gs(this,{type:zs,object:this,newValue:r,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(r){return Ya(this,r)},n.observe_=function(r,o){return o&&r({observableKind:"value",debugObjectName:this.name_,object:this,type:zs,newValue:this.value_,oldValue:void 0}),Xa(this,r)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Yv(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Jr),Lj=Xr("ObservableValue",Dr),bs=function(){function e(n){this.dependenciesState_=Qe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Qe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Ec(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=jc.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||Ge(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Mo("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Sc.structural:Sc.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Rj(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.get=function(){if(this.isComputing&&Ge(32,this.name_,this.derivation),fe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)mp(this)&&(this.warnAboutUntrackedRead_(),Zn(),this.value_=this.computeValue_(!1),Yn());else if(fb(this),mp(this)){var s=fe.trackingContext;this.keepAlive_&&!s&&(fe.trackingContext=this),this.trackAndCompute()&&kj(this),fe.trackingContext=s}var r=this.value_;if(cc(r))throw r.cause;return r},t.set=function(s){if(this.setter_){this.isRunningSetter&&Ge(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,s)}finally{this.isRunningSetter=!1}}else Ge(34,this.name_)},t.trackAndCompute=function(){var s=this.value_,r=this.dependenciesState_===Qe.NOT_TRACKING_,o=this.computeValue_(!0),i=r||cc(s)||cc(o)||!this.equals_(s,o);return i&&(this.value_=o),i},t.computeValue_=function(s){this.isComputing=!0;var r=wf(!1),o;if(s)o=ab(this,this.derivation,this.scope_);else if(fe.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(i){o=new Ec(i)}return Sf(r),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(vp(this),this.value_=void 0)},t.observe_=function(s,r){var o=this,i=!0,a=void 0;return Gj(function(){var l=o.get();if(!i||r){var u=Ho();s({observableKind:"computed",debugObjectName:o.name_,type:zs,object:o,newValue:l,oldValue:a}),dr(u)}i=!1,a=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Yv(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},_i(e,[{key:"isComputing",get:function(){return Ln(this.flags_,e.isComputingMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isComputingMask_,s)}},{key:"isRunningSetter",get:function(){return Ln(this.flags_,e.isRunningSetterMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isRunningSetterMask_,s)}},{key:"isBeingObserved",get:function(){return Ln(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return Ln(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Mn(this.flags_,e.diffValueMask_,s===1)}}])}();bs.isComputingMask_=1;bs.isRunningSetterMask_=2;bs.isBeingObservedMask_=4;bs.isPendingUnobservationMask_=8;bs.diffValueMask_=16;var Za=Xr("ComputedValue",bs),Qe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Qe||(Qe={}));var jc;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(jc||(jc={}));var Ec=function(t){this.cause=void 0,this.cause=t};function cc(e){return e instanceof Ec}function mp(e){switch(e.dependenciesState_){case Qe.UP_TO_DATE_:return!1;case Qe.NOT_TRACKING_:case Qe.STALE_:return!0;case Qe.POSSIBLY_STALE_:{for(var t=Cf(!0),n=Ho(),s=e.observing_,r=s.length,o=0;o<r;o++){var i=s[o];if(Za(i)){if(fe.disableErrorBoundaries)i.get();else try{i.get()}catch{return dr(n),ia(t),!0}if(e.dependenciesState_===Qe.STALE_)return dr(n),ia(t),!0}}return cb(e),dr(n),ia(t),!1}}}function ab(e,t,n){var s=Cf(!0);cb(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++fe.runId;var r=fe.trackingDerivation;fe.trackingDerivation=e,fe.inBatch++;var o;if(fe.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(i){o=new Ec(i)}return fe.inBatch--,fe.trackingDerivation=r,Mj(e),ia(s),o}function Mj(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,s=Qe.UP_TO_DATE_,r=0,o=e.unboundDepsCount_,i=0;i<o;i++){var a=n[i];a.diffValue===0&&(a.diffValue=1,r!==i&&(n[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}for(n.length=r,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&db(l,e),l.diffValue=0}for(;r--;){var u=n[r];u.diffValue===1&&(u.diffValue=0,$j(u,e))}s!==Qe.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}function vp(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)db(t[n],e);e.dependenciesState_=Qe.NOT_TRACKING_}function lb(e){var t=Ho();try{return e()}finally{dr(t)}}function Ho(){var e=fe.trackingDerivation;return fe.trackingDerivation=null,e}function dr(e){fe.trackingDerivation=e}function Cf(e){var t=fe.allowStateReads;return fe.allowStateReads=e,t}function ia(e){fe.allowStateReads=e}function cb(e){if(e.dependenciesState_!==Qe.UP_TO_DATE_){e.dependenciesState_=Qe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Qe.UP_TO_DATE_}}var uc=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},dc=!0,ub=!1,fe=function(){var e=Zc();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(dc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new uc().version&&(dc=!1),dc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new uc):(setTimeout(function(){ub||Ge(35)},1),new uc)}();function Nj(){if((fe.pendingReactions.length||fe.inBatch||fe.isRunningReactions)&&Ge(36),ub=!0,dc){var e=Zc();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),fe=new uc}}function $j(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function db(e,t){e.observers_.delete(t),e.observers_.size===0&&pb(e)}function pb(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,fe.pendingUnobservations.push(e))}function Zn(){fe.inBatch++}function Yn(){if(--fe.inBatch===0){gb();for(var e=fe.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof bs&&n.suspend_())}fe.pendingUnobservations=[]}}function fb(e){var t=fe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&fe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&fe.inBatch>0&&pb(e),!1)}function hb(e){e.lowestObserverState_!==Qe.STALE_&&(e.lowestObserverState_=Qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Qe.STALE_}))}function kj(e){e.lowestObserverState_!==Qe.STALE_&&(e.lowestObserverState_=Qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.POSSIBLY_STALE_?t.dependenciesState_=Qe.STALE_:t.dependenciesState_===Qe.UP_TO_DATE_&&(e.lowestObserverState_=Qe.UP_TO_DATE_)}))}function Rj(e){e.lowestObserverState_===Qe.UP_TO_DATE_&&(e.lowestObserverState_=Qe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.UP_TO_DATE_&&(t.dependenciesState_=Qe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var hr=function(){function e(n,s,r,o){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Qe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=jc.NONE,this.name_=n,this.onInvalidate_=s,this.errorHandler_=r,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,fe.pendingReactions.push(this),gb())},t.runReaction_=function(){if(!this.isDisposed){Zn(),this.isScheduled=!1;var s=fe.trackingContext;if(fe.trackingContext=this,mp(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Qt.NODE_ENV!=="production"&&this.isTrackPending&&Eo()}catch(r){this.reportExceptionInDerivation_(r)}}fe.trackingContext=s,Yn()}},t.track=function(s){if(!this.isDisposed){Zn(),this.isRunning=!0;var r=fe.trackingContext;fe.trackingContext=this;var o=ab(this,s,void 0);fe.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&vp(this),cc(o)&&this.reportExceptionInDerivation_(o.cause),Yn()}},t.reportExceptionInDerivation_=function(s){var r=this;if(this.errorHandler_){this.errorHandler_(s,this);return}if(fe.disableErrorBoundaries)throw s;var o="[mobx] uncaught error in '"+this+"'";fe.suppressReactionErrors||console.error(o,s),fe.globalReactionErrorHandlers.forEach(function(i){return i(s,r)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Zn(),vp(this),Yn()))},t.getDisposer_=function(s){var r=this,o=function i(){r.dispose(),s==null||s.removeEventListener==null||s.removeEventListener("abort",i)};return s==null||s.addEventListener==null||s.addEventListener("abort",o),o[Ee]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(s){},_i(e,[{key:"isDisposed",get:function(){return Ln(this.flags_,e.isDisposedMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isDisposedMask_,s)}},{key:"isScheduled",get:function(){return Ln(this.flags_,e.isScheduledMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isScheduledMask_,s)}},{key:"isTrackPending",get:function(){return Ln(this.flags_,e.isTrackPendingMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isTrackPendingMask_,s)}},{key:"isRunning",get:function(){return Ln(this.flags_,e.isRunningMask_)},set:function(s){this.flags_=Mn(this.flags_,e.isRunningMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Mn(this.flags_,e.diffValueMask_,s===1)}}])}();hr.isDisposedMask_=1;hr.isScheduledMask_=2;hr.isTrackPendingMask_=4;hr.isRunningMask_=8;hr.diffValueMask_=16;var Ij=100,bp=function(t){return t()};function gb(){fe.inBatch>0||fe.isRunningReactions||bp(Vj)}function Vj(){fe.isRunningReactions=!0;for(var e=fe.pendingReactions,t=0;e.length>0;){++t===Ij&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),s=0,r=n.length;s<r;s++)n[s].runReaction_()}fe.isRunningReactions=!1}var Pc=Xr("Reaction",hr);function Hj(e){var t=bp;bp=function(s){return e(function(){return t(s)})}}function Eo(){return Qt.NODE_ENV!=="production"}function Dj(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var mb="action",Fj="action.bound",vb="autoAction",Bj="autoAction.bound",zj="<unnamed action>",yp=Ka(mb),Uj=Ka(Fj,{bound:!0}),xp=Ka(vb,{autoAction:!0}),Wj=Ka(Bj,{autoAction:!0,bound:!0});function bb(e){var t=function(s,r){if(vs(s))return Mo(s.name||zj,s,e);if(vs(r))return Mo(s,r,e);if(qa(r))return(e?xp:yp).decorate_20223_(s,r);if(_o(r))return Ga(s,r,e?xp:yp);if(_o(s))return Bs(Ka(e?vb:mb,{name:s,autoAction:e}))};return t}var li=bb(!1);Object.assign(li,yp);var xa=bb(!0);Object.assign(xa,xp);li.bound=Bs(Uj);xa.bound=Bs(Wj);function wa(e){return vs(e)&&e.isMobxAction===!0}function Gj(e,t){var n,s,r,o;t===void 0&&(t=Uv);var i=(n=(s=t)==null?void 0:s.name)!=null?n:"Autorun",a=!t.scheduler&&!t.delay,l;if(a)l=new hr(i,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=Kj(t),d=!1;l=new hr(i,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(p)}))},t.onError,t.requiresObservable)}function p(){e(l)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var qj=function(t){return t()};function Kj(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:qj}var Zj="onBO",Yj="onBUO";function Xj(e,t,n){return xb(Zj,e,t,n)}function yb(e,t,n){return xb(Yj,e,t,n)}function xb(e,t,n,s){var r=_c(t),o=vs(s)?s:n,i=e+"L";return r[i]?r[i].add(o):r[i]=new Set([o]),function(){var a=r[i];a&&(a.delete(o),a.size===0&&delete r[i])}}var Jj="never",Tl="always",Qj="observed";function eE(e){e.isolateGlobalState===!0&&Nj();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(fe.useProxies=t===Tl?!0:t===Jj?!1:typeof Proxy<"u"),t==="ifavailable"&&(fe.verifyProxies=!0),n!==void 0){var s=n===Tl?Tl:n===Qj;fe.enforceActions=s,fe.allowStateChanges=!(s===!0||s===Tl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(r){r in e&&(fe[r]=!!e[r])}),fe.allowStateReads=!fe.observableRequiresReaction,e.reactionScheduler&&Hj(e.reactionScheduler)}function wb(e,t,n,s){var r=N2(t);return eo(function(){var o=Do(e,s)[Ee];mi(r).forEach(function(i){o.extend_(i,r[i],n&&i in n?n[i]:!0)})}),e}function tE(e,t){return Sb(_c(e,t))}function Sb(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=nE(e.observing_).map(Sb)),t}function nE(e){return Array.from(new Set(e))}var sE=0;function Cb(){this.message="FLOW_CANCELLED"}Cb.prototype=Object.create(Error.prototype);var Ju=eb("flow"),rE=eb("flow.bound",{bound:!0}),No=Object.assign(function(t,n){if(qa(n))return Ju.decorate_20223_(t,n);if(_o(n))return Ga(t,n,Ju);var s=t,r=s.name||"<unnamed flow>",o=function(){var a=this,l=arguments,u=++sE,d=li(r+" - runid: "+u+" - init",s).apply(a,l),p,f=void 0,g=new Promise(function(m,v){var b=0;p=v;function x(S){f=void 0;var C;try{C=li(r+" - runid: "+u+" - yield "+b++,d.next).call(d,S)}catch(j){return v(j)}w(C)}function y(S){f=void 0;var C;try{C=li(r+" - runid: "+u+" - yield "+b++,d.throw).call(d,S)}catch(j){return v(j)}w(C)}function w(S){if(vs(S==null?void 0:S.then)){S.then(w,v);return}return S.done?m(S.value):(f=Promise.resolve(S.value),f.then(x,y))}x(void 0)});return g.cancel=li(r+" - runid: "+u+" - cancel",function(){try{f&&vg(f);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(ii,ii),vg(v),p(new Cb)}catch(b){p(b)}}),g};return o.isMobXFlow=!0,o},Ju);No.bound=Bs(rE);function vg(e){vs(e.cancel)&&e.cancel()}function Sa(e){return(e==null?void 0:e.isMobXFlow)===!0}function oE(e,t){return e?Qa(e)||!!e[Ee]||yf(e)||Pc(e)||Za(e):!1}function jf(e){return oE(e)}function iE(e){if(Qa(e))return e[Ee].ownKeys_();Ge(38)}function Ol(e,t,n){return e.set(t,n),n}function ri(e,t){if(e==null||typeof e!="object"||e instanceof Date||!jf(e))return e;if(Lj(e)||Za(e))return ri(e.get(),t);if(t.has(e))return t.get(e);if(Ja(e)){var n=Ol(t,e,new Array(e.length));return e.forEach(function(i,a){n[a]=ri(i,t)}),n}if(ps(e)){var s=Ol(t,e,new Set);return e.forEach(function(i){s.add(ri(i,t))}),s}if(Qr(e)){var r=Ol(t,e,new Map);return e.forEach(function(i,a){r.set(a,ri(i,t))}),r}else{var o=Ol(t,e,{});return iE(e).forEach(function(i){Ua.propertyIsEnumerable.call(e,i)&&(o[i]=ri(e[i],t))}),o}}function us(e,t){return ri(e,new Map)}function ir(e,t){t===void 0&&(t=void 0),Zn();try{return e.apply(t)}finally{Yn()}}function Zo(e){return e[Ee]}var aE={has:function(t,n){return Zo(t).has_(n)},get:function(t,n){return Zo(t).get_(n)},set:function(t,n,s){var r;return _o(n)?(r=Zo(t).set_(n,s,!0))!=null?r:!0:!1},deleteProperty:function(t,n){var s;return _o(n)?(s=Zo(t).delete_(n,!0))!=null?s:!0:!1},defineProperty:function(t,n,s){var r;return(r=Zo(t).defineProperty_(n,s))!=null?r:!0},ownKeys:function(t){return Zo(t).ownKeys_()},preventExtensions:function(t){Ge(13)}};function lE(e,t){var n,s;return Wv(),e=Do(e,t),(s=(n=e[Ee]).proxy_)!=null?s:n.proxy_=new Proxy(e,aE)}function qn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Ya(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Gv(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function Kn(e,t){var n=Ho();try{for(var s=[].concat(e.interceptors_||[]),r=0,o=s.length;r<o&&(t=s[r](t),t&&!t.type&&Ge(14),!!t);r++);return t}finally{dr(n)}}function hs(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Xa(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Gv(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function gs(e,t){var n=Ho(),s=e.changeListeners_;if(s){s=s.slice();for(var r=0,o=s.length;r<o;r++)s[r](t);dr(n)}}function cE(e,t,n){return eo(function(){var s,r=Do(e,n)[Ee];Qt.NODE_ENV!=="production"&&t&&e[fs],(s=t)!=null||(t=V2(e)),mi(t).forEach(function(o){return r.make_(o,t[o])})}),e}var Qu=Symbol("mobx-keys");function hn(e,t,n){return fr(e)?wb(e,e,t,n):(eo(function(){var s=Do(e,n)[Ee];if(!e[Qu]){var r=Object.getPrototypeOf(e),o=new Set([].concat(mi(e),mi(r)));o.delete("constructor"),o.delete(Ee),Wa(r,Qu,o)}e[Qu].forEach(function(i){return s.make_(i,t&&i in t?t[i]:!0)})}),e)}var bg="splice",zs="update",uE=1e4,dE={get:function(t,n){var s=t[Ee];return n===Ee?s:n==="length"?s.getArrayLength_():typeof n=="string"&&!isNaN(n)?s.get_(parseInt(n)):ur(Tc,n)?Tc[n]:t[n]},set:function(t,n,s){var r=t[Ee];return n==="length"&&r.setArrayLength_(s),typeof n=="symbol"||isNaN(n)?t[n]=s:r.set_(parseInt(n),s),!0},preventExtensions:function(){Ge(15)}},Ef=function(){function e(n,s,r,o){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=o,this.atom_=new Jr(n),this.enhancer_=function(i,a){return s(i,a,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.dehanceValues_=function(s){return this.dehancer!==void 0&&s.length>0?s.map(this.dehancer):s},t.intercept_=function(s){return Ya(this,s)},t.observe_=function(s,r){return r===void 0&&(r=!1),r&&s({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Xa(this,s)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(s){(typeof s!="number"||isNaN(s)||s<0)&&Ge("Out of range: "+s);var r=this.values_.length;if(s!==r)if(s>r){for(var o=new Array(s-r),i=0;i<s-r;i++)o[i]=void 0;this.spliceWithArray_(r,0,o)}else this.spliceWithArray_(s,r-s)},t.updateArrayLength_=function(s,r){s!==this.lastKnownLength_&&Ge(16),this.lastKnownLength_+=r,this.legacyMode_&&r>0&&Ab(s+r+1)},t.spliceWithArray_=function(s,r,o){var i=this;this.atom_;var a=this.values_.length;if(s===void 0?s=0:s>a?s=a:s<0&&(s=Math.max(0,a+s)),arguments.length===1?r=a-s:r==null?r=0:r=Math.max(0,Math.min(r,a-s)),o===void 0&&(o=pp),qn(this)){var l=Kn(this,{object:this.proxy_,type:bg,index:s,removedCount:r,added:o});if(!l)return pp;r=l.removedCount,o=l.added}if(o=o.length===0?o:o.map(function(p){return i.enhancer_(p,void 0)}),this.legacyMode_||Qt.NODE_ENV!=="production"){var u=o.length-r;this.updateArrayLength_(a,u)}var d=this.spliceItemsIntoValues_(s,r,o);return(r!==0||o.length!==0)&&this.notifyArraySplice_(s,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(s,r,o){if(o.length<uE){var i;return(i=this.values_).splice.apply(i,[s,r].concat(o))}else{var a=this.values_.slice(s,s+r),l=this.values_.slice(s+r);this.values_.length+=o.length-r;for(var u=0;u<o.length;u++)this.values_[s+u]=o[u];for(var d=0;d<l.length;d++)this.values_[s+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(s,r,o){var i=!this.owned_&&Eo(),a=hs(this),l=a||i?{observableKind:"array",object:this.proxy_,type:zs,debugObjectName:this.atom_.name_,index:s,newValue:r,oldValue:o}:null;this.atom_.reportChanged(),a&&gs(this,l)},t.notifyArraySplice_=function(s,r,o){var i=!this.owned_&&Eo(),a=hs(this),l=a||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:bg,index:s,removed:o,added:r,removedCount:o.length,addedCount:r.length}:null;this.atom_.reportChanged(),a&&gs(this,l)},t.get_=function(s){if(this.legacyMode_&&s>=this.values_.length){console.warn("[mobx] Out of bounds read: "+s);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[s])},t.set_=function(s,r){var o=this.values_;if(this.legacyMode_&&s>o.length&&Ge(17,s,o.length),s<o.length){this.atom_;var i=o[s];if(qn(this)){var a=Kn(this,{type:zs,object:this.proxy_,index:s,newValue:r});if(!a)return;r=a.newValue}r=this.enhancer_(r,i);var l=r!==i;l&&(o[s]=r,this.notifyArrayChildUpdate_(s,r,i))}else{for(var u=new Array(s+1-o.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=r,this.spliceWithArray_(o.length,0,u)}},e}();function pE(e,t,n,s){return n===void 0&&(n="ObservableArray"),s===void 0&&(s=!1),Wv(),eo(function(){var r=new Ef(n,t,s,!1);Kv(r.values_,Ee,r);var o=new Proxy(r.values_,dE);return r.proxy_=o,e&&e.length&&r.spliceWithArray_(0,0,e),o})}var Tc={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ee];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var s=arguments.length,r=new Array(s>2?s-2:0),o=2;o<s;o++)r[o-2]=arguments[o];var i=this[Ee];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(t);case 2:return i.spliceWithArray_(t,n)}return i.spliceWithArray_(t,n,r)},spliceWithArray:function(t,n,s){return this[Ee].spliceWithArray_(t,n,s)},push:function(){for(var t=this[Ee],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(t.values_.length,0,s),t.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ee],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(0,0,s),t.values_.length},reverse:function(){return fe.trackingDerivation&&Ge(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){fe.trackingDerivation&&Ge(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ee],s=n.dehanceValues_(n.values_).indexOf(t);return s>-1?(this.splice(s,1),!0):!1}};wt("at",Fn);wt("concat",Fn);wt("flat",Fn);wt("includes",Fn);wt("indexOf",Fn);wt("join",Fn);wt("lastIndexOf",Fn);wt("slice",Fn);wt("toString",Fn);wt("toLocaleString",Fn);wt("toSorted",Fn);wt("toSpliced",Fn);wt("with",Fn);wt("every",Cs);wt("filter",Cs);wt("find",Cs);wt("findIndex",Cs);wt("findLast",Cs);wt("findLastIndex",Cs);wt("flatMap",Cs);wt("forEach",Cs);wt("map",Cs);wt("some",Cs);wt("toReversed",Cs);wt("reduce",jb);wt("reduceRight",jb);function wt(e,t){typeof Array.prototype[e]=="function"&&(Tc[e]=t(e))}function Fn(e){return function(){var t=this[Ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Cs(e){return function(t,n){var s=this,r=this[Ee];r.atom_.reportObserved();var o=r.dehanceValues_(r.values_);return o[e](function(i,a){return t.call(n,i,a,s)})}}function jb(e){return function(){var t=this,n=this[Ee];n.atom_.reportObserved();var s=n.dehanceValues_(n.values_),r=arguments[0];return arguments[0]=function(o,i,a){return r(o,i,a,t)},s[e].apply(s,arguments)}}var fE=Xr("ObservableArrayAdministration",Ef);function Ja(e){return Yc(e)&&fE(e[Ee])}var hE={},$r="add",Oc="delete",Eb=function(){function e(n,s,r){var o=this;s===void 0&&(s=Lo),r===void 0&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ee]=hE,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=s,this.name_=r,vs(Map)||Ge(18),eo(function(){o.keysAtom_=Jv(Qt.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(s){return this.data_.has(s)},t.has=function(s){var r=this;if(!fe.trackingDerivation)return this.has_(s);var o=this.hasMap_.get(s);if(!o){var i=o=new Dr(this.has_(s),Xc,"ObservableMap.key?",!1);this.hasMap_.set(s,i),yb(i,function(){return r.hasMap_.delete(s)})}return o.get()},t.set=function(s,r){var o=this.has_(s);if(qn(this)){var i=Kn(this,{type:o?zs:$r,object:this,newValue:r,name:s});if(!i)return this;r=i.newValue}return o?this.updateValue_(s,r):this.addValue_(s,r),this},t.delete=function(s){var r=this;if(this.keysAtom_,qn(this)){var o=Kn(this,{type:Oc,object:this,name:s});if(!o)return!1}if(this.has_(s)){var i=Eo(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Oc,object:this,oldValue:this.data_.get(s).value_,name:s}:null;return ir(function(){var u;r.keysAtom_.reportChanged(),(u=r.hasMap_.get(s))==null||u.setNewValue_(!1);var d=r.data_.get(s);d.setNewValue_(void 0),r.data_.delete(s)}),a&&gs(this,l),!0}return!1},t.updateValue_=function(s,r){var o=this.data_.get(s);if(r=o.prepareNewValue_(r),r!==fe.UNCHANGED){var i=Eo(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:zs,object:this,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&gs(this,l)}},t.addValue_=function(s,r){var o=this;this.keysAtom_,ir(function(){var u,d=new Dr(r,o.enhancer_,"ObservableMap.key",!1);o.data_.set(s,d),r=d.value_,(u=o.hasMap_.get(s))==null||u.setNewValue_(!0),o.keysAtom_.reportChanged()});var i=Eo(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:$r,object:this,name:s,newValue:r}:null;a&&gs(this,l)},t.get=function(s){return this.has(s)?this.dehanceValue_(this.data_.get(s).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var s=this,r=this.keys();return yg({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:s.get(l)}}})},t.entries=function(){var s=this,r=this.keys();return yg({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:[l,s.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(s,r){for(var o=ai(this),i;!(i=o()).done;){var a=i.value,l=a[0],u=a[1];s.call(r,u,l,this)}},t.merge=function(s){var r=this;return Qr(s)&&(s=new Map(s)),ir(function(){fr(s)?M2(s).forEach(function(o){return r.set(o,s[o])}):Array.isArray(s)?s.forEach(function(o){var i=o[0],a=o[1];return r.set(i,a)}):Oi(s)?(L2(s)||Ge(19,s),s.forEach(function(o,i){return r.set(i,o)})):s!=null&&Ge(20,s)}),this},t.clear=function(){var s=this;ir(function(){lb(function(){for(var r=ai(s.keys()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.replace=function(s){var r=this;return ir(function(){for(var o=gE(s),i=new Map,a=!1,l=ai(r.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!o.has(d)){var p=r.delete(d);if(p)a=!0;else{var f=r.data_.get(d);i.set(d,f)}}}for(var g=ai(o.entries()),m;!(m=g()).done;){var v=m.value,b=v[0],x=v[1],y=r.data_.has(b);if(r.set(b,x),r.data_.has(b)){var w=r.data_.get(b);i.set(b,w),y||(a=!0)}}if(!a)if(r.data_.size!==i.size)r.keysAtom_.reportChanged();else for(var S=r.data_.keys(),C=i.keys(),j=S.next(),E=C.next();!j.done;){if(j.value!==E.value){r.keysAtom_.reportChanged();break}j=S.next(),E=C.next()}r.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(s,r){return Xa(this,s)},t.intercept_=function(s){return Ya(this,s)},_i(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Qr=Xr("ObservableMap",Eb);function yg(e){return e[Symbol.toStringTag]="MapIterator",Of(e)}function gE(e){if(Oi(e)||Qr(e))return e;if(Array.isArray(e))return new Map(e);if(fr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return Ge(21,e)}var mE={},Pb=function(){function e(n,s,r){var o=this;s===void 0&&(s=Lo),r===void 0&&(r="ObservableSet"),this.name_=void 0,this[Ee]=mE,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,vs(Set)||Ge(22),this.enhancer_=function(i,a){return s(i,a,r)},eo(function(){o.atom_=Jv(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.clear=function(){var s=this;ir(function(){lb(function(){for(var r=ai(s.data_.values()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.forEach=function(s,r){for(var o=ai(this),i;!(i=o()).done;){var a=i.value;s.call(r,a,a,this)}},t.add=function(s){var r=this;if(this.atom_,qn(this)){var o=Kn(this,{type:$r,object:this,newValue:s});if(!o)return this}if(!this.has(s)){ir(function(){r.data_.add(r.enhancer_(s,void 0)),r.atom_.reportChanged()});var i=Qt.NODE_ENV!=="production",a=hs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:$r,object:this,newValue:s}:null;a&&gs(this,l)}return this},t.delete=function(s){var r=this;if(qn(this)){var o=Kn(this,{type:Oc,object:this,oldValue:s});if(!o)return!1}if(this.has(s)){var i=Qt.NODE_ENV!=="production",a=hs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Oc,object:this,oldValue:s}:null;return ir(function(){r.atom_.reportChanged(),r.data_.delete(s)}),a&&gs(this,l),!0}return!1},t.has=function(s){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(s))},t.entries=function(){var s=0,r=Array.from(this.keys()),o=Array.from(this.values());return xg({next:function(){var a=s;return s+=1,a<o.length?{value:[r[a],o[a]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var s=this,r=0,o=Array.from(this.data_.values());return xg({next:function(){return r<o.length?{value:s.dehanceValue_(o[r++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(s){if(or(s)&&!ps(s))return s.intersection(this);var r=new Set(this);return r.intersection(s)},t.union=function(s){if(or(s)&&!ps(s))return s.union(this);var r=new Set(this);return r.union(s)},t.difference=function(s){return new Set(this).difference(s)},t.symmetricDifference=function(s){if(or(s)&&!ps(s))return s.symmetricDifference(this);var r=new Set(this);return r.symmetricDifference(s)},t.isSubsetOf=function(s){return new Set(this).isSubsetOf(s)},t.isSupersetOf=function(s){return new Set(this).isSupersetOf(s)},t.isDisjointFrom=function(s){if(or(s)&&!ps(s))return s.isDisjointFrom(this);var r=new Set(this);return r.isDisjointFrom(s)},t.replace=function(s){var r=this;return ps(s)&&(s=new Set(s)),ir(function(){Array.isArray(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):or(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):s!=null&&Ge("Cannot initialize set from "+s)}),this},t.observe_=function(s,r){return Xa(this,s)},t.intercept_=function(s){return Ya(this,s)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},_i(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),ps=Xr("ObservableSet",Pb);function xg(e){return e[Symbol.toStringTag]="SetIterator",Of(e)}var wg=Object.create(null),Sg="remove",Tb=function(){function e(n,s,r,o){s===void 0&&(s=new Map),o===void 0&&(o=uj),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=s,this.name_=r,this.defaultAnnotation_=o,this.keysAtom_=new Jr("ObservableObject.keys"),this.isPlainObject_=fr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(s){return this.values_.get(s).get()},t.setObservablePropValue_=function(s,r){var o=this.values_.get(s);if(o instanceof bs)return o.set(r),!0;if(qn(this)){var i=Kn(this,{type:zs,object:this.proxy_||this.target_,name:s,newValue:r});if(!i)return null;r=i.newValue}if(r=o.prepareNewValue_(r),r!==fe.UNCHANGED){var a=hs(this),l=Qt.NODE_ENV!=="production",u=a||l?{type:zs,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&gs(this,u)}return!0},t.get_=function(s){return fe.trackingDerivation&&!ur(this.target_,s)&&this.has_(s),this.target_[s]},t.set_=function(s,r,o){return o===void 0&&(o=!1),ur(this.target_,s)?this.values_.has(s)?this.setObservablePropValue_(s,r):o?Reflect.set(this.target_,s,r):(this.target_[s]=r,!0):this.extend_(s,{value:r,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(s){if(!fe.trackingDerivation)return s in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var r=this.pendingKeys_.get(s);return r||(r=new Dr(s in this.target_,Xc,"ObservableObject.key?",!1),this.pendingKeys_.set(s,r)),r.get()},t.make_=function(s,r){if(r===!0&&(r=this.defaultAnnotation_),r!==!1){if(!(s in this.target_)){var o;if((o=this.target_[fs])!=null&&o[s])return;Ge(1,r.annotationType_,this.name_+"."+s.toString())}for(var i=this.target_;i&&i!==Ua;){var a=wc(i,s);if(a){var l=r.make_(this,s,a,i);if(l===0)return;if(l===1)break}i=Object.getPrototypeOf(i)}jg(this,r,s)}},t.extend_=function(s,r,o,i){if(i===void 0&&(i=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(s,r,i);var a=o.extend_(this,s,r,i);return a&&jg(this,o,s),a},t.defineProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{Zn();var i=this.delete_(s);if(!i)return i;if(qn(this)){var a=Kn(this,{object:this.proxy_||this.target_,name:s,type:$r,newValue:r.value});if(!a)return null;var l=a.newValue;r.value!==l&&(r=Ao({},r,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,s,r))return!1}else Fs(this.target_,s,r);this.notifyPropertyAddition_(s,r.value)}finally{Yn()}return!0},t.defineObservableProperty_=function(s,r,o,i){i===void 0&&(i=!1),this.keysAtom_;try{Zn();var a=this.delete_(s);if(!a)return a;if(qn(this)){var l=Kn(this,{object:this.proxy_||this.target_,name:s,type:$r,newValue:r});if(!l)return null;r=l.newValue}var u=Cg(s),d={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,s,d))return!1}else Fs(this.target_,s,d);var p=new Dr(r,o,Qt.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key",!1);this.values_.set(s,p),this.notifyPropertyAddition_(s,p.value_)}finally{Yn()}return!0},t.defineComputedProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{Zn();var i=this.delete_(s);if(!i)return i;if(qn(this)){var a=Kn(this,{object:this.proxy_||this.target_,name:s,type:$r,newValue:void 0});if(!a)return null}r.name||(r.name=Qt.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key"),r.context=this.proxy_||this.target_;var l=Cg(s),u={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,s,u))return!1}else Fs(this.target_,s,u);this.values_.set(s,new bs(r)),this.notifyPropertyAddition_(s,void 0)}finally{Yn()}return!0},t.delete_=function(s,r){if(r===void 0&&(r=!1),this.keysAtom_,!ur(this.target_,s))return!0;if(qn(this)){var o=Kn(this,{object:this.proxy_||this.target_,name:s,type:Sg});if(!o)return null}try{var i;Zn();var a=hs(this),l=Qt.NODE_ENV!=="production"&&Eo(),u=this.values_.get(s),d=void 0;if(!u&&(a||l)){var p;d=(p=wc(this.target_,s))==null?void 0:p.value}if(r){if(!Reflect.deleteProperty(this.target_,s))return!1}else delete this.target_[s];if(Qt.NODE_ENV,u&&(this.values_.delete(s),u instanceof Dr&&(d=u.value_),hb(u)),this.keysAtom_.reportChanged(),(i=this.pendingKeys_)==null||(i=i.get(s))==null||i.set(s in this.target_),a||l){var f={type:Sg,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:s};Qt.NODE_ENV,a&&gs(this,f),Qt.NODE_ENV}}finally{Yn()}return!0},t.observe_=function(s,r){return Xa(this,s)},t.intercept_=function(s){return Ya(this,s)},t.notifyPropertyAddition_=function(s,r){var o,i=hs(this),a=Qt.NODE_ENV!=="production";if(i||a){var l=i||a?{type:$r,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:s,newValue:r}:null;i&&gs(this,l)}(o=this.pendingKeys_)==null||(o=o.get(s))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),mi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Do(e,t){var n;if(ur(e,Ee))return e;var s=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new Tb(e,new Map,String(s),wj(t));return Wa(e,Ee,r),e}var vE=Xr("ObservableObjectAdministration",Tb);function Cg(e){return wg[e]||(wg[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(n){return this[Ee].setObservablePropValue_(e,n)}})}function Qa(e){return Yc(e)?vE(e[Ee]):!1}function jg(e,t,n){var s;(s=e.target_[fs])==null||delete s[n]}var bE=_b(0),yE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),ed=0,Ob=function(){};function xE(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}xE(Ob,Array.prototype);var Pf=function(e){function t(s,r,o,i){var a;return o===void 0&&(o="ObservableArray"),i===void 0&&(i=!1),a=e.call(this)||this,eo(function(){var l=new Ef(o,r,i,!0);l.proxy_=a,Kv(a,Ee,l),s&&s.length&&a.spliceWithArray(0,0,s),yE&&Object.defineProperty(a,"0",bE)}),a}Xv(t,e);var n=t.prototype;return n.concat=function(){this[Ee].atom_.reportObserved();for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return Ja(a)?a.slice():a}))},n[Symbol.iterator]=function(){var s=this,r=0;return Of({next:function(){return r<s.length?{value:s[r++],done:!1}:{done:!0,value:void 0}}})},_i(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(r){this[Ee].setArrayLength_(r)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Ob);Object.entries(Tc).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Wa(Pf.prototype,t,n)});function _b(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(n){this[Ee].set_(e,n)}}}function wE(e){Fs(Pf.prototype,""+e,_b(e))}function Ab(e){if(e>ed){for(var t=ed;t<e+100;t++)wE(t);ed=e}}Ab(1e3);function SE(e,t,n){return new Pf(e,t,n)}function _c(e,t){if(typeof e=="object"&&e!==null){if(Ja(e))return t!==void 0&&Ge(23),e[Ee].atom_;if(ps(e))return e.atom_;if(Qr(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Ge(25,t,wp(e)),n}if(Qa(e)){if(!t)return Ge(26);var s=e[Ee].values_.get(t);return s||Ge(27,t,wp(e)),s}if(yf(e)||Za(e)||Pc(e))return e}else if(vs(e)&&Pc(e[Ee]))return e[Ee];Ge(28)}function CE(e,t){if(e||Ge(29),yf(e)||Za(e)||Pc(e)||Qr(e)||ps(e))return e;if(e[Ee])return e[Ee];Ge(24,e)}function wp(e,t){var n;if(t!==void 0)n=_c(e,t);else{if(wa(e))return e.name;Qa(e)||Qr(e)||ps(e)?n=CE(e):n=_c(e)}return n.name_}function eo(e){var t=Ho(),n=wf(!0);Zn();try{return e()}finally{Yn(),Sf(n),dr(t)}}var Eg=Ua.toString;function Tf(e,t,n){return n===void 0&&(n=-1),Sp(e,t,n)}function Sp(e,t,n,s,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var i=Eg.call(e);if(i!==Eg.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Pg(e),t=Pg(t);var a=i==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(vs(l)&&l instanceof l&&vs(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),s=s||[],r=r||[];for(var d=s.length;d--;)if(s[d]===e)return r[d]===t;if(s.push(e),r.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Sp(e[d],t[d],n-1,s,r))return!1}else{var p=Object.keys(e),f;if(d=p.length,Object.keys(t).length!==d)return!1;for(;d--;)if(f=p[d],!(ur(t,f)&&Sp(e[f],t[f],n-1,s,r)))return!1}return s.pop(),r.pop(),!0}function Pg(e){return Ja(e)?e.slice():Oi(e)||Qr(e)||or(e)||ps(e)?Array.from(e.entries()):e}var Tg,jE=((Tg=Zc().Iterator)==null?void 0:Tg.prototype)||{};function Of(e){return e[Symbol.iterator]=EE,Object.assign(Object.create(jE),e)}function EE(){return this}["Symbol","Map","Set"].forEach(function(e){var t=Zc();typeof t[e]>"u"&&Ge("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Dj,extras:{getDebugName:wp},$mobx:Ee});if(!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!cE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function PE(e){e()}function TE(e){e||(e=PE),eE({reactionScheduler:e})}function OE(e){return tE(e)}var _E=1e4,AE=1e4,LE=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(s){s===void 0&&(s=_E),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var r=Date.now();n.registrations.forEach(function(o,i){r-o.registeredAt>=s&&(n.finalize(o.value),n.registrations.delete(i))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){this.registrations.set(s,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,AE))}}),e}(),ME=typeof FinalizationRegistry<"u"?FinalizationRegistry:LE,Cp=new ME(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),Lb={exports:{}},td={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=r(o,s(a)))}return o}function s(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)t.call(o,a)&&o[a]&&(i=r(i,a));return i}function r(o,i){return i?o?o+" "+i:o+i:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Xb);var F2=Xb.exports;const L=Cf(F2);var en={NODE_ENV:"production"};function Ye(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var B2={};function Qc(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:B2}var Jb=Object.assign,Pc=Object.getOwnPropertyDescriptor,Us=Object.defineProperty,Ka=Object.prototype,mp=[];Object.freeze(mp);var Qb={};Object.freeze(Qb);var z2=typeof Proxy<"u",U2=Object.toString();function ev(){z2||Ye("Proxy not available")}function tv(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var li=function(){};function vs(e){return typeof e=="function"}function Ao(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function eu(e){return e!==null&&typeof e=="object"}function mr(e){if(!eu(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===U2}function nv(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Za(e,t,n){Us(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function sv(e,t,n){Us(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Qr(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(s){return eu(s)&&s[n]===!0}}function Ai(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function W2(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),s=Object.getPrototypeOf(n);return s===null}function lr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var rv=typeof Object.getOwnPropertySymbols<"u";function G2(e){var t=Object.keys(e);if(!rv)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(s){return Ka.propertyIsEnumerable.call(e,s)})):t}var vi=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:rv?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function ov(e){return e===null?null:typeof e=="object"?""+e:e}function fr(e,t){return Ka.hasOwnProperty.call(e,t)}var q2=Object.getOwnPropertyDescriptors||function(t){var n={};return vi(t).forEach(function(s){n[s]=Pc(t,s)}),n};function Ln(e,t){return!!(e&t)}function Nn(e,t,n){return n?e|=t:e&=~t,e}function yh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function K2(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,Y2(s.key),s)}}function Mi(e,t,n){return t&&K2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ci(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=X2(e))||t){n&&(e=n);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mo(){return Mo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Mo.apply(null,arguments)}function iv(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bp(e,t)}function bp(e,t){return bp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},bp(e,t)}function Z2(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Y2(e){var t=Z2(e,"string");return typeof t=="symbol"?t:t+""}function X2(e,t){if(e){if(typeof e=="string")return yh(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yh(e,t):void 0}}var gs=Symbol("mobx-stored-annotations");function Ws(e){function t(n,s){if(Xa(s))return e.decorate_20223_(n,s);Ya(n,s,e)}return Object.assign(t,e)}function Ya(e,t,n){fr(e,gs)||Za(e,gs,Mo({},e[gs])),ij(n)||(e[gs][t]=n)}function J2(e){return fr(e,gs)||Za(e,gs,Mo({},e[gs])),e[gs]}function Xa(e){return typeof e=="object"&&typeof e.kind=="string"}var Ee=Symbol("mobx administration"),eo=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=st.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.reportObserved=function(){return Sv(this)},t.reportChanged=function(){Yn(),Cv(this),Xn()},t.toString=function(){return this.name_},Mi(e,[{key:"isBeingObserved",get:function(){return Ln(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return Ln(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Nn(this.flags_,e.diffValueMask_,s===1)}}])}();eo.isBeingObservedMask_=1;eo.isPendingUnobservationMask_=2;eo.diffValueMask_=4;var jf=Qr("Atom",eo);function av(e,t,n){t===void 0&&(t=li),n===void 0&&(n=li);var s=new eo(e);return t!==li&&dE(s,t),n!==li&&Ov(s,n),s}function Q2(e,t){return e===t}function ej(e,t){return Lf(e,t)}function tj(e,t){return Lf(e,t,1)}function nj(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Tc={identity:Q2,structural:ej,default:nj,shallow:tj};function Lo(e,t,n){return _f(e)?e:Array.isArray(e)?Zt.array(e,{name:n}):mr(e)?Zt.object(e,void 0,{name:n}):Ai(e)?Zt.map(e,{name:n}):lr(e)?Zt.set(e,{name:n}):typeof e=="function"&&!Ea(e)&&!Pa(e)?nv(e)?$o(e):ja(n,e):e}function sj(e,t,n){if(e==null||sl(e)||nl(e)||to(e)||fs(e))return e;if(Array.isArray(e))return Zt.array(e,{name:n,deep:!1});if(mr(e))return Zt.object(e,void 0,{name:n,deep:!1});if(Ai(e))return Zt.map(e,{name:n,deep:!1});if(lr(e))return Zt.set(e,{name:n,deep:!1})}function tu(e){return e}function rj(e,t){return Lf(e,t)?t:e}var oj="override";function ij(e){return e.annotationType_===oj}function Ja(e,t){return{annotationType_:e,options_:t,make_:aj,extend_:lj,decorate_20223_:cj}}function aj(e,t,n,s){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Ea(n.value))return 1;var o=lv(e,this,t,n,!1);return Us(s,t,o),2}function lj(e,t,n,s){var r=lv(e,this,t,n);return e.defineProperty_(t,r,s)}function cj(e,t){var n=t.kind,s=t.name,r=t.addInitializer,o=this,i=function(u){var d,p,f,h;return No((d=(p=o.options_)==null?void 0:p.name)!=null?d:s.toString(),u,(f=(h=o.options_)==null?void 0:h.autoAction)!=null?f:!1)};if(n=="field")return function(l){var u,d=l;return Ea(d)||(d=i(d)),(u=o.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var a;return Ea(e)||(e=i(e)),(a=this.options_)!=null&&a.bound&&r(function(){var l=this,u=l[s].bind(l);u.isMobxAction=!0,l[s]=u}),e}Ye("Cannot apply '"+o.annotationType_+"' to '"+String(s)+"' (kind: "+n+"):"+(`
7
+ '`+o.annotationType_+"' can only be used on properties with a function value."))}function uj(e,t,n,s){t.annotationType_,s.value}function lv(e,t,n,s,r){var o,i,a,l,u,d,p;r===void 0&&(r=ge.safeDescriptors),uj(e,t,n,s);var f=s.value;if((o=t.options_)!=null&&o.bound){var h;f=f.bind((h=e.proxy_)!=null?h:e.target_)}return{value:No((i=(a=t.options_)==null?void 0:a.name)!=null?i:n.toString(),f,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:r?e.isPlainObject_:!0,enumerable:!1,writable:!r}}function cv(e,t){return{annotationType_:e,options_:t,make_:dj,extend_:pj,decorate_20223_:fj}}function dj(e,t,n,s){var r;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!fr(e.target_,t)||!Pa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Pa(n.value))return 1;var o=uv(e,this,t,n,!1,!1);return Us(s,t,o),2}function pj(e,t,n,s){var r,o=uv(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,s)}function fj(e,t){var n,s=t.name,r=t.addInitializer;return Pa(e)||(e=$o(e)),(n=this.options_)!=null&&n.bound&&r(function(){var o=this,i=o[s].bind(o);i.isMobXFlow=!0,o[s]=i}),e}function gj(e,t,n,s){t.annotationType_,s.value}function uv(e,t,n,s,r,o){o===void 0&&(o=ge.safeDescriptors),gj(e,t,n,s);var i=s.value;if(Pa(i)||(i=$o(i)),r){var a;i=i.bind((a=e.proxy_)!=null?a:e.target_),i.isMobXFlow=!0}return{value:i,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Ef(e,t){return{annotationType_:e,options_:t,make_:hj,extend_:mj,decorate_20223_:bj}}function hj(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function mj(e,t,n,s){return vj(e,this,t,n),e.defineComputedProperty_(t,Mo({},this.options_,{get:n.get,set:n.set}),s)}function bj(e,t){var n=this,s=t.name,r=t.addInitializer;return r(function(){var o=Fo(this)[Ee],i=Mo({},n.options_,{get:e,context:this});i.name||(i.name="ObservableObject."+s.toString()),o.values_.set(s,new ys(i))}),function(){return this[Ee].getObservablePropValue_(s)}}function vj(e,t,n,s){t.annotationType_,s.get}function nu(e,t){return{annotationType_:e,options_:t,make_:yj,extend_:xj,decorate_20223_:wj}}function yj(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function xj(e,t,n,s){var r,o;return Sj(e,this),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer)!=null?r:Lo,s)}function wj(e,t){var n=this,s=t.kind,r=t.name,o=new WeakSet;function i(a,l){var u,d,p=Fo(a)[Ee],f=new Br(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:Lo,"ObservableObject."+r.toString(),!1);p.values_.set(r,f),o.add(a)}if(s=="accessor")return{get:function(){return o.has(this)||i(this,e.get.call(this)),this[Ee].getObservablePropValue_(r)},set:function(l){return o.has(this)||i(this,l),this[Ee].setObservablePropValue_(r,l)},init:function(l){return o.has(this)||i(this,l),l}}}function Sj(e,t,n,s){t.annotationType_}var Cj="true",jj=dv();function dv(e){return{annotationType_:Cj,options_:e,make_:Ej,extend_:Pj,decorate_20223_:Tj}}function Ej(e,t,n,s){var r,o;if(n.get)return su.make_(e,t,n,s);if(n.set){var i=No(t.toString(),n.set);return s===e.target_?e.defineProperty_(t,{configurable:ge.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(Us(s,t,{configurable:!0,set:i}),2)}if(s!==e.target_&&typeof n.value=="function"){var a;if(nv(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?$o.bound:$o;return u.make_(e,t,n,s)}var d=(a=this.options_)!=null&&a.autoBind?ja.bound:ja;return d.make_(e,t,n,s)}var p=((r=this.options_)==null?void 0:r.deep)===!1?Zt.ref:Zt;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var f;n.value=n.value.bind((f=e.proxy_)!=null?f:e.target_)}return p.make_(e,t,n,s)}function Pj(e,t,n,s){var r,o;if(n.get)return su.extend_(e,t,n,s);if(n.set)return e.defineProperty_(t,{configurable:ge.safeDescriptors?e.isPlainObject_:!0,set:No(t.toString(),n.set)},s);if(typeof n.value=="function"&&(r=this.options_)!=null&&r.autoBind){var i;n.value=n.value.bind((i=e.proxy_)!=null?i:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Zt.ref:Zt;return a.extend_(e,t,n,s)}function Tj(e,t){Ye("'"+this.annotationType_+"' cannot be used as a decorator")}var Oj="observable",_j="observable.ref",Aj="observable.shallow",Mj="observable.struct",pv={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(pv);function _l(e){return e||pv}var vp=nu(Oj),Lj=nu(_j,{enhancer:tu}),Nj=nu(Aj,{enhancer:sj}),$j=nu(Mj,{enhancer:rj}),fv=Ws(vp);function Al(e){return e.deep===!0?Lo:e.deep===!1?tu:Rj(e.defaultDecorator)}function kj(e){var t;return e?(t=e.defaultDecorator)!=null?t:dv(e):void 0}function Rj(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Lo}function gv(e,t,n){if(Xa(t))return vp.decorate_20223_(e,t);if(Ao(t)){Ya(e,t,vp);return}return _f(e)?e:mr(e)?Zt.object(e,t,n):Array.isArray(e)?Zt.array(e,t):Ai(e)?Zt.map(e,t):lr(e)?Zt.set(e,t):typeof e=="object"&&e!==null?e:Zt.box(e,t)}Jb(gv,fv);var Ij={box:function(t,n){var s=_l(n);return new Br(t,Al(s),s.name,!0,s.equals)},array:function(t,n){var s=_l(n);return(ge.useProxies===!1||s.proxy===!1?RE:PE)(t,Al(s),s.name)},map:function(t,n){var s=_l(n);return new $v(t,Al(s),s.name)},set:function(t,n){var s=_l(n);return new kv(t,Al(s),s.name)},object:function(t,n,s){return no(function(){return Av(ge.useProxies===!1||(s==null?void 0:s.proxy)===!1?Fo({},s):SE({},s),t,n)})},ref:Ws(Lj),shallow:Ws(Nj),deep:fv,struct:Ws($j)},Zt=Jb(gv,Ij),hv="computed",Vj="computed.struct",yp=Ef(hv),Hj=Ef(Vj,{equals:Tc.structural}),su=function(t,n){if(Xa(n))return yp.decorate_20223_(t,n);if(Ao(n))return Ya(t,n,yp);if(mr(t))return Ws(Ef(hv,t));var s=mr(n)?n:{};return s.get=t,s.name||(s.name=t.name||""),new ys(s)};Object.assign(su,yp);su.struct=Ws(Hj);var xh,wh,Oc=0,Dj=1,Fj=(xh=(wh=Pc(function(){},"name"))==null?void 0:wh.configurable)!=null?xh:!1,Sh={value:"action",configurable:!0,writable:!1,enumerable:!1};function No(e,t,n,s){n===void 0&&(n=!1);function r(){return Bj(e,n,t,s||this,arguments)}return r.isMobxAction=!0,r.toString=function(){return t.toString()},Fj&&(Sh.value=e,Us(r,"name",Sh)),r}function Bj(e,t,n,s,r){var o=zj(e,t);try{return n.apply(s,r)}catch(i){throw o.error_=i,i}finally{Uj(o)}}function zj(e,t,n,s){var r=en.NODE_ENV!=="production",o=0,i=ge.trackingDerivation,a=!t||!i;Yn();var l=ge.allowStateChanges;a&&(Do(),l=Pf(!0));var u=Of(!0),d={runAsAction_:a,prevDerivation_:i,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:r,startTime_:o,actionId_:Dj++,parentActionId_:Oc};return Oc=d.actionId_,d}function Uj(e){Oc!==e.actionId_&&Ye(30),Oc=e.parentActionId_,e.error_!==void 0&&(ge.suppressReactionErrors=!0),Tf(e.prevAllowStateChanges_),la(e.prevAllowStateReads_),Xn(),e.runAsAction_&&gr(e.prevDerivation_),ge.suppressReactionErrors=!1}function Pf(e){var t=ge.allowStateChanges;return ge.allowStateChanges=e,t}function Tf(e){ge.allowStateChanges=e}var Br=function(e){function t(s,r,o,i,a){var l;return o===void 0&&(o="ObservableValue"),a===void 0&&(a=Tc.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=r,l.name_=o,l.equals=a,l.value_=r(s,void 0,o),l}iv(t,e);var n=t.prototype;return n.dehanceValue=function(r){return this.dehancer!==void 0?this.dehancer(r):r},n.set=function(r){this.value_,r=this.prepareNewValue_(r),r!==ge.UNCHANGED&&this.setNewValue_(r)},n.prepareNewValue_=function(r){if(Kn(this)){var o=Zn(this,{object:this,type:Gs,newValue:r});if(!o)return ge.UNCHANGED;r=o.newValue}return r=this.enhancer(r,this.value_,this.name_),this.equals(this.value_,r)?ge.UNCHANGED:r},n.setNewValue_=function(r){var o=this.value_;this.value_=r,this.reportChanged(),hs(this)&&ms(this,{type:Gs,object:this,newValue:r,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(r){return el(this,r)},n.observe_=function(r,o){return o&&r({observableKind:"value",debugObjectName:this.name_,object:this,type:Gs,newValue:this.value_,oldValue:void 0}),tl(this,r)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return ov(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(eo),Wj=Qr("ObservableValue",Br),ys=function(){function e(n){this.dependenciesState_=st.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=st.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Ac(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=_c.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||Ye(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=No("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Tc.structural:Tc.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Yj(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.get=function(){if(this.isComputing&&Ye(32,this.name_,this.derivation),ge.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)xp(this)&&(this.warnAboutUntrackedRead_(),Yn(),this.value_=this.computeValue_(!1),Xn());else if(Sv(this),xp(this)){var s=ge.trackingContext;this.keepAlive_&&!s&&(ge.trackingContext=this),this.trackAndCompute()&&Zj(this),ge.trackingContext=s}var r=this.value_;if(gc(r))throw r.cause;return r},t.set=function(s){if(this.setter_){this.isRunningSetter&&Ye(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,s)}finally{this.isRunningSetter=!1}}else Ye(34,this.name_)},t.trackAndCompute=function(){var s=this.value_,r=this.dependenciesState_===st.NOT_TRACKING_,o=this.computeValue_(!0),i=r||gc(s)||gc(o)||!this.equals_(s,o);return i&&(this.value_=o),i},t.computeValue_=function(s){this.isComputing=!0;var r=Pf(!1),o;if(s)o=mv(this,this.derivation,this.scope_);else if(ge.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(i){o=new Ac(i)}return Tf(r),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(wp(this),this.value_=void 0)},t.observe_=function(s,r){var o=this,i=!0,a=void 0;return iE(function(){var l=o.get();if(!i||r){var u=Do();s({observableKind:"computed",debugObjectName:o.name_,type:Gs,object:o,newValue:l,oldValue:a}),gr(u)}i=!1,a=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return ov(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Mi(e,[{key:"isComputing",get:function(){return Ln(this.flags_,e.isComputingMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isComputingMask_,s)}},{key:"isRunningSetter",get:function(){return Ln(this.flags_,e.isRunningSetterMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isRunningSetterMask_,s)}},{key:"isBeingObserved",get:function(){return Ln(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return Ln(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Nn(this.flags_,e.diffValueMask_,s===1)}}])}();ys.isComputingMask_=1;ys.isRunningSetterMask_=2;ys.isBeingObservedMask_=4;ys.isPendingUnobservationMask_=8;ys.diffValueMask_=16;var Qa=Qr("ComputedValue",ys),st;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(st||(st={}));var _c;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(_c||(_c={}));var Ac=function(t){this.cause=void 0,this.cause=t};function gc(e){return e instanceof Ac}function xp(e){switch(e.dependenciesState_){case st.UP_TO_DATE_:return!1;case st.NOT_TRACKING_:case st.STALE_:return!0;case st.POSSIBLY_STALE_:{for(var t=Of(!0),n=Do(),s=e.observing_,r=s.length,o=0;o<r;o++){var i=s[o];if(Qa(i)){if(ge.disableErrorBoundaries)i.get();else try{i.get()}catch{return gr(n),la(t),!0}if(e.dependenciesState_===st.STALE_)return gr(n),la(t),!0}}return vv(e),gr(n),la(t),!1}}}function mv(e,t,n){var s=Of(!0);vv(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ge.runId;var r=ge.trackingDerivation;ge.trackingDerivation=e,ge.inBatch++;var o;if(ge.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(i){o=new Ac(i)}return ge.inBatch--,ge.trackingDerivation=r,Gj(e),la(s),o}function Gj(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,s=st.UP_TO_DATE_,r=0,o=e.unboundDepsCount_,i=0;i<o;i++){var a=n[i];a.diffValue===0&&(a.diffValue=1,r!==i&&(n[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}for(n.length=r,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&xv(l,e),l.diffValue=0}for(;r--;){var u=n[r];u.diffValue===1&&(u.diffValue=0,Kj(u,e))}s!==st.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}function wp(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)xv(t[n],e);e.dependenciesState_=st.NOT_TRACKING_}function bv(e){var t=Do();try{return e()}finally{gr(t)}}function Do(){var e=ge.trackingDerivation;return ge.trackingDerivation=null,e}function gr(e){ge.trackingDerivation=e}function Of(e){var t=ge.allowStateReads;return ge.allowStateReads=e,t}function la(e){ge.allowStateReads=e}function vv(e){if(e.dependenciesState_!==st.UP_TO_DATE_){e.dependenciesState_=st.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=st.UP_TO_DATE_}}var hc=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},mc=!0,yv=!1,ge=function(){var e=Qc();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(mc=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new hc().version&&(mc=!1),mc?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new hc):(setTimeout(function(){yv||Ye(35)},1),new hc)}();function qj(){if((ge.pendingReactions.length||ge.inBatch||ge.isRunningReactions)&&Ye(36),yv=!0,mc){var e=Qc();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ge=new hc}}function Kj(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function xv(e,t){e.observers_.delete(t),e.observers_.size===0&&wv(e)}function wv(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ge.pendingUnobservations.push(e))}function Yn(){ge.inBatch++}function Xn(){if(--ge.inBatch===0){jv();for(var e=ge.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof ys&&n.suspend_())}ge.pendingUnobservations=[]}}function Sv(e){var t=ge.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ge.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ge.inBatch>0&&wv(e),!1)}function Cv(e){e.lowestObserverState_!==st.STALE_&&(e.lowestObserverState_=st.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===st.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=st.STALE_}))}function Zj(e){e.lowestObserverState_!==st.STALE_&&(e.lowestObserverState_=st.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===st.POSSIBLY_STALE_?t.dependenciesState_=st.STALE_:t.dependenciesState_===st.UP_TO_DATE_&&(e.lowestObserverState_=st.UP_TO_DATE_)}))}function Yj(e){e.lowestObserverState_===st.UP_TO_DATE_&&(e.lowestObserverState_=st.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===st.UP_TO_DATE_&&(t.dependenciesState_=st.POSSIBLY_STALE_,t.onBecomeStale_())}))}var br=function(){function e(n,s,r,o){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=st.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=_c.NONE,this.name_=n,this.onInvalidate_=s,this.errorHandler_=r,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,ge.pendingReactions.push(this),jv())},t.runReaction_=function(){if(!this.isDisposed){Yn(),this.isScheduled=!1;var s=ge.trackingContext;if(ge.trackingContext=this,xp(this)){this.isTrackPending=!0;try{this.onInvalidate_(),en.NODE_ENV!=="production"&&this.isTrackPending&&Po()}catch(r){this.reportExceptionInDerivation_(r)}}ge.trackingContext=s,Xn()}},t.track=function(s){if(!this.isDisposed){Yn(),this.isRunning=!0;var r=ge.trackingContext;ge.trackingContext=this;var o=mv(this,s,void 0);ge.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&wp(this),gc(o)&&this.reportExceptionInDerivation_(o.cause),Xn()}},t.reportExceptionInDerivation_=function(s){var r=this;if(this.errorHandler_){this.errorHandler_(s,this);return}if(ge.disableErrorBoundaries)throw s;var o="[mobx] uncaught error in '"+this+"'";ge.suppressReactionErrors||console.error(o,s),ge.globalReactionErrorHandlers.forEach(function(i){return i(s,r)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Yn(),wp(this),Xn()))},t.getDisposer_=function(s){var r=this,o=function i(){r.dispose(),s==null||s.removeEventListener==null||s.removeEventListener("abort",i)};return s==null||s.addEventListener==null||s.addEventListener("abort",o),o[Ee]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(s){},Mi(e,[{key:"isDisposed",get:function(){return Ln(this.flags_,e.isDisposedMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isDisposedMask_,s)}},{key:"isScheduled",get:function(){return Ln(this.flags_,e.isScheduledMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isScheduledMask_,s)}},{key:"isTrackPending",get:function(){return Ln(this.flags_,e.isTrackPendingMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isTrackPendingMask_,s)}},{key:"isRunning",get:function(){return Ln(this.flags_,e.isRunningMask_)},set:function(s){this.flags_=Nn(this.flags_,e.isRunningMask_,s)}},{key:"diffValue",get:function(){return Ln(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Nn(this.flags_,e.diffValueMask_,s===1)}}])}();br.isDisposedMask_=1;br.isScheduledMask_=2;br.isTrackPendingMask_=4;br.isRunningMask_=8;br.diffValueMask_=16;var Xj=100,Sp=function(t){return t()};function jv(){ge.inBatch>0||ge.isRunningReactions||Sp(Jj)}function Jj(){ge.isRunningReactions=!0;for(var e=ge.pendingReactions,t=0;e.length>0;){++t===Xj&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),s=0,r=n.length;s<r;s++)n[s].runReaction_()}ge.isRunningReactions=!1}var Mc=Qr("Reaction",br);function Qj(e){var t=Sp;Sp=function(s){return e(function(){return t(s)})}}function Po(){return en.NODE_ENV!=="production"}function eE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Ev="action",tE="action.bound",Pv="autoAction",nE="autoAction.bound",sE="<unnamed action>",Cp=Ja(Ev),rE=Ja(tE,{bound:!0}),jp=Ja(Pv,{autoAction:!0}),oE=Ja(nE,{autoAction:!0,bound:!0});function Tv(e){var t=function(s,r){if(vs(s))return No(s.name||sE,s,e);if(vs(r))return No(s,r,e);if(Xa(r))return(e?jp:Cp).decorate_20223_(s,r);if(Ao(r))return Ya(s,r,e?jp:Cp);if(Ao(s))return Ws(Ja(e?Pv:Ev,{name:s,autoAction:e}))};return t}var ui=Tv(!1);Object.assign(ui,Cp);var ja=Tv(!0);Object.assign(ja,jp);ui.bound=Ws(rE);ja.bound=Ws(oE);function Ea(e){return vs(e)&&e.isMobxAction===!0}function iE(e,t){var n,s,r,o;t===void 0&&(t=Qb);var i=(n=(s=t)==null?void 0:s.name)!=null?n:"Autorun",a=!t.scheduler&&!t.delay,l;if(a)l=new br(i,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=lE(t),d=!1;l=new br(i,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(p)}))},t.onError,t.requiresObservable)}function p(){e(l)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var aE=function(t){return t()};function lE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:aE}var cE="onBO",uE="onBUO";function dE(e,t,n){return _v(cE,e,t,n)}function Ov(e,t,n){return _v(uE,e,t,n)}function _v(e,t,n,s){var r=$c(t),o=vs(s)?s:n,i=e+"L";return r[i]?r[i].add(o):r[i]=new Set([o]),function(){var a=r[i];a&&(a.delete(o),a.size===0&&delete r[i])}}var pE="never",Ml="always",fE="observed";function gE(e){e.isolateGlobalState===!0&&qj();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ge.useProxies=t===Ml?!0:t===pE?!1:typeof Proxy<"u"),t==="ifavailable"&&(ge.verifyProxies=!0),n!==void 0){var s=n===Ml?Ml:n===fE;ge.enforceActions=s,ge.allowStateChanges=!(s===!0||s===Ml)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(r){r in e&&(ge[r]=!!e[r])}),ge.allowStateReads=!ge.observableRequiresReaction,e.reactionScheduler&&Qj(e.reactionScheduler)}function Av(e,t,n,s){var r=q2(t);return no(function(){var o=Fo(e,s)[Ee];vi(r).forEach(function(i){o.extend_(i,r[i],n&&i in n?n[i]:!0)})}),e}function hE(e,t){return Mv($c(e,t))}function Mv(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=mE(e.observing_).map(Mv)),t}function mE(e){return Array.from(new Set(e))}var bE=0;function Lv(){this.message="FLOW_CANCELLED"}Lv.prototype=Object.create(Error.prototype);var nd=cv("flow"),vE=cv("flow.bound",{bound:!0}),$o=Object.assign(function(t,n){if(Xa(n))return nd.decorate_20223_(t,n);if(Ao(n))return Ya(t,n,nd);var s=t,r=s.name||"<unnamed flow>",o=function(){var a=this,l=arguments,u=++bE,d=ui(r+" - runid: "+u+" - init",s).apply(a,l),p,f=void 0,h=new Promise(function(m,b){var v=0;p=b;function x(S){f=void 0;var j;try{j=ui(r+" - runid: "+u+" - yield "+v++,d.next).call(d,S)}catch(C){return b(C)}w(j)}function y(S){f=void 0;var j;try{j=ui(r+" - runid: "+u+" - yield "+v++,d.throw).call(d,S)}catch(C){return b(C)}w(j)}function w(S){if(vs(S==null?void 0:S.then)){S.then(w,b);return}return S.done?m(S.value):(f=Promise.resolve(S.value),f.then(x,y))}x(void 0)});return h.cancel=ui(r+" - runid: "+u+" - cancel",function(){try{f&&Ch(f);var m=d.return(void 0),b=Promise.resolve(m.value);b.then(li,li),Ch(b),p(new Lv)}catch(v){p(v)}}),h};return o.isMobXFlow=!0,o},nd);$o.bound=Ws(vE);function Ch(e){vs(e.cancel)&&e.cancel()}function Pa(e){return(e==null?void 0:e.isMobXFlow)===!0}function yE(e,t){return e?sl(e)||!!e[Ee]||jf(e)||Mc(e)||Qa(e):!1}function _f(e){return yE(e)}function xE(e){if(sl(e))return e[Ee].ownKeys_();Ye(38)}function Ll(e,t,n){return e.set(t,n),n}function oi(e,t){if(e==null||typeof e!="object"||e instanceof Date||!_f(e))return e;if(Wj(e)||Qa(e))return oi(e.get(),t);if(t.has(e))return t.get(e);if(nl(e)){var n=Ll(t,e,new Array(e.length));return e.forEach(function(i,a){n[a]=oi(i,t)}),n}if(fs(e)){var s=Ll(t,e,new Set);return e.forEach(function(i){s.add(oi(i,t))}),s}if(to(e)){var r=Ll(t,e,new Map);return e.forEach(function(i,a){r.set(a,oi(i,t))}),r}else{var o=Ll(t,e,{});return xE(e).forEach(function(i){Ka.propertyIsEnumerable.call(e,i)&&(o[i]=oi(e[i],t))}),o}}function ds(e,t){return oi(e,new Map)}function cr(e,t){t===void 0&&(t=void 0),Yn();try{return e.apply(t)}finally{Xn()}}function Yo(e){return e[Ee]}var wE={has:function(t,n){return Yo(t).has_(n)},get:function(t,n){return Yo(t).get_(n)},set:function(t,n,s){var r;return Ao(n)?(r=Yo(t).set_(n,s,!0))!=null?r:!0:!1},deleteProperty:function(t,n){var s;return Ao(n)?(s=Yo(t).delete_(n,!0))!=null?s:!0:!1},defineProperty:function(t,n,s){var r;return(r=Yo(t).defineProperty_(n,s))!=null?r:!0},ownKeys:function(t){return Yo(t).ownKeys_()},preventExtensions:function(t){Ye(13)}};function SE(e,t){var n,s;return ev(),e=Fo(e,t),(s=(n=e[Ee]).proxy_)!=null?s:n.proxy_=new Proxy(e,wE)}function Kn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function el(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),tv(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function Zn(e,t){var n=Do();try{for(var s=[].concat(e.interceptors_||[]),r=0,o=s.length;r<o&&(t=s[r](t),t&&!t.type&&Ye(14),!!t);r++);return t}finally{gr(n)}}function hs(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function tl(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),tv(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function ms(e,t){var n=Do(),s=e.changeListeners_;if(s){s=s.slice();for(var r=0,o=s.length;r<o;r++)s[r](t);gr(n)}}function CE(e,t,n){return no(function(){var s,r=Fo(e,n)[Ee];en.NODE_ENV!=="production"&&t&&e[gs],(s=t)!=null||(t=J2(e)),vi(t).forEach(function(o){return r.make_(o,t[o])})}),e}var sd=Symbol("mobx-keys");function gn(e,t,n){return mr(e)?Av(e,e,t,n):(no(function(){var s=Fo(e,n)[Ee];if(!e[sd]){var r=Object.getPrototypeOf(e),o=new Set([].concat(vi(e),vi(r)));o.delete("constructor"),o.delete(Ee),Za(r,sd,o)}e[sd].forEach(function(i){return s.make_(i,t&&i in t?t[i]:!0)})}),e)}var jh="splice",Gs="update",jE=1e4,EE={get:function(t,n){var s=t[Ee];return n===Ee?s:n==="length"?s.getArrayLength_():typeof n=="string"&&!isNaN(n)?s.get_(parseInt(n)):fr(Lc,n)?Lc[n]:t[n]},set:function(t,n,s){var r=t[Ee];return n==="length"&&r.setArrayLength_(s),typeof n=="symbol"||isNaN(n)?t[n]=s:r.set_(parseInt(n),s),!0},preventExtensions:function(){Ye(15)}},Af=function(){function e(n,s,r,o){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=o,this.atom_=new eo(n),this.enhancer_=function(i,a){return s(i,a,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.dehanceValues_=function(s){return this.dehancer!==void 0&&s.length>0?s.map(this.dehancer):s},t.intercept_=function(s){return el(this,s)},t.observe_=function(s,r){return r===void 0&&(r=!1),r&&s({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),tl(this,s)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(s){(typeof s!="number"||isNaN(s)||s<0)&&Ye("Out of range: "+s);var r=this.values_.length;if(s!==r)if(s>r){for(var o=new Array(s-r),i=0;i<s-r;i++)o[i]=void 0;this.spliceWithArray_(r,0,o)}else this.spliceWithArray_(s,r-s)},t.updateArrayLength_=function(s,r){s!==this.lastKnownLength_&&Ye(16),this.lastKnownLength_+=r,this.legacyMode_&&r>0&&Hv(s+r+1)},t.spliceWithArray_=function(s,r,o){var i=this;this.atom_;var a=this.values_.length;if(s===void 0?s=0:s>a?s=a:s<0&&(s=Math.max(0,a+s)),arguments.length===1?r=a-s:r==null?r=0:r=Math.max(0,Math.min(r,a-s)),o===void 0&&(o=mp),Kn(this)){var l=Zn(this,{object:this.proxy_,type:jh,index:s,removedCount:r,added:o});if(!l)return mp;r=l.removedCount,o=l.added}if(o=o.length===0?o:o.map(function(p){return i.enhancer_(p,void 0)}),this.legacyMode_||en.NODE_ENV!=="production"){var u=o.length-r;this.updateArrayLength_(a,u)}var d=this.spliceItemsIntoValues_(s,r,o);return(r!==0||o.length!==0)&&this.notifyArraySplice_(s,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(s,r,o){if(o.length<jE){var i;return(i=this.values_).splice.apply(i,[s,r].concat(o))}else{var a=this.values_.slice(s,s+r),l=this.values_.slice(s+r);this.values_.length+=o.length-r;for(var u=0;u<o.length;u++)this.values_[s+u]=o[u];for(var d=0;d<l.length;d++)this.values_[s+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(s,r,o){var i=!this.owned_&&Po(),a=hs(this),l=a||i?{observableKind:"array",object:this.proxy_,type:Gs,debugObjectName:this.atom_.name_,index:s,newValue:r,oldValue:o}:null;this.atom_.reportChanged(),a&&ms(this,l)},t.notifyArraySplice_=function(s,r,o){var i=!this.owned_&&Po(),a=hs(this),l=a||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:jh,index:s,removed:o,added:r,removedCount:o.length,addedCount:r.length}:null;this.atom_.reportChanged(),a&&ms(this,l)},t.get_=function(s){if(this.legacyMode_&&s>=this.values_.length){console.warn("[mobx] Out of bounds read: "+s);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[s])},t.set_=function(s,r){var o=this.values_;if(this.legacyMode_&&s>o.length&&Ye(17,s,o.length),s<o.length){this.atom_;var i=o[s];if(Kn(this)){var a=Zn(this,{type:Gs,object:this.proxy_,index:s,newValue:r});if(!a)return;r=a.newValue}r=this.enhancer_(r,i);var l=r!==i;l&&(o[s]=r,this.notifyArrayChildUpdate_(s,r,i))}else{for(var u=new Array(s+1-o.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=r,this.spliceWithArray_(o.length,0,u)}},e}();function PE(e,t,n,s){return n===void 0&&(n="ObservableArray"),s===void 0&&(s=!1),ev(),no(function(){var r=new Af(n,t,s,!1);sv(r.values_,Ee,r);var o=new Proxy(r.values_,EE);return r.proxy_=o,e&&e.length&&r.spliceWithArray_(0,0,e),o})}var Lc={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ee];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var s=arguments.length,r=new Array(s>2?s-2:0),o=2;o<s;o++)r[o-2]=arguments[o];var i=this[Ee];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(t);case 2:return i.spliceWithArray_(t,n)}return i.spliceWithArray_(t,n,r)},spliceWithArray:function(t,n,s){return this[Ee].spliceWithArray_(t,n,s)},push:function(){for(var t=this[Ee],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(t.values_.length,0,s),t.values_.length},pop:function(){return this.splice(Math.max(this[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ee],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(0,0,s),t.values_.length},reverse:function(){return ge.trackingDerivation&&Ye(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ge.trackingDerivation&&Ye(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ee],s=n.dehanceValues_(n.values_).indexOf(t);return s>-1?(this.splice(s,1),!0):!1}};Ct("at",Bn);Ct("concat",Bn);Ct("flat",Bn);Ct("includes",Bn);Ct("indexOf",Bn);Ct("join",Bn);Ct("lastIndexOf",Bn);Ct("slice",Bn);Ct("toString",Bn);Ct("toLocaleString",Bn);Ct("toSorted",Bn);Ct("toSpliced",Bn);Ct("with",Bn);Ct("every",Es);Ct("filter",Es);Ct("find",Es);Ct("findIndex",Es);Ct("findLast",Es);Ct("findLastIndex",Es);Ct("flatMap",Es);Ct("forEach",Es);Ct("map",Es);Ct("some",Es);Ct("toReversed",Es);Ct("reduce",Nv);Ct("reduceRight",Nv);function Ct(e,t){typeof Array.prototype[e]=="function"&&(Lc[e]=t(e))}function Bn(e){return function(){var t=this[Ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Es(e){return function(t,n){var s=this,r=this[Ee];r.atom_.reportObserved();var o=r.dehanceValues_(r.values_);return o[e](function(i,a){return t.call(n,i,a,s)})}}function Nv(e){return function(){var t=this,n=this[Ee];n.atom_.reportObserved();var s=n.dehanceValues_(n.values_),r=arguments[0];return arguments[0]=function(o,i,a){return r(o,i,a,t)},s[e].apply(s,arguments)}}var TE=Qr("ObservableArrayAdministration",Af);function nl(e){return eu(e)&&TE(e[Ee])}var OE={},Rr="add",Nc="delete",$v=function(){function e(n,s,r){var o=this;s===void 0&&(s=Lo),r===void 0&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ee]=OE,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=s,this.name_=r,vs(Map)||Ye(18),no(function(){o.keysAtom_=av(en.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(s){return this.data_.has(s)},t.has=function(s){var r=this;if(!ge.trackingDerivation)return this.has_(s);var o=this.hasMap_.get(s);if(!o){var i=o=new Br(this.has_(s),tu,"ObservableMap.key?",!1);this.hasMap_.set(s,i),Ov(i,function(){return r.hasMap_.delete(s)})}return o.get()},t.set=function(s,r){var o=this.has_(s);if(Kn(this)){var i=Zn(this,{type:o?Gs:Rr,object:this,newValue:r,name:s});if(!i)return this;r=i.newValue}return o?this.updateValue_(s,r):this.addValue_(s,r),this},t.delete=function(s){var r=this;if(this.keysAtom_,Kn(this)){var o=Zn(this,{type:Nc,object:this,name:s});if(!o)return!1}if(this.has_(s)){var i=Po(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Nc,object:this,oldValue:this.data_.get(s).value_,name:s}:null;return cr(function(){var u;r.keysAtom_.reportChanged(),(u=r.hasMap_.get(s))==null||u.setNewValue_(!1);var d=r.data_.get(s);d.setNewValue_(void 0),r.data_.delete(s)}),a&&ms(this,l),!0}return!1},t.updateValue_=function(s,r){var o=this.data_.get(s);if(r=o.prepareNewValue_(r),r!==ge.UNCHANGED){var i=Po(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Gs,object:this,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&ms(this,l)}},t.addValue_=function(s,r){var o=this;this.keysAtom_,cr(function(){var u,d=new Br(r,o.enhancer_,"ObservableMap.key",!1);o.data_.set(s,d),r=d.value_,(u=o.hasMap_.get(s))==null||u.setNewValue_(!0),o.keysAtom_.reportChanged()});var i=Po(),a=hs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Rr,object:this,name:s,newValue:r}:null;a&&ms(this,l)},t.get=function(s){return this.has(s)?this.dehanceValue_(this.data_.get(s).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var s=this,r=this.keys();return Eh({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:s.get(l)}}})},t.entries=function(){var s=this,r=this.keys();return Eh({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:[l,s.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(s,r){for(var o=ci(this),i;!(i=o()).done;){var a=i.value,l=a[0],u=a[1];s.call(r,u,l,this)}},t.merge=function(s){var r=this;return to(s)&&(s=new Map(s)),cr(function(){mr(s)?G2(s).forEach(function(o){return r.set(o,s[o])}):Array.isArray(s)?s.forEach(function(o){var i=o[0],a=o[1];return r.set(i,a)}):Ai(s)?(W2(s)||Ye(19,s),s.forEach(function(o,i){return r.set(i,o)})):s!=null&&Ye(20,s)}),this},t.clear=function(){var s=this;cr(function(){bv(function(){for(var r=ci(s.keys()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.replace=function(s){var r=this;return cr(function(){for(var o=_E(s),i=new Map,a=!1,l=ci(r.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!o.has(d)){var p=r.delete(d);if(p)a=!0;else{var f=r.data_.get(d);i.set(d,f)}}}for(var h=ci(o.entries()),m;!(m=h()).done;){var b=m.value,v=b[0],x=b[1],y=r.data_.has(v);if(r.set(v,x),r.data_.has(v)){var w=r.data_.get(v);i.set(v,w),y||(a=!0)}}if(!a)if(r.data_.size!==i.size)r.keysAtom_.reportChanged();else for(var S=r.data_.keys(),j=i.keys(),C=S.next(),E=j.next();!C.done;){if(C.value!==E.value){r.keysAtom_.reportChanged();break}C=S.next(),E=j.next()}r.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(s,r){return tl(this,s)},t.intercept_=function(s){return el(this,s)},Mi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),to=Qr("ObservableMap",$v);function Eh(e){return e[Symbol.toStringTag]="MapIterator",Nf(e)}function _E(e){if(Ai(e)||to(e))return e;if(Array.isArray(e))return new Map(e);if(mr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return Ye(21,e)}var AE={},kv=function(){function e(n,s,r){var o=this;s===void 0&&(s=Lo),r===void 0&&(r="ObservableSet"),this.name_=void 0,this[Ee]=AE,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,vs(Set)||Ye(22),this.enhancer_=function(i,a){return s(i,a,r)},no(function(){o.atom_=av(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.clear=function(){var s=this;cr(function(){bv(function(){for(var r=ci(s.data_.values()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.forEach=function(s,r){for(var o=ci(this),i;!(i=o()).done;){var a=i.value;s.call(r,a,a,this)}},t.add=function(s){var r=this;if(this.atom_,Kn(this)){var o=Zn(this,{type:Rr,object:this,newValue:s});if(!o)return this}if(!this.has(s)){cr(function(){r.data_.add(r.enhancer_(s,void 0)),r.atom_.reportChanged()});var i=en.NODE_ENV!=="production",a=hs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Rr,object:this,newValue:s}:null;a&&ms(this,l)}return this},t.delete=function(s){var r=this;if(Kn(this)){var o=Zn(this,{type:Nc,object:this,oldValue:s});if(!o)return!1}if(this.has(s)){var i=en.NODE_ENV!=="production",a=hs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Nc,object:this,oldValue:s}:null;return cr(function(){r.atom_.reportChanged(),r.data_.delete(s)}),a&&ms(this,l),!0}return!1},t.has=function(s){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(s))},t.entries=function(){var s=0,r=Array.from(this.keys()),o=Array.from(this.values());return Ph({next:function(){var a=s;return s+=1,a<o.length?{value:[r[a],o[a]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var s=this,r=0,o=Array.from(this.data_.values());return Ph({next:function(){return r<o.length?{value:s.dehanceValue_(o[r++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(s){if(lr(s)&&!fs(s))return s.intersection(this);var r=new Set(this);return r.intersection(s)},t.union=function(s){if(lr(s)&&!fs(s))return s.union(this);var r=new Set(this);return r.union(s)},t.difference=function(s){return new Set(this).difference(s)},t.symmetricDifference=function(s){if(lr(s)&&!fs(s))return s.symmetricDifference(this);var r=new Set(this);return r.symmetricDifference(s)},t.isSubsetOf=function(s){return new Set(this).isSubsetOf(s)},t.isSupersetOf=function(s){return new Set(this).isSupersetOf(s)},t.isDisjointFrom=function(s){if(lr(s)&&!fs(s))return s.isDisjointFrom(this);var r=new Set(this);return r.isDisjointFrom(s)},t.replace=function(s){var r=this;return fs(s)&&(s=new Set(s)),cr(function(){Array.isArray(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):lr(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):s!=null&&Ye("Cannot initialize set from "+s)}),this},t.observe_=function(s,r){return tl(this,s)},t.intercept_=function(s){return el(this,s)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Mi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),fs=Qr("ObservableSet",kv);function Ph(e){return e[Symbol.toStringTag]="SetIterator",Nf(e)}var Th=Object.create(null),Oh="remove",Rv=function(){function e(n,s,r,o){s===void 0&&(s=new Map),o===void 0&&(o=jj),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=s,this.name_=r,this.defaultAnnotation_=o,this.keysAtom_=new eo("ObservableObject.keys"),this.isPlainObject_=mr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(s){return this.values_.get(s).get()},t.setObservablePropValue_=function(s,r){var o=this.values_.get(s);if(o instanceof ys)return o.set(r),!0;if(Kn(this)){var i=Zn(this,{type:Gs,object:this.proxy_||this.target_,name:s,newValue:r});if(!i)return null;r=i.newValue}if(r=o.prepareNewValue_(r),r!==ge.UNCHANGED){var a=hs(this),l=en.NODE_ENV!=="production",u=a||l?{type:Gs,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&ms(this,u)}return!0},t.get_=function(s){return ge.trackingDerivation&&!fr(this.target_,s)&&this.has_(s),this.target_[s]},t.set_=function(s,r,o){return o===void 0&&(o=!1),fr(this.target_,s)?this.values_.has(s)?this.setObservablePropValue_(s,r):o?Reflect.set(this.target_,s,r):(this.target_[s]=r,!0):this.extend_(s,{value:r,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(s){if(!ge.trackingDerivation)return s in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var r=this.pendingKeys_.get(s);return r||(r=new Br(s in this.target_,tu,"ObservableObject.key?",!1),this.pendingKeys_.set(s,r)),r.get()},t.make_=function(s,r){if(r===!0&&(r=this.defaultAnnotation_),r!==!1){if(!(s in this.target_)){var o;if((o=this.target_[gs])!=null&&o[s])return;Ye(1,r.annotationType_,this.name_+"."+s.toString())}for(var i=this.target_;i&&i!==Ka;){var a=Pc(i,s);if(a){var l=r.make_(this,s,a,i);if(l===0)return;if(l===1)break}i=Object.getPrototypeOf(i)}Ah(this,r,s)}},t.extend_=function(s,r,o,i){if(i===void 0&&(i=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(s,r,i);var a=o.extend_(this,s,r,i);return a&&Ah(this,o,s),a},t.defineProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{Yn();var i=this.delete_(s);if(!i)return i;if(Kn(this)){var a=Zn(this,{object:this.proxy_||this.target_,name:s,type:Rr,newValue:r.value});if(!a)return null;var l=a.newValue;r.value!==l&&(r=Mo({},r,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,s,r))return!1}else Us(this.target_,s,r);this.notifyPropertyAddition_(s,r.value)}finally{Xn()}return!0},t.defineObservableProperty_=function(s,r,o,i){i===void 0&&(i=!1),this.keysAtom_;try{Yn();var a=this.delete_(s);if(!a)return a;if(Kn(this)){var l=Zn(this,{object:this.proxy_||this.target_,name:s,type:Rr,newValue:r});if(!l)return null;r=l.newValue}var u=_h(s),d={configurable:ge.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,s,d))return!1}else Us(this.target_,s,d);var p=new Br(r,o,en.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key",!1);this.values_.set(s,p),this.notifyPropertyAddition_(s,p.value_)}finally{Xn()}return!0},t.defineComputedProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{Yn();var i=this.delete_(s);if(!i)return i;if(Kn(this)){var a=Zn(this,{object:this.proxy_||this.target_,name:s,type:Rr,newValue:void 0});if(!a)return null}r.name||(r.name=en.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key"),r.context=this.proxy_||this.target_;var l=_h(s),u={configurable:ge.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,s,u))return!1}else Us(this.target_,s,u);this.values_.set(s,new ys(r)),this.notifyPropertyAddition_(s,void 0)}finally{Xn()}return!0},t.delete_=function(s,r){if(r===void 0&&(r=!1),this.keysAtom_,!fr(this.target_,s))return!0;if(Kn(this)){var o=Zn(this,{object:this.proxy_||this.target_,name:s,type:Oh});if(!o)return null}try{var i;Yn();var a=hs(this),l=en.NODE_ENV!=="production"&&Po(),u=this.values_.get(s),d=void 0;if(!u&&(a||l)){var p;d=(p=Pc(this.target_,s))==null?void 0:p.value}if(r){if(!Reflect.deleteProperty(this.target_,s))return!1}else delete this.target_[s];if(en.NODE_ENV,u&&(this.values_.delete(s),u instanceof Br&&(d=u.value_),Cv(u)),this.keysAtom_.reportChanged(),(i=this.pendingKeys_)==null||(i=i.get(s))==null||i.set(s in this.target_),a||l){var f={type:Oh,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:s};en.NODE_ENV,a&&ms(this,f),en.NODE_ENV}}finally{Xn()}return!0},t.observe_=function(s,r){return tl(this,s)},t.intercept_=function(s){return el(this,s)},t.notifyPropertyAddition_=function(s,r){var o,i=hs(this),a=en.NODE_ENV!=="production";if(i||a){var l=i||a?{type:Rr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:s,newValue:r}:null;i&&ms(this,l)}(o=this.pendingKeys_)==null||(o=o.get(s))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),vi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Fo(e,t){var n;if(fr(e,Ee))return e;var s=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new Rv(e,new Map,String(s),kj(t));return Za(e,Ee,r),e}var ME=Qr("ObservableObjectAdministration",Rv);function _h(e){return Th[e]||(Th[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(n){return this[Ee].setObservablePropValue_(e,n)}})}function sl(e){return eu(e)?ME(e[Ee]):!1}function Ah(e,t,n){var s;(s=e.target_[gs])==null||delete s[n]}var LE=Vv(0),NE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),rd=0,Iv=function(){};function $E(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}$E(Iv,Array.prototype);var Mf=function(e){function t(s,r,o,i){var a;return o===void 0&&(o="ObservableArray"),i===void 0&&(i=!1),a=e.call(this)||this,no(function(){var l=new Af(o,r,i,!0);l.proxy_=a,sv(a,Ee,l),s&&s.length&&a.spliceWithArray(0,0,s),NE&&Object.defineProperty(a,"0",LE)}),a}iv(t,e);var n=t.prototype;return n.concat=function(){this[Ee].atom_.reportObserved();for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return nl(a)?a.slice():a}))},n[Symbol.iterator]=function(){var s=this,r=0;return Nf({next:function(){return r<s.length?{value:s[r++],done:!1}:{done:!0,value:void 0}}})},Mi(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(r){this[Ee].setArrayLength_(r)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Iv);Object.entries(Lc).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Za(Mf.prototype,t,n)});function Vv(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(n){this[Ee].set_(e,n)}}}function kE(e){Us(Mf.prototype,""+e,Vv(e))}function Hv(e){if(e>rd){for(var t=rd;t<e+100;t++)kE(t);rd=e}}Hv(1e3);function RE(e,t,n){return new Mf(e,t,n)}function $c(e,t){if(typeof e=="object"&&e!==null){if(nl(e))return t!==void 0&&Ye(23),e[Ee].atom_;if(fs(e))return e.atom_;if(to(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Ye(25,t,Ep(e)),n}if(sl(e)){if(!t)return Ye(26);var s=e[Ee].values_.get(t);return s||Ye(27,t,Ep(e)),s}if(jf(e)||Qa(e)||Mc(e))return e}else if(vs(e)&&Mc(e[Ee]))return e[Ee];Ye(28)}function IE(e,t){if(e||Ye(29),jf(e)||Qa(e)||Mc(e)||to(e)||fs(e))return e;if(e[Ee])return e[Ee];Ye(24,e)}function Ep(e,t){var n;if(t!==void 0)n=$c(e,t);else{if(Ea(e))return e.name;sl(e)||to(e)||fs(e)?n=IE(e):n=$c(e)}return n.name_}function no(e){var t=Do(),n=Pf(!0);Yn();try{return e()}finally{Xn(),Tf(n),gr(t)}}var Mh=Ka.toString;function Lf(e,t,n){return n===void 0&&(n=-1),Pp(e,t,n)}function Pp(e,t,n,s,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var i=Mh.call(e);if(i!==Mh.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Lh(e),t=Lh(t);var a=i==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(vs(l)&&l instanceof l&&vs(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),s=s||[],r=r||[];for(var d=s.length;d--;)if(s[d]===e)return r[d]===t;if(s.push(e),r.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Pp(e[d],t[d],n-1,s,r))return!1}else{var p=Object.keys(e),f;if(d=p.length,Object.keys(t).length!==d)return!1;for(;d--;)if(f=p[d],!(fr(t,f)&&Pp(e[f],t[f],n-1,s,r)))return!1}return s.pop(),r.pop(),!0}function Lh(e){return nl(e)?e.slice():Ai(e)||to(e)||lr(e)||fs(e)?Array.from(e.entries()):e}var Nh,VE=((Nh=Qc().Iterator)==null?void 0:Nh.prototype)||{};function Nf(e){return e[Symbol.iterator]=HE,Object.assign(Object.create(VE),e)}function HE(){return this}["Symbol","Map","Set"].forEach(function(e){var t=Qc();typeof t[e]>"u"&&Ye("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:eE,extras:{getDebugName:Ep},$mobx:Ee});if(!g.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!CE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function DE(e){e()}function FE(e){e||(e=DE),gE({reactionScheduler:e})}function BE(e){return hE(e)}var zE=1e4,UE=1e4,WE=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(s){s===void 0&&(s=zE),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var r=Date.now();n.registrations.forEach(function(o,i){r-o.registeredAt>=s&&(n.finalize(o.value),n.registrations.delete(i))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){this.registrations.set(s,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,UE))}}),e}(),GE=typeof FinalizationRegistry<"u"?FinalizationRegistry:WE,Tp=new GE(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),Dv={exports:{}},od={};/**
8
8
  * @license React
9
9
  * use-sync-external-store-shim.production.min.js
10
10
  *
@@ -12,38 +12,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var Og;function NE(){if(Og)return td;Og=1;var e=h;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(p,f){var g=f(),m=s({inst:{value:g,getSnapshot:f}}),v=m[0].inst,b=m[1];return o(function(){v.value=g,v.getSnapshot=f,l(v)&&b({inst:v})},[p,g,f]),r(function(){return l(v)&&b({inst:v}),p(function(){l(v)&&b({inst:v})})},[p]),i(g),g}function l(p){var f=p.getSnapshot;p=p.value;try{var g=f();return!n(p,g)}catch{return!0}}function u(p,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return td.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,td}Lb.exports=NE();var $E=Lb.exports;function _g(e){e.reaction=new hr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function kE(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(a){return Cp.unregister(s),s.onStoreChange=a,s.reaction||(_g(s),s.stateVersion=Symbol()),function(){var l;s.onStoreChange=null,(l=s.reaction)===null||l===void 0||l.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};n.current=s}var r=n.current;r.reaction||(_g(r),Cp.register(n,r,r)),h.useDebugValue(r.reaction,OE),$E.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);var o,i;if(r.reaction.track(function(){try{o=e()}catch(a){i=a}}),i)throw i;return o}var nd,sd,Mb=typeof Symbol=="function"&&Symbol.for,RE=(sd=(nd=Object.getOwnPropertyDescriptor(function(){},"name"))===null||nd===void 0?void 0:nd.configurable)!==null&&sd!==void 0?sd:!1,Ag=Mb?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,Lg=Mb?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(Lg&&e.$$typeof===Lg)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var s=(n=void 0)!==null&&n!==void 0?n:!1,r=e,o=e.displayName||e.name;if(Ag&&e.$$typeof===Ag&&(s=!0,r=e.render,typeof r!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var i=function(a,l){return kE(function(){return r(a,l)},o)};return i.displayName=e.displayName,RE&&Object.defineProperty(i,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(i.contextTypes=e.contextTypes),s&&(i=h.forwardRef(i)),i=h.memo(i),VE(e,i),i}var IE={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function VE(e,t){Object.keys(e).forEach(function(n){IE[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var rd;TE($n.unstable_batchedUpdates);rd=Cp.finalizeAllImmediately;const Mg=new Map,HE=(e,t)=>`${t}-${e}`,Nb=Zt(function({svg:t,iconSize:n,...s},r){const o=HE(t,n);let i=Mg.get(o);return i||(i=hS(t,n),Mg.set(o,i)),c.jsx("div",{...s,ref:r,dangerouslySetInnerHTML:{__html:i}})});let $b;const DE=e=>{$b=e},FE=()=>$b;var K=(e=>(e.alertRhombus="alertRhombus",e.alignHorizontalCenter="alignHorizontalCenter",e.alignHorizontalLeft="alignHorizontalLeft",e.alignHorizontalRight="alignHorizontalRight",e.applicationBracketsOutline="applicationBracketsOutline",e.arrowDown="arrowDown",e.arrowExpandAll="arrowExpandAll",e.arrowRight="arrowRight",e.arrowULeftTop="arrowULeftTop",e.arrowURightTop="arrowURightTop",e.borderAllVariant="borderAllVariant",e.borderRadius="borderRadius",e.borderStyle="borderStyle",e.calendar="calendar",e.cellphoneLink="cellphoneLink",e.check="check",e.checkBold="checkBold",e.checkboxBlank="checkboxBlank",e.chevronUp="chevronUp",e.chevronDown="chevronDown",e.chevronLeft="chevronLeft",e.chevronRight="chevronRight",e.close="close",e.codeBraces="codeBraces",e.cog="cog",e.contentCopy="contentCopy",e.contentSave="contentSave",e.delete="delete",e.dotsVertical="dotsVertical",e.email="email",e.emailOutline="emailOutline",e.eye="eye",e.eyedropperVariant="eyedropperVariant",e.eyeOff="eyeOff",e.eyeOffOutline="eyeOffOutline",e.eyeOutline="eyeOutline",e.fire="fire",e.flare="flare",e.floppy="floppy",e.folder="folder",e.fullscreen="fullscreen",e.gradientVertical="gradientVertical",e.helpCircle="helpCircle",e.home="home",e.image="image",e.information="information",e.informationVariant="informationVariant",e.layers="layers",e.link="link",e.lock="lock",e.lockOpenVariant="lockOpenVariant",e.menuDown="menuDown",e.newspaperVariantOutline="newspaperVariantOutline",e.openInNew="openInNew",e.paletteSwatch="paletteSwatch",e.panVertical="panVertical",e.pencil="pencil",e.phone="phone",e.plus="plus",e.plusBox="plusBox",e.powerPlug="powerPlug",e.refresh="refresh",e.rhombusOutline="rhombusOutline",e.rhombusSplit="rhombusSplit",e.rhombusSplitOutline="rhombusSplitOutline",e.tag="tag",e.target="target",e.targetVariant="targetVariant",e.textBoxMultiple="textBoxMultiple",e.trayArrowDown="trayArrowDown",e.unfoldLessHorizontal="unfoldLessHorizontal",e.unfoldMoreHorizontal="unfoldMoreHorizontal",e.viewDayOutline="viewDayOutline",e.viewGridPlus="viewGridPlus",e.web="web",e.xml="xml",e.database="database",e.databaseOutline="databaseOutline",e.databaseOutlineOn="databaseOutlineOn",e.databaseOutlineOff="databaseOutlineOff",e.databaseOutlineRemove="databaseOutlineRemove",e.toggleSwitchOutline="toggleSwitchOutline",e.toggleSwitchOffOutline="toggleSwitchOffOutline",e.codeBrackets="codeBrackets",e.null="null",e.codeString="string",e.number="number",e.cloudUpload="cloudUpload",e.chat="chat",e.creation="creation",e.viewDashboard="viewDashboard",e.rocketLaunch="rocketLaunch",e.lightningBolt="lightningBolt",e.stop="stop",e.arrowUp="arrowUp",e))(K||{});const pc={alertRhombus:MS,alignHorizontalCenter:NS,alignHorizontalLeft:$S,alignHorizontalRight:kS,applicationBracketsOutline:RS,arrowDown:IS,arrowExpandAll:VS,arrowRight:HS,arrowULeftTop:DS,arrowURightTop:FS,borderAllVariant:zS,borderRadius:US,borderStyle:WS,calendar:GS,cellphoneLink:qS,check:Hv,checkBold:ZS,checkboxBlank:YS,chevronUp:eC,chevronDown:XS,chevronLeft:JS,chevronRight:QS,close:Dv,codeBraces:nC,cog:oC,contentCopy:iC,contentSave:aC,delete:hC,dotsVertical:gC,email:mC,emailOutline:vC,eye:bC,eyedropperVariant:SC,eyeOff:yC,eyeOffOutline:xC,eyeOutline:wC,fire:jC,flare:EC,floppy:PC,folder:TC,fullscreen:OC,gradientVertical:_C,helpCircle:AC,home:LC,image:MC,information:$C,informationVariant:kC,layers:RC,link:HC,lock:FC,lockOpenVariant:BC,menuDown:zC,newspaperVariantOutline:GC,openInNew:Fv,paletteSwatch:ZC,panVertical:YC,pencil:XC,phone:JC,plus:QC,plusBox:e2,powerPlug:t2,refresh:n2,rhombusOutline:s2,rhombusSplit:r2,rhombusSplitOutline:o2,tag:l2,target:c2,targetVariant:u2,textBoxMultiple:d2,trayArrowDown:h2,unfoldLessHorizontal:g2,unfoldMoreHorizontal:m2,viewDayOutline:b2,viewGridPlus:y2,web:x2,xml:w2,database:cC,databaseOutline:pC,databaseOutlineOn:dC,databaseOutlineOff:uC,databaseOutlineRemove:fC,codeBrackets:sC,toggleSwitchOutline:f2,toggleSwitchOffOutline:p2,null:qC,string:rC,number:KC,cloudUpload:tC,chat:KS,creation:lC,viewDashboard:v2,rocketLaunch:i2,lightningBolt:VC,stop:a2,arrowUp:BS},BE="gs-cmp-icon",se=ce(function({className:t,icon:n,size:s,rotate:r,horizontal:o,vertical:i}){const a=FE(),l=(a==null?void 0:a[n])||(pc==null?void 0:pc[n])||n,u=[o&&"scaleX(-1)",i&&"scaleY(-1)",r&&`rotate(${r}deg)`].filter(p=>!!p).join(" ");if(!l)return null;const d=M(BE,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(Nb,{className:d,style:{transform:u||void 0},svg:l,iconSize:s}):c.jsx(ta,{className:d,path:l,size:s,rotate:r,horizontal:o,vertical:i})}),_f=150,z={bgTr:"gs-utl-bg-transparent",txt:"gs-theme-cl-txt gs-utl-text-gray-900 dark:gs-utl-text-gray-400",txtLowEmphasis:"gs-utl-text-neutral-500 dark:gs-utl-text-neutral-500",txtHighEmphasis:"gs-utl-text-black dark:gs-utl-text-gray-200",txtHighEmphasisH:"hover:gs-utl-text-black hover:dark:gs-utl-text-gray-200",tA:"gs-theme-cl-tA gs-utl-text-violet-400",tAo:"gs-theme-cl-tAo gs-utl-text-violet-800 dark:gs-utl-text-violet-400",hTAo:"gs-theme-cl-hTAo hover:gs-utl-text-violet-800 hover:dark:gs-utl-text-violet-400",grouphTAo:"gs-theme-cl-grouphTAo group-hover:gs-utl-text-violet-800 group-hover:dark:gs-utl-text-violet-400",bA:"gs-theme-cl-bA gs-utl-border-violet-400",bgA:"gs-theme-cl-bgA gs-utl-bg-violet-400 gs-utl-text-white dark:gs-utl-bg-violet-500",bgA2:"gs-theme-cl-bgA2 gs-utl-bg-violet-500 gs-utl-text-white",bgO:"gs-theme-cl-bg0 gs-utl-bg-violet-50 gs-utl-text-violet-900 dark:gs-utl-bg-zinc-800 dark:gs-utl-text-violet-400",bg:"gs-theme-cl-bg gs-utl-bg-white dark:gs-utl-bg-zinc-900",bgBlur:"gs-utl-bg-white/50 dark:gs-utl-bg-zinc-900/50 gs-utl-backdrop-blur-sm",bgH:"gs-theme-cl-bgH gs-utl-bg-gray-100 dark:gs-utl-bg-zinc-700",bgH75:"gs-utl-bg-gray-100/75 dark:gs-utl-bg-zinc-700/75",bgH50:"gs-utl-bg-gray-100/50 dark:gs-utl-bg-zinc-700/50",bgH25:"gs-utl-bg-gray-100/25 dark:gs-utl-bg-zinc-700/25",hBgH:"gs-theme-cl-hBgH hover:gs-utl-bg-gray-50 hover:dark:gs-utl-bg-zinc-800",bgH2:"gs-theme-cl-bgH2 gs-utl-bg-gray-25 dark:gs-utl-bg-zinc-800",hBgH2:"gs-theme-cl-hBgH2 hover:gs-utl-bg-gray-25 hover:dark:gs-utl-bg-zinc-800",hBgAct:"gs-theme-cl-hBgAct hover:gs-utl-bg-violet-800 hover:dark:gs-utl-bg-violet-400",hBgA2:"gs-theme-cl-hBgA2 hover:gs-utl-bg-violet-500 hover:dark:gs-utl-bg-violet-600",hBgDark:"hover:gs-utl-bg-black/10",sel:"gs-theme-cl-sel gs-utl-bg-pink-200 gs-utl-text-pink-900",selBr:"gs-theme-cl-selBr gs-utl-border-pink-900",cmp:"gs-theme-cl-cmp gs-utl-bg-blue-450 gs-utl-text-white",cmpSymbol:"gs-theme-cl-cmpSymbol gs-utl-bg-[#7b61ff] gs-utl-text-white",cmpBgSoft:"gs-theme-cl-cmpBgSoft gs-utl-bg-blue-100 dark:gs-utl-bg-sky-800",cmpBgSymbolSoft:"gs-theme-cl-cmpBgSymbolSoft gs-utl-bg-violet-200 dark:gs-utl-bg-violet-800",cmpBgSoftX:"gs-theme-cl-cmpBgSoftX gs-utl-bg-blue-50 dark:gs-utl-bg-gray-800",cmpBgSymbolSoftX:"gs-theme-cl-cmpBgSymbolSoftX gs-utl-bg-[#edebff] dark:gs-utl-bg-[#2d1b4b]",cmpTxtActive:"gs-theme-cl-cmpTxtActive dark:gs-utl-text-gray-300",cmpBr:"gs-theme-cl-cmpBr gs-utl-border-blue-450",cmpSymbolBr:"gs-theme-cl-cmpSymbolBr gs-utl-border-[#7b61ff]",cmpTargetBg:"gs-utl-bg-amber-500 gs-utl-text-white",cmpTargetBgOpac:"gs-utl-bg-amber-500/5",cmpTargetBr:"gs-utl-border-amber-500",tW:"gs-utl-text-amber-500",tE:"gs-utl-text-red-500",tS:"gs-utl-text-green-500",boxWarn:"gs-utl-bg-amber-50 gs-utl-border-amber-200 gs-utl-text-amber-700 dark:gs-utl-bg-amber-200/10 dark:gs-utl-border-amber-200/20 dark:gs-utl-text-amber-100/80",boxSuccess:"gs-utl-bg-green-50 gs-utl-border-green-200 gs-utl-text-green-700 dark:gs-utl-bg-green-500/20 dark:gs-utl-border-green-500/20 dark:gs-utl-text-green-100/80",boxDanger:"gs-utl-bg-red-50 gs-utl-border-red-200 gs-utl-text-red-700 dark:gs-utl-bg-red-500/20 dark:gs-utl-border-red-500/20 dark:gs-utl-text-red-100/80",bgW:"gs-utl-bg-amber-500",bgRed:"gs-utl-bg-red-500",hBgRed:"hover:gs-utl-bg-red-600",hBgW:"hover:gs-utl-bg-amber-600",br:"gs-theme-cl-br gs-utl-border-gray-300 dark:gs-utl-border-zinc-700",brRed:"gs-utl-border-red-500",brLight:"gs-utl-border-white/25"},kb={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-scale-95 gs-utl-opacity-0",enterTo:"gs-utl-opacity-100",leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-scale-100 gs-utl-opacity-100",leaveTo:"gs-utl-scale-95 gs-utl-opacity-0"},zE={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},UE={leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"},WE={...zE,...UE},Pe={xy:"gs-utl-px-4 gs-utl-py-2",xyS:"gs-utl-px-2 gs-utl-py-1",xyS2:"gs-utl-px-2 gs-utl-py-0.5",x:"gs-utl-px-4",xS:"gs-utl-px-2",y:"gs-utl-py-2",s:"gs-utl-p-2",m:"gs-utl-p-4"},Af={bg:z.bg,bgH:z.bgH},Ng={bg:"gs-utl-bg-zinc-700",txt:"gs-utl-text-white",block:"gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-rounded gs-utl-px-2 gs-utl-py-1"},te={rnd:"gs-utl-rounded",rndMd:"gs-utl-rounded-md",rndLg:"gs-utl-rounded-lg",pill:"gs-utl-rounded-full",b:"gs-utl-border",bT:"gs-utl-border-transparent",bS:"gs-utl-border-2",bt:"gs-utl-border-t",bb:"gs-utl-border-b",br:"gs-utl-border-r",bl:"gs-utl-border-l",none:"gs-utl-border-0",bA:"gs-theme-cl-bA gs-utl-border-violet-400 dark:gs-utl-border-violet-500"},Ca={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},oe={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},_e={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverM:"gs-utl-transition-opacity gs-utl-opacity-80 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollX:"gs-utl-overflow-x-auto gs-utl-overflow-y-hidden",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",hiddenVisually:"gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001]",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",disabledM:"gs-utl-opacity-50 gs-utl-cursor-not-allowed",noFocusOut:"focus:gs-utl-outline-none",noResize:"gs-utl-resize-none",spin:"gs-utl-animate-spin-fast",bounce:"gs-utl-animate-bounce"},zr={link:z.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},bn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},yn={xs:"gs-utl-text-xs",sm:"gs-utl-text-sm",base:"gs-utl-text-base",lg:"gs-utl-text-lg",xl:"gs-utl-text-xl",xl2:"gs-utl-text-2xl"},GE={all:"gs-utl-break-all"},rr="gs-utl-my-2",qE="gs-utl-my-3",$g=` gs-utl-rounded ${yn.xs} ${bn.mono} ${z.bgH25}`,kg=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${rr} gs-utl-ml-1`,It={h1:`${yn.xl2} ${bn.bold} ${qE}`,h2:`${yn.xl} ${bn.bold} ${rr}`,h3:`${yn.lg} ${bn.semibold} ${rr}`,h4:`${yn.base} ${bn.semibold} ${rr}`,h5:`${yn.sm} ${bn.semibold} ${rr}`,h6:`${yn.xs} ${bn.semibold} ${rr}`,strong:bn.bold,em:bn.italic,ul:`gs-utl-list-disc ${kg}`,ol:`gs-utl-list-decimal ${kg}`,codeInline:`${$g} gs-utl-px-1 gs-utl-py-0.5`,pre:`${$g} gs-utl-p-3 gs-utl-overflow-x-auto ${rr}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${rr} ${bn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${rr}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${bn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},_l={s:"gs-utl-size-5",m:"gs-utl-size-10"},Lf={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Y(z.bgH2,Pe.xyS,z.br,e&&te.bt,(t||e===n-1)&&te.bb)},Rb=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),Ib=e=>{let t={isSymbol:!1,bg:z.cmp,bgSoft:`${z.cmpBgSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSoftX,border:z.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:z.cmpSymbol,bgSoft:`${z.cmpBgSymbolSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSymbolSoftX,border:z.cmpSymbolBr,txt:""}),t},Vb=({variant:e,size:t="m",className:n,disabledClassName:s,active:r,border:o=!0,rounded:i=!0,disabled:a=!1,withBg:l,block:u,full:d})=>{const p=e==="pr",f=e==="out",g=e==="out-clear",m=e==="warn",v=e==="danger",b=o&&(f||g||!e);return["gs-utl-transition-colors gs-utl-cursor-pointer",u&&"gs-utl-block",t==="x2s"&&"gs-utl-text-xs",t==="s"&&"gs-utl-p-1 gs-utl-text-sm",t==="m"&&"gs-utl-p-1 gs-utl-px-2",t==="m2"&&"gs-utl-p-1 gs-utl-px-3",t==="lg"&&"gs-utl-p-2 gs-utl-px-4 gs-utl-text-lg",n,i&&te.rnd,l&&z.bg,b?Y(te.b,z.br,f&&z.bA,f&&z.tAo,!a&&z.hBgH):Y(te.b,te.bT),m&&Y(z.bgW,!a&&z.hBgW,"gs-utl-text-white"),v&&Y(z.bgRed,!a&&z.hBgRed,"gs-utl-text-white"),p&&Y(z.bgA2,!a&&z.hBgAct),r&&z.bgA,a&&(s??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",Ca.focus]};function Ke({children:e,...t}){const{variant:n,size:s,active:r,border:o,rounded:i,block:a,full:l,className:u,icon:d,loading:p,withBg:f,disabled:g,type:m="button",disabledClassName:v,...b}=t,x=p?{icon:DC,size:"18px",className:Y("animate-spin-fast")}:dt(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:Y(Vb(t)),disabled:g||p,type:m,...b,children:x?c.jsxs($,{className:Y("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(F,{children:c.jsx(se,{...x})}),e&&c.jsx(F,{children:e})]}):e})}function Ur({full:e,abs:t,small:n,size:s,className:r,bg:o,currentColor:i}){const a=M(e&&"gs-utl-w-full gs-utl-h-full",t?_e.coverAbs:"gs-utl-relative",r),l=M(!s&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),s==="x2s"&&"gs-utl-size-3",s==="xs"&&"gs-utl-size-4",s==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",te.pill,te.bS,i?"gs-utl-border-current":te.bA);return c.jsxs($,{className:a,items:"center",justify:"center",children:[!!o&&c.jsx("div",{className:M(_e.coverAbs,z.bg,_e.disabled)}),c.jsx("div",{className:l})]})}const en={accessToken:""},KE=()=>{en.timeout&&(clearTimeout(en.timeout),en.timeout=void 0),en.accessToken="",en.license=void 0},Hb=async()=>{var t;let e={accessToken:""};try{const n=await((t=en.getAccessToken)==null?void 0:t.call(en));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){en.getAccessToken&&console.error("Failed to get access token");return}if(en.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(en.timeout||void 0),en.timeout=setTimeout(Hb,n-Date.now()-1)}},Db=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},Ai=e=>Db(e)==="email",ZE=e=>{var r;const t=Bb(e),n=Ai(e),s=e.getWrapper();return t.length>1?!1:n?((r=s==null?void 0:s.findFirstType("mj-body"))==null?void 0:r.components().length)===0:(s==null?void 0:s.components().length)===0},Fb=(e,t={})=>{const{selectedComponents:n=[],withPageContent:s,imageUrls:r=[]}=t,o=e.Pages.getSelected(),i=e.getSelected(),a=Db(e),l=Bb(e),u=ZE(e),d=o?{id:o.getId(),name:o.getName(),content:s?tP(e):void 0}:void 0,p=i?{id:i.getId(),content:i.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:p,selectedComponents:n.map(f=>({id:f.getId(),content:""})),projectType:a,availablePages:l,globalStyles:YE(e),installedPlugins:XE(e),devices:eP(e),isEmail:a==="email",imageUrls:r}},jp=(e,t,n)=>{const{layoutComponents:s}=n||{},r=t,o=r.type,i=o?s==null?void 0:s[o]:void 0;return i?{...r,...i({editor:e,props:t})}:t},nn=(e,t,n)=>{const s=jp(e,t,n);return e.runCommand(ne.layoutComponentRender,{components:s})};function YE(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
- `)}const Bb=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),XE=e=>{const t=QE(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},JE=e=>e.getModel().get("customData")??{},QE=e=>e&&JE(e).plugins||[];function eP(e){return e.Devices.getAll().map(t=>t.toJSON())}function eu(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const tu=(e="",t,n={})=>{if(!(!t||!e)){if(t.innerHTML=eu(e),n.scrollDocument){requestAnimationFrame(()=>{const s=t.ownerDocument,r=s.scrollingElement||s.documentElement;r==null||r.scrollTo({top:r.scrollHeight,behavior:"smooth"})});return}n.skipScroll||(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var s;return(s=t==null?void 0:t.lastElementChild)==null?void 0:s.scrollIntoView({block:"nearest"})}))}},zb=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function nu(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function su(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function tP(e){const t=e.getWrapper(),n=zb(t);return`${Ai(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const nP=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],s=new Map,r=document.createElement("div");r.setAttribute("data-temp-els","true");const o=(i,a)=>{try{a.innerHTML=i.innerHTML,Array.from(i.attributes).forEach(l=>a.setAttribute(l.name,l.value))}catch{}};return{cleanup(){r==null||r.remove()},update:i=>{var f;const a=new DOMParser,l=eu(i),u=a.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),p=e.getWrapper();return(f=p==null?void 0:p.getEl())==null||f.appendChild(r),d.forEach(g=>{var v,b;let m=g.id;if(m){const x=s.get(m),y=t.getById(m),w=y==null?void 0:y.getEl();w&&(o(g,w),!x&&requestAnimationFrame(()=>w==null?void 0:w.scrollIntoView({block:"nearest"}))),s.set(m,{cmp:y,cmpEl:w,newNode:g})}else if(n.includes(g.tagName)){m=[((v=g.tagName)==null?void 0:v.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const x=(b=s.get(m))==null?void 0:b.newNode;x?o(g,x):(r.appendChild(g),s.set(m,{newNode:g}))}}),s}}},sP=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:s,Css:r}=n,{html:o,css:i}=s.parseHtml(t,{returnArray:!0}),a=o[0];e.getId()===((u=a==null?void 0:a.attributes)==null?void 0:u.id)?(e.components().reset(a.components),e.addAttributes({...a==null?void 0:a.attributes,class:(d=a==null?void 0:a.classes)==null?void 0:d.join(" ")}),i&&r.addCollection(i,{extend:!0})):e.components(t)};function rP(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const zn="gs-cmp-ai-chat-tool-generate-image",oP=e=>{var C;const{editor:t,part:n,chatContext:s,isProcessing:r}=e,o=(j,E)=>t.t(`aiChat.message.tool.generateImage.${j}`,E),i=n.input||{},a=s.toolStatusProgress.get(n.toolCallId),l=(C=a==null?void 0:a.content)==null?void 0:C.trim(),u=l||o("generating"),d=Math.min(Math.max(i.n||1,1),4),p=rP(n.output),f=Ai(t),g=j=>{const E=t.getSelected(),O=f?"mj-image":"image",P={type:O,attributes:{src:j}};let T;if(E!=null&&E.is(O)){E.addAttributes({src:j});return}if(E&&t.Components.canMove(E,P))T=E.append(P)[0];else if(!E){const A=t.getWrapper(),_=f?A==null?void 0:A.findFirstType("mj-column"):A;T=_==null?void 0:_.append(P)[0]}T&&t.select(T,{scroll:!0})},m=j=>{t.Canvas.startDrag({content:{type:f?"mj-image":"image",attributes:{src:j}}})},v=()=>{t.Canvas.endDrag()},b=M(`${zn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),x=M(`${zn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=M(`${zn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),w=M(`${zn}__item-actions`,_e.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let S=null;return r?S=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:M(`${zn}__status`,yn.xs,z.txtLowEmphasis),children:u}),c.jsx("div",{className:M(`${zn}__placeholders`,b),children:Array.from({length:d}).map((j,E)=>c.jsx($,{className:M(`${zn}__placeholder`,x,z.bgH50,z.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Ur,{className:`${zn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${E}`))})]}):p.length?S=c.jsx("div",{className:M(`${zn}__output`,b),children:p.map((j,E)=>c.jsxs("div",{className:x,children:[c.jsx("img",{className:y,src:j,alt:o("imageAlt",{num:E+1}),draggable:!0,onDragStart:()=>m(j),onDragEnd:v}),c.jsx($,{className:w,children:c.jsx(Ke,{full:!0,variant:"pr",className:M(`${zn}__btn-use`),onClick:()=>g(j),children:o("useImage")})})]},j))}):l&&(S=c.jsx("div",{className:M(`${zn}__status`,yn.xs,z.txtLowEmphasis),children:l})),c.jsx($,{className:zn,col:!0,gap:"xs",children:S})};function iP(e){return{type:"custom",component:()=>c.jsx(oP,{...e})}}var vo=(e=>(e.ADD_NEW_COMPONENT="addNewComponent",e.EDIT_COMPONENT="editComponent",e.REMOVE_COMPONENT="removeComponent",e.MOVE_COMPONENT="moveComponent",e.ADD_NEW_PAGE="addNewPage",e.ADD_NEW_PROJECT_PAGE="addNewProjectPage",e.GET_PAGE_CONTENT="getPageContent",e.LIST_PAGES="listPages",e.FETCH_WEBSITE="fetchWebsite",e.GENERATE_IMAGE="generateImage",e.RUN_COMMAND="runCommand",e))(vo||{}),ar=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(ar||{}),na=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(na||{}),ds=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(ds||{});function aP(e){const t=Ai(e),n=r=>e.t(`aiChat.message.tool.command.${r}`),s={[na.SHOW_CODE]:{label:({isExecuted:r})=>n(r?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(ne.dialogExportCode)},[na.IMPORT_CODE]:{label:({isExecuted:r})=>n(r?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(ne.dialogImportCode)},[na.PREVIEW]:{label:({isExecuted:r})=>n(r?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(s[na.PAGE_SETTINGS]={label:({isExecuted:r})=>n(r?"pageSettings.done":"pageSettings.pending"),execute:()=>{const r=e.Pages.getSelected();e.runCommand(ne.setPageSettings,{page:r,isOpen:!0})}}),s}function Ub(e,t={}){const{skipDefault:n,commands:s={}}=t,r=new Map(Object.entries(n?{}:aP(e))),o=(i,a)=>e.t(`aiChat.message.tool.command.${i}`,a);return Object.entries(s).forEach(([i,a])=>{if(!a)return;const l=i,u=r.get(l);r.set(l,{execute:a.execute??(u==null?void 0:u.execute),label:a.label??(u==null?void 0:u.label)})}),{async execute(i,a){const l=r.get(i.commandId);if(!l)throw new Error(o("notFound",{id:i.commandId}));if(!l.execute)throw new Error(o("missingHandler",{id:i.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:i,context:a})??{success:!0}},layoutToolLabel:({part:i})=>{const a=i.input,l=a!=null&&a.commandId?r.get(a.commandId):void 0;if(!(l!=null&&l.label))return;const u=i.state==="output-available";return l.label({isExecuted:u})}}}function lP(e){const t={async execute(a){const{componentId:l}=a,u=e.Components.getById(l);return u?(u.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${l}'`}}},n={async execute(a){const{sourceId:l,targetId:u,targetIndex:d}=a,p=e.Components.getById(l),f=e.Components.getById(u);return p?f?(f.append(p,{at:d}),e.select(p,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${u}'`}:{success:!1,error:`Source component not found with ID '${l}'`}}},s={async execute(a){const{pageId:l}=a,u=e.Pages.get(l),d=u==null?void 0:u.getMainComponent();return d?{content:zb(d)}:{success:!1,error:"Page not found"}}},r={async execute(){return{pages:e.Pages.getAll().map(l=>({id:l.getId(),name:l.getName()}))}}},o={layoutToolResult:a=>iP(a)},i=Ub(e);return{[vo.REMOVE_COMPONENT]:t,[vo.MOVE_COMPONENT]:n,[vo.GET_PAGE_CONTENT]:s,[vo.LIST_PAGES]:r,[vo.GENERATE_IMAGE]:o,[vo.RUN_COMMAND]:i}}const Wb="mjml-code-to-html";function cP(e){var o;const{editor:t,content:n,isEmail:s}=e;if(!s)return n;const r=eu(n);try{const i=(o=t.runCommand(Wb,{mjml:r}))==null?void 0:o.html;if(i)return i}catch{}return n}function uP(e){const{editor:t,component:n,content:s,isEmail:r,scrollDocument:o}=e,i=n==null?void 0:n.getEl();if(!i)return;const a=cP({editor:t,content:s,isEmail:r});tu(a,i,{skipScroll:!0,scrollDocument:o})}function dP(e,t,n){var r;const{Pages:s}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(r=s.getSelected())==null||r.setName(n)}function pP(e){nu(e)}function fP(e){su(e)}function hP(e,t){var x;const{componentId:n,position:s}=t,r=Ai(e),o=e.getWrapper(),i=r?o.findFirstType("mj-body"):o;nu(e);const a=document.createElement("div");a.style.display="contents";const{Components:l}=e;let d=l.getById(n)||i;r&&d===o&&(d=i);const p=d==null?void 0:d.parent(),f=d==null?void 0:d.index(),g=d==null?void 0:d.getEl();let m="afterend",v;switch(s){case"before":p?(m="beforebegin",d=p,v=f):(m="afterbegin",v=0);break;case"beforeInside":m="afterbegin",v=0;break;case"afterInside":m="beforeend";break;case"after":p?(m="afterend",d=p,v=(f??0)+1):m="beforeend";break}return g?g==null||g.insertAdjacentElement(m,a):(x=p==null?void 0:p.getEl())==null||x.appendChild(a),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:a,updatePreview:y=>{let w=y;r&&(w=bP(e,d,y,v)),tu(w,a,{skipScroll:!0})},cleanUp(){a==null||a.remove(),su(e)}}}const Al="mjml",gP="mj-head",od="gs-ai-chat-mjml-preview";function Rg(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function mP(e,t){const s=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(s.body.children).forEach(r=>{const i=[r.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();r.setAttribute("css-class",i)}),s.body.innerHTML}function vP(e,t,n){var f,g;const s=e.closestType(Al),r=((f=s==null?void 0:s.findFirstType(gP))==null?void 0:f.toHTML())||"",o=e.components().map(m=>m.toHTML()),i=typeof n=="number"?Math.max(0,Math.min(n,o.length)):o.length;o.splice(i,0,t);const a=o.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==Al;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>Rg(m)).join(""),p=l.map(m=>`</${m.tagName}>`).join("");return`<${Al}>${r}${d}${Rg(e)}${a}</${e.tagName}>${p}</${Al}>`}function bP(e,t,n,s){var o;const r=eu(n);if(!(r!=null&&r.trim()))return"";try{const i=mP(r,od),a=vP(t,i,s),l=(o=e.runCommand(Wb,{mjml:a}))==null?void 0:o.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),p=Array.from(d.querySelectorAll(`.${od}`));return p.length?p.map(f=>(f.classList.remove(od),f.outerHTML)).join(""):""}catch{return""}}function yP(e,t,n){const{target:s,at:r}=t,o=s==null?void 0:s.append(n,{at:r})[0];return o&&setTimeout(()=>e.select(o,{scroll:!0}),50),o}function xP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ar.ADD_COMPONENT_CODE,toolSetup:hP(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.updatePreview(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;yP(t,a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function wP(e){nu(e);const t=nP(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),su(e)}}}function SP(e,t){const n=e.getWrapper();t.mapUpdates.forEach(s=>{const{cmp:r,newNode:o}=s,{outerHTML:i}=o;r?sP(r,i):n==null||n.append(i)})}function CP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ar.EDIT_COMPONENT_CODE,toolSetup:wP(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content),SP(t,a.toolSetup),a.completed=!0,l()}if(i==="error"){l();return}}function jP(e,t){const{name:n}=t,{Pages:s,Components:r}=e;nu(e);const o=s.add({name:n,component:"<h1></h1>"},{select:!0}),i=o.getMainComponent();return i.once(r.events.render,()=>{const a=i.getEl();a&&tu(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
15
+ */var $h;function qE(){if($h)return od;$h=1;var e=g;function t(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(p,f){var h=f(),m=s({inst:{value:h,getSnapshot:f}}),b=m[0].inst,v=m[1];return o(function(){b.value=h,b.getSnapshot=f,l(b)&&v({inst:b})},[p,h,f]),r(function(){return l(b)&&v({inst:b}),p(function(){l(b)&&v({inst:b})})},[p]),i(h),h}function l(p){var f=p.getSnapshot;p=p.value;try{var h=f();return!n(p,h)}catch{return!0}}function u(p,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:a;return od.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,od}Dv.exports=qE();var KE=Dv.exports;function kh(e){e.reaction=new br("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function ZE(e,t){t===void 0&&(t="observed");var n=g.useRef(null);if(!n.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(a){return Tp.unregister(s),s.onStoreChange=a,s.reaction||(kh(s),s.stateVersion=Symbol()),function(){var l;s.onStoreChange=null,(l=s.reaction)===null||l===void 0||l.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};n.current=s}var r=n.current;r.reaction||(kh(r),Tp.register(n,r,r)),g.useDebugValue(r.reaction,BE),KE.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);var o,i;if(r.reaction.track(function(){try{o=e()}catch(a){i=a}}),i)throw i;return o}var id,ad,Fv=typeof Symbol=="function"&&Symbol.for,YE=(ad=(id=Object.getOwnPropertyDescriptor(function(){},"name"))===null||id===void 0?void 0:id.configurable)!==null&&ad!==void 0?ad:!1,Rh=Fv?Symbol.for("react.forward_ref"):typeof g.forwardRef=="function"&&g.forwardRef(function(e){return null}).$$typeof,Ih=Fv?Symbol.for("react.memo"):typeof g.memo=="function"&&g.memo(function(e){return null}).$$typeof;function ue(e,t){var n;if(Ih&&e.$$typeof===Ih)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var s=(n=void 0)!==null&&n!==void 0?n:!1,r=e,o=e.displayName||e.name;if(Rh&&e.$$typeof===Rh&&(s=!0,r=e.render,typeof r!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var i=function(a,l){return ZE(function(){return r(a,l)},o)};return i.displayName=e.displayName,YE&&Object.defineProperty(i,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(i.contextTypes=e.contextTypes),s&&(i=g.forwardRef(i)),i=g.memo(i),JE(e,i),i}var XE={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function JE(e,t){Object.keys(e).forEach(function(n){XE[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var ld;FE(kn.unstable_batchedUpdates);ld=Tp.finalizeAllImmediately;const Vh=new Map,QE=(e,t)=>`${t}-${e}`,Bv=Yt(function({svg:t,iconSize:n,...s},r){const o=QE(t,n);let i=Vh.get(o);return i||(i=_S(t,n),Vh.set(o,i)),c.jsx("div",{...s,ref:r,dangerouslySetInnerHTML:{__html:i}})});let zv;const eP=e=>{zv=e},tP=()=>zv;var K=(e=>(e.alertRhombus="alertRhombus",e.alignHorizontalCenter="alignHorizontalCenter",e.alignHorizontalLeft="alignHorizontalLeft",e.alignHorizontalRight="alignHorizontalRight",e.applicationBracketsOutline="applicationBracketsOutline",e.arrowDown="arrowDown",e.arrowExpandAll="arrowExpandAll",e.arrowRight="arrowRight",e.arrowULeftTop="arrowULeftTop",e.arrowURightTop="arrowURightTop",e.borderAllVariant="borderAllVariant",e.borderRadius="borderRadius",e.borderStyle="borderStyle",e.calendar="calendar",e.cellphoneLink="cellphoneLink",e.check="check",e.checkBold="checkBold",e.checkboxBlank="checkboxBlank",e.chevronUp="chevronUp",e.chevronDown="chevronDown",e.chevronLeft="chevronLeft",e.chevronRight="chevronRight",e.close="close",e.codeBraces="codeBraces",e.cog="cog",e.contentCopy="contentCopy",e.contentSave="contentSave",e.delete="delete",e.dotsVertical="dotsVertical",e.email="email",e.emailOutline="emailOutline",e.eye="eye",e.eyedropperVariant="eyedropperVariant",e.eyeOff="eyeOff",e.eyeOffOutline="eyeOffOutline",e.eyeOutline="eyeOutline",e.fire="fire",e.flare="flare",e.floppy="floppy",e.folder="folder",e.fullscreen="fullscreen",e.gradientVertical="gradientVertical",e.helpCircle="helpCircle",e.home="home",e.image="image",e.information="information",e.informationVariant="informationVariant",e.layers="layers",e.link="link",e.lock="lock",e.lockOpenVariant="lockOpenVariant",e.menuDown="menuDown",e.newspaperVariantOutline="newspaperVariantOutline",e.openInNew="openInNew",e.paletteSwatch="paletteSwatch",e.panVertical="panVertical",e.pencil="pencil",e.phone="phone",e.plus="plus",e.plusBox="plusBox",e.powerPlug="powerPlug",e.refresh="refresh",e.rhombusOutline="rhombusOutline",e.rhombusSplit="rhombusSplit",e.rhombusSplitOutline="rhombusSplitOutline",e.tag="tag",e.target="target",e.targetVariant="targetVariant",e.textBoxMultiple="textBoxMultiple",e.trayArrowDown="trayArrowDown",e.unfoldLessHorizontal="unfoldLessHorizontal",e.unfoldMoreHorizontal="unfoldMoreHorizontal",e.viewDayOutline="viewDayOutline",e.viewGridPlus="viewGridPlus",e.web="web",e.xml="xml",e.database="database",e.databaseOutline="databaseOutline",e.databaseOutlineOn="databaseOutlineOn",e.databaseOutlineOff="databaseOutlineOff",e.databaseOutlineRemove="databaseOutlineRemove",e.toggleSwitchOutline="toggleSwitchOutline",e.toggleSwitchOffOutline="toggleSwitchOffOutline",e.codeBrackets="codeBrackets",e.null="null",e.codeString="string",e.number="number",e.cloudUpload="cloudUpload",e.chat="chat",e.creation="creation",e.viewDashboard="viewDashboard",e.rocketLaunch="rocketLaunch",e.lightningBolt="lightningBolt",e.stop="stop",e.arrowUp="arrowUp",e))(K||{});const bc={alertRhombus:GS,alignHorizontalCenter:qS,alignHorizontalLeft:KS,alignHorizontalRight:ZS,applicationBracketsOutline:YS,arrowDown:XS,arrowExpandAll:JS,arrowRight:QS,arrowULeftTop:eC,arrowURightTop:tC,borderAllVariant:sC,borderRadius:rC,borderStyle:oC,calendar:iC,cellphoneLink:aC,check:Kb,checkBold:cC,checkboxBlank:uC,chevronUp:gC,chevronDown:dC,chevronLeft:pC,chevronRight:fC,close:Zb,codeBraces:mC,cog:yC,contentCopy:xC,contentSave:wC,delete:OC,dotsVertical:_C,email:AC,emailOutline:MC,eye:LC,eyedropperVariant:RC,eyeOff:NC,eyeOffOutline:$C,eyeOutline:kC,fire:VC,flare:HC,floppy:DC,folder:FC,fullscreen:BC,gradientVertical:zC,helpCircle:UC,home:WC,image:GC,information:KC,informationVariant:ZC,layers:YC,link:QC,lock:t2,lockOpenVariant:n2,menuDown:s2,newspaperVariantOutline:i2,openInNew:Yb,paletteSwatch:c2,panVertical:u2,pencil:d2,phone:p2,plus:f2,plusBox:g2,powerPlug:h2,refresh:m2,rhombusOutline:b2,rhombusSplit:v2,rhombusSplitOutline:y2,tag:S2,target:C2,targetVariant:j2,textBoxMultiple:E2,trayArrowDown:O2,unfoldLessHorizontal:_2,unfoldMoreHorizontal:A2,viewDayOutline:L2,viewGridPlus:N2,web:$2,xml:k2,database:CC,databaseOutline:PC,databaseOutlineOn:EC,databaseOutlineOff:jC,databaseOutlineRemove:TC,codeBrackets:bC,toggleSwitchOutline:T2,toggleSwitchOffOutline:P2,null:a2,string:vC,number:l2,cloudUpload:hC,chat:lC,creation:SC,viewDashboard:M2,rocketLaunch:x2,lightningBolt:JC,stop:w2,arrowUp:nC},nP="gs-cmp-icon",ne=ue(function({className:t,icon:n,size:s,rotate:r,horizontal:o,vertical:i}){const a=tP(),l=(a==null?void 0:a[n])||(bc==null?void 0:bc[n])||n,u=[o&&"scaleX(-1)",i&&"scaleY(-1)",r&&`rotate(${r}deg)`].filter(p=>!!p).join(" ");if(!l)return null;const d=L(nP,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(Bv,{className:d,style:{transform:u||void 0},svg:l,iconSize:s}):c.jsx(sa,{className:d,path:l,size:s,rotate:r,horizontal:o,vertical:i})}),$f=150,z={bgTr:"gs-utl-bg-transparent",txt:"gs-theme-cl-txt gs-utl-text-gray-900 dark:gs-utl-text-gray-400",txtLowEmphasis:"gs-utl-text-neutral-500 dark:gs-utl-text-neutral-500",txtHighEmphasis:"gs-utl-text-black dark:gs-utl-text-gray-200",txtHighEmphasisH:"hover:gs-utl-text-black hover:dark:gs-utl-text-gray-200",tA:"gs-theme-cl-tA gs-utl-text-violet-400",tAo:"gs-theme-cl-tAo gs-utl-text-violet-800 dark:gs-utl-text-violet-400",hTAo:"gs-theme-cl-hTAo hover:gs-utl-text-violet-800 hover:dark:gs-utl-text-violet-400",grouphTAo:"gs-theme-cl-grouphTAo group-hover:gs-utl-text-violet-800 group-hover:dark:gs-utl-text-violet-400",bA:"gs-theme-cl-bA gs-utl-border-violet-400",bgA:"gs-theme-cl-bgA gs-utl-bg-violet-400 gs-utl-text-white dark:gs-utl-bg-violet-500",bgA2:"gs-theme-cl-bgA2 gs-utl-bg-violet-500 gs-utl-text-white",bgO:"gs-theme-cl-bg0 gs-utl-bg-violet-50 gs-utl-text-violet-900 dark:gs-utl-bg-zinc-800 dark:gs-utl-text-violet-400",bg:"gs-theme-cl-bg gs-utl-bg-white dark:gs-utl-bg-zinc-900",bgBlur:"gs-utl-bg-white/50 dark:gs-utl-bg-zinc-900/50 gs-utl-backdrop-blur-sm",bgBlurM:"gs-utl-bg-white/80 dark:gs-utl-bg-zinc-900/80 gs-utl-backdrop-blur-md",bgH:"gs-theme-cl-bgH gs-utl-bg-gray-100 dark:gs-utl-bg-zinc-700",bgH75:"gs-utl-bg-gray-100/75 dark:gs-utl-bg-zinc-700/75",bgH50:"gs-utl-bg-gray-100/50 dark:gs-utl-bg-zinc-700/50",bgH25:"gs-utl-bg-gray-100/25 dark:gs-utl-bg-zinc-700/25",hBgH:"gs-theme-cl-hBgH hover:gs-utl-bg-gray-50 hover:dark:gs-utl-bg-zinc-800",bgH2:"gs-theme-cl-bgH2 gs-utl-bg-gray-25 dark:gs-utl-bg-zinc-800",hBgH2:"gs-theme-cl-hBgH2 hover:gs-utl-bg-gray-25 hover:dark:gs-utl-bg-zinc-800",hBgAct:"gs-theme-cl-hBgAct hover:gs-utl-bg-violet-800 hover:dark:gs-utl-bg-violet-400",hBgA2:"gs-theme-cl-hBgA2 hover:gs-utl-bg-violet-500 hover:dark:gs-utl-bg-violet-600",hBgDark:"hover:gs-utl-bg-black/10",sel:"gs-theme-cl-sel gs-utl-bg-pink-200 gs-utl-text-pink-900",selBr:"gs-theme-cl-selBr gs-utl-border-pink-900",cmp:"gs-theme-cl-cmp gs-utl-bg-blue-450 gs-utl-text-white",cmpSymbol:"gs-theme-cl-cmpSymbol gs-utl-bg-[#7b61ff] gs-utl-text-white",cmpBgSoft:"gs-theme-cl-cmpBgSoft gs-utl-bg-blue-100 dark:gs-utl-bg-sky-800",cmpBgSymbolSoft:"gs-theme-cl-cmpBgSymbolSoft gs-utl-bg-violet-200 dark:gs-utl-bg-violet-800",cmpBgSoftX:"gs-theme-cl-cmpBgSoftX gs-utl-bg-blue-50 dark:gs-utl-bg-gray-800",cmpBgSymbolSoftX:"gs-theme-cl-cmpBgSymbolSoftX gs-utl-bg-[#edebff] dark:gs-utl-bg-[#2d1b4b]",cmpTxtActive:"gs-theme-cl-cmpTxtActive dark:gs-utl-text-gray-300",cmpBr:"gs-theme-cl-cmpBr gs-utl-border-blue-450",cmpSymbolBr:"gs-theme-cl-cmpSymbolBr gs-utl-border-[#7b61ff]",cmpTargetBg:"gs-utl-bg-amber-500 gs-utl-text-white",cmpTargetBgOpac:"gs-utl-bg-amber-500/5",cmpTargetBr:"gs-utl-border-amber-500",tW:"gs-utl-text-amber-500",tE:"gs-utl-text-red-500",tS:"gs-utl-text-green-500",boxWarn:"gs-utl-bg-amber-50 gs-utl-border-amber-200 gs-utl-text-amber-700 dark:gs-utl-bg-amber-200/10 dark:gs-utl-border-amber-200/20 dark:gs-utl-text-amber-100/80",boxSuccess:"gs-utl-bg-green-50 gs-utl-border-green-200 gs-utl-text-green-700 dark:gs-utl-bg-green-500/20 dark:gs-utl-border-green-500/20 dark:gs-utl-text-green-100/80",boxDanger:"gs-utl-bg-red-50 gs-utl-border-red-200 gs-utl-text-red-700 dark:gs-utl-bg-red-500/20 dark:gs-utl-border-red-500/20 dark:gs-utl-text-red-100/80",bgW:"gs-utl-bg-amber-500",bgRed:"gs-utl-bg-red-500",hBgRed:"hover:gs-utl-bg-red-600",hBgW:"hover:gs-utl-bg-amber-600",br:"gs-theme-cl-br gs-utl-border-gray-300 dark:gs-utl-border-zinc-700",brRed:"gs-utl-border-red-500",brLight:"gs-utl-border-white/25"},Uv={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-scale-95 gs-utl-opacity-0",enterTo:"gs-utl-opacity-100",leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-scale-100 gs-utl-opacity-100",leaveTo:"gs-utl-scale-95 gs-utl-opacity-0"},sP={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},rP={leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"},oP={...sP,...rP},Pe={xy:"gs-utl-px-4 gs-utl-py-2",xyS:"gs-utl-px-2 gs-utl-py-1",xyS2:"gs-utl-px-2 gs-utl-py-0.5",x:"gs-utl-px-4",xS:"gs-utl-px-2",y:"gs-utl-py-2",s:"gs-utl-p-2",m:"gs-utl-p-4"},kf={bg:z.bg,bgH:z.bgH},Hh={bg:"gs-utl-bg-zinc-700",txt:"gs-utl-text-white",block:"gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-rounded gs-utl-px-2 gs-utl-py-1"},se={rnd:"gs-utl-rounded",rndMd:"gs-utl-rounded-md",rndLg:"gs-utl-rounded-lg",pill:"gs-utl-rounded-full",b:"gs-utl-border",bT:"gs-utl-border-transparent",bS:"gs-utl-border-2",bt:"gs-utl-border-t",bb:"gs-utl-border-b",br:"gs-utl-border-r",bl:"gs-utl-border-l",none:"gs-utl-border-0",bA:"gs-theme-cl-bA gs-utl-border-violet-400 dark:gs-utl-border-violet-500"},Ta={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},oe={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Ae={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverM:"gs-utl-transition-opacity gs-utl-opacity-80 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollX:"gs-utl-overflow-x-auto gs-utl-overflow-y-hidden",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",hiddenVisually:"gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001]",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",disabledM:"gs-utl-opacity-50 gs-utl-cursor-not-allowed",noFocusOut:"focus:gs-utl-outline-none",noResize:"gs-utl-resize-none",spin:"gs-utl-animate-spin-fast",bounce:"gs-utl-animate-bounce"},Wr={link:z.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},vn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},yn={xs:"gs-utl-text-xs",sm:"gs-utl-text-sm",base:"gs-utl-text-base",lg:"gs-utl-text-lg",xl:"gs-utl-text-xl",xl2:"gs-utl-text-2xl"},iP={all:"gs-utl-break-all"},ir="gs-utl-my-2",aP="gs-utl-my-3",Dh=` gs-utl-rounded ${yn.xs} ${vn.mono} ${z.bgH25}`,Fh=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${ir} gs-utl-ml-1`,It={h1:`${yn.xl2} ${vn.bold} ${aP}`,h2:`${yn.xl} ${vn.bold} ${ir}`,h3:`${yn.lg} ${vn.semibold} ${ir}`,h4:`${yn.base} ${vn.semibold} ${ir}`,h5:`${yn.sm} ${vn.semibold} ${ir}`,h6:`${yn.xs} ${vn.semibold} ${ir}`,strong:vn.bold,em:vn.italic,ul:`gs-utl-list-disc ${Fh}`,ol:`gs-utl-list-decimal ${Fh}`,codeInline:`${Dh} gs-utl-px-1 gs-utl-py-0.5`,pre:`${Dh} gs-utl-p-3 gs-utl-overflow-x-auto ${ir}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${ir} ${vn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${ir}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${vn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Nl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Rf={itemList:({index:e=0,open:t=!1,length:n=0}={})=>J(z.bgH2,Pe.xyS,z.br,e&&se.bt,(t||e===n-1)&&se.bb)},Wv=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),Gv=e=>{let t={isSymbol:!1,bg:z.cmp,bgSoft:`${z.cmpBgSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSoftX,border:z.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:z.cmpSymbol,bgSoft:`${z.cmpBgSymbolSoft} ${z.cmpTxtActive}`,bgSoftX:z.cmpBgSymbolSoftX,border:z.cmpSymbolBr,txt:""}),t},qv=({variant:e,size:t="m",className:n,disabledClassName:s,active:r,border:o=!0,rounded:i=!0,disabled:a=!1,withBg:l,block:u,full:d})=>{const p=e==="pr",f=e==="out",h=e==="out-clear",m=e==="warn",b=e==="danger",v=o&&(f||h||!e);return["gs-utl-transition-colors gs-utl-cursor-pointer",u&&"gs-utl-block",t==="x2s"&&"gs-utl-text-xs",t==="s"&&"gs-utl-p-1 gs-utl-text-sm",t==="m"&&"gs-utl-p-1 gs-utl-px-2",t==="m2"&&"gs-utl-p-1 gs-utl-px-3",t==="lg"&&"gs-utl-p-2 gs-utl-px-4 gs-utl-text-lg",n,i&&se.rnd,l&&z.bg,v?J(se.b,z.br,f&&z.bA,f&&z.tAo,!a&&z.hBgH):J(se.b,se.bT),m&&J(z.bgW,!a&&z.hBgW,"gs-utl-text-white"),b&&J(z.bgRed,!a&&z.hBgRed,"gs-utl-text-white"),p&&J(z.bgA2,!a&&z.hBgAct),r&&z.bgA,a&&(s??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",Ta.focus]};function Qe({children:e,...t}){const{variant:n,size:s,active:r,border:o,rounded:i,block:a,full:l,className:u,icon:d,loading:p,withBg:f,disabled:h,type:m="button",disabledClassName:b,...v}=t,x=p?{icon:e2,size:"18px",className:J("animate-spin-fast")}:pt(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:J(qv(t)),disabled:h||p,type:m,...v,children:x?c.jsxs(k,{className:J("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(D,{children:c.jsx(ne,{...x})}),e&&c.jsx(D,{children:e})]}):e})}function Gr({full:e,abs:t,small:n,size:s,className:r,bg:o,currentColor:i}){const a=L(e&&"gs-utl-w-full gs-utl-h-full",t?Ae.coverAbs:"gs-utl-relative",r),l=L(!s&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),s==="x2s"&&"gs-utl-size-3",s==="xs"&&"gs-utl-size-4",s==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",se.pill,se.bS,i?"gs-utl-border-current":se.bA);return c.jsxs(k,{className:a,items:"center",justify:"center",children:[!!o&&c.jsx("div",{className:L(Ae.coverAbs,z.bg,Ae.disabled)}),c.jsx("div",{className:l})]})}const lP=1e3,cP=5e3,Bt={accessToken:""},uP=()=>{Bt.timeout&&(clearTimeout(Bt.timeout),Bt.timeout=void 0),Bt.accessToken="",Bt.license=void 0},Op=async()=>{var t;let e={accessToken:""};try{const n=await((t=Bt.getAccessToken)==null?void 0:t.call(Bt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Bt.getAccessToken&&console.error("Failed to get access token");return}if(Bt.accessToken=e.accessToken,clearTimeout(Bt.timeout),Bt.timeout=void 0,e.expiresAt){const n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)){console.error("Failed to parse access token expiration date",e.expiresAt);return}const s=n-Date.now()-lP;if(s<=0){console.warn("Received an already expired access token, retrying access token refresh soon"),Bt.timeout=setTimeout(Op,cP);return}Bt.timeout=setTimeout(Op,s)}},Kv=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},Li=e=>Kv(e)==="email",Zv=e=>{var r;const t=Xv(e),n=Li(e),s=e.getWrapper();return t.length>1?!1:n?((r=s==null?void 0:s.findFirstType("mj-body"))==null?void 0:r.components().length)===0:(s==null?void 0:s.components().length)===0},Yv=(e,t={})=>{const{selectedComponents:n=[],withPageContent:s,imageUrls:r=[]}=t,o=e.Pages.getSelected(),i=e.getSelected(),a=Kv(e),l=Xv(e),u=Zv(e),d=o?{id:o.getId(),name:o.getName(),content:s?mP(e):void 0}:void 0,p=i?{id:i.getId(),content:i.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:p,selectedComponents:n.map(f=>({id:f.getId(),content:""})),projectType:a,availablePages:l,globalStyles:dP(e),installedPlugins:pP(e),devices:hP(e),isEmail:a==="email",imageUrls:r}},_p=(e,t,n)=>{const{layoutComponents:s}=n||{},r=t,o=r.type,i=o?s==null?void 0:s[o]:void 0;return i?{...r,...i({editor:e,props:t})}:t},nn=(e,t,n)=>{const s=_p(e,t,n);return e.runCommand(te.layoutComponentRender,{components:s})};function dP(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
+ `)}const Xv=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),pP=e=>{const t=gP(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},fP=e=>e.getModel().get("customData")??{},gP=e=>e&&fP(e).plugins||[];function hP(e){return e.Devices.getAll().map(t=>t.toJSON())}function ru(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const ou=(e="",t,n={})=>{if(!(!t||!e)){if(t.innerHTML=ru(e),n.scrollDocument){requestAnimationFrame(()=>{const s=t.ownerDocument,r=s.scrollingElement||s.documentElement;r==null||r.scrollTo({top:r.scrollHeight,behavior:"smooth"})});return}n.skipScroll||(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var s;return(s=t==null?void 0:t.lastElementChild)==null?void 0:s.scrollIntoView({block:"nearest"})}))}},Jv=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function iu(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function au(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function mP(e){const t=e.getWrapper(),n=Jv(t);return`${Li(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const bP=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],s=new Map,r=document.createElement("div");r.setAttribute("data-temp-els","true");const o=(i,a)=>{try{a.innerHTML=i.innerHTML,Array.from(i.attributes).forEach(l=>a.setAttribute(l.name,l.value))}catch{}};return{cleanup(){r==null||r.remove()},update:i=>{var f;const a=new DOMParser,l=ru(i),u=a.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),p=e.getWrapper();return(f=p==null?void 0:p.getEl())==null||f.appendChild(r),d.forEach(h=>{var b,v;let m=h.id;if(m){const x=s.get(m),y=t.getById(m),w=y==null?void 0:y.getEl();w&&(o(h,w),!x&&requestAnimationFrame(()=>w==null?void 0:w.scrollIntoView({block:"nearest"}))),s.set(m,{cmp:y,cmpEl:w,newNode:h})}else if(n.includes(h.tagName)){m=[((b=h.tagName)==null?void 0:b.toLowerCase())||"",...Array.from(h.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const x=(v=s.get(m))==null?void 0:v.newNode;x?o(h,x):(r.appendChild(h),s.set(m,{newNode:h}))}}),s}}},vP=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:s,Css:r}=n,{html:o,css:i}=s.parseHtml(t,{returnArray:!0}),a=o[0];e.getId()===((u=a==null?void 0:a.attributes)==null?void 0:u.id)?(e.components().reset(a.components),e.addAttributes({...a==null?void 0:a.attributes,class:(d=a==null?void 0:a.classes)==null?void 0:d.join(" ")}),i&&r.addCollection(i,{extend:!0})):e.components(t)};function yP(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Un="gs-cmp-ai-chat-tool-generate-image",xP=e=>{var j;const{editor:t,part:n,chatContext:s,isProcessing:r}=e,o=(C,E)=>t.t(`aiChat.message.tool.generateImage.${C}`,E),i=n.input||{},a=s.toolStatusProgress.get(n.toolCallId),l=(j=a==null?void 0:a.content)==null?void 0:j.trim(),u=l||o("generating"),d=Math.min(Math.max(i.n||1,1),4),p=yP(n.output),f=Li(t),h=C=>{const E=t.getSelected(),O=f?"mj-image":"image",P={type:O,attributes:{src:C}};let T;if(E!=null&&E.is(O)){E.addAttributes({src:C});return}if(E&&t.Components.canMove(E,P))T=E.append(P)[0];else if(!E){const A=t.getWrapper(),_=f?A==null?void 0:A.findFirstType("mj-column"):A;T=_==null?void 0:_.append(P)[0]}T&&t.select(T,{scroll:!0})},m=C=>{t.Canvas.startDrag({content:{type:f?"mj-image":"image",attributes:{src:C}}})},b=()=>{t.Canvas.endDrag()},v=L(`${Un}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),x=L(`${Un}__item`,se.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=L(`${Un}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),w=L(`${Un}__item-actions`,Ae.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let S=null;return r?S=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:L(`${Un}__status`,yn.xs,z.txtLowEmphasis),children:u}),c.jsx("div",{className:L(`${Un}__placeholders`,v),children:Array.from({length:d}).map((C,E)=>c.jsx(k,{className:L(`${Un}__placeholder`,x,z.bgH50,z.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Gr,{className:`${Un}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${E}`))})]}):p.length?S=c.jsx("div",{className:L(`${Un}__output`,v),children:p.map((C,E)=>c.jsxs("div",{className:x,children:[c.jsx("img",{className:y,src:C,alt:o("imageAlt",{num:E+1}),draggable:!0,onDragStart:()=>m(C),onDragEnd:b}),c.jsx(k,{className:w,children:c.jsx(Qe,{full:!0,variant:"pr",className:L(`${Un}__btn-use`),onClick:()=>h(C),children:o("useImage")})})]},C))}):l&&(S=c.jsx("div",{className:L(`${Un}__status`,yn.xs,z.txtLowEmphasis),children:l})),c.jsx(k,{className:Un,col:!0,gap:"xs",children:S})};function wP(e){return{type:"custom",component:()=>c.jsx(xP,{...e})}}var Lr=(e=>(e.ADD_NEW_COMPONENT="addNewComponent",e.EDIT_COMPONENT="editComponent",e.REMOVE_COMPONENT="removeComponent",e.MOVE_COMPONENT="moveComponent",e.ADD_NEW_PAGE="addNewPage",e.ADD_NEW_PROJECT_PAGE="addNewProjectPage",e.GET_PAGE_CONTENT="getPageContent",e.LIST_PAGES="listPages",e.FETCH_WEBSITE="fetchWebsite",e.GENERATE_IMAGE="generateImage",e.RUN_COMMAND="runCommand",e))(Lr||{}),ur=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(ur||{}),ra=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(ra||{}),ps=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(ps||{});function SP(e){const t=Li(e),n=r=>e.t(`aiChat.message.tool.command.${r}`),s={[ra.SHOW_CODE]:{label:({isExecuted:r})=>n(r?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(te.dialogExportCode)},[ra.IMPORT_CODE]:{label:({isExecuted:r})=>n(r?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(te.dialogImportCode)},[ra.PREVIEW]:{label:({isExecuted:r})=>n(r?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(s[ra.PAGE_SETTINGS]={label:({isExecuted:r})=>n(r?"pageSettings.done":"pageSettings.pending"),execute:()=>{const r=e.Pages.getSelected();e.runCommand(te.setPageSettings,{page:r,isOpen:!0})}}),s}function Qv(e,t={}){const{skipDefault:n,commands:s={}}=t,r=new Map(Object.entries(n?{}:SP(e))),o=(i,a)=>e.t(`aiChat.message.tool.command.${i}`,a);return Object.entries(s).forEach(([i,a])=>{if(!a)return;const l=i,u=r.get(l);r.set(l,{execute:a.execute??(u==null?void 0:u.execute),label:a.label??(u==null?void 0:u.label)})}),{async execute(i,a){const l=r.get(i.commandId);if(!l)throw new Error(o("notFound",{id:i.commandId}));if(!l.execute)throw new Error(o("missingHandler",{id:i.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:i,context:a})??{success:!0}},layoutToolLabel:({part:i})=>{const a=i.input,l=a!=null&&a.commandId?r.get(a.commandId):void 0;if(!(l!=null&&l.label))return;const u=i.state==="output-available";return l.label({isExecuted:u})}}}function CP(e){const t={async execute(l){const{componentId:u}=l,d=e.Components.getById(u);return d?(d.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${u}'`}}},n={async execute(l){const{sourceId:u,targetId:d,targetIndex:p}=l,f=e.Components.getById(u),h=e.Components.getById(d);return f?h?(h.append(f,{at:p}),e.select(f,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${d}'`}:{success:!1,error:`Source component not found with ID '${u}'`}}},s={async execute(l){const{pageId:u}=l,d=e.Pages.get(u),p=d==null?void 0:d.getMainComponent();return p?{content:Jv(p)}:{success:!1,error:"Page not found"}}},r={async execute(){return{pages:e.Pages.getAll().map(u=>({id:u.getId(),name:u.getName()}))}}},o={layoutToolResult:l=>wP(l)},i={layoutToolLabel:({part:l})=>{const u=l.input,d=String((u==null?void 0:u.url)||"").trim(),f=(typeof l.state=="string"?l.state:void 0)==="output-available";return e.t(`aiChat.message.tool.fetchWebsite.${f?"done":"pending"}`,{params:{url:d}})},onData:({editor:l,toolStatus:u})=>{const{data:d}=u,{status:p,content:f,input:h}=d;if(p!=="done")return;const m=f==null?void 0:f.trim();if(!m)throw new Error(l.t("aiChat.message.tool.fetchWebsite.missingContent"));const{Pages:b}=l,v=b.getAll();Zv(l)&&v[0]&&b.remove(v[0]);const x=String((h==null?void 0:h.name)||"").trim()||l.t("aiChat.message.tool.fetchWebsite.defaultPageName");b.add({name:x,component:m},{select:!0}),l.runCommand(te.canvasReload)}},a=Qv(e);return{[Lr.REMOVE_COMPONENT]:t,[Lr.MOVE_COMPONENT]:n,[Lr.GET_PAGE_CONTENT]:s,[Lr.LIST_PAGES]:r,[Lr.FETCH_WEBSITE]:i,[Lr.GENERATE_IMAGE]:o,[Lr.RUN_COMMAND]:a}}const e0="mjml-code-to-html";function jP(e){var o;const{editor:t,content:n,isEmail:s}=e;if(!s)return n;const r=ru(n);try{const i=(o=t.runCommand(e0,{mjml:r}))==null?void 0:o.html;if(i)return i}catch{}return n}function EP(e){const{editor:t,component:n,content:s,isEmail:r,scrollDocument:o}=e,i=n==null?void 0:n.getEl();if(!i)return;const a=jP({editor:t,content:s,isEmail:r});ou(a,i,{skipScroll:!0,scrollDocument:o})}function PP(e,t,n){var r;const{Pages:s}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(r=s.getSelected())==null||r.setName(n)}function TP(e){iu(e)}function OP(e){au(e)}function _P(e,t){var x;const{componentId:n,position:s}=t,r=Li(e),o=e.getWrapper(),i=r?o.findFirstType("mj-body"):o;iu(e);const a=document.createElement("div");a.style.display="contents";const{Components:l}=e;let d=l.getById(n)||i;r&&d===o&&(d=i);const p=d==null?void 0:d.parent(),f=d==null?void 0:d.index(),h=d==null?void 0:d.getEl();let m="afterend",b;switch(s){case"before":p?(m="beforebegin",d=p,b=f):(m="afterbegin",b=0);break;case"beforeInside":m="afterbegin",b=0;break;case"afterInside":m="beforeend";break;case"after":p?(m="afterend",d=p,b=(f??0)+1):m="beforeend";break}return h?h==null||h.insertAdjacentElement(m,a):(x=p==null?void 0:p.getEl())==null||x.appendChild(a),{target:d,at:b,domPosition:m,tempTargetEl:h,tempDOM:a,updatePreview:y=>{let w=y;r&&(w=NP(e,d,y,b)),ou(w,a,{skipScroll:!0})},cleanUp(){a==null||a.remove(),au(e)}}}const $l="mjml",AP="mj-head",cd="gs-ai-chat-mjml-preview";function Bh(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function MP(e,t){const s=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(s.body.children).forEach(r=>{const i=[r.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();r.setAttribute("css-class",i)}),s.body.innerHTML}function LP(e,t,n){var f,h;const s=e.closestType($l),r=((f=s==null?void 0:s.findFirstType(AP))==null?void 0:f.toHTML())||"",o=e.components().map(m=>m.toHTML()),i=typeof n=="number"?Math.max(0,Math.min(n,o.length)):o.length;o.splice(i,0,t);const a=o.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==$l;)(h=u.tagName)!=null&&h.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>Bh(m)).join(""),p=l.map(m=>`</${m.tagName}>`).join("");return`<${$l}>${r}${d}${Bh(e)}${a}</${e.tagName}>${p}</${$l}>`}function NP(e,t,n,s){var o;const r=ru(n);if(!(r!=null&&r.trim()))return"";try{const i=MP(r,cd),a=LP(t,i,s),l=(o=e.runCommand(e0,{mjml:a}))==null?void 0:o.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),p=Array.from(d.querySelectorAll(`.${cd}`));return p.length?p.map(f=>(f.classList.remove(cd),f.outerHTML)).join(""):""}catch{return""}}function $P(e,t,n){const{target:s,at:r}=t,o=s==null?void 0:s.append(n,{at:r})[0];return o&&setTimeout(()=>e.select(o,{scroll:!0}),50),o}function kP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ur.ADD_COMPONENT_CODE,toolSetup:_P(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.updatePreview(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;$P(t,a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function RP(e){iu(e);const t=bP(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),au(e)}}}function IP(e,t){const n=e.getWrapper();t.mapUpdates.forEach(s=>{const{cmp:r,newNode:o}=s,{outerHTML:i}=o;r?vP(r,i):n==null||n.append(i)})}function VP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ur.EDIT_COMPONENT_CODE,toolSetup:RP(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content),IP(t,a.toolSetup),a.completed=!0,l()}if(i==="error"){l();return}}function HP(e,t){const{name:n}=t,{Pages:s,Components:r}=e;iu(e);const o=s.add({name:n,component:"<h1></h1>"},{select:!0}),i=o.getMainComponent();return i.once(r.events.render,()=>{const a=i.getEl();a&&ou(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
17
17
  Generating ${n?`"${n}" `:""}page...
18
- </h1>`,a,{skipScroll:!0})}),{pageId:o.getId(),cmpRoot:i,cleanUp(){su(e)}}}function EP(e,t){const{cmpRoot:n}=e;n.components(t)}function PP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:ar.ADD_PAGE_CODE,toolSetup:jP(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const u=a.toolSetup.cmpRoot.getEl();u&&tu(r.content,u,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;EP(a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function TP(e){pP(e);const t=e.getWrapper(),n=Fb(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){fP(e)}}}function OP(e,t,n){dP(e,t,n)}function _P(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ar.ADD_PROJECT_PAGE_CODE,toolSetup:TP(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,uP({editor:t,component:a.toolSetup.cmpRoot,content:r.content,isEmail:a.toolSetup.isEmail}));return}if(i==="done"&&a&&r.content){if(a.completed)return;OP(t,r.content,r.input.name),a.completed=!0,l()}if(i==="error"){l();return}}const Gb={[ar.ADD_COMPONENT_CODE]:xP,[ar.EDIT_COMPONENT_CODE]:CP,[ar.ADD_PAGE_CODE]:PP,[ar.ADD_PROJECT_PAGE_CODE]:_P},AP=({editor:e,data:t,toolStatusProgress:n,tools:s,chatApi:r})=>{var u;if(t.type!=="data-tool-status")return;const o=t,i=((u=o.data)==null?void 0:u.name)||"",a=Gb[i];a?a({editor:e,toolStatus:o,toolStatusProgress:n}):LP({toolStatus:o,toolStatusProgress:n});const l=s[i];if(!(!(l!=null&&l.onData)||!r))try{l.onData({editor:e,chatApi:r,toolStatus:o,toolStatusProgress:n})}catch(d){r.setError(d)}};function LP({toolStatus:e,toolStatusProgress:t}){const{id:n,data:s}=e;if(!n||!s)return;const{status:r,content:o}=s;let i=t.get(n);i||(i={type:"generic",content:"",completed:!1},t.set(n,i)),r==="streaming"&&o&&(i.content=o),r==="done"&&(o&&(i.content=o),t.delete(n)),r==="error"&&t.delete(n)}var MP={NODE_ENV:"production"};class NP{constructor(t,n){var o;this.chatStates=new Map,this.editor=t,this.options=n;const s=lP(t);this.tools=((o=n.tools)==null?void 0:o.call(n,{defaultTools:s,createCommandTool:i=>Ub(t,i),editor:t}))||s;const{chat:r}=this.createChat();this.currentChatId=r.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const s=this.createChat();this.currentChatId=s.chat.id}}}createChat(t){const n=this.editor,s=new Map,r=new Set,o=new Set,{tools:i}=this,{chatApi:a,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:p={},onMessagesUpdate:f,messages:g}=this.options,{onFinish:m,onData:v,...b}=p,x=typeof g=="function",y=[],w=new Mv.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:jo.lastAssistantMessageIsCompleteWithToolCalls,transport:new jo.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:P,messages:T,body:A,id:_,trigger:N,credentials:D}){var R;const L={...A,id:_,trigger:N,messages:T.slice(-10),projectContext:Fb(n,{withPageContent:!0,selectedComponents:Array.from(o)}),userPrompt:""},V=typeof u=="function"?u({editor:n,body:L,messages:T}):u,{accessToken:U,license:H}=en,B=MP.NODE_ENV!=="production",k=`${mf({isDev:B,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!H||["enterprise","business"].includes(((R=H==null?void 0:H.plan)==null?void 0:R.category)??"free"))&&typeof a<"u"?typeof a=="function"?a():a:k,headers:{...P,...U?{Authorization:`Bearer ${U}`}:{}},credentials:D,body:{...L,...V}}}}),onToolCall:async({toolCall:P})=>{l==null||l({toolCall:P});const T=!!Gb[P.toolName];if(P.dynamic||T)return;const{toolName:A,input:_,toolCallId:N}=P,D=i[A];if(D&&D.execute){const L=new AbortController;r.add(L);try{const{messages:V}=w,U=await Promise.race([D.execute(_||{},{editor:n,messages:V,lastUserMessage:V.findLast(H=>H.role==="user"),toolCallId:N,abortController:L}),new Promise((H,B)=>{L.signal.addEventListener("abort",()=>B(new Error("Aborted")))})]);if(U&&typeof U.error=="string")throw new Error(U.error);w.addToolOutput({tool:A,toolCallId:N,output:U})}catch(V){w.addToolOutput({tool:A,toolCallId:N,state:"output-error",errorText:V instanceof Error?V.message:"Unknown error"})}finally{r.delete(L)}}},onData(P){v==null||v(P),AP({editor:n,data:P,toolStatusProgress:s,tools:i,chatApi:C})},onFinish(P){f==null||f({messages:P.messages,editor:n}),P.isAbort&&(s.forEach(T=>{"toolSetup"in T&&T.toolSetup.cleanUp()}),s.clear()),m==null||m(P)},...b}),S=new Set,C={get messages(){return w.messages},get lastMessage(){return w.lastMessage},get status(){return w.status},get error(){return w.error},sendMessage:(...P)=>j.isMessagesLoaded?w.sendMessage(...P):(y.push(P),Promise.resolve()),setMessages:P=>{w.messages=P},clearError:()=>w.clearError(),stop:()=>w.stop(),setError:P=>{const T=P instanceof Error?P:new Error(String(P));w.setStatus({status:"error",error:T})}},j={chat:w,chatApi:C,isMessagesLoaded:!x,toolStatusProgress:s,toolAbortControllers:r,contextComponents:o,onUpdate:P=>(S.add(P),()=>{S.delete(P)}),emitUpdate:()=>{S.forEach(P=>P())}},E=async()=>{if(!j.isMessagesLoaded||y.length===0)return;const P=y.splice(0);for(const T of P)await w.sendMessage(...T)};this.chatStates.set(w.id,j);const O=()=>{w["~registerMessagesCallback"](()=>{w.status==="ready"&&(f==null||f({messages:w.messages,editor:n}))})};return x?g({editor:n}).then(P=>{w.messages=P,O()}).catch(P=>C.setError(P)).finally(()=>{j.isMessagesLoaded=!0,E().catch(P=>C.setError(P)),j.emitUpdate()}):O(),j}}const $P=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],kP=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Yo="gs-cmp-ai-chat-empty",RP=({className:e,style:t,chatContext:n,editor:s,suggestions:r})=>{const{sendMessage:o}=n,i="aiChat.emptyState",a=M(Yo,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=s.t(`${i}.title`),u=s.t(`${i}.subtitle`),d=Ai(s)?kP:$P,p=r??d;return c.jsxs($,{className:a,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs($,{className:`${Yo}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:M(`${Yo}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:M(`${Yo}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx($,{col:!0,className:`${Yo}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(f=>{const g=s.t(`${i}.suggestions.${f.id}`)||f.label,m=f.prompt??g;return c.jsx(Ke,{className:`${Yo}__suggestion`,onClick:()=>o({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},f.id)})})]})},Bi="gs-cmp-ai-chat-error",IP=({className:e,style:t,chatContext:n,editor:s})=>{var a;const r=M(Bi,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),o=`${Bi}__message gs-utl-text-sm gs-utl-opacity-75 gs-utl-max-h-24 gs-utl-overflow-auto gs-utl-break-words gs-utl-max-w-full`;return c.jsxs($,{className:r,style:t,gap:"xs",col:!0,children:[c.jsxs($,{className:`${Bi}__header`,items:"center",gap:"xs",children:[c.jsx(F,{className:`${Bi}__header-title`,grow:!0,children:s.t("aiChat.error.title")}),c.jsx(Ke,{className:`${Bi}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(F,{className:o,grow:!0,children:(a=n.error)==null?void 0:a.message})]})},id="gs-cmp-ai-chat-header",VP=({className:e,chatContext:t,title:n,editor:s,layoutBefore:r,layoutAfter:o,clearButtonProps:i,onClear:a,...l})=>{const[u,d]=h.useState(!1),{messages:p,setMessages:f,status:g}=t,m=M(id,e,te.bb,z.br,Pe.s),v=g==="streaming"||g==="submitted",b="aiChat.header",x=s.runCommand(ds.getChatApi),y={isClearing:u,setIsClearing:d},w=()=>{d(!0),f([])},{className:S,children:C,...j}=i||{},E={chatApi:x,messages:p,state:y},O=r==null?void 0:r(E),P=o==null?void 0:o(E),T=async A=>{if(!u)try{a?await a({...E,clear:w,event:A}):w()}catch(_){t.setError(_ instanceof Error?_:new Error(String(_)))}finally{d(!1)}};return c.jsxs($,{className:m,items:"center",gap:"s",...l,children:[O&&nn(s,O),c.jsx(F,{className:`${id}__title`,grow:!0,children:n??s.t(`${b}.title`)}),p.length>0&&c.jsx(Ke,{className:M(`${id}__btn-clear`,S,_e.hover,te.none),onClick:T,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...j,children:C??s.t(`${b}.clear`)}),P&&nn(s,P)]})};function Xo(e,t,n){let s=n.initialDeps??[],r;return()=>{var o,i,a,l;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==s.length||d.some((g,m)=>s[m]!==g)))return r;s=d;let f;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(f=Date.now()),r=t(...d),n.key&&((a=n.debug)!=null&&a.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-f)*100)/100,v=m/16,b=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
18
+ </h1>`,a,{skipScroll:!0})}),{pageId:o.getId(),cmpRoot:i,cleanUp(){au(e)}}}function DP(e,t){const{cmpRoot:n}=e;n.components(t)}function FP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:ur.ADD_PAGE_CODE,toolSetup:HP(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const u=a.toolSetup.cmpRoot.getEl();u&&ou(r.content,u,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;DP(a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function BP(e){TP(e);const t=e.getWrapper(),n=Yv(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){OP(e)}}}function zP(e,t,n){PP(e,t,n)}function UP(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:ur.ADD_PROJECT_PAGE_CODE,toolSetup:BP(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,EP({editor:t,component:a.toolSetup.cmpRoot,content:r.content,isEmail:a.toolSetup.isEmail}));return}if(i==="done"&&a&&r.content){if(a.completed)return;zP(t,r.content,r.input.name),a.completed=!0,l()}if(i==="error"){l();return}}const t0={[ur.ADD_COMPONENT_CODE]:kP,[ur.EDIT_COMPONENT_CODE]:VP,[ur.ADD_PAGE_CODE]:FP,[ur.ADD_PROJECT_PAGE_CODE]:UP},WP=({editor:e,data:t,toolStatusProgress:n,tools:s,chatApi:r})=>{var u;if(t.type!=="data-tool-status")return;const o=t,i=((u=o.data)==null?void 0:u.name)||"",a=t0[i];a?a({editor:e,toolStatus:o,toolStatusProgress:n}):GP({toolStatus:o,toolStatusProgress:n});const l=s[i];if(!(!(l!=null&&l.onData)||!r))try{l.onData({editor:e,chatApi:r,toolStatus:o,toolStatusProgress:n})}catch(d){r.setError(d)}};function GP({toolStatus:e,toolStatusProgress:t}){const{id:n,data:s}=e;if(!n||!s)return;const{status:r,content:o}=s;let i=t.get(n);i||(i={type:"generic",content:"",completed:!1},t.set(n,i)),r==="streaming"&&o&&(i.content=o),r==="done"&&(o&&(i.content=o),t.delete(n)),r==="error"&&t.delete(n)}var qP={NODE_ENV:"production"};class KP{constructor(t,n){var o;this.chatStates=new Map,this.editor=t,this.options=n;const s=CP(t);this.tools=((o=n.tools)==null?void 0:o.call(n,{defaultTools:s,createCommandTool:i=>Qv(t,i),editor:t}))||s;const{chat:r}=this.createChat();this.currentChatId=r.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const s=this.createChat();this.currentChatId=s.chat.id}}}createChat(t){const n=this.editor,s=new Map,r=new Set,o=new Set,{tools:i}=this,{chatApi:a,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:p={},onMessagesUpdate:f,messages:h}=this.options,{onFinish:m,onData:b,...v}=p,x=typeof h=="function",y=[],w=new Hb.Chat({id:t,messages:Array.isArray(h)?h:void 0,sendAutomaticallyWhen:Eo.lastAssistantMessageIsCompleteWithToolCalls,transport:new Eo.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:P,messages:T,body:A,id:_,trigger:N,credentials:V}){var $;const M={...A,id:_,trigger:N,messages:T.slice(-10),projectContext:Yv(n,{withPageContent:!0,selectedComponents:Array.from(o)}),userPrompt:""},I=typeof u=="function"?u({editor:n,body:M,messages:T}):u,{accessToken:U,license:F}=Bt,W=qP.NODE_ENV!=="production",H=`${wf({isDev:W,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!F||["enterprise","business"].includes((($=F==null?void 0:F.plan)==null?void 0:$.category)??"free"))&&typeof a<"u"?typeof a=="function"?a():a:H,headers:{...P,...U?{Authorization:`Bearer ${U}`}:{}},credentials:V,body:{...M,...I}}}}),onToolCall:async({toolCall:P})=>{l==null||l({toolCall:P});const T=!!t0[P.toolName];if(P.dynamic||T)return;const{toolName:A,input:_,toolCallId:N}=P,V=i[A];if(V&&V.execute){const M=new AbortController;r.add(M);try{const{messages:I}=w,U=await Promise.race([V.execute(_||{},{editor:n,messages:I,lastUserMessage:I.findLast(F=>F.role==="user"),toolCallId:N,abortController:M}),new Promise((F,W)=>{M.signal.addEventListener("abort",()=>W(new Error("Aborted")))})]);if(U&&typeof U.error=="string")throw new Error(U.error);w.addToolOutput({tool:A,toolCallId:N,output:U})}catch(I){w.addToolOutput({tool:A,toolCallId:N,state:"output-error",errorText:I instanceof Error?I.message:"Unknown error"})}finally{r.delete(M)}}},onData(P){b==null||b(P),WP({editor:n,data:P,toolStatusProgress:s,tools:i,chatApi:j})},onFinish(P){f==null||f({messages:P.messages,editor:n}),P.isAbort&&(s.forEach(T=>{"toolSetup"in T&&T.toolSetup.cleanUp()}),s.clear()),m==null||m(P)},...v}),S=new Set,j={get messages(){return w.messages},get lastMessage(){return w.lastMessage},get status(){return w.status},get error(){return w.error},sendMessage:(...P)=>C.isMessagesLoaded?w.sendMessage(...P):(y.push(P),Promise.resolve()),setMessages:P=>{w.messages=P},clearError:()=>w.clearError(),stop:()=>w.stop(),setError:P=>{const T=P instanceof Error?P:new Error(String(P));w.setStatus({status:"error",error:T})}},C={chat:w,chatApi:j,isMessagesLoaded:!x,toolStatusProgress:s,toolAbortControllers:r,contextComponents:o,onUpdate:P=>(S.add(P),()=>{S.delete(P)}),emitUpdate:()=>{S.forEach(P=>P())}},E=async()=>{if(!C.isMessagesLoaded||y.length===0)return;const P=y.splice(0);for(const T of P)await w.sendMessage(...T)};this.chatStates.set(w.id,C);const O=()=>{w["~registerMessagesCallback"](()=>{w.status==="ready"&&(f==null||f({messages:w.messages,editor:n}))})};return x?h({editor:n}).then(P=>{w.messages=P,O()}).catch(P=>j.setError(P)).finally(()=>{C.isMessagesLoaded=!0,E().catch(P=>j.setError(P)),C.emitUpdate()}):O(),C}}const ZP=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],YP=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Xo="gs-cmp-ai-chat-empty",XP=({className:e,style:t,chatContext:n,editor:s,suggestions:r})=>{const{sendMessage:o}=n,i="aiChat.emptyState",a=L(Xo,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=s.t(`${i}.title`),u=s.t(`${i}.subtitle`),d=Li(s)?YP:ZP,p=r??d;return c.jsxs(k,{className:a,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(k,{className:`${Xo}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:L(`${Xo}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:L(`${Xo}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx(k,{col:!0,className:`${Xo}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(f=>{const h=s.t(`${i}.suggestions.${f.id}`)||f.label,m=f.prompt??h;return c.jsx(Qe,{className:`${Xo}__suggestion`,onClick:()=>o({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:h},f.id)})})]})},Ui="gs-cmp-ai-chat-error";function JP(e){const t=e==null?void 0:e.message;if(!t)return t;try{const n=JSON.parse(t);return n.error||n.message||t}catch{return t}}const QP=({className:e,style:t,chatContext:n,editor:s})=>{var l;const r=L(Ui,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),o=`${Ui}__message gs-utl-text-sm gs-utl-opacity-75 gs-utl-max-h-24 gs-utl-overflow-auto gs-utl-break-words gs-utl-max-w-full`,i="aiChat.error",a=g.useMemo(()=>JP(n.error),[(l=n.error)==null?void 0:l.message]);return c.jsxs(k,{className:r,style:t,gap:"xs",col:!0,children:[c.jsxs(k,{className:`${Ui}__header`,items:"center",gap:"xs",children:[c.jsx(D,{className:`${Ui}__header-title`,grow:!0,children:s.t(`${i}.title`)}),c.jsx(Qe,{className:`${Ui}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(D,{className:o,grow:!0,children:a})]})},ud="gs-cmp-ai-chat-header",eT=({className:e,chatContext:t,title:n,editor:s,layoutBefore:r,layoutAfter:o,clearButtonProps:i,onClear:a,...l})=>{const[u,d]=g.useState(!1),{messages:p,setMessages:f,status:h}=t,m=L(ud,e,se.bb,z.br,Pe.s),b=h==="streaming"||h==="submitted",v="aiChat.header",x=s.runCommand(ps.getChatApi),y={isClearing:u,setIsClearing:d},w=()=>{d(!0),f([])},{className:S,children:j,...C}=i||{},E={chatApi:x,messages:p,state:y},O=r==null?void 0:r(E),P=o==null?void 0:o(E),T=async A=>{if(!u)try{a?await a({...E,clear:w,event:A}):w()}catch(_){t.setError(_ instanceof Error?_:new Error(String(_)))}finally{d(!1)}};return c.jsxs(k,{className:m,items:"center",gap:"s",...l,children:[O&&nn(s,O),c.jsx(D,{className:`${ud}__title`,grow:!0,children:n??s.t(`${v}.title`)}),p.length>0&&c.jsx(Qe,{className:L(`${ud}__btn-clear`,S,Ae.hover,se.none),onClick:T,size:"xs",border:!1,icon:"delete",loading:u,disabled:b,...C,children:j??s.t(`${v}.clear`)}),P&&nn(s,P)]})};function Jo(e,t,n){let s=n.initialDeps??[],r;return()=>{var o,i,a,l;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==s.length||d.some((h,m)=>s[m]!==h)))return r;s=d;let f;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(f=Date.now()),r=t(...d),n.key&&((a=n.debug)!=null&&a.call(n))){const h=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-f)*100)/100,b=m/16,v=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${v(m,5)} /${v(h,5)} ms`,`
19
19
  font-size: .6rem;
20
20
  font-weight: bold;
21
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,r),r}}function ad(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const HP=(e,t)=>Math.abs(e-t)<1,DP=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};var zi={NODE_ENV:"production"};const FP=e=>e,BP=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},zP=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:a,height:l}=i;t({width:Math.round(a),height:Math.round(l)})};if(r(n.getBoundingClientRect()),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const a=i[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){r({width:l.inlineSize,height:l.blockSize});return}}r(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Ig={passive:!0},UP=typeof window>"u"?!0:"onscrollend"in window,WP=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=UP?()=>{}:DP(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:d,isRtl:p}=e.options;r=d?n.scrollLeft*(p&&-1||1):n.scrollTop,o(),t(r,u)},a=i(!0),l=i(!1);return l(),n.addEventListener("scroll",a,Ig),n.addEventListener("scrollend",l,Ig),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},GP=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},qP=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const i=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class KP{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:FP,rangeExtractor:BP,onChange:()=>{},measureElement:GP,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Xo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:zi.NODE_ENV!=="production",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const a=n[i];if(r.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Xo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Xo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const p=o(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=f?f.end+this.options.gap:s+r,m=a.get(p),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,x=f?f.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:p,lane:x}}return this.measurementsCache=u,u},{key:zi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=Xo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,s,r)=>this.range=n.length>0&&s>0?ZP({measurements:n,outerSize:s,scrollOffset:r}):null,{key:zi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=Xo(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,s,r,o)=>s===null?[]:n({startIndex:s.startIndex,endIndex:s.endIndex,overscan:r,count:o}),{key:zi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,i=s-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=Xo(()=>[this.getIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],l=s[a];r.push(l)}return r},{key:zi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return ad(s[qb(0,s.length-1,r=>ad(s[r]).start,n)])},this.getOffsetForAlignment=(n,s)=>{const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(n<=o?s="start":n>=o+r?s="end":s="start"),s==="start"?n=n:s==="end"?n=n-r:s==="center"&&(n=n-r/2);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-r;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,a]=o;this._scrollToOffset(i,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=ad(this.getOffsetForIndex(n,a));HP(u,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:r})}else this.scrollToIndex(n,{align:a,behavior:r})}))},this.scrollBy=(n,{behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;return s.length===0?r=this.options.paddingStart:r=this.options.lanes===1?((n=s[s.length-1])==null?void 0:n.end)??0:Math.max(...s.slice(-this.options.lanes).map(o=>o.end)),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const qb=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function ZP({measurements:e,outerSize:t,scrollOffset:n}){const s=e.length-1,o=qb(0,s,a=>e[a].start,n);let i=o;for(;i<s&&e[i].end<n+t;)i++;return{startIndex:o,endIndex:i}}const YP=typeof document<"u"?rt.useLayoutEffect:rt.useEffect;function XP(e){const t=rt.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var i;o?$n.flushSync(t):t(),(i=e.onChange)==null||i.call(e,r,o)}},[s]=rt.useState(()=>new KP(n));return s.setOptions(n),rt.useEffect(()=>s._didMount(),[]),YP(()=>s._willUpdate()),s}function JP(e){return XP({observeElementRect:zP,observeElementOffset:WP,scrollToFn:qP,...e})}var QP=Object.defineProperty,e5=(e,t,n)=>t in e?QP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ld=(e,t,n)=>(e5(e,typeof t!="symbol"?t+"":t,n),n);let t5=class{constructor(){ld(this,"current",this.detect()),ld(this,"handoffState","pending"),ld(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},pr=new t5,qe=(e,t)=>{pr.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function Ht(e){let t=h.useRef(e);return qe(()=>{t.current=e},[e]),t}function el(e,t){let[n,s]=h.useState(e),r=Ht(e);return qe(()=>s(r.current),[r,s,...t]),n}let re=function(e){let t=Ht(e);return h.useCallback((...n)=>t.current(...n),[t])};function ru(e,t,n){let[s,r]=h.useState(n),o=e!==void 0,i=h.useRef(o),a=h.useRef(!1),l=h.useRef(!1);return o&&!i.current&&!a.current?(a.current=!0,i.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&i.current&&!l.current&&(l.current=!0,i.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,re(u=>(o||r(u),t==null?void 0:t(u)))]}function Mf(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Ws(){let e=[],t={addEventListener(n,s,r,o){return n.addEventListener(s,r,o),t.add(()=>n.removeEventListener(s,r,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return Mf(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,r){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:r}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=Ws();return n(s),this.add(()=>s.dispose())},add(n){return e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let r of e.splice(s,1))r()}},dispose(){for(let n of e.splice(0))n()}};return t}function ys(){let[e]=h.useState(Ws);return h.useEffect(()=>()=>e.dispose(),[e]),e}function n5(){let e=typeof document>"u";return"useSyncExternalStore"in rt?(t=>t.useSyncExternalStore)(rt)(()=>()=>{},()=>!1,()=>!e):!1}function ou(){let e=n5(),[t,n]=rt.useState(pr.isHandoffComplete);return t&&pr.isHandoffComplete===!1&&n(!1),rt.useEffect(()=>{t!==!0&&n(!0)},[t]),rt.useEffect(()=>pr.handoff(),[]),e?!1:t}var Vg;let Pt=(Vg=h.useId)!=null?Vg:function(){let e=ou(),[t,n]=h.useState(e?()=>pr.nextId():null);return qe(()=>{t===null&&n(pr.nextId())},[t]),t!=null?""+t:void 0};function Re(e,t,...n){if(e in t){let r=t[e];return typeof r=="function"?r(...n):r}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Re),s}function to(e){return pr.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Ep=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Lt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Lt||{}),Vs=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Vs||{}),s5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(s5||{});function iu(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ep)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var au=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(au||{});function Nf(e,t=0){var n;return e===((n=to(e))==null?void 0:n.body)?!1:Re(t,{0(){return e.matches(Ep)},1(){let s=e;for(;s!==null;){if(s.matches(Ep))return!0;s=s.parentElement}return!1}})}var r5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(r5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let o5=["textarea","input"].join(",");function i5(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,o5))!=null?n:!1}function lr(e,t=n=>n){return e.slice().sort((n,s)=>{let r=t(n),o=t(s);if(r===null||o===null)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function cn(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:r=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?lr(e):e:iu(e);r.length>0&&i.length>1&&(i=i.filter(g=>!r.includes(g))),s=s??o.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(s))-1;if(t&4)return Math.max(0,i.indexOf(s))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,p=i.length,f;do{if(d>=p||d+p<=0)return 0;let g=l+d;if(t&16)g=(g+p)%p;else{if(g<0)return 3;if(g>=p)return 1}f=i[g],f==null||f.focus(u),d+=a}while(f!==o.activeElement);return t&6&&i5(f)&&f.select(),2}function a5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function l5(){return/Android/gi.test(window.navigator.userAgent)}function Kb(){return a5()||l5()}function Ll(e,t,n){let s=Ht(t);h.useEffect(()=>{function r(o){s.current(o)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[e,n])}function Zb(e,t,n){let s=Ht(t);h.useEffect(()=>{function r(o){s.current(o)}return window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)},[e,n])}function $f(e,t,n=!0){let s=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{s.current=n})},[n]);function r(i,a){if(!s.current||i.defaultPrevented)return;let l=a(i);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(e);for(let d of u){if(d===null)continue;let p=d instanceof HTMLElement?d:d.current;if(p!=null&&p.contains(l)||i.composed&&i.composedPath().includes(p))return}return!Nf(l,au.Loose)&&l.tabIndex!==-1&&i.preventDefault(),t(i,l)}let o=h.useRef(null);Ll("pointerdown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),Ll("mousedown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),Ll("click",i=>{Kb()||o.current&&(r(i,()=>o.current),o.current=null)},!0),Ll("touchend",i=>r(i,()=>i.target instanceof HTMLElement?i.target:null),!0),Zb("blur",i=>r(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Fo(...e){return h.useMemo(()=>to(...e),[...e])}function Hg(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Li(e,t){let[n,s]=h.useState(()=>Hg(e));return qe(()=>{s(Hg(e))},[e.type,e.as]),qe(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&s("button")},[n,t]),n}let Yb=Symbol();function kf(e,t=!0){return Object.assign(e,{[Yb]:t})}function Ze(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=re(s=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(s):r.current=s)});return e.every(s=>s==null||(s==null?void 0:s[Yb]))?void 0:n}function Dg(e){return[e.screenX,e.screenY]}function Xb(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=Dg(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Dg(t)}}}function Jb({container:e,accept:t,walk:n,enabled:s=!0}){let r=h.useRef(t),o=h.useRef(n);h.useEffect(()=>{r.current=t,o.current=n},[t,n]),qe(()=>{if(!e||!s)return;let i=to(e);if(!i)return;let a=r.current,l=o.current,u=Object.assign(p=>a(p),{acceptNode:a}),d=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,s,r,o])}function Fg(e,t){let n=h.useRef([]),s=re(e);h.useEffect(()=>{let r=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=s(t,r);return n.current=t,a}},[s,...t])}function Ac(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var Cn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Cn||{}),kr=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(kr||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:r,visible:o=!0,name:i,mergeRefs:a}){a=a??c5;let l=Qb(t,e);if(o)return Ml(l,n,s,i,a);let u=r??0;if(u&2){let{static:d=!1,...p}=l;if(d)return Ml(p,n,s,i,a)}if(u&1){let{unmount:d=!0,...p}=l;return Re(d?0:1,{0(){return null},1(){return Ml({...p,hidden:!0,style:{display:"none"}},n,s,i,a)}})}return Ml(l,n,s,i,a)}function Ml(e,t={},n,s,r){let{as:o=n,children:i,refName:a="ref",...l}=cd(e,["unmount","static"]),u=e.ref!==void 0?{[a]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let p={};if(t){let f=!1,g=[];for(let[m,v]of Object.entries(t))typeof v=="boolean"&&(f=!0),v===!0&&g.push(m);f&&(p["data-headlessui-state"]=g.join(" "))}if(o===h.Fragment&&Object.keys(vi(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(v=>` - ${v}`).join(`
22
- `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(v=>` - ${v}`).join(`
21
+ color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,r),r}}function dd(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const tT=(e,t)=>Math.abs(e-t)<1,nT=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};var Wi={NODE_ENV:"production"};const sT=e=>e,rT=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},oT=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:a,height:l}=i;t({width:Math.round(a),height:Math.round(l)})};if(r(n.getBoundingClientRect()),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const a=i[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){r({width:l.inlineSize,height:l.blockSize});return}}r(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},zh={passive:!0},iT=typeof window>"u"?!0:"onscrollend"in window,aT=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=iT?()=>{}:nT(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:d,isRtl:p}=e.options;r=d?n.scrollLeft*(p&&-1||1):n.scrollTop,o(),t(r,u)},a=i(!0),l=i(!1);return l(),n.addEventListener("scroll",a,zh),n.addEventListener("scrollend",l,zh),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},lT=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},cT=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const i=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class uT{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:sT,rangeExtractor:rT,onChange:()=>{},measureElement:lT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Jo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:Wi.NODE_ENV!=="production",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const a=n[i];if(r.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Jo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Jo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const p=o(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),h=f?f.end+this.options.gap:s+r,m=a.get(p),b=typeof m=="number"?m:this.options.estimateSize(d),v=h+b,x=f?f.lane:d%this.options.lanes;u[d]={index:d,start:h,size:b,end:v,key:p,lane:x}}return this.measurementsCache=u,u},{key:Wi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=Jo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,s,r)=>this.range=n.length>0&&s>0?dT({measurements:n,outerSize:s,scrollOffset:r}):null,{key:Wi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=Jo(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,s,r,o)=>s===null?[]:n({startIndex:s.startIndex,endIndex:s.endIndex,overscan:r,count:o}),{key:Wi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,i=s-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=Jo(()=>[this.getIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],l=s[a];r.push(l)}return r},{key:Wi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return dd(s[n0(0,s.length-1,r=>dd(s[r]).start,n)])},this.getOffsetForAlignment=(n,s)=>{const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(n<=o?s="start":n>=o+r?s="end":s="start"),s==="start"?n=n:s==="end"?n=n-r:s==="center"&&(n=n-r/2);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-r;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,a]=o;this._scrollToOffset(i,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=dd(this.getOffsetForIndex(n,a));tT(u,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:r})}else this.scrollToIndex(n,{align:a,behavior:r})}))},this.scrollBy=(n,{behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;return s.length===0?r=this.options.paddingStart:r=this.options.lanes===1?((n=s[s.length-1])==null?void 0:n.end)??0:Math.max(...s.slice(-this.options.lanes).map(o=>o.end)),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const n0=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function dT({measurements:e,outerSize:t,scrollOffset:n}){const s=e.length-1,o=n0(0,s,a=>e[a].start,n);let i=o;for(;i<s&&e[i].end<n+t;)i++;return{startIndex:o,endIndex:i}}const pT=typeof document<"u"?it.useLayoutEffect:it.useEffect;function fT(e){const t=it.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var i;o?kn.flushSync(t):t(),(i=e.onChange)==null||i.call(e,r,o)}},[s]=it.useState(()=>new uT(n));return s.setOptions(n),it.useEffect(()=>s._didMount(),[]),pT(()=>s._willUpdate()),s}function gT(e){return fT({observeElementRect:oT,observeElementOffset:aT,scrollToFn:cT,...e})}var hT=Object.defineProperty,mT=(e,t,n)=>t in e?hT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pd=(e,t,n)=>(mT(e,typeof t!="symbol"?t+"":t,n),n);let bT=class{constructor(){pd(this,"current",this.detect()),pd(this,"handoffState","pending"),pd(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},hr=new bT,Je=(e,t)=>{hr.isServer?g.useEffect(e,t):g.useLayoutEffect(e,t)};function Ht(e){let t=g.useRef(e);return Je(()=>{t.current=e},[e]),t}function rl(e,t){let[n,s]=g.useState(e),r=Ht(e);return Je(()=>s(r.current),[r,s,...t]),n}let re=function(e){let t=Ht(e);return g.useCallback((...n)=>t.current(...n),[t])};function lu(e,t,n){let[s,r]=g.useState(n),o=e!==void 0,i=g.useRef(o),a=g.useRef(!1),l=g.useRef(!1);return o&&!i.current&&!a.current?(a.current=!0,i.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&i.current&&!l.current&&(l.current=!0,i.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,re(u=>(o||r(u),t==null?void 0:t(u)))]}function If(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Ks(){let e=[],t={addEventListener(n,s,r,o){return n.addEventListener(s,r,o),t.add(()=>n.removeEventListener(s,r,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return If(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,r){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:r}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=Ks();return n(s),this.add(()=>s.dispose())},add(n){return e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let r of e.splice(s,1))r()}},dispose(){for(let n of e.splice(0))n()}};return t}function xs(){let[e]=g.useState(Ks);return g.useEffect(()=>()=>e.dispose(),[e]),e}function vT(){let e=typeof document>"u";return"useSyncExternalStore"in it?(t=>t.useSyncExternalStore)(it)(()=>()=>{},()=>!1,()=>!e):!1}function cu(){let e=vT(),[t,n]=it.useState(hr.isHandoffComplete);return t&&hr.isHandoffComplete===!1&&n(!1),it.useEffect(()=>{t!==!0&&n(!0)},[t]),it.useEffect(()=>hr.handoff(),[]),e?!1:t}var Uh;let Tt=(Uh=g.useId)!=null?Uh:function(){let e=cu(),[t,n]=g.useState(e?()=>hr.nextId():null);return Je(()=>{t===null&&n(hr.nextId())},[t]),t!=null?""+t:void 0};function He(e,t,...n){if(e in t){let r=t[e];return typeof r=="function"?r(...n):r}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,He),s}function so(e){return hr.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Ap=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Lt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Lt||{}),Fs=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Fs||{}),yT=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(yT||{});function uu(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ap)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var du=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(du||{});function Vf(e,t=0){var n;return e===((n=so(e))==null?void 0:n.body)?!1:He(t,{0(){return e.matches(Ap)},1(){let s=e;for(;s!==null;){if(s.matches(Ap))return!0;s=s.parentElement}return!1}})}var xT=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(xT||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let wT=["textarea","input"].join(",");function ST(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,wT))!=null?n:!1}function dr(e,t=n=>n){return e.slice().sort((n,s)=>{let r=t(n),o=t(s);if(r===null||o===null)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function cn(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:r=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?dr(e):e:uu(e);r.length>0&&i.length>1&&(i=i.filter(h=>!r.includes(h))),s=s??o.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(s))-1;if(t&4)return Math.max(0,i.indexOf(s))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,p=i.length,f;do{if(d>=p||d+p<=0)return 0;let h=l+d;if(t&16)h=(h+p)%p;else{if(h<0)return 3;if(h>=p)return 1}f=i[h],f==null||f.focus(u),d+=a}while(f!==o.activeElement);return t&6&&ST(f)&&f.select(),2}function CT(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function jT(){return/Android/gi.test(window.navigator.userAgent)}function s0(){return CT()||jT()}function kl(e,t,n){let s=Ht(t);g.useEffect(()=>{function r(o){s.current(o)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[e,n])}function r0(e,t,n){let s=Ht(t);g.useEffect(()=>{function r(o){s.current(o)}return window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)},[e,n])}function Hf(e,t,n=!0){let s=g.useRef(!1);g.useEffect(()=>{requestAnimationFrame(()=>{s.current=n})},[n]);function r(i,a){if(!s.current||i.defaultPrevented)return;let l=a(i);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(p){return typeof p=="function"?d(p()):Array.isArray(p)||p instanceof Set?p:[p]}(e);for(let d of u){if(d===null)continue;let p=d instanceof HTMLElement?d:d.current;if(p!=null&&p.contains(l)||i.composed&&i.composedPath().includes(p))return}return!Vf(l,du.Loose)&&l.tabIndex!==-1&&i.preventDefault(),t(i,l)}let o=g.useRef(null);kl("pointerdown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),kl("mousedown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),kl("click",i=>{s0()||o.current&&(r(i,()=>o.current),o.current=null)},!0),kl("touchend",i=>r(i,()=>i.target instanceof HTMLElement?i.target:null),!0),r0("blur",i=>r(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Bo(...e){return g.useMemo(()=>so(...e),[...e])}function Wh(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function Ni(e,t){let[n,s]=g.useState(()=>Wh(e));return Je(()=>{s(Wh(e))},[e.type,e.as]),Je(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&s("button")},[n,t]),n}let o0=Symbol();function Df(e,t=!0){return Object.assign(e,{[o0]:t})}function et(...e){let t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]);let n=re(s=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(s):r.current=s)});return e.every(s=>s==null||(s==null?void 0:s[o0]))?void 0:n}function Gh(e){return[e.screenX,e.screenY]}function i0(){let e=g.useRef([-1,-1]);return{wasMoved(t){let n=Gh(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Gh(t)}}}function a0({container:e,accept:t,walk:n,enabled:s=!0}){let r=g.useRef(t),o=g.useRef(n);g.useEffect(()=>{r.current=t,o.current=n},[t,n]),Je(()=>{if(!e||!s)return;let i=so(e);if(!i)return;let a=r.current,l=o.current,u=Object.assign(p=>a(p),{acceptNode:a}),d=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,s,r,o])}function qh(e,t){let n=g.useRef([]),s=re(e);g.useEffect(()=>{let r=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=s(t,r);return n.current=t,a}},[s,...t])}function kc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var Cn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Cn||{}),Ir=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ir||{});function Ge({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:r,visible:o=!0,name:i,mergeRefs:a}){a=a??ET;let l=l0(t,e);if(o)return Rl(l,n,s,i,a);let u=r??0;if(u&2){let{static:d=!1,...p}=l;if(d)return Rl(p,n,s,i,a)}if(u&1){let{unmount:d=!0,...p}=l;return He(d?0:1,{0(){return null},1(){return Rl({...p,hidden:!0,style:{display:"none"}},n,s,i,a)}})}return Rl(l,n,s,i,a)}function Rl(e,t={},n,s,r){let{as:o=n,children:i,refName:a="ref",...l}=fd(e,["unmount","static"]),u=e.ref!==void 0?{[a]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let p={};if(t){let f=!1,h=[];for(let[m,b]of Object.entries(t))typeof b=="boolean"&&(f=!0),b===!0&&h.push(m);f&&(p["data-headlessui-state"]=h.join(" "))}if(o===g.Fragment&&Object.keys(yi(l)).length>0){if(!g.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(b=>` - ${b}`).join(`
22
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
23
23
  `)].join(`
24
- `));let f=d.props,g=typeof(f==null?void 0:f.className)=="function"?(...v)=>Ac(f==null?void 0:f.className(...v),l.className):Ac(f==null?void 0:f.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},Qb(d.props,vi(cd(l,["ref"]))),p,u,{ref:r(d.ref,u.ref)},m))}return h.createElement(o,Object.assign({},cd(l,["ref"]),o!==h.Fragment&&u,o!==h.Fragment&&p),d)}function Rf(){let e=h.useRef([]),t=h.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function c5(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Qb(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(s=>[s,void 0])));for(let s in n)Object.assign(t,{[s](r,...o){let i=n[s];for(let a of i){if((r instanceof Event||(r==null?void 0:r.nativeEvent)instanceof Event)&&r.defaultPrevented)return;a(r,...o)}}});return t}function ze(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function vi(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function cd(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}let u5="div";var xs=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(xs||{});function d5(e,t){var n;let{features:s=1,...r}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return Be({ourProps:o,theirProps:r,slot:{},defaultTag:u5,name:"Hidden"})}let ws=ze(d5),If=h.createContext(null);If.displayName="OpenClosedContext";var gt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(gt||{});function Bo(){return h.useContext(If)}function tl({value:e,children:t}){return h.createElement(If.Provider,{value:e},t)}function p5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let bo=[];p5(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&bo[0]!==t.target&&(bo.unshift(t.target),bo=bo.filter(n=>n!=null&&n.isConnected),bo.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Wr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&f5(n)?!1:s}function f5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function h5(e){throw new Error("Unexpected object: "+e)}var Je=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Je||{});function Pp(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),r=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{for(let o=r-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=r+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:h5(e)}}function lu(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))t0(n,e0(t,s),r);return n}function e0(e,t){return e?e+"["+t+"]":t}function t0(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())t0(e,e0(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):lu(n,t,e)}function n0(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}var be=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(be||{}),g5={NODE_ENV:"production"},m5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(m5||{}),v5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(v5||{}),b5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(b5||{}),y5=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(y5||{});function ud(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):lr(s,i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let x5={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,s,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||(s=e.dataRef.current)!=null&&s.optionsRef.current&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Je.Specific?t.idx:Pp(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var f,g;return(g=(f=e.activeOptionIndex)!=null?f:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),p=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let a=ud(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===Je.Specific?t.idx:Pp(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...a,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,s,r;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=ud(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(s=e.dataRef.current)!=null&&s.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=ud(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...s,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let r=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);r!==-1?s=r:s=null}return{...e,activeOptionIndex:s,virtual:Object.assign({},e.virtual,{options:t.options})}}},Vf=h.createContext(null);Vf.displayName="ComboboxActionsContext";function nl(e){let t=h.useContext(Vf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,nl),n}return t}let s0=h.createContext(null);function w5(e){var t;let n=zo("VirtualProvider"),[s,r]=h.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),o=JP({scrollPaddingStart:s,scrollPaddingEnd:r,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[i,a]=h.useState(0);return qe(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(s0.Provider,{value:o},h.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&g5.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var u;return h.createElement(h.Fragment,{key:l.key},h.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${i}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let Hf=h.createContext(null);Hf.displayName="ComboboxDataContext";function zo(e){let t=h.useContext(Hf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zo),n}return t}function S5(e,t){return Re(t.type,x5,e,t)}let C5=h.Fragment;function j5(e,t){let{value:n,defaultValue:s,onChange:r,form:o,name:i,by:a=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:p=!1,immediate:f=!1,virtual:g=null,...m}=e,v=!1,b=null,[x=p?[]:void 0,y]=ru(n,r,s),[w,S]=h.useReducer(S5,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=h.useRef(!1),j=h.useRef({static:!1,hold:!1}),E=h.useRef(null),O=h.useRef(null),P=h.useRef(null),T=h.useRef(null),A=re(typeof a=="string"?(ee,ae)=>{let ge=a;return(ee==null?void 0:ee[ge])===(ae==null?void 0:ae[ge])}:a??((ee,ae)=>ee===ae)),_=re(ee=>w.options.findIndex(ae=>A(ae.dataRef.current.value,ee))),N=h.useCallback(ee=>Re(L.mode,{1:()=>x.some(ae=>A(ae,ee)),0:()=>A(x,ee)}),[x]),D=re(ee=>w.activeOptionIndex===_(ee)),L=h.useMemo(()=>({...w,immediate:v,optionsPropsRef:j,labelRef:E,inputRef:O,buttonRef:P,optionsRef:T,value:x,defaultValue:s,disabled:l,mode:p?1:0,virtual:w.virtual,get activeOptionIndex(){if(C.current&&w.activeOptionIndex===null&&w.options.length>0){let ee=w.options.findIndex(ae=>!ae.dataRef.current.disabled);if(ee!==-1)return ee}return w.activeOptionIndex},calculateIndex:_,compare:A,isSelected:N,isActive:D,nullable:d,__demoMode:u}),[x,s,l,p,d,u,w,b]);qe(()=>{},[b,void 0]),qe(()=>{w.dataRef.current=L},[L]),$f([L.buttonRef,L.inputRef,L.optionsRef],()=>X.closeCombobox(),L.comboboxState===0);let V=h.useMemo(()=>{var ee,ae,ge;return{open:L.comboboxState===0,disabled:l,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(ee=L.activeOptionIndex)!=null?ee:0]:(ge=(ae=L.options[L.activeOptionIndex])==null?void 0:ae.dataRef.current.value)!=null?ge:null,value:x}},[L,l,x]),U=re(()=>{if(L.activeOptionIndex!==null){if(L.virtual)W(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:ee}=L.options[L.activeOptionIndex];W(ee.current.value)}X.goToOption(Je.Specific,L.activeOptionIndex)}}),H=re(()=>{S({type:0}),C.current=!0}),B=re(()=>{S({type:1}),C.current=!1}),k=re((ee,ae,ge)=>(C.current=!1,ee===Je.Specific?S({type:2,focus:Je.Specific,idx:ae,trigger:ge}):S({type:2,focus:ee,trigger:ge}))),I=re((ee,ae)=>(S({type:3,payload:{id:ee,dataRef:ae}}),()=>{L.isActive(ae.current.value)&&(C.current=!0),S({type:4,id:ee})})),R=re(ee=>(S({type:5,id:ee}),()=>S({type:5,id:null}))),W=re(ee=>Re(L.mode,{0(){return y==null?void 0:y(ee)},1(){let ae=L.value.slice(),ge=ae.findIndex(je=>A(je,ee));return ge===-1?ae.push(ee):ae.splice(ge,1),y==null?void 0:y(ae)}})),Z=re(ee=>{S({type:6,trigger:ee})}),X=h.useMemo(()=>({onChange:W,registerOption:I,registerLabel:R,goToOption:k,closeCombobox:B,openCombobox:H,setActivationTrigger:Z,selectActiveOption:U}),[]),J=t===null?{}:{ref:t},Q=h.useRef(null),G=ys();return h.useEffect(()=>{Q.current&&s!==void 0&&G.addEventListener(Q.current,"reset",()=>{y==null||y(s)})},[Q,y]),h.createElement(Vf.Provider,{value:X},h.createElement(Hf.Provider,{value:L},h.createElement(tl,{value:Re(L.comboboxState,{0:gt.Open,1:gt.Closed})},i!=null&&x!=null&&lu({[i]:x}).map(([ee,ae],ge)=>h.createElement(ws,{features:xs.Hidden,ref:ge===0?je=>{var Se;Q.current=(Se=je==null?void 0:je.closest("form"))!=null?Se:null}:void 0,...vi({key:ee,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:ee,value:ae})})),Be({ourProps:J,theirProps:m,slot:V,defaultTag:C5,name:"Combobox"}))))}let E5="input";function P5(e,t){var n,s,r,o,i;let a=Pt(),{id:l=`headlessui-combobox-input-${a}`,onChange:u,displayValue:d,type:p="text",...f}=e,g=zo("Combobox.Input"),m=nl("Combobox.Input"),v=Ze(g.inputRef,t),b=Fo(g.inputRef),x=h.useRef(!1),y=ys(),w=re(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),S=function(){var L;return typeof d=="function"&&g.value!==void 0?(L=d(g.value))!=null?L:"":typeof g.value=="string"?g.value:""}();Fg(([L,V],[U,H])=>{if(x.current)return;let B=g.inputRef.current;B&&((H===0&&V===1||L!==U)&&(B.value=L),requestAnimationFrame(()=>{if(x.current||!B||(b==null?void 0:b.activeElement)!==B)return;let{selectionStart:k,selectionEnd:I}=B;Math.abs((I??0)-(k??0))===0&&k===0&&B.setSelectionRange(B.value.length,B.value.length)}))},[S,g.comboboxState,b]),Fg(([L],[V])=>{if(L===0&&V===1){if(x.current)return;let U=g.inputRef.current;if(!U)return;let H=U.value,{selectionStart:B,selectionEnd:k,selectionDirection:I}=U;U.value="",U.value=H,I!==null?U.setSelectionRange(B,k,I):U.setSelectionRange(B,k)}},[g.comboboxState]);let C=h.useRef(!1),j=re(()=>{C.current=!0}),E=re(()=>{y.nextFrame(()=>{C.current=!1})}),O=re(L=>{switch(x.current=!0,L.key){case be.Enter:if(x.current=!1,g.comboboxState!==0||C.current)return;if(L.preventDefault(),L.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case be.ArrowDown:return x.current=!1,L.preventDefault(),L.stopPropagation(),Re(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case be.ArrowUp:return x.current=!1,L.preventDefault(),L.stopPropagation(),Re(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case be.Home:if(L.shiftKey)break;return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case be.PageUp:return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case be.End:if(L.shiftKey)break;return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case be.PageDown:return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case be.Escape:return x.current=!1,g.comboboxState!==0?void 0:(L.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&L.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&w(),m.closeCombobox());case be.Tab:if(x.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),P=re(L=>{u==null||u(L),g.nullable&&g.mode===0&&L.target.value===""&&w(),m.openCombobox()}),T=re(L=>{var V,U,H;let B=(V=L.relatedTarget)!=null?V:bo.find(k=>k!==L.currentTarget);if(x.current=!1,!((U=g.optionsRef.current)!=null&&U.contains(B))&&!((H=g.buttonRef.current)!=null&&H.contains(B))&&g.comboboxState===0)return L.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?w():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=re(L=>{var V,U,H;let B=(V=L.relatedTarget)!=null?V:bo.find(k=>k!==L.currentTarget);(U=g.buttonRef.current)!=null&&U.contains(B)||(H=g.optionsRef.current)!=null&&H.contains(B)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),_=el(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),N=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),D={ref:v,id:l,role:"combobox",type:p,"aria-controls":(n=g.optionsRef.current)==null?void 0:n.id,"aria-expanded":g.comboboxState===0,"aria-activedescendant":g.activeOptionIndex===null?void 0:g.virtual?(s=g.options.find(L=>{var V;return!((V=g.virtual)!=null&&V.disabled(L.dataRef.current.value))&&g.compare(L.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:s.id:(r=g.options[g.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":_,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?i:g.defaultValue,disabled:g.disabled,onCompositionStart:j,onCompositionEnd:E,onKeyDown:O,onChange:P,onFocus:A,onBlur:T};return Be({ourProps:D,theirProps:f,slot:N,defaultTag:E5,name:"Combobox.Input"})}let T5="button";function O5(e,t){var n;let s=zo("Combobox.Button"),r=nl("Combobox.Button"),o=Ze(s.buttonRef,t),i=Pt(),{id:a=`headlessui-combobox-button-${i}`,...l}=e,u=ys(),d=re(v=>{switch(v.key){case be.ArrowDown:return v.preventDefault(),v.stopPropagation(),s.comboboxState===1&&r.openCombobox(),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case be.ArrowUp:return v.preventDefault(),v.stopPropagation(),s.comboboxState===1&&(r.openCombobox(),u.nextFrame(()=>{s.value||r.goToOption(Je.Last)})),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case be.Escape:return s.comboboxState!==0?void 0:(v.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&v.stopPropagation(),r.closeCombobox(),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),p=re(v=>{if(Wr(v.currentTarget))return v.preventDefault();s.comboboxState===0?r.closeCombobox():(v.preventDefault(),r.openCombobox()),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),f=el(()=>{if(s.labelId)return[s.labelId,a].join(" ")},[s.labelId,a]),g=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled,value:s.value}),[s]),m={ref:o,id:a,type:Li(e,s.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-labelledby":f,disabled:s.disabled,onClick:p,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:T5,name:"Combobox.Button"})}let _5="label";function A5(e,t){let n=Pt(),{id:s=`headlessui-combobox-label-${n}`,...r}=e,o=zo("Combobox.Label"),i=nl("Combobox.Label"),a=Ze(o.labelRef,t);qe(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return Be({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:_5,name:"Combobox.Label"})}let L5="ul",M5=Cn.RenderStrategy|Cn.Static;function N5(e,t){let n=Pt(),{id:s=`headlessui-combobox-options-${n}`,hold:r=!1,...o}=e,i=zo("Combobox.Options"),a=Ze(i.optionsRef,t),l=Bo(),u=l!==null?(l&gt.Open)===gt.Open:i.comboboxState===0;qe(()=>{var g;i.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[i.optionsPropsRef,e.static]),qe(()=>{i.optionsPropsRef.current.hold=r},[i.optionsPropsRef,r]),Jb({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let d=el(()=>{var g,m;return(m=i.labelId)!=null?m:(g=i.buttonRef.current)==null?void 0:g.id},[i.labelId,i.buttonRef.current]),p=h.useMemo(()=>({open:i.comboboxState===0,option:void 0}),[i]),f={"aria-labelledby":d,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:s,ref:a};return i.virtual&&i.comboboxState===0&&Object.assign(o,{children:h.createElement(w5,null,o.children)}),Be({ourProps:f,theirProps:o,slot:p,defaultTag:L5,features:M5,visible:u,name:"Combobox.Options"})}let $5="li";function k5(e,t){var n;let s=Pt(),{id:r=`headlessui-combobox-option-${s}`,disabled:o=!1,value:i,order:a=null,...l}=e,u=zo("Combobox.Option"),d=nl("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(i):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===r,f=u.isSelected(i),g=h.useRef(null),m=Ht({disabled:o,value:i,domRef:g,order:a}),v=h.useContext(s0),b=Ze(t,g,v?v.measureElement:null),x=re(()=>d.onChange(i));qe(()=>d.registerOption(r,m),[m,r]);let y=h.useRef(!(u.virtual||u.__demoMode));qe(()=>{if(!u.virtual||!u.__demoMode)return;let T=Ws();return T.requestAnimationFrame(()=>{y.current=!0}),T.dispose},[u.virtual,u.__demoMode]),qe(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let T=Ws();return T.requestAnimationFrame(()=>{var A,_;(_=(A=g.current)==null?void 0:A.scrollIntoView)==null||_.call(A,{block:"nearest"})}),T.dispose},[g,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let w=re(T=>{var A;if(o||(A=u.virtual)!=null&&A.disabled(i))return T.preventDefault();x(),Kb()||requestAnimationFrame(()=>{var _;return(_=u.inputRef.current)==null?void 0:_.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),S=re(()=>{var T;if(o||(T=u.virtual)!=null&&T.disabled(i))return d.goToOption(Je.Nothing);let A=u.calculateIndex(i);d.goToOption(Je.Specific,A)}),C=Xb(),j=re(T=>C.update(T)),E=re(T=>{var A;if(!C.wasMoved(T)||o||(A=u.virtual)!=null&&A.disabled(i)||p)return;let _=u.calculateIndex(i);d.goToOption(Je.Specific,_,0)}),O=re(T=>{var A;C.wasMoved(T)&&(o||(A=u.virtual)!=null&&A.disabled(i)||p&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),P=h.useMemo(()=>({active:p,selected:f,disabled:o}),[p,f,o]);return Be({ourProps:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:w,onFocus:S,onPointerEnter:j,onMouseEnter:j,onPointerMove:E,onMouseMove:E,onPointerLeave:O,onMouseLeave:O},theirProps:l,slot:P,defaultTag:$5,name:"Combobox.Option"})}let R5=ze(j5),I5=ze(O5),V5=ze(P5),H5=ze(A5),D5=ze(N5),F5=ze(k5),Jo=Object.assign(R5,{Input:V5,Button:I5,Label:H5,Options:D5,Option:F5});function B5(e,t,n,s){let r=Ht(n);h.useEffect(()=>{e=e??window;function o(i){r.current(i)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function cu(){let e=h.useRef(!1);return qe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function z5(e){let t=re(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Mf(()=>{n.current&&t()})}),[t])}var cr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(cr||{});function r0(){let e=h.useRef(0);return Zb("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let U5=h.createContext(!1);function W5(){return h.useContext(U5)}function G5(e){let t=W5(),n=h.useContext(o0),s=Fo(e),[r,o]=h.useState(()=>{if(!t&&n!==null||pr.isServer)return null;let i=s==null?void 0:s.getElementById("headlessui-portal-root");if(i)return i;if(s===null)return null;let a=s.createElement("div");return a.setAttribute("id","headlessui-portal-root"),s.body.appendChild(a)});return h.useEffect(()=>{r!==null&&(s!=null&&s.body.contains(r)||s==null||s.body.appendChild(r))},[r,s]),h.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let q5=h.Fragment;function K5(e,t){let n=e,s=h.useRef(null),r=Ze(kf(d=>{s.current=d}),t),o=Fo(s),i=G5(s),[a]=h.useState(()=>{var d;return pr.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=h.useContext(Tp),u=ou();return qe(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),qe(()=>{if(a&&l)return l.register(a)},[l,a]),z5(()=>{var d;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((d=i.parentElement)==null||d.removeChild(i)))}),u?!i||!a?null:$n.createPortal(Be({ourProps:{ref:r},theirProps:n,defaultTag:q5,name:"Portal"}),a):null}let Z5=h.Fragment,o0=h.createContext(null);function Y5(e,t){let{target:n,...s}=e,r={ref:Ze(t)};return h.createElement(o0.Provider,{value:n},Be({ourProps:r,theirProps:s,defaultTag:Z5,name:"Popover.Group"}))}let Tp=h.createContext(null);function X5(){let e=h.useContext(Tp),t=h.useRef([]),n=re(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=re(o=>{let i=t.current.indexOf(o);i!==-1&&t.current.splice(i,1),e&&e.unregister(o)}),r=h.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,h.useMemo(()=>function({children:o}){return h.createElement(Tp.Provider,{value:r},o)},[r])]}let J5=ze(K5),Q5=ze(Y5);Object.assign(J5,{Group:Q5});function eT({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var s;let r=h.useRef((s=n==null?void 0:n.current)!=null?s:null),o=Fo(r),i=re(()=>{var a,l,u;let d=[];for(let p of e)p!==null&&(p instanceof HTMLElement?d.push(p):"current"in p&&p.current instanceof HTMLElement&&d.push(p.current));if(t!=null&&t.current)for(let p of t.current)d.push(p);for(let p of(a=o==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?a:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(r.current)||p.contains((u=(l=r.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(f=>p.contains(f))||d.push(p));return d});return{resolveContainers:i,contains:re(a=>i().some(l=>l.contains(a))),mainTreeNodeRef:r,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(ws,{features:xs.Hidden,ref:r})},[r,n])}}function tT(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(ws,{features:xs.Hidden,ref:e})},[e])}}let i0=h.createContext(null);function a0(){let e=h.useContext(i0);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,a0),t}return e}function Df(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(i0.Provider,{value:r},n.children)},[t])]}let nT="p";function sT(e,t){let n=Pt(),{id:s=`headlessui-description-${n}`,...r}=e,o=a0(),i=Ze(t);qe(()=>o.register(s),[s,o.register]);let a={ref:i,...o.props,id:s};return Be({ourProps:a,theirProps:r,slot:o.slot||{},defaultTag:nT,name:o.name||"Description"})}let rT=ze(sT),l0=Object.assign(rT,{});var Bg;let oT=(Bg=h.startTransition)!=null?Bg:function(e){e()};var iT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(iT||{}),aT=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e))(aT||{});let lT={0:e=>({...e,disclosureState:Re(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Ff=h.createContext(null);Ff.displayName="DisclosureContext";function Bf(e){let t=h.useContext(Ff);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Bf),n}return t}let zf=h.createContext(null);zf.displayName="DisclosureAPIContext";function c0(e){let t=h.useContext(zf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,c0),n}return t}let Uf=h.createContext(null);Uf.displayName="DisclosurePanelContext";function cT(){return h.useContext(Uf)}function uT(e,t){return Re(t.type,lT,e,t)}let dT=h.Fragment;function pT(e,t){let{defaultOpen:n=!1,...s}=e,r=h.useRef(null),o=Ze(t,kf(b=>{r.current=b},e.as===void 0||e.as===h.Fragment)),i=h.useRef(null),a=h.useRef(null),l=h.useReducer(uT,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:a,panelRef:i,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=l,f=re(b=>{p({type:1});let x=to(r);if(!x||!d)return;let y=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:x.getElementById(d):x.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:f}),[f]),m=h.useMemo(()=>({open:u===0,close:f}),[u,f]),v={ref:o};return h.createElement(Ff.Provider,{value:l},h.createElement(zf.Provider,{value:g},h.createElement(tl,{value:Re(u,{0:gt.Open,1:gt.Closed})},Be({ourProps:v,theirProps:s,slot:m,defaultTag:dT,name:"Disclosure"}))))}let fT="button";function hT(e,t){let n=Pt(),{id:s=`headlessui-disclosure-button-${n}`,...r}=e,[o,i]=Bf("Disclosure.Button"),a=cT(),l=a===null?!1:a===o.panelId,u=h.useRef(null),d=Ze(u,t,l?null:o.buttonRef),p=Rf();h.useEffect(()=>{if(!l)return i({type:2,buttonId:s}),()=>{i({type:2,buttonId:null})}},[s,i,l]);let f=re(y=>{var w;if(l){if(o.disclosureState===1)return;switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),i({type:0}),(w=o.buttonRef.current)==null||w.focus();break}}else switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),i({type:0});break}}),g=re(y=>{switch(y.key){case be.Space:y.preventDefault();break}}),m=re(y=>{var w;Wr(y.currentTarget)||e.disabled||(l?(i({type:0}),(w=o.buttonRef.current)==null||w.focus()):i({type:0}))}),v=h.useMemo(()=>({open:o.disclosureState===0}),[o]),b=Li(e,u),x=l?{ref:d,type:b,onKeyDown:f,onClick:m}:{ref:d,id:s,type:b,"aria-expanded":o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:f,onKeyUp:g,onClick:m};return Be({mergeRefs:p,ourProps:x,theirProps:r,slot:v,defaultTag:fT,name:"Disclosure.Button"})}let gT="div",mT=Cn.RenderStrategy|Cn.Static;function vT(e,t){let n=Pt(),{id:s=`headlessui-disclosure-panel-${n}`,...r}=e,[o,i]=Bf("Disclosure.Panel"),{close:a}=c0("Disclosure.Panel"),l=Rf(),u=Ze(t,o.panelRef,m=>{oT(()=>i({type:m?4:5}))});h.useEffect(()=>(i({type:3,panelId:s}),()=>{i({type:3,panelId:null})}),[s,i]);let d=Bo(),p=d!==null?(d&gt.Open)===gt.Open:o.disclosureState===0,f=h.useMemo(()=>({open:o.disclosureState===0,close:a}),[o,a]),g={ref:u,id:s};return h.createElement(Uf.Provider,{value:o.panelId},Be({mergeRefs:l,ourProps:g,theirProps:r,slot:f,defaultTag:gT,features:mT,visible:p,name:"Disclosure.Panel"}))}let bT=ze(pT),yT=ze(hT),xT=ze(vT),dd=Object.assign(bT,{Button:yT,Panel:xT}),zg=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Ug(e){var t,n;let s=(t=e.innerText)!=null?t:"",r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return s;let o=!1;for(let a of r.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let i=o?(n=r.innerText)!=null?n:"":s;return zg.test(i)&&(i=i.replace(zg,"")),i}function wT(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let s=n.split(" ").map(r=>{let o=document.getElementById(r);if(o){let i=o.getAttribute("aria-label");return typeof i=="string"?i.trim():Ug(o).trim()}return null}).filter(Boolean);if(s.length>0)return s.join(", ")}return Ug(e).trim()}function ST(e){let t=h.useRef(""),n=h.useRef("");return re(()=>{let s=e.current;if(!s)return"";let r=s.innerText;if(t.current===r)return n.current;let o=wT(s).trim().toLowerCase();return t.current=r,n.current=o,o})}var CT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(CT||{}),jT=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(jT||{}),ET=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(ET||{}),PT=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(PT||{});function pd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=lr(t(e.options.slice()),o=>o.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let TT={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,s=e.options.findIndex(r=>n(r.dataRef.current.value));return s!==-1&&(t=s),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s=pd(e),r=Pp(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...s,searchQuery:"",activeOptionIndex:r,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var a;return!i.dataRef.current.disabled&&((a=i.dataRef.current.textValue)==null?void 0:a.startsWith(s))}),o=r?e.options.indexOf(r):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},s=pd(e,r=>[...r,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(n)),{...e,...s}},6:(e,t)=>{let n=pd(e,s=>{let r=s.findIndex(o=>o.id===t.id);return r!==-1&&s.splice(r,1),s});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},Wf=h.createContext(null);Wf.displayName="ListboxActionsContext";function sl(e){let t=h.useContext(Wf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sl),n}return t}let Gf=h.createContext(null);Gf.displayName="ListboxDataContext";function rl(e){let t=h.useContext(Gf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,rl),n}return t}function OT(e,t){return Re(t.type,TT,e,t)}let _T=h.Fragment;function AT(e,t){let{value:n,defaultValue:s,form:r,name:o,onChange:i,by:a=(Z,X)=>Z===X,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const f=u?"horizontal":"vertical";let g=Ze(t),[m=d?[]:void 0,v]=ru(n,i,s),[b,x]=h.useReducer(OT,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),w=h.useRef(null),S=h.useRef(null),C=h.useRef(null),j=re(typeof a=="string"?(Z,X)=>{let J=a;return(Z==null?void 0:Z[J])===(X==null?void 0:X[J])}:a),E=h.useCallback(Z=>Re(O.mode,{1:()=>m.some(X=>j(X,Z)),0:()=>j(m,Z)}),[m]),O=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:f,compare:j,isSelected:E,optionsPropsRef:y,labelRef:w,buttonRef:S,optionsRef:C}),[m,l,d,b]);qe(()=>{b.dataRef.current=O},[O]),$f([O.buttonRef,O.optionsRef],(Z,X)=>{var J;x({type:1}),Nf(X,au.Loose)||(Z.preventDefault(),(J=O.buttonRef.current)==null||J.focus())},O.listboxState===0);let P=h.useMemo(()=>({open:O.listboxState===0,disabled:l,value:m}),[O,l,m]),T=re(Z=>{let X=O.options.find(J=>J.id===Z);X&&U(X.dataRef.current.value)}),A=re(()=>{if(O.activeOptionIndex!==null){let{dataRef:Z,id:X}=O.options[O.activeOptionIndex];U(Z.current.value),x({type:2,focus:Je.Specific,id:X})}}),_=re(()=>x({type:0})),N=re(()=>x({type:1})),D=re((Z,X,J)=>Z===Je.Specific?x({type:2,focus:Je.Specific,id:X,trigger:J}):x({type:2,focus:Z,trigger:J})),L=re((Z,X)=>(x({type:5,id:Z,dataRef:X}),()=>x({type:6,id:Z}))),V=re(Z=>(x({type:7,id:Z}),()=>x({type:7,id:null}))),U=re(Z=>Re(O.mode,{0(){return v==null?void 0:v(Z)},1(){let X=O.value.slice(),J=X.findIndex(Q=>j(Q,Z));return J===-1?X.push(Z):X.splice(J,1),v==null?void 0:v(X)}})),H=re(Z=>x({type:3,value:Z})),B=re(()=>x({type:4})),k=h.useMemo(()=>({onChange:U,registerOption:L,registerLabel:V,goToOption:D,closeListbox:N,openListbox:_,selectActiveOption:A,selectOption:T,search:H,clearSearch:B}),[]),I={ref:g},R=h.useRef(null),W=ys();return h.useEffect(()=>{R.current&&s!==void 0&&W.addEventListener(R.current,"reset",()=>{v==null||v(s)})},[R,v]),h.createElement(Wf.Provider,{value:k},h.createElement(Gf.Provider,{value:O},h.createElement(tl,{value:Re(O.listboxState,{0:gt.Open,1:gt.Closed})},o!=null&&m!=null&&lu({[o]:m}).map(([Z,X],J)=>h.createElement(ws,{features:xs.Hidden,ref:J===0?Q=>{var G;R.current=(G=Q==null?void 0:Q.closest("form"))!=null?G:null}:void 0,...vi({key:Z,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:l,name:Z,value:X})})),Be({ourProps:I,theirProps:p,slot:P,defaultTag:_T,name:"Listbox"}))))}let LT="button";function MT(e,t){var n;let s=Pt(),{id:r=`headlessui-listbox-button-${s}`,...o}=e,i=rl("Listbox.Button"),a=sl("Listbox.Button"),l=Ze(i.buttonRef,t),u=ys(),d=re(b=>{switch(b.key){case be.Space:case be.Enter:case be.ArrowDown:b.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Je.First)});break;case be.ArrowUp:b.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Je.Last)});break}}),p=re(b=>{switch(b.key){case be.Space:b.preventDefault();break}}),f=re(b=>{if(Wr(b.currentTarget))return b.preventDefault();i.listboxState===0?(a.closeListbox(),u.nextFrame(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})})):(b.preventDefault(),a.openListbox())}),g=el(()=>{if(i.labelId)return[i.labelId,r].join(" ")},[i.labelId,r]),m=h.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),v={ref:l,id:r,type:Li(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":g,disabled:i.disabled,onKeyDown:d,onKeyUp:p,onClick:f};return Be({ourProps:v,theirProps:o,slot:m,defaultTag:LT,name:"Listbox.Button"})}let NT="label";function $T(e,t){let n=Pt(),{id:s=`headlessui-listbox-label-${n}`,...r}=e,o=rl("Listbox.Label"),i=sl("Listbox.Label"),a=Ze(o.labelRef,t);qe(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return Be({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:NT,name:"Listbox.Label"})}let kT="ul",RT=Cn.RenderStrategy|Cn.Static;function IT(e,t){var n;let s=Pt(),{id:r=`headlessui-listbox-options-${s}`,...o}=e,i=rl("Listbox.Options"),a=sl("Listbox.Options"),l=Ze(i.optionsRef,t),u=ys(),d=ys(),p=Bo(),f=p!==null?(p&gt.Open)===gt.Open:i.listboxState===0;h.useEffect(()=>{var x;let y=i.optionsRef.current;y&&i.listboxState===0&&y!==((x=to(y))==null?void 0:x.activeElement)&&y.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let g=re(x=>{switch(d.dispose(),x.key){case be.Space:if(i.searchQuery!=="")return x.preventDefault(),x.stopPropagation(),a.search(x.key);case be.Enter:if(x.preventDefault(),x.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:y}=i.options[i.activeOptionIndex];a.onChange(y.current.value)}i.mode===0&&(a.closeListbox(),Ws().nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Re(i.orientation,{vertical:be.ArrowDown,horizontal:be.ArrowRight}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Next);case Re(i.orientation,{vertical:be.ArrowUp,horizontal:be.ArrowLeft}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Previous);case be.Home:case be.PageUp:return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.First);case be.End:case be.PageDown:return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Last);case be.Escape:return x.preventDefault(),x.stopPropagation(),a.closeListbox(),u.nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case be.Tab:x.preventDefault(),x.stopPropagation();break;default:x.key.length===1&&(a.search(x.key),d.setTimeout(()=>a.clearSearch(),350));break}}),m=el(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.id},[i.buttonRef.current]),v=h.useMemo(()=>({open:i.listboxState===0}),[i]),b={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":i.orientation,id:r,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:b,theirProps:o,slot:v,defaultTag:kT,features:RT,visible:f,name:"Listbox.Options"})}let VT="li";function HT(e,t){let n=Pt(),{id:s=`headlessui-listbox-option-${n}`,disabled:r=!1,value:o,...i}=e,a=rl("Listbox.Option"),l=sl("Listbox.Option"),u=a.activeOptionIndex!==null?a.options[a.activeOptionIndex].id===s:!1,d=a.isSelected(o),p=h.useRef(null),f=ST(p),g=Ht({disabled:r,value:o,domRef:p,get textValue(){return f()}}),m=Ze(t,p);qe(()=>{if(a.listboxState!==0||!u||a.activationTrigger===0)return;let j=Ws();return j.requestAnimationFrame(()=>{var E,O;(O=(E=p.current)==null?void 0:E.scrollIntoView)==null||O.call(E,{block:"nearest"})}),j.dispose},[p,u,a.listboxState,a.activationTrigger,a.activeOptionIndex]),qe(()=>l.registerOption(s,g),[g,s]);let v=re(j=>{if(r)return j.preventDefault();l.onChange(o),a.mode===0&&(l.closeListbox(),Ws().nextFrame(()=>{var E;return(E=a.buttonRef.current)==null?void 0:E.focus({preventScroll:!0})}))}),b=re(()=>{if(r)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,s)}),x=Xb(),y=re(j=>x.update(j)),w=re(j=>{x.wasMoved(j)&&(r||u||l.goToOption(Je.Specific,s,0))}),S=re(j=>{x.wasMoved(j)&&(r||u&&l.goToOption(Je.Nothing))}),C=h.useMemo(()=>({active:u,selected:d,disabled:r}),[u,d,r]);return Be({ourProps:{id:s,ref:m,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:v,onFocus:b,onPointerEnter:y,onMouseEnter:y,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:C,defaultTag:VT,name:"Listbox.Option"})}let DT=ze(AT),FT=ze(MT),BT=ze($T),zT=ze(IT),UT=ze(HT),Ui=Object.assign(DT,{Button:FT,Label:BT,Options:zT,Option:UT});var WT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(WT||{}),GT=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(GT||{});let qT={0:e=>{let t={...e,popoverState:Re(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState:1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},qf=h.createContext(null);qf.displayName="PopoverContext";function uu(e){let t=h.useContext(qf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,uu),n}return t}let Kf=h.createContext(null);Kf.displayName="PopoverAPIContext";function Zf(e){let t=h.useContext(Kf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Zf),n}return t}let Yf=h.createContext(null);Yf.displayName="PopoverGroupContext";function u0(){return h.useContext(Yf)}let du=h.createContext(null);du.displayName="PopoverPanelContext";function KT(){return h.useContext(du)}function ZT(e,t){return Re(t.type,qT,e,t)}let YT="div";function XT(e,t){var n;let{__demoMode:s=!1,...r}=e,o=h.useRef(null),i=Ze(t,kf(V=>{o.current=V})),a=h.useRef([]),l=h.useReducer(ZT,{__demoMode:s,popoverState:s?0:1,buttons:a,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:h.createRef(),afterPanelSentinel:h.createRef()}),[{popoverState:u,button:d,buttonId:p,panel:f,panelId:g,beforePanelSentinel:m,afterPanelSentinel:v},b]=l,x=Fo((n=o.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!f)return!1;for(let R of document.querySelectorAll("body > *"))if(Number(R==null?void 0:R.contains(d))^Number(R==null?void 0:R.contains(f)))return!0;let V=iu(),U=V.indexOf(d),H=(U+V.length-1)%V.length,B=(U+1)%V.length,k=V[H],I=V[B];return!f.contains(k)&&!f.contains(I)},[d,f]),w=Ht(p),S=Ht(g),C=h.useMemo(()=>({buttonId:w,panelId:S,close:()=>b({type:1})}),[w,S,b]),j=u0(),E=j==null?void 0:j.registerPopover,O=re(()=>{var V;return(V=j==null?void 0:j.isFocusWithinPopoverGroup())!=null?V:(x==null?void 0:x.activeElement)&&((d==null?void 0:d.contains(x.activeElement))||(f==null?void 0:f.contains(x.activeElement)))});h.useEffect(()=>E==null?void 0:E(C),[E,C]);let[P,T]=X5(),A=eT({mainTreeNodeRef:j==null?void 0:j.mainTreeNodeRef,portals:P,defaultContainers:[d,f]});B5(x==null?void 0:x.defaultView,"focus",V=>{var U,H,B,k;V.target!==window&&V.target instanceof HTMLElement&&u===0&&(O()||d&&f&&(A.contains(V.target)||(H=(U=m.current)==null?void 0:U.contains)!=null&&H.call(U,V.target)||(k=(B=v.current)==null?void 0:B.contains)!=null&&k.call(B,V.target)||b({type:1})))},!0),$f(A.resolveContainers,(V,U)=>{b({type:1}),Nf(U,au.Loose)||(V.preventDefault(),d==null||d.focus())},u===0);let _=re(V=>{b({type:1});let U=V?V instanceof HTMLElement?V:"current"in V&&V.current instanceof HTMLElement?V.current:d:d;U==null||U.focus()}),N=h.useMemo(()=>({close:_,isPortalled:y}),[_,y]),D=h.useMemo(()=>({open:u===0,close:_}),[u,_]),L={ref:i};return h.createElement(du.Provider,{value:null},h.createElement(qf.Provider,{value:l},h.createElement(Kf.Provider,{value:N},h.createElement(tl,{value:Re(u,{0:gt.Open,1:gt.Closed})},h.createElement(T,null,Be({ourProps:L,theirProps:r,slot:D,defaultTag:YT,name:"Popover"}),h.createElement(A.MainTreeNode,null))))))}let JT="button";function QT(e,t){let n=Pt(),{id:s=`headlessui-popover-button-${n}`,...r}=e,[o,i]=uu("Popover.Button"),{isPortalled:a}=Zf("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Pt()}`,d=u0(),p=d==null?void 0:d.closeOthers,f=KT()!==null;h.useEffect(()=>{if(!f)return i({type:3,buttonId:s}),()=>{i({type:3,buttonId:null})}},[f,s,i]);let[g]=h.useState(()=>Symbol()),m=Ze(l,t,f?null:A=>{if(A)o.buttons.current.push(g);else{let _=o.buttons.current.indexOf(g);_!==-1&&o.buttons.current.splice(_,1)}o.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&i({type:2,button:A})}),v=Ze(l,t),b=Fo(l),x=re(A=>{var _,N,D;if(f){if(o.popoverState===1)return;switch(A.key){case be.Space:case be.Enter:A.preventDefault(),(N=(_=A.target).click)==null||N.call(_),i({type:1}),(D=o.button)==null||D.focus();break}}else switch(A.key){case be.Space:case be.Enter:A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),i({type:0});break;case be.Escape:if(o.popoverState!==0)return p==null?void 0:p(o.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;A.preventDefault(),A.stopPropagation(),i({type:1});break}}),y=re(A=>{f||A.key===be.Space&&A.preventDefault()}),w=re(A=>{var _,N;Wr(A.currentTarget)||e.disabled||(f?(i({type:1}),(_=o.button)==null||_.focus()):(A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),i({type:0}),(N=o.button)==null||N.focus()))}),S=re(A=>{A.preventDefault(),A.stopPropagation()}),C=o.popoverState===0,j=h.useMemo(()=>({open:C}),[C]),E=Li(e,l),O=f?{ref:v,type:E,onKeyDown:x,onClick:w}:{ref:m,id:o.buttonId,type:E,"aria-expanded":o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:x,onKeyUp:y,onClick:w,onMouseDown:S},P=r0(),T=re(()=>{let A=o.panel;if(!A)return;function _(){Re(P.current,{[cr.Forwards]:()=>cn(A,Lt.First),[cr.Backwards]:()=>cn(A,Lt.Last)})===Vs.Error&&cn(iu().filter(N=>N.dataset.headlessuiFocusGuard!=="true"),Re(P.current,{[cr.Forwards]:Lt.Next,[cr.Backwards]:Lt.Previous}),{relativeTo:o.button})}_()});return h.createElement(h.Fragment,null,Be({ourProps:O,theirProps:r,slot:j,defaultTag:JT,name:"Popover.Button"}),C&&!f&&a&&h.createElement(ws,{id:u,features:xs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let eO="div",tO=Cn.RenderStrategy|Cn.Static;function nO(e,t){let n=Pt(),{id:s=`headlessui-popover-overlay-${n}`,...r}=e,[{popoverState:o},i]=uu("Popover.Overlay"),a=Ze(t),l=Bo(),u=l!==null?(l&gt.Open)===gt.Open:o===0,d=re(f=>{if(Wr(f.currentTarget))return f.preventDefault();i({type:1})}),p=h.useMemo(()=>({open:o===0}),[o]);return Be({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:d},theirProps:r,slot:p,defaultTag:eO,features:tO,visible:u,name:"Popover.Overlay"})}let sO="div",rO=Cn.RenderStrategy|Cn.Static;function oO(e,t){let n=Pt(),{id:s=`headlessui-popover-panel-${n}`,focus:r=!1,...o}=e,[i,a]=uu("Popover.Panel"),{close:l,isPortalled:u}=Zf("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Pt()}`,p=`headlessui-focus-sentinel-after-${Pt()}`,f=h.useRef(null),g=Ze(f,t,O=>{a({type:4,panel:O})}),m=Fo(f),v=Rf();qe(()=>(a({type:5,panelId:s}),()=>{a({type:5,panelId:null})}),[s,a]);let b=Bo(),x=b!==null?(b&gt.Open)===gt.Open:i.popoverState===0,y=re(O=>{var P;switch(O.key){case be.Escape:if(i.popoverState!==0||!f.current||m!=null&&m.activeElement&&!f.current.contains(m.activeElement))return;O.preventDefault(),O.stopPropagation(),a({type:1}),(P=i.button)==null||P.focus();break}});h.useEffect(()=>{var O;e.static||i.popoverState===1&&((O=e.unmount)==null||O)&&a({type:4,panel:null})},[i.popoverState,e.unmount,e.static,a]),h.useEffect(()=>{if(i.__demoMode||!r||i.popoverState!==0||!f.current)return;let O=m==null?void 0:m.activeElement;f.current.contains(O)||cn(f.current,Lt.First)},[i.__demoMode,r,f,i.popoverState]);let w=h.useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),S={ref:g,id:s,onKeyDown:y,onBlur:r&&i.popoverState===0?O=>{var P,T,A,_,N;let D=O.relatedTarget;D&&f.current&&((P=f.current)!=null&&P.contains(D)||(a({type:1}),((A=(T=i.beforePanelSentinel.current)==null?void 0:T.contains)!=null&&A.call(T,D)||(N=(_=i.afterPanelSentinel.current)==null?void 0:_.contains)!=null&&N.call(_,D))&&D.focus({preventScroll:!0})))}:void 0,tabIndex:-1},C=r0(),j=re(()=>{let O=f.current;if(!O)return;function P(){Re(C.current,{[cr.Forwards]:()=>{var T;cn(O,Lt.First)===Vs.Error&&((T=i.afterPanelSentinel.current)==null||T.focus())},[cr.Backwards]:()=>{var T;(T=i.button)==null||T.focus({preventScroll:!0})}})}P()}),E=re(()=>{let O=f.current;if(!O)return;function P(){Re(C.current,{[cr.Forwards]:()=>{var T;if(!i.button)return;let A=iu(),_=A.indexOf(i.button),N=A.slice(0,_+1),D=[...A.slice(_+1),...N];for(let L of D.slice())if(L.dataset.headlessuiFocusGuard==="true"||(T=i.panel)!=null&&T.contains(L)){let V=D.indexOf(L);V!==-1&&D.splice(V,1)}cn(D,Lt.First,{sorted:!1})},[cr.Backwards]:()=>{var T;cn(O,Lt.Previous)===Vs.Error&&((T=i.button)==null||T.focus())}})}P()});return h.createElement(du.Provider,{value:s},x&&u&&h.createElement(ws,{id:d,ref:i.beforePanelSentinel,features:xs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}),Be({mergeRefs:v,ourProps:S,theirProps:o,slot:w,defaultTag:sO,features:rO,visible:x,name:"Popover.Panel"}),x&&u&&h.createElement(ws,{id:p,ref:i.afterPanelSentinel,features:xs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}))}let iO="div";function aO(e,t){let n=h.useRef(null),s=Ze(n,t),[r,o]=h.useState([]),i=tT(),a=re(v=>{o(b=>{let x=b.indexOf(v);if(x!==-1){let y=b.slice();return y.splice(x,1),y}return b})}),l=re(v=>(o(b=>[...b,v]),()=>a(v))),u=re(()=>{var v;let b=to(n);if(!b)return!1;let x=b.activeElement;return(v=n.current)!=null&&v.contains(x)?!0:r.some(y=>{var w,S;return((w=b.getElementById(y.buttonId.current))==null?void 0:w.contains(x))||((S=b.getElementById(y.panelId.current))==null?void 0:S.contains(x))})}),d=re(v=>{for(let b of r)b.buttonId.current!==v&&b.close()}),p=h.useMemo(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:i.mainTreeNodeRef}),[l,a,u,d,i.mainTreeNodeRef]),f=h.useMemo(()=>({}),[]),g=e,m={ref:s};return h.createElement(Yf.Provider,{value:p},Be({ourProps:m,theirProps:g,slot:f,defaultTag:iO,name:"Popover.Group"}),h.createElement(i.MainTreeNode,null))}let lO=ze(XT),cO=ze(QT),uO=ze(nO),dO=ze(oO),pO=ze(aO),fd=Object.assign(lO,{Button:cO,Overlay:uO,Panel:dO,Group:pO}),d0=h.createContext(null);function p0(){let e=h.useContext(d0);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,p0),t}return e}function Xf(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(d0.Provider,{value:r},n.children)},[t])]}let fO="label";function hO(e,t){let n=Pt(),{id:s=`headlessui-label-${n}`,passive:r=!1,...o}=e,i=p0(),a=Ze(t);qe(()=>i.register(s),[s,i.register]);let l={ref:a,...i.props,id:s};return r&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in o&&delete o.onClick),Be({ourProps:l,theirProps:o,slot:i.slot||{},defaultTag:fO,name:i.name||"Label"})}let gO=ze(hO),f0=Object.assign(gO,{});function h0(e=0){let[t,n]=h.useState(e),s=cu(),r=h.useCallback(l=>{s.current&&n(u=>u|l)},[t,s]),o=h.useCallback(l=>!!(t&l),[t]),i=h.useCallback(l=>{s.current&&n(u=>u&~l)},[n,s]),a=h.useCallback(l=>{s.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:r,hasFlag:o,removeFlag:i,toggleFlag:a}}var mO=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(mO||{});let vO={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:lr(n,s=>s.element.current)}},1(e,t){let n=e.options.slice(),s=e.options.findIndex(r=>r.id===t.id);return s===-1?e:(n.splice(s,1),{...e,options:n})}},Jf=h.createContext(null);Jf.displayName="RadioGroupDataContext";function g0(e){let t=h.useContext(Jf);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,g0),n}return t}let Qf=h.createContext(null);Qf.displayName="RadioGroupActionsContext";function m0(e){let t=h.useContext(Qf);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,m0),n}return t}function bO(e,t){return Re(t.type,vO,e,t)}let yO="div";function xO(e,t){let n=Pt(),{id:s=`headlessui-radiogroup-${n}`,value:r,defaultValue:o,form:i,name:a,onChange:l,by:u=(B,k)=>B===k,disabled:d=!1,...p}=e,f=re(typeof u=="string"?(B,k)=>{let I=u;return(B==null?void 0:B[I])===(k==null?void 0:k[I])}:u),[g,m]=h.useReducer(bO,{options:[]}),v=g.options,[b,x]=Xf(),[y,w]=Df(),S=h.useRef(null),C=Ze(S,t),[j,E]=ru(r,l,o),O=h.useMemo(()=>v.find(B=>!B.propsRef.current.disabled),[v]),P=h.useMemo(()=>v.some(B=>f(B.propsRef.current.value,j)),[v,j]),T=re(B=>{var k;if(d||f(B,j))return!1;let I=(k=v.find(R=>f(R.propsRef.current.value,B)))==null?void 0:k.propsRef.current;return I!=null&&I.disabled?!1:(E==null||E(B),!0)});Jb({container:S.current,accept(B){return B.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:B.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(B){B.setAttribute("role","none")}});let A=re(B=>{let k=S.current;if(!k)return;let I=to(k),R=v.filter(W=>W.propsRef.current.disabled===!1).map(W=>W.element.current);switch(B.key){case be.Enter:n0(B.currentTarget);break;case be.ArrowLeft:case be.ArrowUp:if(B.preventDefault(),B.stopPropagation(),cn(R,Lt.Previous|Lt.WrapAround)===Vs.Success){let W=v.find(Z=>Z.element.current===(I==null?void 0:I.activeElement));W&&T(W.propsRef.current.value)}break;case be.ArrowRight:case be.ArrowDown:if(B.preventDefault(),B.stopPropagation(),cn(R,Lt.Next|Lt.WrapAround)===Vs.Success){let W=v.find(Z=>Z.element.current===(I==null?void 0:I.activeElement));W&&T(W.propsRef.current.value)}break;case be.Space:{B.preventDefault(),B.stopPropagation();let W=v.find(Z=>Z.element.current===(I==null?void 0:I.activeElement));W&&T(W.propsRef.current.value)}break}}),_=re(B=>(m({type:0,...B}),()=>m({type:1,id:B.id}))),N=h.useMemo(()=>({value:j,firstOption:O,containsCheckedOption:P,disabled:d,compare:f,...g}),[j,O,P,d,f,g]),D=h.useMemo(()=>({registerOption:_,change:T}),[_,T]),L={ref:C,id:s,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:A},V=h.useMemo(()=>({value:j}),[j]),U=h.useRef(null),H=ys();return h.useEffect(()=>{U.current&&o!==void 0&&H.addEventListener(U.current,"reset",()=>{T(o)})},[U,T]),h.createElement(w,{name:"RadioGroup.Description"},h.createElement(x,{name:"RadioGroup.Label"},h.createElement(Qf.Provider,{value:D},h.createElement(Jf.Provider,{value:N},a!=null&&j!=null&&lu({[a]:j}).map(([B,k],I)=>h.createElement(ws,{features:xs.Hidden,ref:I===0?R=>{var W;U.current=(W=R==null?void 0:R.closest("form"))!=null?W:null}:void 0,...vi({key:B,as:"input",type:"radio",checked:k!=null,hidden:!0,readOnly:!0,form:i,disabled:d,name:B,value:k})})),Be({ourProps:L,theirProps:p,slot:V,defaultTag:yO,name:"RadioGroup"})))))}var wO=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(wO||{});let SO="div";function CO(e,t){var n;let s=Pt(),{id:r=`headlessui-radiogroup-option-${s}`,value:o,disabled:i=!1,...a}=e,l=h.useRef(null),u=Ze(l,t),[d,p]=Xf(),[f,g]=Df(),{addFlag:m,removeFlag:v,hasFlag:b}=h0(1),x=Ht({value:o,disabled:i}),y=g0("RadioGroup.Option"),w=m0("RadioGroup.Option");qe(()=>w.registerOption({id:r,element:l,propsRef:x}),[r,w,l,x]);let S=re(_=>{var N;if(Wr(_.currentTarget))return _.preventDefault();w.change(o)&&(m(2),(N=l.current)==null||N.focus())}),C=re(_=>{if(Wr(_.currentTarget))return _.preventDefault();m(2)}),j=re(()=>v(2)),E=((n=y.firstOption)==null?void 0:n.id)===r,O=y.disabled||i,P=y.compare(y.value,o),T={ref:u,id:r,role:"radio","aria-checked":P?"true":"false","aria-labelledby":d,"aria-describedby":f,"aria-disabled":O?!0:void 0,tabIndex:O?-1:P||!y.containsCheckedOption&&E?0:-1,onClick:O?void 0:S,onFocus:O?void 0:C,onBlur:O?void 0:j},A=h.useMemo(()=>({checked:P,disabled:O,active:b(2)}),[P,O,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(p,{name:"RadioGroup.Label"},Be({ourProps:T,theirProps:a,slot:A,defaultTag:SO,name:"RadioGroup.Option"})))}let jO=ze(xO),EO=ze(CO),Wg=Object.assign(jO,{Option:EO,Label:f0,Description:l0}),eh=h.createContext(null);eh.displayName="GroupContext";let PO=h.Fragment;function TO(e){var t;let[n,s]=h.useState(null),[r,o]=Xf(),[i,a]=Df(),l=h.useMemo(()=>({switch:n,setSwitch:s,labelledby:r,describedby:i}),[n,s,r,i]),u={},d=e;return h.createElement(a,{name:"Switch.Description"},h.createElement(o,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(p){n&&(p.currentTarget.tagName==="LABEL"&&p.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(eh.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:PO,name:"Switch.Group"}))))}let OO="button";function _O(e,t){var n;let s=Pt(),{id:r=`headlessui-switch-${s}`,checked:o,defaultChecked:i=!1,onChange:a,disabled:l=!1,name:u,value:d,form:p,...f}=e,g=h.useContext(eh),m=h.useRef(null),v=Ze(m,t,g===null?null:g.setSwitch),[b,x]=ru(o,a,i),y=re(()=>x==null?void 0:x(!b)),w=re(P=>{if(Wr(P.currentTarget))return P.preventDefault();P.preventDefault(),y()}),S=re(P=>{P.key===be.Space?(P.preventDefault(),y()):P.key===be.Enter&&n0(P.currentTarget)}),C=re(P=>P.preventDefault()),j=h.useMemo(()=>({checked:b}),[b]),E={id:r,ref:v,role:"switch",type:Li(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":b,"aria-labelledby":g==null?void 0:g.labelledby,"aria-describedby":g==null?void 0:g.describedby,disabled:l,onClick:w,onKeyUp:S,onKeyPress:C},O=ys();return h.useEffect(()=>{var P;let T=(P=m.current)==null?void 0:P.closest("form");T&&i!==void 0&&O.addEventListener(T,"reset",()=>{x(i)})},[m,x]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(ws,{features:xs.Hidden,...vi({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:p,checked:b,name:u,value:d})}),Be({ourProps:E,theirProps:f,slot:j,defaultTag:OO,name:"Switch"}))}let AO=ze(_O),LO=TO,hd=Object.assign(AO,{Group:LO,Label:f0,Description:l0});function MO({onFocus:e}){let[t,n]=h.useState(!0),s=cu();return t?h.createElement(ws,{as:"button",type:"button",features:xs.Focusable,onFocus:r=>{r.preventDefault();let o,i=50;function a(){if(i--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!s.current)return;n(!1);return}o=requestAnimationFrame(a)}o=requestAnimationFrame(a)}}):null}const v0=rt.createContext(null);function NO(){return{groups:new Map,get(e,t){var n;let s=this.groups.get(e);s||(s=new Map,this.groups.set(e,s));let r=(n=s.get(t))!=null?n:0;s.set(t,r+1);let o=Array.from(s.keys()).indexOf(t);function i(){let a=s.get(t);a>1?s.set(t,a-1):s.delete(t)}return[o,i]}}}function $O({children:e}){let t=rt.useRef(NO());return rt.createElement(v0.Provider,{value:t},e)}function b0(e){let t=rt.useContext(v0);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=kO(),[s,r]=t.current.get(e,n);return rt.useEffect(()=>r,[]),s}function kO(){var e,t,n;let s=(n=(t=(e=rt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!s)return Symbol();let r=[],o=s;for(;o;)r.push(o.index),o=o.return;return"$."+r.join(".")}var RO=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(RO||{}),IO=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(IO||{}),VO=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(VO||{});let HO={0(e,t){var n;let s=lr(e.tabs,d=>d.current),r=lr(e.panels,d=>d.current),o=s.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),i={...e,tabs:s,panels:r};if(t.index<0||t.index>s.length-1){let d=Re(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Re(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return i;let p=Re(d,{0:()=>s.indexOf(o[0]),1:()=>s.indexOf(o[o.length-1])});return{...i,selectedIndex:p===-1?e.selectedIndex:p}}let a=s.slice(0,t.index),l=[...s.slice(t.index),...a].find(d=>o.includes(d));if(!l)return i;let u=(n=s.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...i,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],s=lr([...e.tabs,t.tab],o=>o.current),r=e.selectedIndex;return e.info.current.isControlled||(r=s.indexOf(n),r===-1&&(r=e.selectedIndex)),{...e,tabs:s,selectedIndex:r}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:lr([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},th=h.createContext(null);th.displayName="TabsDataContext";function bi(e){let t=h.useContext(th);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,bi),n}return t}let nh=h.createContext(null);nh.displayName="TabsActionsContext";function sh(e){let t=h.useContext(nh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sh),n}return t}function DO(e,t){return Re(t.type,HO,e,t)}let FO=h.Fragment;function BO(e,t){let{defaultIndex:n=0,vertical:s=!1,manual:r=!1,onChange:o,selectedIndex:i=null,...a}=e;const l=s?"vertical":"horizontal",u=r?"manual":"auto";let d=i!==null,p=Ht({isControlled:d}),f=Ze(t),[g,m]=h.useReducer(DO,{info:p,selectedIndex:i??n,tabs:[],panels:[]}),v=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),b=Ht(o||(()=>{})),x=Ht(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),w=re(P=>(m({type:1,tab:P}),()=>m({type:2,tab:P}))),S=re(P=>(m({type:3,panel:P}),()=>m({type:4,panel:P}))),C=re(P=>{j.current!==P&&b.current(P),d||m({type:0,index:P})}),j=Ht(d?e.selectedIndex:g.selectedIndex),E=h.useMemo(()=>({registerTab:w,registerPanel:S,change:C}),[]);qe(()=>{m({type:0,index:i??n})},[i]),qe(()=>{if(j.current===void 0||g.tabs.length<=0)return;let P=lr(g.tabs,T=>T.current);P.some((T,A)=>g.tabs[A]!==T)&&C(P.indexOf(g.tabs[j.current]))});let O={ref:f};return h.createElement($O,null,h.createElement(nh.Provider,{value:E},h.createElement(th.Provider,{value:y},y.tabs.length<=0&&h.createElement(MO,{onFocus:()=>{var P,T;for(let A of x.current)if(((P=A.current)==null?void 0:P.tabIndex)===0)return(T=A.current)==null||T.focus(),!0;return!1}}),Be({ourProps:O,theirProps:a,slot:v,defaultTag:FO,name:"Tabs"}))))}let zO="div";function UO(e,t){let{orientation:n,selectedIndex:s}=bi("Tab.List"),r=Ze(t);return Be({ourProps:{ref:r,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:s},defaultTag:zO,name:"Tabs.List"})}let WO="button";function GO(e,t){var n,s;let r=Pt(),{id:o=`headlessui-tabs-tab-${r}`,...i}=e,{orientation:a,activation:l,selectedIndex:u,tabs:d,panels:p}=bi("Tab"),f=sh("Tab"),g=bi("Tab"),m=h.useRef(null),v=Ze(m,t);qe(()=>f.registerTab(m),[f,m]);let b=b0("tabs"),x=d.indexOf(m);x===-1&&(x=b);let y=x===u,w=re(T=>{var A;let _=T();if(_===Vs.Success&&l==="auto"){let N=(A=to(m))==null?void 0:A.activeElement,D=g.tabs.findIndex(L=>L.current===N);D!==-1&&f.change(D)}return _}),S=re(T=>{let A=d.map(_=>_.current).filter(Boolean);if(T.key===be.Space||T.key===be.Enter){T.preventDefault(),T.stopPropagation(),f.change(x);return}switch(T.key){case be.Home:case be.PageUp:return T.preventDefault(),T.stopPropagation(),w(()=>cn(A,Lt.First));case be.End:case be.PageDown:return T.preventDefault(),T.stopPropagation(),w(()=>cn(A,Lt.Last))}if(w(()=>Re(a,{vertical(){return T.key===be.ArrowUp?cn(A,Lt.Previous|Lt.WrapAround):T.key===be.ArrowDown?cn(A,Lt.Next|Lt.WrapAround):Vs.Error},horizontal(){return T.key===be.ArrowLeft?cn(A,Lt.Previous|Lt.WrapAround):T.key===be.ArrowRight?cn(A,Lt.Next|Lt.WrapAround):Vs.Error}}))===Vs.Success)return T.preventDefault()}),C=h.useRef(!1),j=re(()=>{var T;C.current||(C.current=!0,(T=m.current)==null||T.focus({preventScroll:!0}),f.change(x),Mf(()=>{C.current=!1}))}),E=re(T=>{T.preventDefault()}),O=h.useMemo(()=>{var T;return{selected:y,disabled:(T=e.disabled)!=null?T:!1}},[y,e.disabled]),P={ref:v,onKeyDown:S,onMouseDown:E,onClick:j,id:o,role:"tab",type:Li(e,m),"aria-controls":(s=(n=p[x])==null?void 0:n.current)==null?void 0:s.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:P,theirProps:i,slot:O,defaultTag:WO,name:"Tabs.Tab"})}let qO="div";function KO(e,t){let{selectedIndex:n}=bi("Tab.Panels"),s=Ze(t),r=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:s},theirProps:e,slot:r,defaultTag:qO,name:"Tabs.Panels"})}let ZO="div",YO=Cn.RenderStrategy|Cn.Static;function XO(e,t){var n,s,r,o;let i=Pt(),{id:a=`headlessui-tabs-panel-${i}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:p,panels:f}=bi("Tab.Panel"),g=sh("Tab.Panel"),m=h.useRef(null),v=Ze(m,t);qe(()=>g.registerPanel(m),[g,m,a]);let b=b0("panels"),x=f.indexOf(m);x===-1&&(x=b);let y=x===d,w=h.useMemo(()=>({selected:y}),[y]),S={ref:v,id:a,role:"tabpanel","aria-labelledby":(s=(n=p[x])==null?void 0:n.current)==null?void 0:s.id,tabIndex:y?l:-1};return!y&&((r=u.unmount)==null||r)&&!((o=u.static)!=null&&o)?h.createElement(ws,{as:"span","aria-hidden":"true",...S}):Be({ourProps:S,theirProps:u,slot:w,defaultTag:ZO,features:YO,visible:y,name:"Tabs.Panel"})}let JO=ze(GO),QO=ze(BO),e_=ze(UO),t_=ze(KO),n_=ze(XO),Wi=Object.assign(JO,{Group:QO,List:e_,Panels:t_,Panel:n_});function s_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function gd(e,...t){e&&t.length>0&&e.classList.add(...t)}function md(e,...t){e&&t.length>0&&e.classList.remove(...t)}function r_(e,t){let n=Ws();if(!e)return n.dispose;let{transitionDuration:s,transitionDelay:r}=getComputedStyle(e),[o,i]=[s,r].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return u}),a=o+i;if(a!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},a),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function o_(e,t,n,s){let r=n?"enter":"leave",o=Ws(),i=s!==void 0?s_(s):()=>{};r==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Re(r,{enter:()=>t.enter,leave:()=>t.leave}),l=Re(r,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Re(r,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return md(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),gd(e,...t.base,...a,...u),o.nextFrame(()=>{md(e,...t.base,...a,...u),gd(e,...t.base,...a,...l),r_(e,()=>(md(e,...t.base,...a),gd(e,...t.base,...t.entered),i()))}),o.dispose}function i_({immediate:e,container:t,direction:n,classes:s,onStart:r,onStop:o}){let i=cu(),a=ys(),l=Ht(n);qe(()=>{e&&(l.current="enter")},[e]),qe(()=>{let u=Ws();a.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&i.current)return u.dispose(),r.current(l.current),u.add(o_(d,s.current,l.current==="enter",()=>{u.dispose(),o.current(l.current)})),u.dispose},[n])}function Pr(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let pu=h.createContext(null);pu.displayName="TransitionContext";var a_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(a_||{});function l_(){let e=h.useContext(pu);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function c_(){let e=h.useContext(fu);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let fu=h.createContext(null);fu.displayName="NestingContext";function hu(e){return"children"in e?hu(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function y0(e,t){let n=Ht(e),s=h.useRef([]),r=cu(),o=ys(),i=re((g,m=kr.Hidden)=>{let v=s.current.findIndex(({el:b})=>b===g);v!==-1&&(Re(m,{[kr.Unmount](){s.current.splice(v,1)},[kr.Hidden](){s.current[v].state="hidden"}}),o.microTask(()=>{var b;!hu(s)&&r.current&&((b=n.current)==null||b.call(n))}))}),a=re(g=>{let m=s.current.find(({el:v})=>v===g);return m?m.state!=="visible"&&(m.state="visible"):s.current.push({el:g,state:"visible"}),()=>i(g,kr.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),p=re((g,m,v)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([b])=>b!==g)),t==null||t.chains.current[m].push([g,new Promise(b=>{l.current.push(b)})]),t==null||t.chains.current[m].push([g,new Promise(b=>{Promise.all(d.current[m].map(([x,y])=>y)).then(()=>b())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(m)):v(m)}),f=re((g,m,v)=>{Promise.all(d.current[m].splice(0).map(([b,x])=>x)).then(()=>{var b;(b=l.current.shift())==null||b()}).then(()=>v(m))});return h.useMemo(()=>({children:s,register:a,unregister:i,onStart:p,onStop:f,wait:u,chains:d}),[a,i,s,p,f,d,u])}function u_(){}let d_=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Gg(e){var t;let n={};for(let s of d_)n[s]=(t=e[s])!=null?t:u_;return n}function p_(e){let t=h.useRef(Gg(e));return h.useEffect(()=>{t.current=Gg(e)},[e]),t}let f_="div",x0=Cn.RenderStrategy;function h_(e,t){var n,s;let{beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a,enter:l,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),x=Ze(b,t),y=(n=v.unmount)==null||n?kr.Unmount:kr.Hidden,{show:w,appear:S,initial:C}=l_(),[j,E]=h.useState(w?"visible":"hidden"),O=c_(),{register:P,unregister:T}=O;h.useEffect(()=>P(b),[P,b]),h.useEffect(()=>{if(y===kr.Hidden&&b.current){if(w&&j!=="visible"){E("visible");return}return Re(j,{hidden:()=>T(b),visible:()=>P(b)})}},[j,b,P,T,w,y]);let A=Ht({base:Pr(v.className),enter:Pr(l),enterFrom:Pr(u),enterTo:Pr(d),entered:Pr(p),leave:Pr(f),leaveFrom:Pr(g),leaveTo:Pr(m)}),_=p_({beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a}),N=ou();h.useEffect(()=>{if(N&&j==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,j,N]);let D=C&&!S,L=S&&w&&C,V=!N||D?"idle":w?"enter":"leave",U=h0(0),H=re(Z=>Re(Z,{enter:()=>{U.addFlag(gt.Opening),_.current.beforeEnter()},leave:()=>{U.addFlag(gt.Closing),_.current.beforeLeave()},idle:()=>{}})),B=re(Z=>Re(Z,{enter:()=>{U.removeFlag(gt.Opening),_.current.afterEnter()},leave:()=>{U.removeFlag(gt.Closing),_.current.afterLeave()},idle:()=>{}})),k=y0(()=>{E("hidden"),T(b)},O),I=h.useRef(!1);i_({immediate:L,container:b,classes:A,direction:V,onStart:Ht(Z=>{I.current=!0,k.onStart(b,Z,H)}),onStop:Ht(Z=>{I.current=!1,k.onStop(b,Z,B),Z==="leave"&&!hu(k)&&(E("hidden"),T(b))})});let R=v,W={ref:x};return L?R={...R,className:Ac(v.className,...A.current.enter,...A.current.enterFrom)}:I.current&&(R.className=Ac(v.className,(s=b.current)==null?void 0:s.className),R.className===""&&delete R.className),h.createElement(fu.Provider,{value:k},h.createElement(tl,{value:Re(j,{visible:gt.Open,hidden:gt.Closed})|U.flags},Be({ourProps:W,theirProps:R,defaultTag:f_,features:x0,visible:j==="visible",name:"Transition.Child"})))}function g_(e,t){let{show:n,appear:s=!1,unmount:r=!0,...o}=e,i=h.useRef(null),a=Ze(i,t);ou();let l=Bo();if(n===void 0&&l!==null&&(n=(l&gt.Open)===gt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=h.useState(n?"visible":"hidden"),p=y0(()=>{d("hidden")}),[f,g]=h.useState(!0),m=h.useRef([n]);qe(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let v=h.useMemo(()=>({show:n,appear:s,initial:f}),[n,s,f]);h.useEffect(()=>{if(n)d("visible");else if(!hu(p))d("hidden");else{let w=i.current;if(!w)return;let S=w.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&d("hidden")}},[n,p]);let b={unmount:r},x=re(()=>{var w;f&&g(!1),(w=e.beforeEnter)==null||w.call(e)}),y=re(()=>{var w;f&&g(!1),(w=e.beforeLeave)==null||w.call(e)});return h.createElement(fu.Provider,{value:p},h.createElement(pu.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement(w0,{ref:a,...b,...o,beforeEnter:x,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:x0,visible:u==="visible",name:"Transition"})))}function m_(e,t){let n=h.useContext(pu)!==null,s=Bo()!==null;return h.createElement(h.Fragment,null,!n&&s?h.createElement(Op,{ref:t,...e}):h.createElement(w0,{ref:t,...e}))}let Op=ze(g_),w0=ze(h_),v_=ze(m_),rh=Object.assign(Op,{Child:v_,Root:Op});var qg=function(t){return t.reduce(function(n,s){var r=s[0],o=s[1];return n[r]=o,n},{})},Kg=typeof window<"u"&&window.document&&window.document.createElement?rt.useLayoutEffect:rt.useEffect,wn="top",ns="bottom",ss="right",Sn="left",oh="auto",ol=[wn,ns,ss,Sn],yi="start",ja="end",b_="clippingParents",S0="viewport",Gi="popper",y_="reference",Zg=ol.reduce(function(e,t){return e.concat([t+"-"+yi,t+"-"+ja])},[]),C0=[].concat(ol,[oh]).reduce(function(e,t){return e.concat([t,t+"-"+yi,t+"-"+ja])},[]),x_="beforeRead",w_="read",S_="afterRead",C_="beforeMain",j_="main",E_="afterMain",P_="beforeWrite",T_="write",O_="afterWrite",__=[x_,w_,S_,C_,j_,E_,P_,T_,O_];function Gs(e){return e?(e.nodeName||"").toLowerCase():null}function Dn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function $o(e){var t=Dn(e).Element;return e instanceof t||e instanceof Element}function ts(e){var t=Dn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ih(e){if(typeof ShadowRoot>"u")return!1;var t=Dn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function A_(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var s=t.styles[n]||{},r=t.attributes[n]||{},o=t.elements[n];!ts(o)||!Gs(o)||(Object.assign(o.style,s),Object.keys(r).forEach(function(i){var a=r[i];a===!1?o.removeAttribute(i):o.setAttribute(i,a===!0?"":a)}))})}function L_(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(s){var r=t.elements[s],o=t.attributes[s]||{},i=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:n[s]),a=i.reduce(function(l,u){return l[u]="",l},{});!ts(r)||!Gs(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(l){r.removeAttribute(l)}))})}}const M_={name:"applyStyles",enabled:!0,phase:"write",fn:A_,effect:L_,requires:["computeStyles"]};function Us(e){return e.split("-")[0]}var Po=Math.max,Lc=Math.min,xi=Math.round;function _p(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function j0(){return!/^((?!chrome|android).)*safari/i.test(_p())}function wi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var s=e.getBoundingClientRect(),r=1,o=1;t&&ts(e)&&(r=e.offsetWidth>0&&xi(s.width)/e.offsetWidth||1,o=e.offsetHeight>0&&xi(s.height)/e.offsetHeight||1);var i=$o(e)?Dn(e):window,a=i.visualViewport,l=!j0()&&n,u=(s.left+(l&&a?a.offsetLeft:0))/r,d=(s.top+(l&&a?a.offsetTop:0))/o,p=s.width/r,f=s.height/o;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function ah(e){var t=wi(e),n=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:s}}function E0(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ih(n)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function gr(e){return Dn(e).getComputedStyle(e)}function N_(e){return["table","td","th"].indexOf(Gs(e))>=0}function no(e){return(($o(e)?e.ownerDocument:e.document)||window.document).documentElement}function gu(e){return Gs(e)==="html"?e:e.assignedSlot||e.parentNode||(ih(e)?e.host:null)||no(e)}function Yg(e){return!ts(e)||gr(e).position==="fixed"?null:e.offsetParent}function $_(e){var t=/firefox/i.test(_p()),n=/Trident/i.test(_p());if(n&&ts(e)){var s=gr(e);if(s.position==="fixed")return null}var r=gu(e);for(ih(r)&&(r=r.host);ts(r)&&["html","body"].indexOf(Gs(r))<0;){var o=gr(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function il(e){for(var t=Dn(e),n=Yg(e);n&&N_(n)&&gr(n).position==="static";)n=Yg(n);return n&&(Gs(n)==="html"||Gs(n)==="body"&&gr(n).position==="static")?t:n||$_(e)||t}function lh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function aa(e,t,n){return Po(e,Lc(t,n))}function k_(e,t,n){var s=aa(e,t,n);return s>n?n:s}function P0(){return{top:0,right:0,bottom:0,left:0}}function T0(e){return Object.assign({},P0(),e)}function O0(e,t){return t.reduce(function(n,s){return n[s]=e,n},{})}var R_=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,T0(typeof t!="number"?t:O0(t,ol))};function I_(e){var t,n=e.state,s=e.name,r=e.options,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=Us(n.placement),l=lh(a),u=[Sn,ss].indexOf(a)>=0,d=u?"height":"width";if(!(!o||!i)){var p=R_(r.padding,n),f=ah(o),g=l==="y"?wn:Sn,m=l==="y"?ns:ss,v=n.rects.reference[d]+n.rects.reference[l]-i[l]-n.rects.popper[d],b=i[l]-n.rects.reference[l],x=il(o),y=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=v/2-b/2,S=p[g],C=y-f[d]-p[m],j=y/2-f[d]/2+w,E=aa(S,j,C),O=l;n.modifiersData[s]=(t={},t[O]=E,t.centerOffset=E-j,t)}}function V_(e){var t=e.state,n=e.options,s=n.element,r=s===void 0?"[data-popper-arrow]":s;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||E0(t.elements.popper,r)&&(t.elements.arrow=r))}const H_={name:"arrow",enabled:!0,phase:"main",fn:I_,effect:V_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Si(e){return e.split("-")[1]}var D_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function F_(e,t){var n=e.x,s=e.y,r=t.devicePixelRatio||1;return{x:xi(n*r)/r||0,y:xi(s*r)/r||0}}function Xg(e){var t,n=e.popper,s=e.popperRect,r=e.placement,o=e.variation,i=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=i.x,g=f===void 0?0:f,m=i.y,v=m===void 0?0:m,b=typeof d=="function"?d({x:g,y:v}):{x:g,y:v};g=b.x,v=b.y;var x=i.hasOwnProperty("x"),y=i.hasOwnProperty("y"),w=Sn,S=wn,C=window;if(u){var j=il(n),E="clientHeight",O="clientWidth";if(j===Dn(n)&&(j=no(n),gr(j).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),j=j,r===wn||(r===Sn||r===ss)&&o===ja){S=ns;var P=p&&j===C&&C.visualViewport?C.visualViewport.height:j[E];v-=P-s.height,v*=l?1:-1}if(r===Sn||(r===wn||r===ns)&&o===ja){w=ss;var T=p&&j===C&&C.visualViewport?C.visualViewport.width:j[O];g-=T-s.width,g*=l?1:-1}}var A=Object.assign({position:a},u&&D_),_=d===!0?F_({x:g,y:v},Dn(n)):{x:g,y:v};if(g=_.x,v=_.y,l){var N;return Object.assign({},A,(N={},N[S]=y?"0":"",N[w]=x?"0":"",N.transform=(C.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",N))}return Object.assign({},A,(t={},t[S]=y?v+"px":"",t[w]=x?g+"px":"",t.transform="",t))}function B_(e){var t=e.state,n=e.options,s=n.gpuAcceleration,r=s===void 0?!0:s,o=n.adaptive,i=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Us(t.placement),variation:Si(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Xg(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Xg(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const z_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:B_,data:{}};var Nl={passive:!0};function U_(e){var t=e.state,n=e.instance,s=e.options,r=s.scroll,o=r===void 0?!0:r,i=s.resize,a=i===void 0?!0:i,l=Dn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(d){d.addEventListener("scroll",n.update,Nl)}),a&&l.addEventListener("resize",n.update,Nl),function(){o&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Nl)}),a&&l.removeEventListener("resize",n.update,Nl)}}const W_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:U_,data:{}};var G_={left:"right",right:"left",bottom:"top",top:"bottom"};function fc(e){return e.replace(/left|right|bottom|top/g,function(t){return G_[t]})}var q_={start:"end",end:"start"};function Jg(e){return e.replace(/start|end/g,function(t){return q_[t]})}function ch(e){var t=Dn(e),n=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:n,scrollTop:s}}function uh(e){return wi(no(e)).left+ch(e).scrollLeft}function K_(e,t){var n=Dn(e),s=no(e),r=n.visualViewport,o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(r){o=r.width,i=r.height;var u=j0();(u||!u&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:i,x:a+uh(e),y:l}}function Z_(e){var t,n=no(e),s=ch(e),r=(t=e.ownerDocument)==null?void 0:t.body,o=Po(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=Po(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-s.scrollLeft+uh(e),l=-s.scrollTop;return gr(r||n).direction==="rtl"&&(a+=Po(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:i,x:a,y:l}}function dh(e){var t=gr(e),n=t.overflow,s=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+s)}function _0(e){return["html","body","#document"].indexOf(Gs(e))>=0?e.ownerDocument.body:ts(e)&&dh(e)?e:_0(gu(e))}function la(e,t){var n;t===void 0&&(t=[]);var s=_0(e),r=s===((n=e.ownerDocument)==null?void 0:n.body),o=Dn(s),i=r?[o].concat(o.visualViewport||[],dh(s)?s:[]):s,a=t.concat(i);return r?a:a.concat(la(gu(i)))}function Ap(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Y_(e,t){var n=wi(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Qg(e,t,n){return t===S0?Ap(K_(e,n)):$o(t)?Y_(t,n):Ap(Z_(no(e)))}function X_(e){var t=la(gu(e)),n=["absolute","fixed"].indexOf(gr(e).position)>=0,s=n&&ts(e)?il(e):e;return $o(s)?t.filter(function(r){return $o(r)&&E0(r,s)&&Gs(r)!=="body"}):[]}function J_(e,t,n,s){var r=t==="clippingParents"?X_(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(l,u){var d=Qg(e,u,s);return l.top=Po(d.top,l.top),l.right=Lc(d.right,l.right),l.bottom=Lc(d.bottom,l.bottom),l.left=Po(d.left,l.left),l},Qg(e,i,s));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function A0(e){var t=e.reference,n=e.element,s=e.placement,r=s?Us(s):null,o=s?Si(s):null,i=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(r){case wn:l={x:i,y:t.y-n.height};break;case ns:l={x:i,y:t.y+t.height};break;case ss:l={x:t.x+t.width,y:a};break;case Sn:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var u=r?lh(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(o){case yi:l[u]=l[u]-(t[d]/2-n[d]/2);break;case ja:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function Ea(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=s===void 0?e.placement:s,o=n.strategy,i=o===void 0?e.strategy:o,a=n.boundary,l=a===void 0?b_:a,u=n.rootBoundary,d=u===void 0?S0:u,p=n.elementContext,f=p===void 0?Gi:p,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,x=T0(typeof b!="number"?b:O0(b,ol)),y=f===Gi?y_:Gi,w=e.rects.popper,S=e.elements[m?y:f],C=J_($o(S)?S:S.contextElement||no(e.elements.popper),l,d,i),j=wi(e.elements.reference),E=A0({reference:j,element:w,strategy:"absolute",placement:r}),O=Ap(Object.assign({},w,E)),P=f===Gi?O:j,T={top:C.top-P.top+x.top,bottom:P.bottom-C.bottom+x.bottom,left:C.left-P.left+x.left,right:P.right-C.right+x.right},A=e.modifiersData.offset;if(f===Gi&&A){var _=A[r];Object.keys(T).forEach(function(N){var D=[ss,ns].indexOf(N)>=0?1:-1,L=[wn,ns].indexOf(N)>=0?"y":"x";T[N]+=_[L]*D})}return T}function Q_(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=n.boundary,o=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?C0:l,d=Si(s),p=d?a?Zg:Zg.filter(function(m){return Si(m)===d}):ol,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var g=f.reduce(function(m,v){return m[v]=Ea(e,{placement:v,boundary:r,rootBoundary:o,padding:i})[Us(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function eA(e){if(Us(e)===oh)return[];var t=fc(e);return[Jg(e),t,Jg(t)]}function tA(e){var t=e.state,n=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,f=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,v=n.allowedAutoPlacements,b=t.options.placement,x=Us(b),y=x===b,w=l||(y||!m?[fc(b)]:eA(b)),S=[b].concat(w).reduce(function(Z,X){return Z.concat(Us(X)===oh?Q_(t,{placement:X,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:v}):X)},[]),C=t.rects.reference,j=t.rects.popper,E=new Map,O=!0,P=S[0],T=0;T<S.length;T++){var A=S[T],_=Us(A),N=Si(A)===yi,D=[wn,ns].indexOf(_)>=0,L=D?"width":"height",V=Ea(t,{placement:A,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),U=D?N?ss:Sn:N?ns:wn;C[L]>j[L]&&(U=fc(U));var H=fc(U),B=[];if(o&&B.push(V[_]<=0),a&&B.push(V[U]<=0,V[H]<=0),B.every(function(Z){return Z})){P=A,O=!1;break}E.set(A,B)}if(O)for(var k=m?3:1,I=function(X){var J=S.find(function(Q){var G=E.get(Q);if(G)return G.slice(0,X).every(function(ee){return ee})});if(J)return P=J,"break"},R=k;R>0;R--){var W=I(R);if(W==="break")break}t.placement!==P&&(t.modifiersData[s]._skip=!0,t.placement=P,t.reset=!0)}}const nA={name:"flip",enabled:!0,phase:"main",fn:tA,requiresIfExists:["offset"],data:{_skip:!1}};function em(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function tm(e){return[wn,ss,ns,Sn].some(function(t){return e[t]>=0})}function sA(e){var t=e.state,n=e.name,s=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=Ea(t,{elementContext:"reference"}),a=Ea(t,{altBoundary:!0}),l=em(i,s),u=em(a,r,o),d=tm(l),p=tm(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const rA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:sA};function oA(e,t,n){var s=Us(e),r=[Sn,wn].indexOf(s)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=o[0],a=o[1];return i=i||0,a=(a||0)*r,[Sn,ss].indexOf(s)>=0?{x:a,y:i}:{x:i,y:a}}function iA(e){var t=e.state,n=e.options,s=e.name,r=n.offset,o=r===void 0?[0,0]:r,i=C0.reduce(function(d,p){return d[p]=oA(p,t.rects,o),d},{}),a=i[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[s]=i}const aA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:iA};function lA(e){var t=e.state,n=e.name;t.modifiersData[n]=A0({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const cA={name:"popperOffsets",enabled:!0,phase:"read",fn:lA,data:{}};function uA(e){return e==="x"?"y":"x"}function dA(e){var t=e.state,n=e.options,s=e.name,r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,g=f===void 0?!0:f,m=n.tetherOffset,v=m===void 0?0:m,b=Ea(t,{boundary:l,rootBoundary:u,padding:p,altBoundary:d}),x=Us(t.placement),y=Si(t.placement),w=!y,S=lh(x),C=uA(S),j=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,P=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,T=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,_={x:0,y:0};if(j){if(o){var N,D=S==="y"?wn:Sn,L=S==="y"?ns:ss,V=S==="y"?"height":"width",U=j[S],H=U+b[D],B=U-b[L],k=g?-O[V]/2:0,I=y===yi?E[V]:O[V],R=y===yi?-O[V]:-E[V],W=t.elements.arrow,Z=g&&W?ah(W):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:P0(),J=X[D],Q=X[L],G=aa(0,E[V],Z[V]),ee=w?E[V]/2-k-G-J-T.mainAxis:I-G-J-T.mainAxis,ae=w?-E[V]/2+k+G+Q+T.mainAxis:R+G+Q+T.mainAxis,ge=t.elements.arrow&&il(t.elements.arrow),je=ge?S==="y"?ge.clientTop||0:ge.clientLeft||0:0,Se=(N=A==null?void 0:A[S])!=null?N:0,et=U+ee-Se-je,Ye=U+ae-Se,Ct=aa(g?Lc(H,et):H,U,g?Po(B,Ye):B);j[S]=Ct,_[S]=Ct-U}if(a){var ct,we=S==="x"?wn:Sn,nt=S==="x"?ns:ss,st=j[C],vt=C==="y"?"height":"width",Me=st+b[we],pt=st-b[nt],ut=[wn,Sn].indexOf(x)!==-1,Fe=(ct=A==null?void 0:A[C])!=null?ct:0,Yt=ut?Me:st-E[vt]-O[vt]-Fe+T.altAxis,he=ut?st+E[vt]+O[vt]-Fe-T.altAxis:pt,Ve=g&&ut?k_(Yt,st,he):aa(g?Yt:Me,st,g?he:pt);j[C]=Ve,_[C]=Ve-st}t.modifiersData[s]=_}}const pA={name:"preventOverflow",enabled:!0,phase:"main",fn:dA,requiresIfExists:["offset"]};function fA(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function hA(e){return e===Dn(e)||!ts(e)?ch(e):fA(e)}function gA(e){var t=e.getBoundingClientRect(),n=xi(t.width)/e.offsetWidth||1,s=xi(t.height)/e.offsetHeight||1;return n!==1||s!==1}function mA(e,t,n){n===void 0&&(n=!1);var s=ts(t),r=ts(t)&&gA(t),o=no(t),i=wi(e,r,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(s||!s&&!n)&&((Gs(t)!=="body"||dh(o))&&(a=hA(t)),ts(t)?(l=wi(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=uh(o))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function vA(e){var t=new Map,n=new Set,s=[];e.forEach(function(o){t.set(o.name,o)});function r(o){n.add(o.name);var i=[].concat(o.requires||[],o.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&r(l)}}),s.push(o)}return e.forEach(function(o){n.has(o.name)||r(o)}),s}function bA(e){var t=vA(e);return __.reduce(function(n,s){return n.concat(t.filter(function(r){return r.phase===s}))},[])}function yA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function xA(e){var t=e.reduce(function(n,s){var r=n[s.name];return n[s.name]=r?Object.assign({},r,s,{options:Object.assign({},r.options,s.options),data:Object.assign({},r.data,s.data)}):s,n},{});return Object.keys(t).map(function(n){return t[n]})}var nm={placement:"bottom",modifiers:[],strategy:"absolute"};function sm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function wA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,s=n===void 0?[]:n,r=t.defaultOptions,o=r===void 0?nm:r;return function(a,l,u){u===void 0&&(u=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},nm,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},p=[],f=!1,g={state:d,setOptions:function(x){var y=typeof x=="function"?x(d.options):x;v(),d.options=Object.assign({},o,d.options,y),d.scrollParents={reference:$o(a)?la(a):a.contextElement?la(a.contextElement):[],popper:la(l)};var w=bA(xA([].concat(s,d.options.modifiers)));return d.orderedModifiers=w.filter(function(S){return S.enabled}),m(),g.update()},forceUpdate:function(){if(!f){var x=d.elements,y=x.reference,w=x.popper;if(sm(y,w)){d.rects={reference:mA(y,il(w),d.options.strategy==="fixed"),popper:ah(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(T){return d.modifiersData[T.name]=Object.assign({},T.data)});for(var S=0;S<d.orderedModifiers.length;S++){if(d.reset===!0){d.reset=!1,S=-1;continue}var C=d.orderedModifiers[S],j=C.fn,E=C.options,O=E===void 0?{}:E,P=C.name;typeof j=="function"&&(d=j({state:d,options:O,name:P,instance:g})||d)}}}},update:yA(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),f=!0}};if(!sm(a,l))return g;g.setOptions(u).then(function(b){!f&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var x=b.name,y=b.options,w=y===void 0?{}:y,S=b.effect;if(typeof S=="function"){var C=S({state:d,name:x,instance:g,options:w}),j=function(){};p.push(C||j)}})}function v(){p.forEach(function(b){return b()}),p=[]}return g}}var SA=[W_,cA,z_,M_,aA,nA,pA,H_,rA],CA=wA({defaultModifiers:SA}),jA=typeof Element<"u",EA=typeof Map=="function",PA=typeof Set=="function",TA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function hc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!hc(e[s],t[s]))return!1;return!0}var o;if(EA&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!hc(s.value[1],t.get(s.value[0])))return!1;return!0}if(PA&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(TA&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;if(jA&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((r[s]==="_owner"||r[s]==="__v"||r[s]==="__o")&&e.$$typeof)&&!hc(e[r[s]],t[r[s]]))return!1;return!0}return e!==e&&t!==t}var OA=function(t,n){try{return hc(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const _A=bf(OA);var AA=[],al=function(t,n,s){s===void 0&&(s={});var r=rt.useRef(null),o={onFirstUpdate:s.onFirstUpdate,placement:s.placement||"bottom",strategy:s.strategy||"absolute",modifiers:s.modifiers||AA},i=rt.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=i[0],l=i[1],u=rt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,v=Object.keys(m.elements);tS.flushSync(function(){l({styles:qg(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:qg(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=rt.useMemo(function(){var f={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[u,{name:"applyStyles",enabled:!1}])};return _A(r.current,f)?r.current||f:(r.current=f,f)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,u]),p=rt.useRef();return Kg(function(){p.current&&p.current.setOptions(d)},[d]),Kg(function(){if(!(t==null||n==null)){var f=s.createPopper||CA,g=f(t,n,d);return p.current=g,function(){g.destroy(),p.current=null}}},[t,n,s.createPopper]),{state:p.current?p.current.state:null,styles:a.styles,attributes:a.attributes,update:p.current?p.current.update:null,forceUpdate:p.current?p.current.forceUpdate:null}};const rs=Zt(function({children:t,title:n,onClose:s,icon:r,skipOverflow:o,shadow:i=!0,padding:a=!0,border:l=!0,round:u=!0,className:d,classNameBody:p,size:f="m",titleClass:g=Y("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},x){const y=yr(r)?r:{};return c.jsxs("div",{...b,ref:x,style:m,className:Y(["gs-utl-card",d,v||Af.bg,te.b,u&&te.rnd,l?z.br:te.bT,!o&&"gs-utl-overflow-auto",i&&"gs-utl-shadow-md",a&&f==="l"&&"gs-utl-p-5",a&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",a&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",a&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",a&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||s)&&n!==!1&&c.jsxs($,{className:Y("gs-utl-card-title",g),items:"center",children:[c.jsx(F,{className:Y("truncate"),grow:!0,children:n}),(s||r)&&c.jsx(F,{onClick:s,className:Y("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(se,{icon:(dt(r)?r:"")||K.close,size:"18px",...y})})]}),c.jsx("div",{className:Y("gs-utl-card-body",p),children:t})]})});var $l,LA=new Uint8Array(16);function MA(){if(!$l&&($l=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!$l))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $l(LA)}const NA=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function $A(e){return typeof e=="string"&&NA.test(e)}var qt=[];for(var vd=0;vd<256;++vd)qt.push((vd+256).toString(16).substr(1));function kA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(qt[e[t+0]]+qt[e[t+1]]+qt[e[t+2]]+qt[e[t+3]]+"-"+qt[e[t+4]]+qt[e[t+5]]+"-"+qt[e[t+6]]+qt[e[t+7]]+"-"+qt[e[t+8]]+qt[e[t+9]]+"-"+qt[e[t+10]]+qt[e[t+11]]+qt[e[t+12]]+qt[e[t+13]]+qt[e[t+14]]+qt[e[t+15]]).toLowerCase();if(!$A(n))throw TypeError("Stringified UUID is invalid");return n}function L0(e,t,n){e=e||{};var s=e.random||(e.rng||MA)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,kA(s)}class RA extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const qi=async(e,{onError:t,onLoading:n,onResult:s,params:r,rawText:o,...i})=>{try{n==null||n(!0);const a=r?new URLSearchParams(r).toString():"",l=a?`?${a}`:"",u=await fetch(`${e}${l}`,i);if(!u.ok){const p=await u.json();throw new RA(p.error||"Request failed!",p.errorData)}let d;if(o)d=await u.text();else try{d=await u.json()}catch{d=void 0}return s==null||s(d),d}catch(a){const l=a instanceof Error?a:new Error(a);if(t==null||t(l),i.throwError)throw l;return l}finally{n==null||n(!1)}};class Zs{static async get(t,n){return qi(t,{...n,method:"GET"})}static async post(t,n){return qi(t,{...n,method:"POST"})}static async put(t,n){return qi(t,{...n,method:"PUT"})}static async patch(t,n){return qi(t,{...n,method:"PATCH"})}static async delete(t,n){return qi(t,{...n,method:"DELETE"})}}var mu=(e=>(e.Projects="projects",e.Settings="settings",e))(mu||{}),M0=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(M0||{});const rm={},IA=1,VA=(e={})=>new Promise((t,n)=>{const s=(e==null?void 0:e.db)||"gjs",r=s==="gjs-studio"?IA:1,o=rm[s];if(o)t(o);else{if(!os())return n(new Error("window context not found"));const i=window.indexedDB.open(s,r);i.onerror=n,i.onsuccess=()=>{const a=i.result;a.onerror=n,rm[s]=a,t(a)},i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains("projects")||a.createObjectStore("projects"),a.objectStoreNames.contains("settings")||a.createObjectStore("settings")}}}),ph=async(e,t)=>(await VA(t)).transaction([e],"readwrite").objectStore(e),HA=async(e,t)=>{const n=await ph(e,t);return new Promise((s,r)=>{const o=[],i=n.openCursor();i.onerror=r,i.onsuccess=function(a){const u=a.target.result;if(u){const d=u.primaryKey,p=u.value;o.push({key:d,data:p}),u.continue()}else s(o)}})},DA=async(e,t,n)=>{const s=await ph(e,n);return new Promise((r,o)=>{const i=s.get(t);i.onerror=o,i.onsuccess=()=>r(i.result)})},FA=async(e,t,n)=>{const s=await ph(e,n);return new Promise((r,o)=>{const i=s.delete(t);i.onerror=o,i.onsuccess=()=>r()})};var Pa=(e=>(e.Existing="existing",e.Templates="templates",e))(Pa||{});const BA=e=>{const t=O3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},zA=(e,t)=>Zs.get(BA(e),{...t}),UA=async e=>{try{const t=await zA(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},N0=async(e=jt.web)=>typeof window>"u"?[]:(await HA(mu.Projects)).map(({key:s,data:r})=>{var o;return{id:`${s}`,name:`${((o=r.custom)==null?void 0:o.projectName)||s}`,data:r}}).filter(s=>{var r;return((r=s.data.custom)==null?void 0:r.projectType)===e}),$0=new Set,Rn=new WeakMap,fi=new WeakMap,ko=new WeakMap,Lp=new WeakMap,WA=new WeakMap,Ci=new WeakMap,Mc=new WeakMap;let Gr;const xo="__aa_tgt",Mp="__aa_del",GA=e=>{const t=XA(e);t&&t.forEach(n=>JA(n))},qA=e=>{e.forEach(t=>{t.target===Gr&&ZA(),Rn.has(t.target)&&Uo(t.target)})};function KA(e){const t=Lp.get(e);t==null||t.disconnect();let n=Rn.get(e),s=0;const r=5;n||(n=ji(e),Rn.set(e,n));const{offsetWidth:o,offsetHeight:i}=Gr,l=[n.top-r,o-(n.left+r+n.width),i-(n.top+r+n.height),n.left-r].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++s>1&&Uo(e)},{root:Gr,threshold:1,rootMargin:l});u.observe(e),Lp.set(e,u)}function Uo(e){clearTimeout(Mc.get(e));const t=vu(e),n=typeof t=="function"?500:t.duration;Mc.set(e,setTimeout(()=>{const s=ko.get(e);(!s||s.finished)&&(Rn.set(e,ji(e)),KA(e))},n))}function ZA(){clearTimeout(Mc.get(Gr)),Mc.set(Gr,setTimeout(()=>{$0.forEach(e=>I0(e,t=>k0(()=>Uo(t))))},100))}function YA(e){setTimeout(()=>{WA.set(e,setInterval(()=>k0(Uo.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function k0(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Np,ci;typeof window<"u"&&(Gr=document.documentElement,Np=new MutationObserver(GA),ci=new ResizeObserver(qA),ci.observe(Gr));function XA(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(bd(n.target),!t.has(n.target)){t.add(n.target);for(let s=0;s<n.target.children.length;s++){const r=n.target.children.item(s);if(r){if(Mp in r)return!1;bd(n.target,r),t.add(r)}}}if(n.removedNodes.length)for(let s=0;s<n.removedNodes.length;s++){const r=n.removedNodes[s];if(Mp in r)return!1;r instanceof Element&&(t.add(r),bd(n.target,r),fi.set(r,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function bd(e,t){!t&&!(xo in e)?Object.defineProperty(e,xo,{value:e}):t&&!(xo in t)&&Object.defineProperty(t,xo,{value:e})}function JA(e){var t;const n=Gr.contains(e),s=Rn.has(e);n&&fi.has(e)&&fi.delete(e),ko.has(e)&&((t=ko.get(e))===null||t===void 0||t.cancel()),s&&n?QA(e):s&&!n?t3(e):e3(e)}function _s(e){return Number(e.replace(/[^0-9.\-]/g,""))}function ji(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function R0(e,t,n){let s=t.width,r=t.height,o=n.width,i=n.height;const a=getComputedStyle(e);if(a.getPropertyValue("box-sizing")==="content-box"){const u=_s(a.paddingTop)+_s(a.paddingBottom)+_s(a.borderTopWidth)+_s(a.borderBottomWidth),d=_s(a.paddingLeft)+_s(a.paddingRight)+_s(a.borderRightWidth)+_s(a.borderLeftWidth);s-=d,o-=d,r-=u,i-=u}return[s,o,r,i].map(Math.round)}function vu(e){return xo in e&&Ci.has(e[xo])?Ci.get(e[xo]):{duration:250,easing:"ease-in-out"}}function I0(e,...t){t.forEach(n=>n(e,Ci.has(e)));for(let n=0;n<e.children.length;n++){const s=e.children.item(n);s&&t.forEach(r=>r(s,Ci.has(s)))}}function QA(e){const t=Rn.get(e),n=ji(e);let s;if(!t)return;const r=vu(e);if(typeof r!="function"){const o=t.left-n.left,i=t.top-n.top,[a,l,u,d]=R0(e,t,n),p={transform:`translate(${o}px, ${i}px)`},f={transform:"translate(0, 0)"};a!==l&&(p.width=`${a}px`,f.width=`${l}px`),u!==d&&(p.height=`${u}px`,f.height=`${d}px`),s=e.animate([p,f],r)}else s=new Animation(r(e,"remain",t,n)),s.play();ko.set(e,s),Rn.set(e,n),s.addEventListener("finish",Uo.bind(null,e))}function e3(e){const t=ji(e);Rn.set(e,t);const n=vu(e);let s;typeof n!="function"?s=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(s=new Animation(n(e,"add",t)),s.play()),ko.set(e,s),s.addEventListener("finish",Uo.bind(null,e))}function t3(e){if(!fi.has(e)||!Rn.has(e))return;const[t,n]=fi.get(e);Object.defineProperty(e,Mp,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[s,r,o,i]=n3(e),a=vu(e),l=Rn.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${r}px`,width:`${o}px`,height:`${i}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof a!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:a.duration,easing:"ease-out"}):(u=new Animation(a(e,"remove",l)),u.play()),ko.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Rn.delete(e),fi.delete(e),ko.delete(e),(d=Lp.get(e))===null||d===void 0||d.disconnect()})}function n3(e){const t=Rn.get(e),[n,,s]=R0(e,t,ji(e));let r=e.parentElement;for(;r&&(getComputedStyle(r).position==="static"||r instanceof HTMLBodyElement);)r=r.parentElement;r||(r=document.body);const o=getComputedStyle(r),i=Rn.get(r)||ji(r),a=Math.round(t.top-i.top)-_s(o.borderTopWidth),l=Math.round(t.left-i.left)-_s(o.borderLeftWidth);return[a,l,n,s]}function s3(e,t={}){Np&&ci&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),I0(e,Uo,YA,n=>ci==null?void 0:ci.observe(n)),typeof t=="function"?Ci.set(e,t):Ci.set(e,{duration:250,easing:"ease-in-out",...t}),Np.observe(e,{childList:!0}),$0.add(e))}function r3(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&s3(t.current,e)},[t]),t}const o3={[un.Info]:z.bgA,[un.Error]:"bg-red-500",[un.Success]:"bg-green-500",[un.Warning]:"bg-orange-400"},i3=Zt(function(t,n){const s={[un.Info]:K.informationVariant,[un.Error]:K.fire,[un.Success]:K.checkBold,[un.Warning]:K.alertRhombus},{children:r,className:o,content:i,id:a,buttons:l=[],variant:u=un.Info,autoHideTimeout:d=3e3}=t,p=h.useRef(null),f=h.useRef(),g=s[u],m=o3[u];h.useImperativeHandle(n,()=>p.current,[]);const v=()=>{var w;return(w=t.onDismiss)==null?void 0:w.call(t,a)},b=()=>{d&&(f.current=setTimeout(v,d))},x=()=>f.current&&clearTimeout(f.current);h.useEffect(()=>(b(),x),[]);const y=i||r;return c.jsx(rs,{className:ie(o,"overflow-hidden relative"),ref:p,onPointerEnter:x,onPointerLeave:b,children:c.jsxs($,{space:"m",items:"center",className:ie(Pe.y),children:[c.jsx(F,{className:ie(m,te.pill,"text-white gjs-p-1"),children:c.jsx(se,{icon:g,size:oe.s})}),c.jsx(F,{grow:!0,className:ie("gjs-pr-3"),children:c.jsxs($,{col:!0,space:"xs",children:[c.jsx(F,{className:ie("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(F,{className:ie(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx($,{space:"m",justify:"end",children:l.map(({id:w,...S})=>c.jsx(Ke,{...S},w))})]})}),c.jsx(F,{className:ie("absolute top-1 right-1"),children:c.jsx(St,{onClick:v,border:!1,children:c.jsx(se,{icon:K.close,size:oe.s})})})]})})});ce(Zt(function({className:t,toasts:n,onDismiss:s,...r},o){const i=r3({});return c.jsx("div",{className:ie(t,"w-80 gs-utl-z-30"),...r,ref:i,children:n.map(a=>c.jsx(i3,{...a,className:ie("gjs-mb-2"),onDismiss:s},a.uuid||a.id))})}));var $p=(e=>(e.self="self",e.cloud="cloud",e))($p||{}),To=(e=>(e.image="image",e.video="video",e))(To||{}),cs=(e=>(e.componentOutline="componentOutline",e.preview="preview",e.fullscreen="fullscreen",e.showCode="showCode",e.showImportCode="showImportCode",e.clearCanvas="clearCanvas",e.store="store",e.undo="undo",e.redo="redo",e))(cs||{}),fh=(e=>(e.canvas="canvas",e.layers="layers",e))(fh||{}),Ar=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Ar||{}),Ut=(e=>(e.variable="data-variable",e.condition="data-condition",e.conditionTrue="data-condition-true-content",e.conditionFalse="data-condition-false-content",e.collection="data-collection",e.collectionItem="data-collection-item",e))(Ut||{}),kp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(kp||{});const Ta=e=>e.replaceAll('"',"").replaceAll("'",""),Ro=e=>e.includes(",")?e:/\s/.test(e)?`'${Ta(e)}'`:Ta(e),om=(e,t,n)=>({family:e,variant:t,...n}),ca=(e,t)=>{e=Ro(e);const{menuVariant:n,variants:s}=t;return{family:e,familyLabel:Ta(e),menuVariant:n&&om(Ro(`menuFont-${Ta(e)}`),"regular",n),variants:Object.assign({},...Object.entries(s).map(([r,o])=>({[r]:om(e,r,o)})))}},hh=(e,t)=>{var a;const n=ca(e.family,e),s=n.menuVariant??((a=Object.values(n.variants))==null?void 0:a[0]);if(!s)return"Arial, Helvetica, sans-serif";const{source:r,descriptors:o}=s,i=Ta(s.family);if(!t){const l=new FontFace(i,`url("${r}")`,o),u=Array.from(document.fonts.values()).filter(d=>d.family===i);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return Ro(i)},Os=", sans-serif",im=["Arial, Helvetica"+Os,"Arial Black, Gadget"+Os,"Brush Script MT"+Os,"Comic Sans MS, cursive"+Os,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Os,"Impact, Charcoal"+Os,"Lucida Sans Unicode, Lucida Grande"+Os,"Tahoma, Geneva"+Os,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Os,"Verdana, Geneva"+Os].map(e=>({id:e,label:e.split(",")[0]})),a3=String.raw,tr=(e,t)=>{if(!t)return"";const n=e[0],s=e[1];return`${n}${t}${s}`},l3=({family:e,source:t,descriptors:n})=>{const{display:s,ascentOverride:r,descentOverride:o,featureSettings:i,lineGapOverride:a,stretch:l,style:u,unicodeRange:d,weight:p}=n??{},f=[tr`font-ascent-override: ${r};`,tr`font-display: ${s};`,tr`font-descent-override: ${o};`,tr`font-feature-settings: ${i};`,tr`font-line-gap-override: ${a};`,tr`font-stretch: ${l};`,tr`font-style: ${u};`,tr`font-unicode-range: ${d};`,tr`font-weight: ${p};`].filter(Boolean);return a3`
24
+ `));let f=d.props,h=typeof(f==null?void 0:f.className)=="function"?(...b)=>kc(f==null?void 0:f.className(...b),l.className):kc(f==null?void 0:f.className,l.className),m=h?{className:h}:{};return g.cloneElement(d,Object.assign({},l0(d.props,yi(fd(l,["ref"]))),p,u,{ref:r(d.ref,u.ref)},m))}return g.createElement(o,Object.assign({},fd(l,["ref"]),o!==g.Fragment&&u,o!==g.Fragment&&p),d)}function Ff(){let e=g.useRef([]),t=g.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function ET(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function l0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(s=>[s,void 0])));for(let s in n)Object.assign(t,{[s](r,...o){let i=n[s];for(let a of i){if((r instanceof Event||(r==null?void 0:r.nativeEvent)instanceof Event)&&r.defaultPrevented)return;a(r,...o)}}});return t}function qe(e){var t;return Object.assign(g.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function yi(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function fd(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}let PT="div";var ws=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ws||{});function TT(e,t){var n;let{features:s=1,...r}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return Ge({ourProps:o,theirProps:r,slot:{},defaultTag:PT,name:"Hidden"})}let Ss=qe(TT),Bf=g.createContext(null);Bf.displayName="OpenClosedContext";var mt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(mt||{});function zo(){return g.useContext(Bf)}function ol({value:e,children:t}){return g.createElement(Bf.Provider,{value:e},t)}function OT(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let vo=[];OT(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&vo[0]!==t.target&&(vo.unshift(t.target),vo=vo.filter(n=>n!=null&&n.isConnected),vo.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function qr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&_T(n)?!1:s}function _T(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function AT(e){throw new Error("Unexpected object: "+e)}var nt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(nt||{});function Mp(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),r=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{for(let o=r-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=r+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:AT(e)}}function pu(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))u0(n,c0(t,s),r);return n}function c0(e,t){return e?e+"["+t+"]":t}function u0(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())u0(e,c0(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):pu(n,t,e)}function d0(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}var xe=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(xe||{}),MT={NODE_ENV:"production"},LT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(LT||{}),NT=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(NT||{}),$T=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))($T||{}),kT=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(kT||{});function gd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):dr(s,i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let RT={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,s,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||(s=e.dataRef.current)!=null&&s.optionsRef.current&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===nt.Specific?t.idx:Mp(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var f,h;return(h=(f=e.activeOptionIndex)!=null?f:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?h:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),p=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let a=gd(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===nt.Specific?t.idx:Mp(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...a,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,s,r;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=gd(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(s=e.dataRef.current)!=null&&s.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=gd(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...s,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let r=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);r!==-1?s=r:s=null}return{...e,activeOptionIndex:s,virtual:Object.assign({},e.virtual,{options:t.options})}}},zf=g.createContext(null);zf.displayName="ComboboxActionsContext";function il(e){let t=g.useContext(zf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,il),n}return t}let p0=g.createContext(null);function IT(e){var t;let n=Uo("VirtualProvider"),[s,r]=g.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),o=gT({scrollPaddingStart:s,scrollPaddingEnd:r,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[i,a]=g.useState(0);return Je(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),g.createElement(p0.Provider,{value:o},g.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&MT.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var u;return g.createElement(g.Fragment,{key:l.key},g.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${i}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let Uf=g.createContext(null);Uf.displayName="ComboboxDataContext";function Uo(e){let t=g.useContext(Uf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Uo),n}return t}function VT(e,t){return He(t.type,RT,e,t)}let HT=g.Fragment;function DT(e,t){let{value:n,defaultValue:s,onChange:r,form:o,name:i,by:a=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:p=!1,immediate:f=!1,virtual:h=null,...m}=e,b=!1,v=null,[x=p?[]:void 0,y]=lu(n,r,s),[w,S]=g.useReducer(VT,{dataRef:g.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),j=g.useRef(!1),C=g.useRef({static:!1,hold:!1}),E=g.useRef(null),O=g.useRef(null),P=g.useRef(null),T=g.useRef(null),A=re(typeof a=="string"?(Q,ie)=>{let ae=a;return(Q==null?void 0:Q[ae])===(ie==null?void 0:ie[ae])}:a??((Q,ie)=>Q===ie)),_=re(Q=>w.options.findIndex(ie=>A(ie.dataRef.current.value,Q))),N=g.useCallback(Q=>He(M.mode,{1:()=>x.some(ie=>A(ie,Q)),0:()=>A(x,Q)}),[x]),V=re(Q=>w.activeOptionIndex===_(Q)),M=g.useMemo(()=>({...w,immediate:b,optionsPropsRef:C,labelRef:E,inputRef:O,buttonRef:P,optionsRef:T,value:x,defaultValue:s,disabled:l,mode:p?1:0,virtual:w.virtual,get activeOptionIndex(){if(j.current&&w.activeOptionIndex===null&&w.options.length>0){let Q=w.options.findIndex(ie=>!ie.dataRef.current.disabled);if(Q!==-1)return Q}return w.activeOptionIndex},calculateIndex:_,compare:A,isSelected:N,isActive:V,nullable:d,__demoMode:u}),[x,s,l,p,d,u,w,v]);Je(()=>{},[v,void 0]),Je(()=>{w.dataRef.current=M},[M]),Hf([M.buttonRef,M.inputRef,M.optionsRef],()=>Y.closeCombobox(),M.comboboxState===0);let I=g.useMemo(()=>{var Q,ie,ae;return{open:M.comboboxState===0,disabled:l,activeIndex:M.activeOptionIndex,activeOption:M.activeOptionIndex===null?null:M.virtual?M.virtual.options[(Q=M.activeOptionIndex)!=null?Q:0]:(ae=(ie=M.options[M.activeOptionIndex])==null?void 0:ie.dataRef.current.value)!=null?ae:null,value:x}},[M,l,x]),U=re(()=>{if(M.activeOptionIndex!==null){if(M.virtual)B(M.virtual.options[M.activeOptionIndex]);else{let{dataRef:Q}=M.options[M.activeOptionIndex];B(Q.current.value)}Y.goToOption(nt.Specific,M.activeOptionIndex)}}),F=re(()=>{S({type:0}),j.current=!0}),W=re(()=>{S({type:1}),j.current=!1}),H=re((Q,ie,ae)=>(j.current=!1,Q===nt.Specific?S({type:2,focus:nt.Specific,idx:ie,trigger:ae}):S({type:2,focus:Q,trigger:ae}))),R=re((Q,ie)=>(S({type:3,payload:{id:Q,dataRef:ie}}),()=>{M.isActive(ie.current.value)&&(j.current=!0),S({type:4,id:Q})})),$=re(Q=>(S({type:5,id:Q}),()=>S({type:5,id:null}))),B=re(Q=>He(M.mode,{0(){return y==null?void 0:y(Q)},1(){let ie=M.value.slice(),ae=ie.findIndex(me=>A(me,Q));return ae===-1?ie.push(Q):ie.splice(ae,1),y==null?void 0:y(ie)}})),Z=re(Q=>{S({type:6,trigger:Q})}),Y=g.useMemo(()=>({onChange:B,registerOption:R,registerLabel:$,goToOption:H,closeCombobox:W,openCombobox:F,setActivationTrigger:Z,selectActiveOption:U}),[]),ee=t===null?{}:{ref:t},X=g.useRef(null),G=xs();return g.useEffect(()=>{X.current&&s!==void 0&&G.addEventListener(X.current,"reset",()=>{y==null||y(s)})},[X,y]),g.createElement(zf.Provider,{value:Y},g.createElement(Uf.Provider,{value:M},g.createElement(ol,{value:He(M.comboboxState,{0:mt.Open,1:mt.Closed})},i!=null&&x!=null&&pu({[i]:x}).map(([Q,ie],ae)=>g.createElement(Ss,{features:ws.Hidden,ref:ae===0?me=>{var ve;X.current=(ve=me==null?void 0:me.closest("form"))!=null?ve:null}:void 0,...yi({key:Q,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Q,value:ie})})),Ge({ourProps:ee,theirProps:m,slot:I,defaultTag:HT,name:"Combobox"}))))}let FT="input";function BT(e,t){var n,s,r,o,i;let a=Tt(),{id:l=`headlessui-combobox-input-${a}`,onChange:u,displayValue:d,type:p="text",...f}=e,h=Uo("Combobox.Input"),m=il("Combobox.Input"),b=et(h.inputRef,t),v=Bo(h.inputRef),x=g.useRef(!1),y=xs(),w=re(()=>{m.onChange(null),h.optionsRef.current&&(h.optionsRef.current.scrollTop=0),m.goToOption(nt.Nothing)}),S=function(){var M;return typeof d=="function"&&h.value!==void 0?(M=d(h.value))!=null?M:"":typeof h.value=="string"?h.value:""}();qh(([M,I],[U,F])=>{if(x.current)return;let W=h.inputRef.current;W&&((F===0&&I===1||M!==U)&&(W.value=M),requestAnimationFrame(()=>{if(x.current||!W||(v==null?void 0:v.activeElement)!==W)return;let{selectionStart:H,selectionEnd:R}=W;Math.abs((R??0)-(H??0))===0&&H===0&&W.setSelectionRange(W.value.length,W.value.length)}))},[S,h.comboboxState,v]),qh(([M],[I])=>{if(M===0&&I===1){if(x.current)return;let U=h.inputRef.current;if(!U)return;let F=U.value,{selectionStart:W,selectionEnd:H,selectionDirection:R}=U;U.value="",U.value=F,R!==null?U.setSelectionRange(W,H,R):U.setSelectionRange(W,H)}},[h.comboboxState]);let j=g.useRef(!1),C=re(()=>{j.current=!0}),E=re(()=>{y.nextFrame(()=>{j.current=!1})}),O=re(M=>{switch(x.current=!0,M.key){case xe.Enter:if(x.current=!1,h.comboboxState!==0||j.current)return;if(M.preventDefault(),M.stopPropagation(),h.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),h.mode===0&&m.closeCombobox();break;case xe.ArrowDown:return x.current=!1,M.preventDefault(),M.stopPropagation(),He(h.comboboxState,{0:()=>m.goToOption(nt.Next),1:()=>m.openCombobox()});case xe.ArrowUp:return x.current=!1,M.preventDefault(),M.stopPropagation(),He(h.comboboxState,{0:()=>m.goToOption(nt.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{h.value||m.goToOption(nt.Last)})}});case xe.Home:if(M.shiftKey)break;return x.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(nt.First);case xe.PageUp:return x.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(nt.First);case xe.End:if(M.shiftKey)break;return x.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(nt.Last);case xe.PageDown:return x.current=!1,M.preventDefault(),M.stopPropagation(),m.goToOption(nt.Last);case xe.Escape:return x.current=!1,h.comboboxState!==0?void 0:(M.preventDefault(),h.optionsRef.current&&!h.optionsPropsRef.current.static&&M.stopPropagation(),h.nullable&&h.mode===0&&h.value===null&&w(),m.closeCombobox());case xe.Tab:if(x.current=!1,h.comboboxState!==0)return;h.mode===0&&h.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),P=re(M=>{u==null||u(M),h.nullable&&h.mode===0&&M.target.value===""&&w(),m.openCombobox()}),T=re(M=>{var I,U,F;let W=(I=M.relatedTarget)!=null?I:vo.find(H=>H!==M.currentTarget);if(x.current=!1,!((U=h.optionsRef.current)!=null&&U.contains(W))&&!((F=h.buttonRef.current)!=null&&F.contains(W))&&h.comboboxState===0)return M.preventDefault(),h.mode===0&&(h.nullable&&h.value===null?w():h.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=re(M=>{var I,U,F;let W=(I=M.relatedTarget)!=null?I:vo.find(H=>H!==M.currentTarget);(U=h.buttonRef.current)!=null&&U.contains(W)||(F=h.optionsRef.current)!=null&&F.contains(W)||h.disabled||h.immediate&&h.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),_=rl(()=>{if(h.labelId)return[h.labelId].join(" ")},[h.labelId]),N=g.useMemo(()=>({open:h.comboboxState===0,disabled:h.disabled}),[h]),V={ref:b,id:l,role:"combobox",type:p,"aria-controls":(n=h.optionsRef.current)==null?void 0:n.id,"aria-expanded":h.comboboxState===0,"aria-activedescendant":h.activeOptionIndex===null?void 0:h.virtual?(s=h.options.find(M=>{var I;return!((I=h.virtual)!=null&&I.disabled(M.dataRef.current.value))&&h.compare(M.dataRef.current.value,h.virtual.options[h.activeOptionIndex])}))==null?void 0:s.id:(r=h.options[h.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":_,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:h.defaultValue!==void 0?d==null?void 0:d(h.defaultValue):null)!=null?i:h.defaultValue,disabled:h.disabled,onCompositionStart:C,onCompositionEnd:E,onKeyDown:O,onChange:P,onFocus:A,onBlur:T};return Ge({ourProps:V,theirProps:f,slot:N,defaultTag:FT,name:"Combobox.Input"})}let zT="button";function UT(e,t){var n;let s=Uo("Combobox.Button"),r=il("Combobox.Button"),o=et(s.buttonRef,t),i=Tt(),{id:a=`headlessui-combobox-button-${i}`,...l}=e,u=xs(),d=re(b=>{switch(b.key){case xe.ArrowDown:return b.preventDefault(),b.stopPropagation(),s.comboboxState===1&&r.openCombobox(),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case xe.ArrowUp:return b.preventDefault(),b.stopPropagation(),s.comboboxState===1&&(r.openCombobox(),u.nextFrame(()=>{s.value||r.goToOption(nt.Last)})),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case xe.Escape:return s.comboboxState!==0?void 0:(b.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&b.stopPropagation(),r.closeCombobox(),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})}));default:return}}),p=re(b=>{if(qr(b.currentTarget))return b.preventDefault();s.comboboxState===0?r.closeCombobox():(b.preventDefault(),r.openCombobox()),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})})}),f=rl(()=>{if(s.labelId)return[s.labelId,a].join(" ")},[s.labelId,a]),h=g.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled,value:s.value}),[s]),m={ref:o,id:a,type:Ni(e,s.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-labelledby":f,disabled:s.disabled,onClick:p,onKeyDown:d};return Ge({ourProps:m,theirProps:l,slot:h,defaultTag:zT,name:"Combobox.Button"})}let WT="label";function GT(e,t){let n=Tt(),{id:s=`headlessui-combobox-label-${n}`,...r}=e,o=Uo("Combobox.Label"),i=il("Combobox.Label"),a=et(o.labelRef,t);Je(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=g.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return Ge({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:WT,name:"Combobox.Label"})}let qT="ul",KT=Cn.RenderStrategy|Cn.Static;function ZT(e,t){let n=Tt(),{id:s=`headlessui-combobox-options-${n}`,hold:r=!1,...o}=e,i=Uo("Combobox.Options"),a=et(i.optionsRef,t),l=zo(),u=l!==null?(l&mt.Open)===mt.Open:i.comboboxState===0;Je(()=>{var h;i.optionsPropsRef.current.static=(h=e.static)!=null?h:!1},[i.optionsPropsRef,e.static]),Je(()=>{i.optionsPropsRef.current.hold=r},[i.optionsPropsRef,r]),a0({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(h){return h.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:h.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(h){h.setAttribute("role","none")}});let d=rl(()=>{var h,m;return(m=i.labelId)!=null?m:(h=i.buttonRef.current)==null?void 0:h.id},[i.labelId,i.buttonRef.current]),p=g.useMemo(()=>({open:i.comboboxState===0,option:void 0}),[i]),f={"aria-labelledby":d,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:s,ref:a};return i.virtual&&i.comboboxState===0&&Object.assign(o,{children:g.createElement(IT,null,o.children)}),Ge({ourProps:f,theirProps:o,slot:p,defaultTag:qT,features:KT,visible:u,name:"Combobox.Options"})}let YT="li";function XT(e,t){var n;let s=Tt(),{id:r=`headlessui-combobox-option-${s}`,disabled:o=!1,value:i,order:a=null,...l}=e,u=Uo("Combobox.Option"),d=il("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(i):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===r,f=u.isSelected(i),h=g.useRef(null),m=Ht({disabled:o,value:i,domRef:h,order:a}),b=g.useContext(p0),v=et(t,h,b?b.measureElement:null),x=re(()=>d.onChange(i));Je(()=>d.registerOption(r,m),[m,r]);let y=g.useRef(!(u.virtual||u.__demoMode));Je(()=>{if(!u.virtual||!u.__demoMode)return;let T=Ks();return T.requestAnimationFrame(()=>{y.current=!0}),T.dispose},[u.virtual,u.__demoMode]),Je(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let T=Ks();return T.requestAnimationFrame(()=>{var A,_;(_=(A=h.current)==null?void 0:A.scrollIntoView)==null||_.call(A,{block:"nearest"})}),T.dispose},[h,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let w=re(T=>{var A;if(o||(A=u.virtual)!=null&&A.disabled(i))return T.preventDefault();x(),s0()||requestAnimationFrame(()=>{var _;return(_=u.inputRef.current)==null?void 0:_.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),S=re(()=>{var T;if(o||(T=u.virtual)!=null&&T.disabled(i))return d.goToOption(nt.Nothing);let A=u.calculateIndex(i);d.goToOption(nt.Specific,A)}),j=i0(),C=re(T=>j.update(T)),E=re(T=>{var A;if(!j.wasMoved(T)||o||(A=u.virtual)!=null&&A.disabled(i)||p)return;let _=u.calculateIndex(i);d.goToOption(nt.Specific,_,0)}),O=re(T=>{var A;j.wasMoved(T)&&(o||(A=u.virtual)!=null&&A.disabled(i)||p&&(u.optionsPropsRef.current.hold||d.goToOption(nt.Nothing)))}),P=g.useMemo(()=>({active:p,selected:f,disabled:o}),[p,f,o]);return Ge({ourProps:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:w,onFocus:S,onPointerEnter:C,onMouseEnter:C,onPointerMove:E,onMouseMove:E,onPointerLeave:O,onMouseLeave:O},theirProps:l,slot:P,defaultTag:YT,name:"Combobox.Option"})}let JT=qe(DT),QT=qe(UT),e5=qe(BT),t5=qe(GT),n5=qe(ZT),s5=qe(XT),Qo=Object.assign(JT,{Input:e5,Button:QT,Label:t5,Options:n5,Option:s5});function r5(e,t,n,s){let r=Ht(n);g.useEffect(()=>{e=e??window;function o(i){r.current(i)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function fu(){let e=g.useRef(!1);return Je(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function o5(e){let t=re(e),n=g.useRef(!1);g.useEffect(()=>(n.current=!1,()=>{n.current=!0,If(()=>{n.current&&t()})}),[t])}var pr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(pr||{});function f0(){let e=g.useRef(0);return r0("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let i5=g.createContext(!1);function a5(){return g.useContext(i5)}function l5(e){let t=a5(),n=g.useContext(g0),s=Bo(e),[r,o]=g.useState(()=>{if(!t&&n!==null||hr.isServer)return null;let i=s==null?void 0:s.getElementById("headlessui-portal-root");if(i)return i;if(s===null)return null;let a=s.createElement("div");return a.setAttribute("id","headlessui-portal-root"),s.body.appendChild(a)});return g.useEffect(()=>{r!==null&&(s!=null&&s.body.contains(r)||s==null||s.body.appendChild(r))},[r,s]),g.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let c5=g.Fragment;function u5(e,t){let n=e,s=g.useRef(null),r=et(Df(d=>{s.current=d}),t),o=Bo(s),i=l5(s),[a]=g.useState(()=>{var d;return hr.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=g.useContext(Lp),u=cu();return Je(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),Je(()=>{if(a&&l)return l.register(a)},[l,a]),o5(()=>{var d;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((d=i.parentElement)==null||d.removeChild(i)))}),u?!i||!a?null:kn.createPortal(Ge({ourProps:{ref:r},theirProps:n,defaultTag:c5,name:"Portal"}),a):null}let d5=g.Fragment,g0=g.createContext(null);function p5(e,t){let{target:n,...s}=e,r={ref:et(t)};return g.createElement(g0.Provider,{value:n},Ge({ourProps:r,theirProps:s,defaultTag:d5,name:"Popover.Group"}))}let Lp=g.createContext(null);function f5(){let e=g.useContext(Lp),t=g.useRef([]),n=re(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=re(o=>{let i=t.current.indexOf(o);i!==-1&&t.current.splice(i,1),e&&e.unregister(o)}),r=g.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,g.useMemo(()=>function({children:o}){return g.createElement(Lp.Provider,{value:r},o)},[r])]}let g5=qe(u5),h5=qe(p5);Object.assign(g5,{Group:h5});function m5({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var s;let r=g.useRef((s=n==null?void 0:n.current)!=null?s:null),o=Bo(r),i=re(()=>{var a,l,u;let d=[];for(let p of e)p!==null&&(p instanceof HTMLElement?d.push(p):"current"in p&&p.current instanceof HTMLElement&&d.push(p.current));if(t!=null&&t.current)for(let p of t.current)d.push(p);for(let p of(a=o==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?a:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(r.current)||p.contains((u=(l=r.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(f=>p.contains(f))||d.push(p));return d});return{resolveContainers:i,contains:re(a=>i().some(l=>l.contains(a))),mainTreeNodeRef:r,MainTreeNode:g.useMemo(()=>function(){return n!=null?null:g.createElement(Ss,{features:ws.Hidden,ref:r})},[r,n])}}function b5(){let e=g.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:g.useMemo(()=>function(){return g.createElement(Ss,{features:ws.Hidden,ref:e})},[e])}}let h0=g.createContext(null);function m0(){let e=g.useContext(h0);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,m0),t}return e}function Wf(){let[e,t]=g.useState([]);return[e.length>0?e.join(" "):void 0,g.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=g.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return g.createElement(h0.Provider,{value:r},n.children)},[t])]}let v5="p";function y5(e,t){let n=Tt(),{id:s=`headlessui-description-${n}`,...r}=e,o=m0(),i=et(t);Je(()=>o.register(s),[s,o.register]);let a={ref:i,...o.props,id:s};return Ge({ourProps:a,theirProps:r,slot:o.slot||{},defaultTag:v5,name:o.name||"Description"})}let x5=qe(y5),b0=Object.assign(x5,{});var Kh;let w5=(Kh=g.startTransition)!=null?Kh:function(e){e()};var S5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(S5||{}),C5=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel",e))(C5||{});let j5={0:e=>({...e,disclosureState:He(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Gf=g.createContext(null);Gf.displayName="DisclosureContext";function qf(e){let t=g.useContext(Gf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,qf),n}return t}let Kf=g.createContext(null);Kf.displayName="DisclosureAPIContext";function v0(e){let t=g.useContext(Kf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,v0),n}return t}let Zf=g.createContext(null);Zf.displayName="DisclosurePanelContext";function E5(){return g.useContext(Zf)}function P5(e,t){return He(t.type,j5,e,t)}let T5=g.Fragment;function O5(e,t){let{defaultOpen:n=!1,...s}=e,r=g.useRef(null),o=et(t,Df(v=>{r.current=v},e.as===void 0||e.as===g.Fragment)),i=g.useRef(null),a=g.useRef(null),l=g.useReducer(P5,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:a,panelRef:i,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=l,f=re(v=>{p({type:1});let x=so(r);if(!x||!d)return;let y=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:x.getElementById(d):x.getElementById(d);y==null||y.focus()}),h=g.useMemo(()=>({close:f}),[f]),m=g.useMemo(()=>({open:u===0,close:f}),[u,f]),b={ref:o};return g.createElement(Gf.Provider,{value:l},g.createElement(Kf.Provider,{value:h},g.createElement(ol,{value:He(u,{0:mt.Open,1:mt.Closed})},Ge({ourProps:b,theirProps:s,slot:m,defaultTag:T5,name:"Disclosure"}))))}let _5="button";function A5(e,t){let n=Tt(),{id:s=`headlessui-disclosure-button-${n}`,...r}=e,[o,i]=qf("Disclosure.Button"),a=E5(),l=a===null?!1:a===o.panelId,u=g.useRef(null),d=et(u,t,l?null:o.buttonRef),p=Ff();g.useEffect(()=>{if(!l)return i({type:2,buttonId:s}),()=>{i({type:2,buttonId:null})}},[s,i,l]);let f=re(y=>{var w;if(l){if(o.disclosureState===1)return;switch(y.key){case xe.Space:case xe.Enter:y.preventDefault(),y.stopPropagation(),i({type:0}),(w=o.buttonRef.current)==null||w.focus();break}}else switch(y.key){case xe.Space:case xe.Enter:y.preventDefault(),y.stopPropagation(),i({type:0});break}}),h=re(y=>{switch(y.key){case xe.Space:y.preventDefault();break}}),m=re(y=>{var w;qr(y.currentTarget)||e.disabled||(l?(i({type:0}),(w=o.buttonRef.current)==null||w.focus()):i({type:0}))}),b=g.useMemo(()=>({open:o.disclosureState===0}),[o]),v=Ni(e,u),x=l?{ref:d,type:v,onKeyDown:f,onClick:m}:{ref:d,id:s,type:v,"aria-expanded":o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:f,onKeyUp:h,onClick:m};return Ge({mergeRefs:p,ourProps:x,theirProps:r,slot:b,defaultTag:_5,name:"Disclosure.Button"})}let M5="div",L5=Cn.RenderStrategy|Cn.Static;function N5(e,t){let n=Tt(),{id:s=`headlessui-disclosure-panel-${n}`,...r}=e,[o,i]=qf("Disclosure.Panel"),{close:a}=v0("Disclosure.Panel"),l=Ff(),u=et(t,o.panelRef,m=>{w5(()=>i({type:m?4:5}))});g.useEffect(()=>(i({type:3,panelId:s}),()=>{i({type:3,panelId:null})}),[s,i]);let d=zo(),p=d!==null?(d&mt.Open)===mt.Open:o.disclosureState===0,f=g.useMemo(()=>({open:o.disclosureState===0,close:a}),[o,a]),h={ref:u,id:s};return g.createElement(Zf.Provider,{value:o.panelId},Ge({mergeRefs:l,ourProps:h,theirProps:r,slot:f,defaultTag:M5,features:L5,visible:p,name:"Disclosure.Panel"}))}let $5=qe(O5),k5=qe(A5),R5=qe(N5),hd=Object.assign($5,{Button:k5,Panel:R5}),Zh=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Yh(e){var t,n;let s=(t=e.innerText)!=null?t:"",r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return s;let o=!1;for(let a of r.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let i=o?(n=r.innerText)!=null?n:"":s;return Zh.test(i)&&(i=i.replace(Zh,"")),i}function I5(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let s=n.split(" ").map(r=>{let o=document.getElementById(r);if(o){let i=o.getAttribute("aria-label");return typeof i=="string"?i.trim():Yh(o).trim()}return null}).filter(Boolean);if(s.length>0)return s.join(", ")}return Yh(e).trim()}function V5(e){let t=g.useRef(""),n=g.useRef("");return re(()=>{let s=e.current;if(!s)return"";let r=s.innerText;if(t.current===r)return n.current;let o=I5(s).trim().toLowerCase();return t.current=r,n.current=o,o})}var H5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(H5||{}),D5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(D5||{}),F5=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(F5||{}),B5=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(B5||{});function md(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=dr(t(e.options.slice()),o=>o.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let z5={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,s=e.options.findIndex(r=>n(r.dataRef.current.value));return s!==-1&&(t=s),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s=md(e),r=Mp(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...s,searchQuery:"",activeOptionIndex:r,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var a;return!i.dataRef.current.disabled&&((a=i.dataRef.current.textValue)==null?void 0:a.startsWith(s))}),o=r?e.options.indexOf(r):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},s=md(e,r=>[...r,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(n)),{...e,...s}},6:(e,t)=>{let n=md(e,s=>{let r=s.findIndex(o=>o.id===t.id);return r!==-1&&s.splice(r,1),s});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},Yf=g.createContext(null);Yf.displayName="ListboxActionsContext";function al(e){let t=g.useContext(Yf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,al),n}return t}let Xf=g.createContext(null);Xf.displayName="ListboxDataContext";function ll(e){let t=g.useContext(Xf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ll),n}return t}function U5(e,t){return He(t.type,z5,e,t)}let W5=g.Fragment;function G5(e,t){let{value:n,defaultValue:s,form:r,name:o,onChange:i,by:a=(Z,Y)=>Z===Y,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const f=u?"horizontal":"vertical";let h=et(t),[m=d?[]:void 0,b]=lu(n,i,s),[v,x]=g.useReducer(U5,{dataRef:g.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=g.useRef({static:!1,hold:!1}),w=g.useRef(null),S=g.useRef(null),j=g.useRef(null),C=re(typeof a=="string"?(Z,Y)=>{let ee=a;return(Z==null?void 0:Z[ee])===(Y==null?void 0:Y[ee])}:a),E=g.useCallback(Z=>He(O.mode,{1:()=>m.some(Y=>C(Y,Z)),0:()=>C(m,Z)}),[m]),O=g.useMemo(()=>({...v,value:m,disabled:l,mode:d?1:0,orientation:f,compare:C,isSelected:E,optionsPropsRef:y,labelRef:w,buttonRef:S,optionsRef:j}),[m,l,d,v]);Je(()=>{v.dataRef.current=O},[O]),Hf([O.buttonRef,O.optionsRef],(Z,Y)=>{var ee;x({type:1}),Vf(Y,du.Loose)||(Z.preventDefault(),(ee=O.buttonRef.current)==null||ee.focus())},O.listboxState===0);let P=g.useMemo(()=>({open:O.listboxState===0,disabled:l,value:m}),[O,l,m]),T=re(Z=>{let Y=O.options.find(ee=>ee.id===Z);Y&&U(Y.dataRef.current.value)}),A=re(()=>{if(O.activeOptionIndex!==null){let{dataRef:Z,id:Y}=O.options[O.activeOptionIndex];U(Z.current.value),x({type:2,focus:nt.Specific,id:Y})}}),_=re(()=>x({type:0})),N=re(()=>x({type:1})),V=re((Z,Y,ee)=>Z===nt.Specific?x({type:2,focus:nt.Specific,id:Y,trigger:ee}):x({type:2,focus:Z,trigger:ee})),M=re((Z,Y)=>(x({type:5,id:Z,dataRef:Y}),()=>x({type:6,id:Z}))),I=re(Z=>(x({type:7,id:Z}),()=>x({type:7,id:null}))),U=re(Z=>He(O.mode,{0(){return b==null?void 0:b(Z)},1(){let Y=O.value.slice(),ee=Y.findIndex(X=>C(X,Z));return ee===-1?Y.push(Z):Y.splice(ee,1),b==null?void 0:b(Y)}})),F=re(Z=>x({type:3,value:Z})),W=re(()=>x({type:4})),H=g.useMemo(()=>({onChange:U,registerOption:M,registerLabel:I,goToOption:V,closeListbox:N,openListbox:_,selectActiveOption:A,selectOption:T,search:F,clearSearch:W}),[]),R={ref:h},$=g.useRef(null),B=xs();return g.useEffect(()=>{$.current&&s!==void 0&&B.addEventListener($.current,"reset",()=>{b==null||b(s)})},[$,b]),g.createElement(Yf.Provider,{value:H},g.createElement(Xf.Provider,{value:O},g.createElement(ol,{value:He(O.listboxState,{0:mt.Open,1:mt.Closed})},o!=null&&m!=null&&pu({[o]:m}).map(([Z,Y],ee)=>g.createElement(Ss,{features:ws.Hidden,ref:ee===0?X=>{var G;$.current=(G=X==null?void 0:X.closest("form"))!=null?G:null}:void 0,...yi({key:Z,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:l,name:Z,value:Y})})),Ge({ourProps:R,theirProps:p,slot:P,defaultTag:W5,name:"Listbox"}))))}let q5="button";function K5(e,t){var n;let s=Tt(),{id:r=`headlessui-listbox-button-${s}`,...o}=e,i=ll("Listbox.Button"),a=al("Listbox.Button"),l=et(i.buttonRef,t),u=xs(),d=re(v=>{switch(v.key){case xe.Space:case xe.Enter:case xe.ArrowDown:v.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(nt.First)});break;case xe.ArrowUp:v.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(nt.Last)});break}}),p=re(v=>{switch(v.key){case xe.Space:v.preventDefault();break}}),f=re(v=>{if(qr(v.currentTarget))return v.preventDefault();i.listboxState===0?(a.closeListbox(),u.nextFrame(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})})):(v.preventDefault(),a.openListbox())}),h=rl(()=>{if(i.labelId)return[i.labelId,r].join(" ")},[i.labelId,r]),m=g.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),b={ref:l,id:r,type:Ni(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":h,disabled:i.disabled,onKeyDown:d,onKeyUp:p,onClick:f};return Ge({ourProps:b,theirProps:o,slot:m,defaultTag:q5,name:"Listbox.Button"})}let Z5="label";function Y5(e,t){let n=Tt(),{id:s=`headlessui-listbox-label-${n}`,...r}=e,o=ll("Listbox.Label"),i=al("Listbox.Label"),a=et(o.labelRef,t);Je(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=g.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return Ge({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:Z5,name:"Listbox.Label"})}let X5="ul",J5=Cn.RenderStrategy|Cn.Static;function Q5(e,t){var n;let s=Tt(),{id:r=`headlessui-listbox-options-${s}`,...o}=e,i=ll("Listbox.Options"),a=al("Listbox.Options"),l=et(i.optionsRef,t),u=xs(),d=xs(),p=zo(),f=p!==null?(p&mt.Open)===mt.Open:i.listboxState===0;g.useEffect(()=>{var x;let y=i.optionsRef.current;y&&i.listboxState===0&&y!==((x=so(y))==null?void 0:x.activeElement)&&y.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let h=re(x=>{switch(d.dispose(),x.key){case xe.Space:if(i.searchQuery!=="")return x.preventDefault(),x.stopPropagation(),a.search(x.key);case xe.Enter:if(x.preventDefault(),x.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:y}=i.options[i.activeOptionIndex];a.onChange(y.current.value)}i.mode===0&&(a.closeListbox(),Ks().nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case He(i.orientation,{vertical:xe.ArrowDown,horizontal:xe.ArrowRight}):return x.preventDefault(),x.stopPropagation(),a.goToOption(nt.Next);case He(i.orientation,{vertical:xe.ArrowUp,horizontal:xe.ArrowLeft}):return x.preventDefault(),x.stopPropagation(),a.goToOption(nt.Previous);case xe.Home:case xe.PageUp:return x.preventDefault(),x.stopPropagation(),a.goToOption(nt.First);case xe.End:case xe.PageDown:return x.preventDefault(),x.stopPropagation(),a.goToOption(nt.Last);case xe.Escape:return x.preventDefault(),x.stopPropagation(),a.closeListbox(),u.nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case xe.Tab:x.preventDefault(),x.stopPropagation();break;default:x.key.length===1&&(a.search(x.key),d.setTimeout(()=>a.clearSearch(),350));break}}),m=rl(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.id},[i.buttonRef.current]),b=g.useMemo(()=>({open:i.listboxState===0}),[i]),v={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":i.orientation,id:r,onKeyDown:h,role:"listbox",tabIndex:0,ref:l};return Ge({ourProps:v,theirProps:o,slot:b,defaultTag:X5,features:J5,visible:f,name:"Listbox.Options"})}let eO="li";function tO(e,t){let n=Tt(),{id:s=`headlessui-listbox-option-${n}`,disabled:r=!1,value:o,...i}=e,a=ll("Listbox.Option"),l=al("Listbox.Option"),u=a.activeOptionIndex!==null?a.options[a.activeOptionIndex].id===s:!1,d=a.isSelected(o),p=g.useRef(null),f=V5(p),h=Ht({disabled:r,value:o,domRef:p,get textValue(){return f()}}),m=et(t,p);Je(()=>{if(a.listboxState!==0||!u||a.activationTrigger===0)return;let C=Ks();return C.requestAnimationFrame(()=>{var E,O;(O=(E=p.current)==null?void 0:E.scrollIntoView)==null||O.call(E,{block:"nearest"})}),C.dispose},[p,u,a.listboxState,a.activationTrigger,a.activeOptionIndex]),Je(()=>l.registerOption(s,h),[h,s]);let b=re(C=>{if(r)return C.preventDefault();l.onChange(o),a.mode===0&&(l.closeListbox(),Ks().nextFrame(()=>{var E;return(E=a.buttonRef.current)==null?void 0:E.focus({preventScroll:!0})}))}),v=re(()=>{if(r)return l.goToOption(nt.Nothing);l.goToOption(nt.Specific,s)}),x=i0(),y=re(C=>x.update(C)),w=re(C=>{x.wasMoved(C)&&(r||u||l.goToOption(nt.Specific,s,0))}),S=re(C=>{x.wasMoved(C)&&(r||u&&l.goToOption(nt.Nothing))}),j=g.useMemo(()=>({active:u,selected:d,disabled:r}),[u,d,r]);return Ge({ourProps:{id:s,ref:m,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:b,onFocus:v,onPointerEnter:y,onMouseEnter:y,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:j,defaultTag:eO,name:"Listbox.Option"})}let nO=qe(G5),sO=qe(K5),rO=qe(Y5),oO=qe(Q5),iO=qe(tO),Gi=Object.assign(nO,{Button:sO,Label:rO,Options:oO,Option:iO});var aO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(aO||{}),lO=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(lO||{});let cO={0:e=>{let t={...e,popoverState:He(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState:1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Jf=g.createContext(null);Jf.displayName="PopoverContext";function gu(e){let t=g.useContext(Jf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,gu),n}return t}let Qf=g.createContext(null);Qf.displayName="PopoverAPIContext";function eg(e){let t=g.useContext(Qf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,eg),n}return t}let tg=g.createContext(null);tg.displayName="PopoverGroupContext";function y0(){return g.useContext(tg)}let hu=g.createContext(null);hu.displayName="PopoverPanelContext";function uO(){return g.useContext(hu)}function dO(e,t){return He(t.type,cO,e,t)}let pO="div";function fO(e,t){var n;let{__demoMode:s=!1,...r}=e,o=g.useRef(null),i=et(t,Df(I=>{o.current=I})),a=g.useRef([]),l=g.useReducer(dO,{__demoMode:s,popoverState:s?0:1,buttons:a,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:g.createRef(),afterPanelSentinel:g.createRef()}),[{popoverState:u,button:d,buttonId:p,panel:f,panelId:h,beforePanelSentinel:m,afterPanelSentinel:b},v]=l,x=Bo((n=o.current)!=null?n:d),y=g.useMemo(()=>{if(!d||!f)return!1;for(let $ of document.querySelectorAll("body > *"))if(Number($==null?void 0:$.contains(d))^Number($==null?void 0:$.contains(f)))return!0;let I=uu(),U=I.indexOf(d),F=(U+I.length-1)%I.length,W=(U+1)%I.length,H=I[F],R=I[W];return!f.contains(H)&&!f.contains(R)},[d,f]),w=Ht(p),S=Ht(h),j=g.useMemo(()=>({buttonId:w,panelId:S,close:()=>v({type:1})}),[w,S,v]),C=y0(),E=C==null?void 0:C.registerPopover,O=re(()=>{var I;return(I=C==null?void 0:C.isFocusWithinPopoverGroup())!=null?I:(x==null?void 0:x.activeElement)&&((d==null?void 0:d.contains(x.activeElement))||(f==null?void 0:f.contains(x.activeElement)))});g.useEffect(()=>E==null?void 0:E(j),[E,j]);let[P,T]=f5(),A=m5({mainTreeNodeRef:C==null?void 0:C.mainTreeNodeRef,portals:P,defaultContainers:[d,f]});r5(x==null?void 0:x.defaultView,"focus",I=>{var U,F,W,H;I.target!==window&&I.target instanceof HTMLElement&&u===0&&(O()||d&&f&&(A.contains(I.target)||(F=(U=m.current)==null?void 0:U.contains)!=null&&F.call(U,I.target)||(H=(W=b.current)==null?void 0:W.contains)!=null&&H.call(W,I.target)||v({type:1})))},!0),Hf(A.resolveContainers,(I,U)=>{v({type:1}),Vf(U,du.Loose)||(I.preventDefault(),d==null||d.focus())},u===0);let _=re(I=>{v({type:1});let U=I?I instanceof HTMLElement?I:"current"in I&&I.current instanceof HTMLElement?I.current:d:d;U==null||U.focus()}),N=g.useMemo(()=>({close:_,isPortalled:y}),[_,y]),V=g.useMemo(()=>({open:u===0,close:_}),[u,_]),M={ref:i};return g.createElement(hu.Provider,{value:null},g.createElement(Jf.Provider,{value:l},g.createElement(Qf.Provider,{value:N},g.createElement(ol,{value:He(u,{0:mt.Open,1:mt.Closed})},g.createElement(T,null,Ge({ourProps:M,theirProps:r,slot:V,defaultTag:pO,name:"Popover"}),g.createElement(A.MainTreeNode,null))))))}let gO="button";function hO(e,t){let n=Tt(),{id:s=`headlessui-popover-button-${n}`,...r}=e,[o,i]=gu("Popover.Button"),{isPortalled:a}=eg("Popover.Button"),l=g.useRef(null),u=`headlessui-focus-sentinel-${Tt()}`,d=y0(),p=d==null?void 0:d.closeOthers,f=uO()!==null;g.useEffect(()=>{if(!f)return i({type:3,buttonId:s}),()=>{i({type:3,buttonId:null})}},[f,s,i]);let[h]=g.useState(()=>Symbol()),m=et(l,t,f?null:A=>{if(A)o.buttons.current.push(h);else{let _=o.buttons.current.indexOf(h);_!==-1&&o.buttons.current.splice(_,1)}o.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&i({type:2,button:A})}),b=et(l,t),v=Bo(l),x=re(A=>{var _,N,V;if(f){if(o.popoverState===1)return;switch(A.key){case xe.Space:case xe.Enter:A.preventDefault(),(N=(_=A.target).click)==null||N.call(_),i({type:1}),(V=o.button)==null||V.focus();break}}else switch(A.key){case xe.Space:case xe.Enter:A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),i({type:0});break;case xe.Escape:if(o.popoverState!==0)return p==null?void 0:p(o.buttonId);if(!l.current||v!=null&&v.activeElement&&!l.current.contains(v.activeElement))return;A.preventDefault(),A.stopPropagation(),i({type:1});break}}),y=re(A=>{f||A.key===xe.Space&&A.preventDefault()}),w=re(A=>{var _,N;qr(A.currentTarget)||e.disabled||(f?(i({type:1}),(_=o.button)==null||_.focus()):(A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),i({type:0}),(N=o.button)==null||N.focus()))}),S=re(A=>{A.preventDefault(),A.stopPropagation()}),j=o.popoverState===0,C=g.useMemo(()=>({open:j}),[j]),E=Ni(e,l),O=f?{ref:b,type:E,onKeyDown:x,onClick:w}:{ref:m,id:o.buttonId,type:E,"aria-expanded":o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:x,onKeyUp:y,onClick:w,onMouseDown:S},P=f0(),T=re(()=>{let A=o.panel;if(!A)return;function _(){He(P.current,{[pr.Forwards]:()=>cn(A,Lt.First),[pr.Backwards]:()=>cn(A,Lt.Last)})===Fs.Error&&cn(uu().filter(N=>N.dataset.headlessuiFocusGuard!=="true"),He(P.current,{[pr.Forwards]:Lt.Next,[pr.Backwards]:Lt.Previous}),{relativeTo:o.button})}_()});return g.createElement(g.Fragment,null,Ge({ourProps:O,theirProps:r,slot:C,defaultTag:gO,name:"Popover.Button"}),j&&!f&&a&&g.createElement(Ss,{id:u,features:ws.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let mO="div",bO=Cn.RenderStrategy|Cn.Static;function vO(e,t){let n=Tt(),{id:s=`headlessui-popover-overlay-${n}`,...r}=e,[{popoverState:o},i]=gu("Popover.Overlay"),a=et(t),l=zo(),u=l!==null?(l&mt.Open)===mt.Open:o===0,d=re(f=>{if(qr(f.currentTarget))return f.preventDefault();i({type:1})}),p=g.useMemo(()=>({open:o===0}),[o]);return Ge({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:d},theirProps:r,slot:p,defaultTag:mO,features:bO,visible:u,name:"Popover.Overlay"})}let yO="div",xO=Cn.RenderStrategy|Cn.Static;function wO(e,t){let n=Tt(),{id:s=`headlessui-popover-panel-${n}`,focus:r=!1,...o}=e,[i,a]=gu("Popover.Panel"),{close:l,isPortalled:u}=eg("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Tt()}`,p=`headlessui-focus-sentinel-after-${Tt()}`,f=g.useRef(null),h=et(f,t,O=>{a({type:4,panel:O})}),m=Bo(f),b=Ff();Je(()=>(a({type:5,panelId:s}),()=>{a({type:5,panelId:null})}),[s,a]);let v=zo(),x=v!==null?(v&mt.Open)===mt.Open:i.popoverState===0,y=re(O=>{var P;switch(O.key){case xe.Escape:if(i.popoverState!==0||!f.current||m!=null&&m.activeElement&&!f.current.contains(m.activeElement))return;O.preventDefault(),O.stopPropagation(),a({type:1}),(P=i.button)==null||P.focus();break}});g.useEffect(()=>{var O;e.static||i.popoverState===1&&((O=e.unmount)==null||O)&&a({type:4,panel:null})},[i.popoverState,e.unmount,e.static,a]),g.useEffect(()=>{if(i.__demoMode||!r||i.popoverState!==0||!f.current)return;let O=m==null?void 0:m.activeElement;f.current.contains(O)||cn(f.current,Lt.First)},[i.__demoMode,r,f,i.popoverState]);let w=g.useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),S={ref:h,id:s,onKeyDown:y,onBlur:r&&i.popoverState===0?O=>{var P,T,A,_,N;let V=O.relatedTarget;V&&f.current&&((P=f.current)!=null&&P.contains(V)||(a({type:1}),((A=(T=i.beforePanelSentinel.current)==null?void 0:T.contains)!=null&&A.call(T,V)||(N=(_=i.afterPanelSentinel.current)==null?void 0:_.contains)!=null&&N.call(_,V))&&V.focus({preventScroll:!0})))}:void 0,tabIndex:-1},j=f0(),C=re(()=>{let O=f.current;if(!O)return;function P(){He(j.current,{[pr.Forwards]:()=>{var T;cn(O,Lt.First)===Fs.Error&&((T=i.afterPanelSentinel.current)==null||T.focus())},[pr.Backwards]:()=>{var T;(T=i.button)==null||T.focus({preventScroll:!0})}})}P()}),E=re(()=>{let O=f.current;if(!O)return;function P(){He(j.current,{[pr.Forwards]:()=>{var T;if(!i.button)return;let A=uu(),_=A.indexOf(i.button),N=A.slice(0,_+1),V=[...A.slice(_+1),...N];for(let M of V.slice())if(M.dataset.headlessuiFocusGuard==="true"||(T=i.panel)!=null&&T.contains(M)){let I=V.indexOf(M);I!==-1&&V.splice(I,1)}cn(V,Lt.First,{sorted:!1})},[pr.Backwards]:()=>{var T;cn(O,Lt.Previous)===Fs.Error&&((T=i.button)==null||T.focus())}})}P()});return g.createElement(hu.Provider,{value:s},x&&u&&g.createElement(Ss,{id:d,ref:i.beforePanelSentinel,features:ws.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:C}),Ge({mergeRefs:b,ourProps:S,theirProps:o,slot:w,defaultTag:yO,features:xO,visible:x,name:"Popover.Panel"}),x&&u&&g.createElement(Ss,{id:p,ref:i.afterPanelSentinel,features:ws.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}))}let SO="div";function CO(e,t){let n=g.useRef(null),s=et(n,t),[r,o]=g.useState([]),i=b5(),a=re(b=>{o(v=>{let x=v.indexOf(b);if(x!==-1){let y=v.slice();return y.splice(x,1),y}return v})}),l=re(b=>(o(v=>[...v,b]),()=>a(b))),u=re(()=>{var b;let v=so(n);if(!v)return!1;let x=v.activeElement;return(b=n.current)!=null&&b.contains(x)?!0:r.some(y=>{var w,S;return((w=v.getElementById(y.buttonId.current))==null?void 0:w.contains(x))||((S=v.getElementById(y.panelId.current))==null?void 0:S.contains(x))})}),d=re(b=>{for(let v of r)v.buttonId.current!==b&&v.close()}),p=g.useMemo(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:i.mainTreeNodeRef}),[l,a,u,d,i.mainTreeNodeRef]),f=g.useMemo(()=>({}),[]),h=e,m={ref:s};return g.createElement(tg.Provider,{value:p},Ge({ourProps:m,theirProps:h,slot:f,defaultTag:SO,name:"Popover.Group"}),g.createElement(i.MainTreeNode,null))}let jO=qe(fO),EO=qe(hO),PO=qe(vO),TO=qe(wO),OO=qe(CO),bd=Object.assign(jO,{Button:EO,Overlay:PO,Panel:TO,Group:OO}),x0=g.createContext(null);function w0(){let e=g.useContext(x0);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,w0),t}return e}function ng(){let[e,t]=g.useState([]);return[e.length>0?e.join(" "):void 0,g.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=g.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return g.createElement(x0.Provider,{value:r},n.children)},[t])]}let _O="label";function AO(e,t){let n=Tt(),{id:s=`headlessui-label-${n}`,passive:r=!1,...o}=e,i=w0(),a=et(t);Je(()=>i.register(s),[s,i.register]);let l={ref:a,...i.props,id:s};return r&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in o&&delete o.onClick),Ge({ourProps:l,theirProps:o,slot:i.slot||{},defaultTag:_O,name:i.name||"Label"})}let MO=qe(AO),S0=Object.assign(MO,{});function C0(e=0){let[t,n]=g.useState(e),s=fu(),r=g.useCallback(l=>{s.current&&n(u=>u|l)},[t,s]),o=g.useCallback(l=>!!(t&l),[t]),i=g.useCallback(l=>{s.current&&n(u=>u&~l)},[n,s]),a=g.useCallback(l=>{s.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:r,hasFlag:o,removeFlag:i,toggleFlag:a}}var LO=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(LO||{});let NO={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:dr(n,s=>s.element.current)}},1(e,t){let n=e.options.slice(),s=e.options.findIndex(r=>r.id===t.id);return s===-1?e:(n.splice(s,1),{...e,options:n})}},sg=g.createContext(null);sg.displayName="RadioGroupDataContext";function j0(e){let t=g.useContext(sg);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,j0),n}return t}let rg=g.createContext(null);rg.displayName="RadioGroupActionsContext";function E0(e){let t=g.useContext(rg);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,E0),n}return t}function $O(e,t){return He(t.type,NO,e,t)}let kO="div";function RO(e,t){let n=Tt(),{id:s=`headlessui-radiogroup-${n}`,value:r,defaultValue:o,form:i,name:a,onChange:l,by:u=(W,H)=>W===H,disabled:d=!1,...p}=e,f=re(typeof u=="string"?(W,H)=>{let R=u;return(W==null?void 0:W[R])===(H==null?void 0:H[R])}:u),[h,m]=g.useReducer($O,{options:[]}),b=h.options,[v,x]=ng(),[y,w]=Wf(),S=g.useRef(null),j=et(S,t),[C,E]=lu(r,l,o),O=g.useMemo(()=>b.find(W=>!W.propsRef.current.disabled),[b]),P=g.useMemo(()=>b.some(W=>f(W.propsRef.current.value,C)),[b,C]),T=re(W=>{var H;if(d||f(W,C))return!1;let R=(H=b.find($=>f($.propsRef.current.value,W)))==null?void 0:H.propsRef.current;return R!=null&&R.disabled?!1:(E==null||E(W),!0)});a0({container:S.current,accept(W){return W.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:W.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(W){W.setAttribute("role","none")}});let A=re(W=>{let H=S.current;if(!H)return;let R=so(H),$=b.filter(B=>B.propsRef.current.disabled===!1).map(B=>B.element.current);switch(W.key){case xe.Enter:d0(W.currentTarget);break;case xe.ArrowLeft:case xe.ArrowUp:if(W.preventDefault(),W.stopPropagation(),cn($,Lt.Previous|Lt.WrapAround)===Fs.Success){let B=b.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));B&&T(B.propsRef.current.value)}break;case xe.ArrowRight:case xe.ArrowDown:if(W.preventDefault(),W.stopPropagation(),cn($,Lt.Next|Lt.WrapAround)===Fs.Success){let B=b.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));B&&T(B.propsRef.current.value)}break;case xe.Space:{W.preventDefault(),W.stopPropagation();let B=b.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));B&&T(B.propsRef.current.value)}break}}),_=re(W=>(m({type:0,...W}),()=>m({type:1,id:W.id}))),N=g.useMemo(()=>({value:C,firstOption:O,containsCheckedOption:P,disabled:d,compare:f,...h}),[C,O,P,d,f,h]),V=g.useMemo(()=>({registerOption:_,change:T}),[_,T]),M={ref:j,id:s,role:"radiogroup","aria-labelledby":v,"aria-describedby":y,onKeyDown:A},I=g.useMemo(()=>({value:C}),[C]),U=g.useRef(null),F=xs();return g.useEffect(()=>{U.current&&o!==void 0&&F.addEventListener(U.current,"reset",()=>{T(o)})},[U,T]),g.createElement(w,{name:"RadioGroup.Description"},g.createElement(x,{name:"RadioGroup.Label"},g.createElement(rg.Provider,{value:V},g.createElement(sg.Provider,{value:N},a!=null&&C!=null&&pu({[a]:C}).map(([W,H],R)=>g.createElement(Ss,{features:ws.Hidden,ref:R===0?$=>{var B;U.current=(B=$==null?void 0:$.closest("form"))!=null?B:null}:void 0,...yi({key:W,as:"input",type:"radio",checked:H!=null,hidden:!0,readOnly:!0,form:i,disabled:d,name:W,value:H})})),Ge({ourProps:M,theirProps:p,slot:I,defaultTag:kO,name:"RadioGroup"})))))}var IO=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(IO||{});let VO="div";function HO(e,t){var n;let s=Tt(),{id:r=`headlessui-radiogroup-option-${s}`,value:o,disabled:i=!1,...a}=e,l=g.useRef(null),u=et(l,t),[d,p]=ng(),[f,h]=Wf(),{addFlag:m,removeFlag:b,hasFlag:v}=C0(1),x=Ht({value:o,disabled:i}),y=j0("RadioGroup.Option"),w=E0("RadioGroup.Option");Je(()=>w.registerOption({id:r,element:l,propsRef:x}),[r,w,l,x]);let S=re(_=>{var N;if(qr(_.currentTarget))return _.preventDefault();w.change(o)&&(m(2),(N=l.current)==null||N.focus())}),j=re(_=>{if(qr(_.currentTarget))return _.preventDefault();m(2)}),C=re(()=>b(2)),E=((n=y.firstOption)==null?void 0:n.id)===r,O=y.disabled||i,P=y.compare(y.value,o),T={ref:u,id:r,role:"radio","aria-checked":P?"true":"false","aria-labelledby":d,"aria-describedby":f,"aria-disabled":O?!0:void 0,tabIndex:O?-1:P||!y.containsCheckedOption&&E?0:-1,onClick:O?void 0:S,onFocus:O?void 0:j,onBlur:O?void 0:C},A=g.useMemo(()=>({checked:P,disabled:O,active:v(2)}),[P,O,v]);return g.createElement(h,{name:"RadioGroup.Description"},g.createElement(p,{name:"RadioGroup.Label"},Ge({ourProps:T,theirProps:a,slot:A,defaultTag:VO,name:"RadioGroup.Option"})))}let DO=qe(RO),FO=qe(HO),Xh=Object.assign(DO,{Option:FO,Label:S0,Description:b0}),og=g.createContext(null);og.displayName="GroupContext";let BO=g.Fragment;function zO(e){var t;let[n,s]=g.useState(null),[r,o]=ng(),[i,a]=Wf(),l=g.useMemo(()=>({switch:n,setSwitch:s,labelledby:r,describedby:i}),[n,s,r,i]),u={},d=e;return g.createElement(a,{name:"Switch.Description"},g.createElement(o,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(p){n&&(p.currentTarget.tagName==="LABEL"&&p.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},g.createElement(og.Provider,{value:l},Ge({ourProps:u,theirProps:d,defaultTag:BO,name:"Switch.Group"}))))}let UO="button";function WO(e,t){var n;let s=Tt(),{id:r=`headlessui-switch-${s}`,checked:o,defaultChecked:i=!1,onChange:a,disabled:l=!1,name:u,value:d,form:p,...f}=e,h=g.useContext(og),m=g.useRef(null),b=et(m,t,h===null?null:h.setSwitch),[v,x]=lu(o,a,i),y=re(()=>x==null?void 0:x(!v)),w=re(P=>{if(qr(P.currentTarget))return P.preventDefault();P.preventDefault(),y()}),S=re(P=>{P.key===xe.Space?(P.preventDefault(),y()):P.key===xe.Enter&&d0(P.currentTarget)}),j=re(P=>P.preventDefault()),C=g.useMemo(()=>({checked:v}),[v]),E={id:r,ref:b,role:"switch",type:Ni(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":v,"aria-labelledby":h==null?void 0:h.labelledby,"aria-describedby":h==null?void 0:h.describedby,disabled:l,onClick:w,onKeyUp:S,onKeyPress:j},O=xs();return g.useEffect(()=>{var P;let T=(P=m.current)==null?void 0:P.closest("form");T&&i!==void 0&&O.addEventListener(T,"reset",()=>{x(i)})},[m,x]),g.createElement(g.Fragment,null,u!=null&&v&&g.createElement(Ss,{features:ws.Hidden,...yi({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:p,checked:v,name:u,value:d})}),Ge({ourProps:E,theirProps:f,slot:C,defaultTag:UO,name:"Switch"}))}let GO=qe(WO),qO=zO,vd=Object.assign(GO,{Group:qO,Label:S0,Description:b0});function KO({onFocus:e}){let[t,n]=g.useState(!0),s=fu();return t?g.createElement(Ss,{as:"button",type:"button",features:ws.Focusable,onFocus:r=>{r.preventDefault();let o,i=50;function a(){if(i--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!s.current)return;n(!1);return}o=requestAnimationFrame(a)}o=requestAnimationFrame(a)}}):null}const P0=it.createContext(null);function ZO(){return{groups:new Map,get(e,t){var n;let s=this.groups.get(e);s||(s=new Map,this.groups.set(e,s));let r=(n=s.get(t))!=null?n:0;s.set(t,r+1);let o=Array.from(s.keys()).indexOf(t);function i(){let a=s.get(t);a>1?s.set(t,a-1):s.delete(t)}return[o,i]}}}function YO({children:e}){let t=it.useRef(ZO());return it.createElement(P0.Provider,{value:t},e)}function T0(e){let t=it.useContext(P0);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=XO(),[s,r]=t.current.get(e,n);return it.useEffect(()=>r,[]),s}function XO(){var e,t,n;let s=(n=(t=(e=it.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!s)return Symbol();let r=[],o=s;for(;o;)r.push(o.index),o=o.return;return"$."+r.join(".")}var JO=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(JO||{}),QO=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(QO||{}),e_=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(e_||{});let t_={0(e,t){var n;let s=dr(e.tabs,d=>d.current),r=dr(e.panels,d=>d.current),o=s.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),i={...e,tabs:s,panels:r};if(t.index<0||t.index>s.length-1){let d=He(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>He(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return i;let p=He(d,{0:()=>s.indexOf(o[0]),1:()=>s.indexOf(o[o.length-1])});return{...i,selectedIndex:p===-1?e.selectedIndex:p}}let a=s.slice(0,t.index),l=[...s.slice(t.index),...a].find(d=>o.includes(d));if(!l)return i;let u=(n=s.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...i,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],s=dr([...e.tabs,t.tab],o=>o.current),r=e.selectedIndex;return e.info.current.isControlled||(r=s.indexOf(n),r===-1&&(r=e.selectedIndex)),{...e,tabs:s,selectedIndex:r}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:dr([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},ig=g.createContext(null);ig.displayName="TabsDataContext";function xi(e){let t=g.useContext(ig);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xi),n}return t}let ag=g.createContext(null);ag.displayName="TabsActionsContext";function lg(e){let t=g.useContext(ag);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,lg),n}return t}function n_(e,t){return He(t.type,t_,e,t)}let s_=g.Fragment;function r_(e,t){let{defaultIndex:n=0,vertical:s=!1,manual:r=!1,onChange:o,selectedIndex:i=null,...a}=e;const l=s?"vertical":"horizontal",u=r?"manual":"auto";let d=i!==null,p=Ht({isControlled:d}),f=et(t),[h,m]=g.useReducer(n_,{info:p,selectedIndex:i??n,tabs:[],panels:[]}),b=g.useMemo(()=>({selectedIndex:h.selectedIndex}),[h.selectedIndex]),v=Ht(o||(()=>{})),x=Ht(h.tabs),y=g.useMemo(()=>({orientation:l,activation:u,...h}),[l,u,h]),w=re(P=>(m({type:1,tab:P}),()=>m({type:2,tab:P}))),S=re(P=>(m({type:3,panel:P}),()=>m({type:4,panel:P}))),j=re(P=>{C.current!==P&&v.current(P),d||m({type:0,index:P})}),C=Ht(d?e.selectedIndex:h.selectedIndex),E=g.useMemo(()=>({registerTab:w,registerPanel:S,change:j}),[]);Je(()=>{m({type:0,index:i??n})},[i]),Je(()=>{if(C.current===void 0||h.tabs.length<=0)return;let P=dr(h.tabs,T=>T.current);P.some((T,A)=>h.tabs[A]!==T)&&j(P.indexOf(h.tabs[C.current]))});let O={ref:f};return g.createElement(YO,null,g.createElement(ag.Provider,{value:E},g.createElement(ig.Provider,{value:y},y.tabs.length<=0&&g.createElement(KO,{onFocus:()=>{var P,T;for(let A of x.current)if(((P=A.current)==null?void 0:P.tabIndex)===0)return(T=A.current)==null||T.focus(),!0;return!1}}),Ge({ourProps:O,theirProps:a,slot:b,defaultTag:s_,name:"Tabs"}))))}let o_="div";function i_(e,t){let{orientation:n,selectedIndex:s}=xi("Tab.List"),r=et(t);return Ge({ourProps:{ref:r,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:s},defaultTag:o_,name:"Tabs.List"})}let a_="button";function l_(e,t){var n,s;let r=Tt(),{id:o=`headlessui-tabs-tab-${r}`,...i}=e,{orientation:a,activation:l,selectedIndex:u,tabs:d,panels:p}=xi("Tab"),f=lg("Tab"),h=xi("Tab"),m=g.useRef(null),b=et(m,t);Je(()=>f.registerTab(m),[f,m]);let v=T0("tabs"),x=d.indexOf(m);x===-1&&(x=v);let y=x===u,w=re(T=>{var A;let _=T();if(_===Fs.Success&&l==="auto"){let N=(A=so(m))==null?void 0:A.activeElement,V=h.tabs.findIndex(M=>M.current===N);V!==-1&&f.change(V)}return _}),S=re(T=>{let A=d.map(_=>_.current).filter(Boolean);if(T.key===xe.Space||T.key===xe.Enter){T.preventDefault(),T.stopPropagation(),f.change(x);return}switch(T.key){case xe.Home:case xe.PageUp:return T.preventDefault(),T.stopPropagation(),w(()=>cn(A,Lt.First));case xe.End:case xe.PageDown:return T.preventDefault(),T.stopPropagation(),w(()=>cn(A,Lt.Last))}if(w(()=>He(a,{vertical(){return T.key===xe.ArrowUp?cn(A,Lt.Previous|Lt.WrapAround):T.key===xe.ArrowDown?cn(A,Lt.Next|Lt.WrapAround):Fs.Error},horizontal(){return T.key===xe.ArrowLeft?cn(A,Lt.Previous|Lt.WrapAround):T.key===xe.ArrowRight?cn(A,Lt.Next|Lt.WrapAround):Fs.Error}}))===Fs.Success)return T.preventDefault()}),j=g.useRef(!1),C=re(()=>{var T;j.current||(j.current=!0,(T=m.current)==null||T.focus({preventScroll:!0}),f.change(x),If(()=>{j.current=!1}))}),E=re(T=>{T.preventDefault()}),O=g.useMemo(()=>{var T;return{selected:y,disabled:(T=e.disabled)!=null?T:!1}},[y,e.disabled]),P={ref:b,onKeyDown:S,onMouseDown:E,onClick:C,id:o,role:"tab",type:Ni(e,m),"aria-controls":(s=(n=p[x])==null?void 0:n.current)==null?void 0:s.id,"aria-selected":y,tabIndex:y?0:-1};return Ge({ourProps:P,theirProps:i,slot:O,defaultTag:a_,name:"Tabs.Tab"})}let c_="div";function u_(e,t){let{selectedIndex:n}=xi("Tab.Panels"),s=et(t),r=g.useMemo(()=>({selectedIndex:n}),[n]);return Ge({ourProps:{ref:s},theirProps:e,slot:r,defaultTag:c_,name:"Tabs.Panels"})}let d_="div",p_=Cn.RenderStrategy|Cn.Static;function f_(e,t){var n,s,r,o;let i=Tt(),{id:a=`headlessui-tabs-panel-${i}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:p,panels:f}=xi("Tab.Panel"),h=lg("Tab.Panel"),m=g.useRef(null),b=et(m,t);Je(()=>h.registerPanel(m),[h,m,a]);let v=T0("panels"),x=f.indexOf(m);x===-1&&(x=v);let y=x===d,w=g.useMemo(()=>({selected:y}),[y]),S={ref:b,id:a,role:"tabpanel","aria-labelledby":(s=(n=p[x])==null?void 0:n.current)==null?void 0:s.id,tabIndex:y?l:-1};return!y&&((r=u.unmount)==null||r)&&!((o=u.static)!=null&&o)?g.createElement(Ss,{as:"span","aria-hidden":"true",...S}):Ge({ourProps:S,theirProps:u,slot:w,defaultTag:d_,features:p_,visible:y,name:"Tabs.Panel"})}let g_=qe(l_),h_=qe(r_),m_=qe(i_),b_=qe(u_),v_=qe(f_),qi=Object.assign(g_,{Group:h_,List:m_,Panels:b_,Panel:v_});function y_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function yd(e,...t){e&&t.length>0&&e.classList.add(...t)}function xd(e,...t){e&&t.length>0&&e.classList.remove(...t)}function x_(e,t){let n=Ks();if(!e)return n.dispose;let{transitionDuration:s,transitionDelay:r}=getComputedStyle(e),[o,i]=[s,r].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return u}),a=o+i;if(a!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},a),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function w_(e,t,n,s){let r=n?"enter":"leave",o=Ks(),i=s!==void 0?y_(s):()=>{};r==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=He(r,{enter:()=>t.enter,leave:()=>t.leave}),l=He(r,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=He(r,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return xd(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),yd(e,...t.base,...a,...u),o.nextFrame(()=>{xd(e,...t.base,...a,...u),yd(e,...t.base,...a,...l),x_(e,()=>(xd(e,...t.base,...a),yd(e,...t.base,...t.entered),i()))}),o.dispose}function S_({immediate:e,container:t,direction:n,classes:s,onStart:r,onStop:o}){let i=fu(),a=xs(),l=Ht(n);Je(()=>{e&&(l.current="enter")},[e]),Je(()=>{let u=Ks();a.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&i.current)return u.dispose(),r.current(l.current),u.add(w_(d,s.current,l.current==="enter",()=>{u.dispose(),o.current(l.current)})),u.dispose},[n])}function Or(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let mu=g.createContext(null);mu.displayName="TransitionContext";var C_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(C_||{});function j_(){let e=g.useContext(mu);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function E_(){let e=g.useContext(bu);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let bu=g.createContext(null);bu.displayName="NestingContext";function vu(e){return"children"in e?vu(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function O0(e,t){let n=Ht(e),s=g.useRef([]),r=fu(),o=xs(),i=re((h,m=Ir.Hidden)=>{let b=s.current.findIndex(({el:v})=>v===h);b!==-1&&(He(m,{[Ir.Unmount](){s.current.splice(b,1)},[Ir.Hidden](){s.current[b].state="hidden"}}),o.microTask(()=>{var v;!vu(s)&&r.current&&((v=n.current)==null||v.call(n))}))}),a=re(h=>{let m=s.current.find(({el:b})=>b===h);return m?m.state!=="visible"&&(m.state="visible"):s.current.push({el:h,state:"visible"}),()=>i(h,Ir.Unmount)}),l=g.useRef([]),u=g.useRef(Promise.resolve()),d=g.useRef({enter:[],leave:[],idle:[]}),p=re((h,m,b)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==h)),t==null||t.chains.current[m].push([h,new Promise(v=>{l.current.push(v)})]),t==null||t.chains.current[m].push([h,new Promise(v=>{Promise.all(d.current[m].map(([x,y])=>y)).then(()=>v())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),f=re((h,m,b)=>{Promise.all(d.current[m].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=l.current.shift())==null||v()}).then(()=>b(m))});return g.useMemo(()=>({children:s,register:a,unregister:i,onStart:p,onStop:f,wait:u,chains:d}),[a,i,s,p,f,d,u])}function P_(){}let T_=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Jh(e){var t;let n={};for(let s of T_)n[s]=(t=e[s])!=null?t:P_;return n}function O_(e){let t=g.useRef(Jh(e));return g.useEffect(()=>{t.current=Jh(e)},[e]),t}let __="div",_0=Cn.RenderStrategy;function A_(e,t){var n,s;let{beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a,enter:l,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:h,leaveTo:m,...b}=e,v=g.useRef(null),x=et(v,t),y=(n=b.unmount)==null||n?Ir.Unmount:Ir.Hidden,{show:w,appear:S,initial:j}=j_(),[C,E]=g.useState(w?"visible":"hidden"),O=E_(),{register:P,unregister:T}=O;g.useEffect(()=>P(v),[P,v]),g.useEffect(()=>{if(y===Ir.Hidden&&v.current){if(w&&C!=="visible"){E("visible");return}return He(C,{hidden:()=>T(v),visible:()=>P(v)})}},[C,v,P,T,w,y]);let A=Ht({base:Or(b.className),enter:Or(l),enterFrom:Or(u),enterTo:Or(d),entered:Or(p),leave:Or(f),leaveFrom:Or(h),leaveTo:Or(m)}),_=O_({beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a}),N=cu();g.useEffect(()=>{if(N&&C==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,C,N]);let V=j&&!S,M=S&&w&&j,I=!N||V?"idle":w?"enter":"leave",U=C0(0),F=re(Z=>He(Z,{enter:()=>{U.addFlag(mt.Opening),_.current.beforeEnter()},leave:()=>{U.addFlag(mt.Closing),_.current.beforeLeave()},idle:()=>{}})),W=re(Z=>He(Z,{enter:()=>{U.removeFlag(mt.Opening),_.current.afterEnter()},leave:()=>{U.removeFlag(mt.Closing),_.current.afterLeave()},idle:()=>{}})),H=O0(()=>{E("hidden"),T(v)},O),R=g.useRef(!1);S_({immediate:M,container:v,classes:A,direction:I,onStart:Ht(Z=>{R.current=!0,H.onStart(v,Z,F)}),onStop:Ht(Z=>{R.current=!1,H.onStop(v,Z,W),Z==="leave"&&!vu(H)&&(E("hidden"),T(v))})});let $=b,B={ref:x};return M?$={...$,className:kc(b.className,...A.current.enter,...A.current.enterFrom)}:R.current&&($.className=kc(b.className,(s=v.current)==null?void 0:s.className),$.className===""&&delete $.className),g.createElement(bu.Provider,{value:H},g.createElement(ol,{value:He(C,{visible:mt.Open,hidden:mt.Closed})|U.flags},Ge({ourProps:B,theirProps:$,defaultTag:__,features:_0,visible:C==="visible",name:"Transition.Child"})))}function M_(e,t){let{show:n,appear:s=!1,unmount:r=!0,...o}=e,i=g.useRef(null),a=et(i,t);cu();let l=zo();if(n===void 0&&l!==null&&(n=(l&mt.Open)===mt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=g.useState(n?"visible":"hidden"),p=O0(()=>{d("hidden")}),[f,h]=g.useState(!0),m=g.useRef([n]);Je(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),h(!1))},[m,n]);let b=g.useMemo(()=>({show:n,appear:s,initial:f}),[n,s,f]);g.useEffect(()=>{if(n)d("visible");else if(!vu(p))d("hidden");else{let w=i.current;if(!w)return;let S=w.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&d("hidden")}},[n,p]);let v={unmount:r},x=re(()=>{var w;f&&h(!1),(w=e.beforeEnter)==null||w.call(e)}),y=re(()=>{var w;f&&h(!1),(w=e.beforeLeave)==null||w.call(e)});return g.createElement(bu.Provider,{value:p},g.createElement(mu.Provider,{value:b},Ge({ourProps:{...v,as:g.Fragment,children:g.createElement(A0,{ref:a,...v,...o,beforeEnter:x,beforeLeave:y})},theirProps:{},defaultTag:g.Fragment,features:_0,visible:u==="visible",name:"Transition"})))}function L_(e,t){let n=g.useContext(mu)!==null,s=zo()!==null;return g.createElement(g.Fragment,null,!n&&s?g.createElement(Np,{ref:t,...e}):g.createElement(A0,{ref:t,...e}))}let Np=qe(M_),A0=qe(A_),N_=qe(L_),cg=Object.assign(Np,{Child:N_,Root:Np});var Qh=function(t){return t.reduce(function(n,s){var r=s[0],o=s[1];return n[r]=o,n},{})},em=typeof window<"u"&&window.document&&window.document.createElement?it.useLayoutEffect:it.useEffect,wn="top",ss="bottom",rs="right",Sn="left",ug="auto",cl=[wn,ss,rs,Sn],wi="start",Oa="end",$_="clippingParents",M0="viewport",Ki="popper",k_="reference",tm=cl.reduce(function(e,t){return e.concat([t+"-"+wi,t+"-"+Oa])},[]),L0=[].concat(cl,[ug]).reduce(function(e,t){return e.concat([t,t+"-"+wi,t+"-"+Oa])},[]),R_="beforeRead",I_="read",V_="afterRead",H_="beforeMain",D_="main",F_="afterMain",B_="beforeWrite",z_="write",U_="afterWrite",W_=[R_,I_,V_,H_,D_,F_,B_,z_,U_];function Zs(e){return e?(e.nodeName||"").toLowerCase():null}function Fn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ko(e){var t=Fn(e).Element;return e instanceof t||e instanceof Element}function ns(e){var t=Fn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function dg(e){if(typeof ShadowRoot>"u")return!1;var t=Fn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function G_(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var s=t.styles[n]||{},r=t.attributes[n]||{},o=t.elements[n];!ns(o)||!Zs(o)||(Object.assign(o.style,s),Object.keys(r).forEach(function(i){var a=r[i];a===!1?o.removeAttribute(i):o.setAttribute(i,a===!0?"":a)}))})}function q_(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(s){var r=t.elements[s],o=t.attributes[s]||{},i=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:n[s]),a=i.reduce(function(l,u){return l[u]="",l},{});!ns(r)||!Zs(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(l){r.removeAttribute(l)}))})}}const K_={name:"applyStyles",enabled:!0,phase:"write",fn:G_,effect:q_,requires:["computeStyles"]};function qs(e){return e.split("-")[0]}var To=Math.max,Rc=Math.min,Si=Math.round;function $p(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function N0(){return!/^((?!chrome|android).)*safari/i.test($p())}function Ci(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var s=e.getBoundingClientRect(),r=1,o=1;t&&ns(e)&&(r=e.offsetWidth>0&&Si(s.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Si(s.height)/e.offsetHeight||1);var i=ko(e)?Fn(e):window,a=i.visualViewport,l=!N0()&&n,u=(s.left+(l&&a?a.offsetLeft:0))/r,d=(s.top+(l&&a?a.offsetTop:0))/o,p=s.width/r,f=s.height/o;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function pg(e){var t=Ci(e),n=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:s}}function $0(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&dg(n)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function vr(e){return Fn(e).getComputedStyle(e)}function Z_(e){return["table","td","th"].indexOf(Zs(e))>=0}function ro(e){return((ko(e)?e.ownerDocument:e.document)||window.document).documentElement}function yu(e){return Zs(e)==="html"?e:e.assignedSlot||e.parentNode||(dg(e)?e.host:null)||ro(e)}function nm(e){return!ns(e)||vr(e).position==="fixed"?null:e.offsetParent}function Y_(e){var t=/firefox/i.test($p()),n=/Trident/i.test($p());if(n&&ns(e)){var s=vr(e);if(s.position==="fixed")return null}var r=yu(e);for(dg(r)&&(r=r.host);ns(r)&&["html","body"].indexOf(Zs(r))<0;){var o=vr(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function ul(e){for(var t=Fn(e),n=nm(e);n&&Z_(n)&&vr(n).position==="static";)n=nm(n);return n&&(Zs(n)==="html"||Zs(n)==="body"&&vr(n).position==="static")?t:n||Y_(e)||t}function fg(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ca(e,t,n){return To(e,Rc(t,n))}function X_(e,t,n){var s=ca(e,t,n);return s>n?n:s}function k0(){return{top:0,right:0,bottom:0,left:0}}function R0(e){return Object.assign({},k0(),e)}function I0(e,t){return t.reduce(function(n,s){return n[s]=e,n},{})}var J_=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,R0(typeof t!="number"?t:I0(t,cl))};function Q_(e){var t,n=e.state,s=e.name,r=e.options,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=qs(n.placement),l=fg(a),u=[Sn,rs].indexOf(a)>=0,d=u?"height":"width";if(!(!o||!i)){var p=J_(r.padding,n),f=pg(o),h=l==="y"?wn:Sn,m=l==="y"?ss:rs,b=n.rects.reference[d]+n.rects.reference[l]-i[l]-n.rects.popper[d],v=i[l]-n.rects.reference[l],x=ul(o),y=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=b/2-v/2,S=p[h],j=y-f[d]-p[m],C=y/2-f[d]/2+w,E=ca(S,C,j),O=l;n.modifiersData[s]=(t={},t[O]=E,t.centerOffset=E-C,t)}}function eA(e){var t=e.state,n=e.options,s=n.element,r=s===void 0?"[data-popper-arrow]":s;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||$0(t.elements.popper,r)&&(t.elements.arrow=r))}const tA={name:"arrow",enabled:!0,phase:"main",fn:Q_,effect:eA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ji(e){return e.split("-")[1]}var nA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function sA(e,t){var n=e.x,s=e.y,r=t.devicePixelRatio||1;return{x:Si(n*r)/r||0,y:Si(s*r)/r||0}}function sm(e){var t,n=e.popper,s=e.popperRect,r=e.placement,o=e.variation,i=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=i.x,h=f===void 0?0:f,m=i.y,b=m===void 0?0:m,v=typeof d=="function"?d({x:h,y:b}):{x:h,y:b};h=v.x,b=v.y;var x=i.hasOwnProperty("x"),y=i.hasOwnProperty("y"),w=Sn,S=wn,j=window;if(u){var C=ul(n),E="clientHeight",O="clientWidth";if(C===Fn(n)&&(C=ro(n),vr(C).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),C=C,r===wn||(r===Sn||r===rs)&&o===Oa){S=ss;var P=p&&C===j&&j.visualViewport?j.visualViewport.height:C[E];b-=P-s.height,b*=l?1:-1}if(r===Sn||(r===wn||r===ss)&&o===Oa){w=rs;var T=p&&C===j&&j.visualViewport?j.visualViewport.width:C[O];h-=T-s.width,h*=l?1:-1}}var A=Object.assign({position:a},u&&nA),_=d===!0?sA({x:h,y:b},Fn(n)):{x:h,y:b};if(h=_.x,b=_.y,l){var N;return Object.assign({},A,(N={},N[S]=y?"0":"",N[w]=x?"0":"",N.transform=(j.devicePixelRatio||1)<=1?"translate("+h+"px, "+b+"px)":"translate3d("+h+"px, "+b+"px, 0)",N))}return Object.assign({},A,(t={},t[S]=y?b+"px":"",t[w]=x?h+"px":"",t.transform="",t))}function rA(e){var t=e.state,n=e.options,s=n.gpuAcceleration,r=s===void 0?!0:s,o=n.adaptive,i=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:qs(t.placement),variation:ji(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,sm(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,sm(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const oA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:rA,data:{}};var Il={passive:!0};function iA(e){var t=e.state,n=e.instance,s=e.options,r=s.scroll,o=r===void 0?!0:r,i=s.resize,a=i===void 0?!0:i,l=Fn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(d){d.addEventListener("scroll",n.update,Il)}),a&&l.addEventListener("resize",n.update,Il),function(){o&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Il)}),a&&l.removeEventListener("resize",n.update,Il)}}const aA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:iA,data:{}};var lA={left:"right",right:"left",bottom:"top",top:"bottom"};function vc(e){return e.replace(/left|right|bottom|top/g,function(t){return lA[t]})}var cA={start:"end",end:"start"};function rm(e){return e.replace(/start|end/g,function(t){return cA[t]})}function gg(e){var t=Fn(e),n=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:n,scrollTop:s}}function hg(e){return Ci(ro(e)).left+gg(e).scrollLeft}function uA(e,t){var n=Fn(e),s=ro(e),r=n.visualViewport,o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(r){o=r.width,i=r.height;var u=N0();(u||!u&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:i,x:a+hg(e),y:l}}function dA(e){var t,n=ro(e),s=gg(e),r=(t=e.ownerDocument)==null?void 0:t.body,o=To(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=To(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-s.scrollLeft+hg(e),l=-s.scrollTop;return vr(r||n).direction==="rtl"&&(a+=To(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:i,x:a,y:l}}function mg(e){var t=vr(e),n=t.overflow,s=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+s)}function V0(e){return["html","body","#document"].indexOf(Zs(e))>=0?e.ownerDocument.body:ns(e)&&mg(e)?e:V0(yu(e))}function ua(e,t){var n;t===void 0&&(t=[]);var s=V0(e),r=s===((n=e.ownerDocument)==null?void 0:n.body),o=Fn(s),i=r?[o].concat(o.visualViewport||[],mg(s)?s:[]):s,a=t.concat(i);return r?a:a.concat(ua(yu(i)))}function kp(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function pA(e,t){var n=Ci(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function om(e,t,n){return t===M0?kp(uA(e,n)):ko(t)?pA(t,n):kp(dA(ro(e)))}function fA(e){var t=ua(yu(e)),n=["absolute","fixed"].indexOf(vr(e).position)>=0,s=n&&ns(e)?ul(e):e;return ko(s)?t.filter(function(r){return ko(r)&&$0(r,s)&&Zs(r)!=="body"}):[]}function gA(e,t,n,s){var r=t==="clippingParents"?fA(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(l,u){var d=om(e,u,s);return l.top=To(d.top,l.top),l.right=Rc(d.right,l.right),l.bottom=Rc(d.bottom,l.bottom),l.left=To(d.left,l.left),l},om(e,i,s));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function H0(e){var t=e.reference,n=e.element,s=e.placement,r=s?qs(s):null,o=s?ji(s):null,i=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(r){case wn:l={x:i,y:t.y-n.height};break;case ss:l={x:i,y:t.y+t.height};break;case rs:l={x:t.x+t.width,y:a};break;case Sn:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var u=r?fg(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(o){case wi:l[u]=l[u]-(t[d]/2-n[d]/2);break;case Oa:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function _a(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=s===void 0?e.placement:s,o=n.strategy,i=o===void 0?e.strategy:o,a=n.boundary,l=a===void 0?$_:a,u=n.rootBoundary,d=u===void 0?M0:u,p=n.elementContext,f=p===void 0?Ki:p,h=n.altBoundary,m=h===void 0?!1:h,b=n.padding,v=b===void 0?0:b,x=R0(typeof v!="number"?v:I0(v,cl)),y=f===Ki?k_:Ki,w=e.rects.popper,S=e.elements[m?y:f],j=gA(ko(S)?S:S.contextElement||ro(e.elements.popper),l,d,i),C=Ci(e.elements.reference),E=H0({reference:C,element:w,strategy:"absolute",placement:r}),O=kp(Object.assign({},w,E)),P=f===Ki?O:C,T={top:j.top-P.top+x.top,bottom:P.bottom-j.bottom+x.bottom,left:j.left-P.left+x.left,right:P.right-j.right+x.right},A=e.modifiersData.offset;if(f===Ki&&A){var _=A[r];Object.keys(T).forEach(function(N){var V=[rs,ss].indexOf(N)>=0?1:-1,M=[wn,ss].indexOf(N)>=0?"y":"x";T[N]+=_[M]*V})}return T}function hA(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=n.boundary,o=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?L0:l,d=ji(s),p=d?a?tm:tm.filter(function(m){return ji(m)===d}):cl,f=p.filter(function(m){return u.indexOf(m)>=0});f.length===0&&(f=p);var h=f.reduce(function(m,b){return m[b]=_a(e,{placement:b,boundary:r,rootBoundary:o,padding:i})[qs(b)],m},{});return Object.keys(h).sort(function(m,b){return h[m]-h[b]})}function mA(e){if(qs(e)===ug)return[];var t=vc(e);return[rm(e),t,rm(t)]}function bA(e){var t=e.state,n=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,m=h===void 0?!0:h,b=n.allowedAutoPlacements,v=t.options.placement,x=qs(v),y=x===v,w=l||(y||!m?[vc(v)]:mA(v)),S=[v].concat(w).reduce(function(Z,Y){return Z.concat(qs(Y)===ug?hA(t,{placement:Y,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:b}):Y)},[]),j=t.rects.reference,C=t.rects.popper,E=new Map,O=!0,P=S[0],T=0;T<S.length;T++){var A=S[T],_=qs(A),N=ji(A)===wi,V=[wn,ss].indexOf(_)>=0,M=V?"width":"height",I=_a(t,{placement:A,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),U=V?N?rs:Sn:N?ss:wn;j[M]>C[M]&&(U=vc(U));var F=vc(U),W=[];if(o&&W.push(I[_]<=0),a&&W.push(I[U]<=0,I[F]<=0),W.every(function(Z){return Z})){P=A,O=!1;break}E.set(A,W)}if(O)for(var H=m?3:1,R=function(Y){var ee=S.find(function(X){var G=E.get(X);if(G)return G.slice(0,Y).every(function(Q){return Q})});if(ee)return P=ee,"break"},$=H;$>0;$--){var B=R($);if(B==="break")break}t.placement!==P&&(t.modifiersData[s]._skip=!0,t.placement=P,t.reset=!0)}}const vA={name:"flip",enabled:!0,phase:"main",fn:bA,requiresIfExists:["offset"],data:{_skip:!1}};function im(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function am(e){return[wn,rs,ss,Sn].some(function(t){return e[t]>=0})}function yA(e){var t=e.state,n=e.name,s=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=_a(t,{elementContext:"reference"}),a=_a(t,{altBoundary:!0}),l=im(i,s),u=im(a,r,o),d=am(l),p=am(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const xA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:yA};function wA(e,t,n){var s=qs(e),r=[Sn,wn].indexOf(s)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=o[0],a=o[1];return i=i||0,a=(a||0)*r,[Sn,rs].indexOf(s)>=0?{x:a,y:i}:{x:i,y:a}}function SA(e){var t=e.state,n=e.options,s=e.name,r=n.offset,o=r===void 0?[0,0]:r,i=L0.reduce(function(d,p){return d[p]=wA(p,t.rects,o),d},{}),a=i[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[s]=i}const CA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:SA};function jA(e){var t=e.state,n=e.name;t.modifiersData[n]=H0({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const EA={name:"popperOffsets",enabled:!0,phase:"read",fn:jA,data:{}};function PA(e){return e==="x"?"y":"x"}function TA(e){var t=e.state,n=e.options,s=e.name,r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,f=n.tether,h=f===void 0?!0:f,m=n.tetherOffset,b=m===void 0?0:m,v=_a(t,{boundary:l,rootBoundary:u,padding:p,altBoundary:d}),x=qs(t.placement),y=ji(t.placement),w=!y,S=fg(x),j=PA(S),C=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,P=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,T=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,_={x:0,y:0};if(C){if(o){var N,V=S==="y"?wn:Sn,M=S==="y"?ss:rs,I=S==="y"?"height":"width",U=C[S],F=U+v[V],W=U-v[M],H=h?-O[I]/2:0,R=y===wi?E[I]:O[I],$=y===wi?-O[I]:-E[I],B=t.elements.arrow,Z=h&&B?pg(B):{width:0,height:0},Y=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:k0(),ee=Y[V],X=Y[M],G=ca(0,E[I],Z[I]),Q=w?E[I]/2-H-G-ee-T.mainAxis:R-G-ee-T.mainAxis,ie=w?-E[I]/2+H+G+X+T.mainAxis:$+G+X+T.mainAxis,ae=t.elements.arrow&&ul(t.elements.arrow),me=ae?S==="y"?ae.clientTop||0:ae.clientLeft||0:0,ve=(N=A==null?void 0:A[S])!=null?N:0,ke=U+Q-ve-me,Re=U+ie-ve,ot=ca(h?Rc(F,ke):F,U,h?To(W,Re):W);C[S]=ot,_[S]=ot-U}if(a){var Ue,we=S==="x"?wn:Sn,ze=S==="x"?ss:rs,Xe=C[j],vt=j==="y"?"height":"width",Le=Xe+v[we],ft=Xe-v[ze],dt=[wn,Sn].indexOf(x)!==-1,We=(Ue=A==null?void 0:A[j])!=null?Ue:0,Xt=dt?Le:Xe-E[vt]-O[vt]-We+T.altAxis,he=dt?Xe+E[vt]+O[vt]-We-T.altAxis:ft,De=h&&dt?X_(Xt,Xe,he):ca(h?Xt:Le,Xe,h?he:ft);C[j]=De,_[j]=De-Xe}t.modifiersData[s]=_}}const OA={name:"preventOverflow",enabled:!0,phase:"main",fn:TA,requiresIfExists:["offset"]};function _A(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function AA(e){return e===Fn(e)||!ns(e)?gg(e):_A(e)}function MA(e){var t=e.getBoundingClientRect(),n=Si(t.width)/e.offsetWidth||1,s=Si(t.height)/e.offsetHeight||1;return n!==1||s!==1}function LA(e,t,n){n===void 0&&(n=!1);var s=ns(t),r=ns(t)&&MA(t),o=ro(t),i=Ci(e,r,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(s||!s&&!n)&&((Zs(t)!=="body"||mg(o))&&(a=AA(t)),ns(t)?(l=Ci(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=hg(o))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function NA(e){var t=new Map,n=new Set,s=[];e.forEach(function(o){t.set(o.name,o)});function r(o){n.add(o.name);var i=[].concat(o.requires||[],o.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&r(l)}}),s.push(o)}return e.forEach(function(o){n.has(o.name)||r(o)}),s}function $A(e){var t=NA(e);return W_.reduce(function(n,s){return n.concat(t.filter(function(r){return r.phase===s}))},[])}function kA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function RA(e){var t=e.reduce(function(n,s){var r=n[s.name];return n[s.name]=r?Object.assign({},r,s,{options:Object.assign({},r.options,s.options),data:Object.assign({},r.data,s.data)}):s,n},{});return Object.keys(t).map(function(n){return t[n]})}var lm={placement:"bottom",modifiers:[],strategy:"absolute"};function cm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function IA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,s=n===void 0?[]:n,r=t.defaultOptions,o=r===void 0?lm:r;return function(a,l,u){u===void 0&&(u=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},lm,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},p=[],f=!1,h={state:d,setOptions:function(x){var y=typeof x=="function"?x(d.options):x;b(),d.options=Object.assign({},o,d.options,y),d.scrollParents={reference:ko(a)?ua(a):a.contextElement?ua(a.contextElement):[],popper:ua(l)};var w=$A(RA([].concat(s,d.options.modifiers)));return d.orderedModifiers=w.filter(function(S){return S.enabled}),m(),h.update()},forceUpdate:function(){if(!f){var x=d.elements,y=x.reference,w=x.popper;if(cm(y,w)){d.rects={reference:LA(y,ul(w),d.options.strategy==="fixed"),popper:pg(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(T){return d.modifiersData[T.name]=Object.assign({},T.data)});for(var S=0;S<d.orderedModifiers.length;S++){if(d.reset===!0){d.reset=!1,S=-1;continue}var j=d.orderedModifiers[S],C=j.fn,E=j.options,O=E===void 0?{}:E,P=j.name;typeof C=="function"&&(d=C({state:d,options:O,name:P,instance:h})||d)}}}},update:kA(function(){return new Promise(function(v){h.forceUpdate(),v(d)})}),destroy:function(){b(),f=!0}};if(!cm(a,l))return h;h.setOptions(u).then(function(v){!f&&u.onFirstUpdate&&u.onFirstUpdate(v)});function m(){d.orderedModifiers.forEach(function(v){var x=v.name,y=v.options,w=y===void 0?{}:y,S=v.effect;if(typeof S=="function"){var j=S({state:d,name:x,instance:h,options:w}),C=function(){};p.push(j||C)}})}function b(){p.forEach(function(v){return v()}),p=[]}return h}}var VA=[aA,EA,oA,K_,CA,vA,OA,tA,xA],HA=IA({defaultModifiers:VA}),DA=typeof Element<"u",FA=typeof Map=="function",BA=typeof Set=="function",zA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function yc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!yc(e[s],t[s]))return!1;return!0}var o;if(FA&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!yc(s.value[1],t.get(s.value[0])))return!1;return!0}if(BA&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(zA&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;if(DA&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((r[s]==="_owner"||r[s]==="__v"||r[s]==="__o")&&e.$$typeof)&&!yc(e[r[s]],t[r[s]]))return!1;return!0}return e!==e&&t!==t}var UA=function(t,n){try{return yc(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const WA=Cf(UA);var GA=[],dl=function(t,n,s){s===void 0&&(s={});var r=it.useRef(null),o={onFirstUpdate:s.onFirstUpdate,placement:s.placement||"bottom",strategy:s.strategy||"absolute",modifiers:s.modifiers||GA},i=it.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=i[0],l=i[1],u=it.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(h){var m=h.state,b=Object.keys(m.elements);mS.flushSync(function(){l({styles:Qh(b.map(function(v){return[v,m.styles[v]||{}]})),attributes:Qh(b.map(function(v){return[v,m.attributes[v]]}))})})},requires:["computeStyles"]}},[]),d=it.useMemo(function(){var f={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[u,{name:"applyStyles",enabled:!1}])};return WA(r.current,f)?r.current||f:(r.current=f,f)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,u]),p=it.useRef();return em(function(){p.current&&p.current.setOptions(d)},[d]),em(function(){if(!(t==null||n==null)){var f=s.createPopper||HA,h=f(t,n,d);return p.current=h,function(){h.destroy(),p.current=null}}},[t,n,s.createPopper]),{state:p.current?p.current.state:null,styles:a.styles,attributes:a.attributes,update:p.current?p.current.update:null,forceUpdate:p.current?p.current.forceUpdate:null}};const os=Yt(function({children:t,title:n,onClose:s,icon:r,skipOverflow:o,shadow:i=!0,padding:a=!0,border:l=!0,round:u=!0,className:d,classNameBody:p,size:f="m",titleClass:h=J("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:b,...v},x){const y=wr(r)?r:{};return c.jsxs("div",{...v,ref:x,style:m,className:J(["gs-utl-card",d,b||kf.bg,se.b,u&&se.rnd,l?z.br:se.bT,!o&&"gs-utl-overflow-auto",i&&"gs-utl-shadow-md",a&&f==="l"&&"gs-utl-p-5",a&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",a&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",a&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",a&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||s)&&n!==!1&&c.jsxs(k,{className:J("gs-utl-card-title",h),items:"center",children:[c.jsx(D,{className:J("truncate"),grow:!0,children:n}),(s||r)&&c.jsx(D,{onClick:s,className:J("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(ne,{icon:(pt(r)?r:"")||K.close,size:"18px",...y})})]}),c.jsx("div",{className:J("gs-utl-card-body",p),children:t})]})});var Vl,qA=new Uint8Array(16);function KA(){if(!Vl&&(Vl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Vl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vl(qA)}const ZA=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function YA(e){return typeof e=="string"&&ZA.test(e)}var Kt=[];for(var wd=0;wd<256;++wd)Kt.push((wd+256).toString(16).substr(1));function XA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Kt[e[t+0]]+Kt[e[t+1]]+Kt[e[t+2]]+Kt[e[t+3]]+"-"+Kt[e[t+4]]+Kt[e[t+5]]+"-"+Kt[e[t+6]]+Kt[e[t+7]]+"-"+Kt[e[t+8]]+Kt[e[t+9]]+"-"+Kt[e[t+10]]+Kt[e[t+11]]+Kt[e[t+12]]+Kt[e[t+13]]+Kt[e[t+14]]+Kt[e[t+15]]).toLowerCase();if(!YA(n))throw TypeError("Stringified UUID is invalid");return n}function D0(e,t,n){e=e||{};var s=e.random||(e.rng||KA)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,XA(s)}class JA extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Zi=async(e,{onError:t,onLoading:n,onResult:s,params:r,rawText:o,...i})=>{try{n==null||n(!0);const a=r?new URLSearchParams(r).toString():"",l=a?`?${a}`:"",u=await fetch(`${e}${l}`,i);if(!u.ok){const p=await u.json();throw new JA(p.error||"Request failed!",p.errorData)}let d;if(o)d=await u.text();else try{d=await u.json()}catch{d=void 0}return s==null||s(d),d}catch(a){const l=a instanceof Error?a:new Error(a);if(t==null||t(l),i.throwError)throw l;return l}finally{n==null||n(!1)}};class Js{static async get(t,n){return Zi(t,{...n,method:"GET"})}static async post(t,n){return Zi(t,{...n,method:"POST"})}static async put(t,n){return Zi(t,{...n,method:"PUT"})}static async patch(t,n){return Zi(t,{...n,method:"PATCH"})}static async delete(t,n){return Zi(t,{...n,method:"DELETE"})}}var xu=(e=>(e.Projects="projects",e.Settings="settings",e))(xu||{}),F0=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(F0||{});const um={},QA=1,e3=(e={})=>new Promise((t,n)=>{const s=(e==null?void 0:e.db)||"gjs",r=s==="gjs-studio"?QA:1,o=um[s];if(o)t(o);else{if(!is())return n(new Error("window context not found"));const i=window.indexedDB.open(s,r);i.onerror=n,i.onsuccess=()=>{const a=i.result;a.onerror=n,um[s]=a,t(a)},i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains("projects")||a.createObjectStore("projects"),a.objectStoreNames.contains("settings")||a.createObjectStore("settings")}}}),bg=async(e,t)=>(await e3(t)).transaction([e],"readwrite").objectStore(e),t3=async(e,t)=>{const n=await bg(e,t);return new Promise((s,r)=>{const o=[],i=n.openCursor();i.onerror=r,i.onsuccess=function(a){const u=a.target.result;if(u){const d=u.primaryKey,p=u.value;o.push({key:d,data:p}),u.continue()}else s(o)}})},n3=async(e,t,n)=>{const s=await bg(e,n);return new Promise((r,o)=>{const i=s.get(t);i.onerror=o,i.onsuccess=()=>r(i.result)})},s3=async(e,t,n)=>{const s=await bg(e,n);return new Promise((r,o)=>{const i=s.delete(t);i.onerror=o,i.onsuccess=()=>r()})};var Aa=(e=>(e.Existing="existing",e.Templates="templates",e))(Aa||{});const r3=e=>{const t=z3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},o3=(e,t)=>Js.get(r3(e),{...t}),i3=async e=>{try{const t=await o3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},B0=async(e=Et.web)=>typeof window>"u"?[]:(await t3(xu.Projects)).map(({key:s,data:r})=>{var o;return{id:`${s}`,name:`${((o=r.custom)==null?void 0:o.projectName)||s}`,data:r}}).filter(s=>{var r;return((r=s.data.custom)==null?void 0:r.projectType)===e}),z0=new Set,In=new WeakMap,hi=new WeakMap,Ro=new WeakMap,Rp=new WeakMap,a3=new WeakMap,Ei=new WeakMap,Ic=new WeakMap;let Kr;const xo="__aa_tgt",Ip="__aa_del",l3=e=>{const t=f3(e);t&&t.forEach(n=>g3(n))},c3=e=>{e.forEach(t=>{t.target===Kr&&d3(),In.has(t.target)&&Wo(t.target)})};function u3(e){const t=Rp.get(e);t==null||t.disconnect();let n=In.get(e),s=0;const r=5;n||(n=Pi(e),In.set(e,n));const{offsetWidth:o,offsetHeight:i}=Kr,l=[n.top-r,o-(n.left+r+n.width),i-(n.top+r+n.height),n.left-r].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++s>1&&Wo(e)},{root:Kr,threshold:1,rootMargin:l});u.observe(e),Rp.set(e,u)}function Wo(e){clearTimeout(Ic.get(e));const t=wu(e),n=typeof t=="function"?500:t.duration;Ic.set(e,setTimeout(()=>{const s=Ro.get(e);(!s||s.finished)&&(In.set(e,Pi(e)),u3(e))},n))}function d3(){clearTimeout(Ic.get(Kr)),Ic.set(Kr,setTimeout(()=>{z0.forEach(e=>G0(e,t=>U0(()=>Wo(t))))},100))}function p3(e){setTimeout(()=>{a3.set(e,setInterval(()=>U0(Wo.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function U0(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Vp,di;typeof window<"u"&&(Kr=document.documentElement,Vp=new MutationObserver(l3),di=new ResizeObserver(c3),di.observe(Kr));function f3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Sd(n.target),!t.has(n.target)){t.add(n.target);for(let s=0;s<n.target.children.length;s++){const r=n.target.children.item(s);if(r){if(Ip in r)return!1;Sd(n.target,r),t.add(r)}}}if(n.removedNodes.length)for(let s=0;s<n.removedNodes.length;s++){const r=n.removedNodes[s];if(Ip in r)return!1;r instanceof Element&&(t.add(r),Sd(n.target,r),hi.set(r,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Sd(e,t){!t&&!(xo in e)?Object.defineProperty(e,xo,{value:e}):t&&!(xo in t)&&Object.defineProperty(t,xo,{value:e})}function g3(e){var t;const n=Kr.contains(e),s=In.has(e);n&&hi.has(e)&&hi.delete(e),Ro.has(e)&&((t=Ro.get(e))===null||t===void 0||t.cancel()),s&&n?h3(e):s&&!n?b3(e):m3(e)}function Ls(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Pi(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function W0(e,t,n){let s=t.width,r=t.height,o=n.width,i=n.height;const a=getComputedStyle(e);if(a.getPropertyValue("box-sizing")==="content-box"){const u=Ls(a.paddingTop)+Ls(a.paddingBottom)+Ls(a.borderTopWidth)+Ls(a.borderBottomWidth),d=Ls(a.paddingLeft)+Ls(a.paddingRight)+Ls(a.borderRightWidth)+Ls(a.borderLeftWidth);s-=d,o-=d,r-=u,i-=u}return[s,o,r,i].map(Math.round)}function wu(e){return xo in e&&Ei.has(e[xo])?Ei.get(e[xo]):{duration:250,easing:"ease-in-out"}}function G0(e,...t){t.forEach(n=>n(e,Ei.has(e)));for(let n=0;n<e.children.length;n++){const s=e.children.item(n);s&&t.forEach(r=>r(s,Ei.has(s)))}}function h3(e){const t=In.get(e),n=Pi(e);let s;if(!t)return;const r=wu(e);if(typeof r!="function"){const o=t.left-n.left,i=t.top-n.top,[a,l,u,d]=W0(e,t,n),p={transform:`translate(${o}px, ${i}px)`},f={transform:"translate(0, 0)"};a!==l&&(p.width=`${a}px`,f.width=`${l}px`),u!==d&&(p.height=`${u}px`,f.height=`${d}px`),s=e.animate([p,f],r)}else s=new Animation(r(e,"remain",t,n)),s.play();Ro.set(e,s),In.set(e,n),s.addEventListener("finish",Wo.bind(null,e))}function m3(e){const t=Pi(e);In.set(e,t);const n=wu(e);let s;typeof n!="function"?s=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(s=new Animation(n(e,"add",t)),s.play()),Ro.set(e,s),s.addEventListener("finish",Wo.bind(null,e))}function b3(e){if(!hi.has(e)||!In.has(e))return;const[t,n]=hi.get(e);Object.defineProperty(e,Ip,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[s,r,o,i]=v3(e),a=wu(e),l=In.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${r}px`,width:`${o}px`,height:`${i}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof a!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:a.duration,easing:"ease-out"}):(u=new Animation(a(e,"remove",l)),u.play()),Ro.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),In.delete(e),hi.delete(e),Ro.delete(e),(d=Rp.get(e))===null||d===void 0||d.disconnect()})}function v3(e){const t=In.get(e),[n,,s]=W0(e,t,Pi(e));let r=e.parentElement;for(;r&&(getComputedStyle(r).position==="static"||r instanceof HTMLBodyElement);)r=r.parentElement;r||(r=document.body);const o=getComputedStyle(r),i=In.get(r)||Pi(r),a=Math.round(t.top-i.top)-Ls(o.borderTopWidth),l=Math.round(t.left-i.left)-Ls(o.borderLeftWidth);return[a,l,n,s]}function y3(e,t={}){Vp&&di&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),G0(e,Wo,p3,n=>di==null?void 0:di.observe(n)),typeof t=="function"?Ei.set(e,t):Ei.set(e,{duration:250,easing:"ease-in-out",...t}),Vp.observe(e,{childList:!0}),z0.add(e))}function x3(e){const t=g.useRef(null);return g.useEffect(()=>{t.current instanceof HTMLElement&&y3(t.current,e)},[t]),t}const w3={[un.Info]:z.bgA,[un.Error]:"bg-red-500",[un.Success]:"bg-green-500",[un.Warning]:"bg-orange-400"},S3=Yt(function(t,n){const s={[un.Info]:K.informationVariant,[un.Error]:K.fire,[un.Success]:K.checkBold,[un.Warning]:K.alertRhombus},{children:r,className:o,content:i,id:a,buttons:l=[],variant:u=un.Info,autoHideTimeout:d=3e3}=t,p=g.useRef(null),f=g.useRef(),h=s[u],m=w3[u];g.useImperativeHandle(n,()=>p.current,[]);const b=()=>{var w;return(w=t.onDismiss)==null?void 0:w.call(t,a)},v=()=>{d&&(f.current=setTimeout(b,d))},x=()=>f.current&&clearTimeout(f.current);g.useEffect(()=>(v(),x),[]);const y=i||r;return c.jsx(os,{className:le(o,"overflow-hidden relative"),ref:p,onPointerEnter:x,onPointerLeave:v,children:c.jsxs(k,{space:"m",items:"center",className:le(Pe.y),children:[c.jsx(D,{className:le(m,se.pill,"text-white gjs-p-1"),children:c.jsx(ne,{icon:h,size:oe.s})}),c.jsx(D,{grow:!0,className:le("gjs-pr-3"),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(D,{className:le("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(D,{className:le(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx(k,{space:"m",justify:"end",children:l.map(({id:w,...S})=>c.jsx(Qe,{...S},w))})]})}),c.jsx(D,{className:le("absolute top-1 right-1"),children:c.jsx(St,{onClick:b,border:!1,children:c.jsx(ne,{icon:K.close,size:oe.s})})})]})})});ue(Yt(function({className:t,toasts:n,onDismiss:s,...r},o){const i=x3({});return c.jsx("div",{className:le(t,"w-80 gs-utl-z-30"),...r,ref:i,children:n.map(a=>c.jsx(S3,{...a,className:le("gjs-mb-2"),onDismiss:s},a.uuid||a.id))})}));var Hp=(e=>(e.self="self",e.cloud="cloud",e))(Hp||{}),Oo=(e=>(e.image="image",e.video="video",e))(Oo||{}),us=(e=>(e.componentOutline="componentOutline",e.preview="preview",e.fullscreen="fullscreen",e.showCode="showCode",e.showImportCode="showImportCode",e.clearCanvas="clearCanvas",e.store="store",e.undo="undo",e.redo="redo",e))(us||{}),vg=(e=>(e.canvas="canvas",e.layers="layers",e))(vg||{}),Nr=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Nr||{}),Wt=(e=>(e.variable="data-variable",e.condition="data-condition",e.conditionTrue="data-condition-true-content",e.conditionFalse="data-condition-false-content",e.collection="data-collection",e.collectionItem="data-collection-item",e))(Wt||{}),Dp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(Dp||{});const Ma=e=>e.replaceAll('"',"").replaceAll("'",""),Io=e=>e.includes(",")?e:/\s/.test(e)?`'${Ma(e)}'`:Ma(e),dm=(e,t,n)=>({family:e,variant:t,...n}),da=(e,t)=>{e=Io(e);const{menuVariant:n,variants:s}=t;return{family:e,familyLabel:Ma(e),menuVariant:n&&dm(Io(`menuFont-${Ma(e)}`),"regular",n),variants:Object.assign({},...Object.entries(s).map(([r,o])=>({[r]:dm(e,r,o)})))}},yg=(e,t)=>{var a;const n=da(e.family,e),s=n.menuVariant??((a=Object.values(n.variants))==null?void 0:a[0]);if(!s)return"Arial, Helvetica, sans-serif";const{source:r,descriptors:o}=s,i=Ma(s.family);if(!t){const l=new FontFace(i,`url("${r}")`,o),u=Array.from(document.fonts.values()).filter(d=>d.family===i);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return Io(i)},Ms=", sans-serif",pm=["Arial, Helvetica"+Ms,"Arial Black, Gadget"+Ms,"Brush Script MT"+Ms,"Comic Sans MS, cursive"+Ms,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Ms,"Impact, Charcoal"+Ms,"Lucida Sans Unicode, Lucida Grande"+Ms,"Tahoma, Geneva"+Ms,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Ms,"Verdana, Geneva"+Ms].map(e=>({id:e,label:e.split(",")[0]})),C3=String.raw,sr=(e,t)=>{if(!t)return"";const n=e[0],s=e[1];return`${n}${t}${s}`},j3=({family:e,source:t,descriptors:n})=>{const{display:s,ascentOverride:r,descentOverride:o,featureSettings:i,lineGapOverride:a,stretch:l,style:u,unicodeRange:d,weight:p}=n??{},f=[sr`font-ascent-override: ${r};`,sr`font-display: ${s};`,sr`font-descent-override: ${o};`,sr`font-feature-settings: ${i};`,sr`font-line-gap-override: ${a};`,sr`font-stretch: ${l};`,sr`font-style: ${u};`,sr`font-unicode-range: ${d};`,sr`font-weight: ${p};`].filter(Boolean);return C3`
25
25
  @font-face {
26
26
  font-family: ${e};
27
27
  src: url('${t}');
28
28
  ${f.join(`
29
29
  `)}
30
30
  }
31
- `},V0=(e={})=>{const t=Object.entries(e).map(([s,r])=>ca(s,r));let n="";for(const s of t)for(const r of Object.values(s.variants))n+=l3(r)+`
32
- `;return n.trim()},H0="data-project-fonts",D0="true",c3=`${H0}="${D0}"`,F0=(e={})=>{const t=V0(e);return t?`<style ${c3}>
31
+ `},q0=(e={})=>{const t=Object.entries(e).map(([s,r])=>da(s,r));let n="";for(const s of t)for(const r of Object.values(s.variants))n+=j3(r)+`
32
+ `;return n.trim()},K0="data-project-fonts",Z0="true",E3=`${K0}="${Z0}"`,Y0=(e={})=>{const t=q0(e);return t?`<style ${E3}>
33
33
  ${t}
34
- </style>`:""},u3=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),d3=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),am=e=>!!e.id,Qo=e=>t=>(t.tagName||"").toLowerCase()===e,Ms=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),p3=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},hi=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},qr=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},ll=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},cl=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},f3=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),Rp=(e,t,n="html")=>{const{Pages:s}=e,r=an({page:t,key:"slug"})??"";return`${s.getMain()===t?"index":Kc(r||t.getName())}.${n}`},h3=(e,t)=>{const{toolbar:n}=e;n.some(r=>r.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},Nc="custom-html-body",$c="data-custom-html-body",lm="data-global-custom-html-head",cm="data-global-custom-html-body",um="global",g3=function(e,t){const n=r=>{if(!r)return e.em.logError("loadGlobalHead: document not found");const o=Ip(t.appStore);let i=r.querySelector(`[${lm}]`);i||(i=r.createElement("div"),i.setAttribute(lm,"true"),r.head.insertBefore(i,r.head.firstChild));const a=F0(o.fonts),l=o.customCodeHead,u=[a,l].filter(d=>!!d).join(`
35
- `);i.innerHTML=u,lg(i)},s=r=>{if(!r)return e.em.logError("loadGlobalBody: document not found");const o=Ip(t.appStore);let i=r.querySelector(`[${cm}]`);if(!i){i=r.createElement("div"),i.setAttribute(cm,"true");const a=r.querySelector('[data-gjs-type="wrapper"]');a==null||a.appendChild(i)}i.innerHTML=o.customCodeBody||"",lg(i)};e.on(e.Canvas.events.frameLoad,r=>{var o;return n((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(e.Canvas.events.frameLoadBody,r=>{var o;return s((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(Hn.pageSettingsUpdate,r=>{var i,a;if(r.page)return;const o=(a=(i=e.Canvas.getFrames()[0])==null?void 0:i.view)==null?void 0:a.getDoc();n(o),s(o)}),e.Components.addType(Nc,{isComponent:r=>ll(r,$c),model:{defaults:{attributes:{[$c]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:r}=t,{globalPageSettings:o}=r.projectDataCustom;let i=(o==null?void 0:o.customCodeHead)||"",a=(o==null?void 0:o.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),p=[];d.forEach(m=>{m.has(um)&&p.push(m)}),p.forEach(m=>{const v=m.toHTML();i.includes(v)||(i+=v),m.remove()});const f=[];u.findType(Nc).forEach(m=>{m.has(um)&&f.push(m)}),f.forEach(m=>{const v=m.getInnerHTML();a.includes(v)||(a+=v),m.remove()})}),(i||a)&&r.setProjectDataCustom({globalPageSettings:{...o,customCodeHead:i,customCodeBody:a}})})},Oa="page://",bu="href-params__",m3=`data-gjs-${bu}`,yu=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},xu=e=>!!yu(e),dm=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},v3=e=>!!(e!=null&&e.Components.getType("mjml")),B0=e=>xu(e)?K.database:gh(e)?K.home:"",z0=e=>!!e.getSymbolOverride()?c.jsx(se,{icon:K.rhombusOutline,size:oe.s3x}):c.jsx(Nb,{className:M("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),U0=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},gh=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},ft={title:({cmp:e})=>e.tagName==="title",favicon:({cmp:e})=>{var t;return e.tagName==="link"&&((t=e.attributes.attributes)==null?void 0:t.rel)==="icon"},description:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="description"},keywords:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="keywords"},socialTitle:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:title"},socialImage:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:image"},socialDescription:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:description"},charset:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.charset)},viewport:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="viewport"},robots:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="robots"},generator:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="generator"}},W0=e=>{for(const t in ft){const n=t;if(ft[n]({cmp:e}))return n}},G0=(e,t,n)=>{const s=[];let r=n;return e.getMainComponent().findType(Nc).forEach(o=>{s.push(o),r=(r||"")+o.getInnerHTML()}),{components:s,html:r,changed:r!==t}},b3=(e,t)=>{const n={...t},s=e.getMainComponent(),{head:r}=s;if(r){const i=[],a=r.components();a.forEach(u=>{ft.title({cmp:u})?(u.components(t.title),delete n.title):ft.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):ft.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):ft.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):ft.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):ft.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):ft.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):W0(u)||i.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(a.remove(i),l.head.components&&a.add(l.head.components),delete n.customCodeHead)}const o=G0(e,n.customCodeBody);if(o.changed){const[i,...a]=o.components;(i||s.append({type:Nc})[0]).components(n.customCodeBody),a.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},y3=(e,t={})=>{var o;const n={...e.get("settings")??{}},s=e.getMainComponent(),{head:r}=s;if(r){const i=[];r.components().forEach(a=>{const{content:l,href:u}=a.getAttributes({noClass:!0,noStyle:!0});ft.title({cmp:a})?n.title=a.getInnerHTML():ft.favicon({cmp:a})?n.favicon=u:ft.description({cmp:a})?n.description=l:ft.keywords({cmp:a})?n.keywords=l:ft.socialTitle({cmp:a})?n.socialTitle=l:ft.socialDescription({cmp:a})?n.socialDescription=l:ft.socialImage({cmp:a})?n.socialImage=l:W0(a)||i.push(a.toHTML())}),i.length&&(n.customCodeHead=i.join(`
36
- `))}if(n.customCodeBody=G0(e,n.customCodeBody).html,t.replaceDataSources&&yu(e)){const{currentItem:i}=((o=s.getCollectionsState)==null?void 0:o.call(s))||{};i&&Object.keys(n).forEach(a=>{const l=a,u=n[l];dt(u)&&(n[l]=q0(u,i))})}return n},q0=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,s)=>{const r=t[s.trim()];return r!==void 0?String(r):""}),K0=(e,t={})=>{const{currentItem:n}=t,s=t.ext??"html",r=an({page:e,key:"slug"})??"",o=n?q0(r,n):r,i=o.lastIndexOf("/"),a=i>=0,l=a?o.substring(i+1):o,u=a?o.substring(0,i):void 0,d=`${Kc(l)}${s?`.${s}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},x3=(e,t)=>e.get(`${bu}${t}`)||"",w3=(e,t,n)=>{e.set({[`${bu}${t}`]:n})},S3=(e,t)=>{Object.entries(t).forEach(([n,s])=>{e[`${m3}${n}`]=s})},C3=(e,t)=>{e.getModel().set("customData",{...Ei(e),...t})},Ei=e=>e.getModel().get("customData")??{},Ip=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},an=e=>{const{page:t,key:n,appEditorStore:s,def:r,defPage:o,opts:i}=e;return t?y3(t,i)[n]??o:Ip(s)[n]??r},Tr=(e,t,n)=>{const s=e.em.getEditor(),o=Ei(s).globalPageSettings||{};return an({page:e,key:t,opts:n})||o[t]},pm=(e,t)=>{const n=(e==null?void 0:e.getName())??"",s={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:an({...s,key:"slug",defPage:Kc(n)}),title:an({...s,key:"title",defPage:n}),description:an({...s,key:"description"}),favicon:an({...s,key:"favicon"}),keywords:an({...s,key:"keywords"}),socialTitle:an({...s,key:"socialTitle",defPage:n}),socialImage:an({...s,key:"socialImage"}),socialDescription:an({...s,key:"socialDescription"}),customCodeHead:an({...s,key:"customCodeHead"}),customCodeBody:an({...s,key:"customCodeBody"})}},kl=({icon:e,layout:t,tooltip:n,className:s,forceRemove:r,removeLayouts:o})=>({type:"button",icon:e,tooltip:n,className:s,size:"s",editorEvents:{[`${Hn.layoutToggleId}${t.id}`]:({fromEvent:i,setState:a})=>{a({active:i.isOpen})}},onClick:({editor:i})=>{o==null||o.forEach(a=>i.runCommand(ne.layoutRemove,{id:a,force:r})),i.runCommand(ne.layoutToggle,{...t})}}),fm={type:"static",layoutId:"leftPanelsContainer"},hm={width:240,overflow:"hidden"};kl({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:hm,placer:fm}}),kl({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:hm,placer:fm}}),kl({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),kl({icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,10.11C13.03,10.11 13.87,10.95 13.87,12C13.87,13 13.03,13.85 12,13.85C10.97,13.85 10.13,13 10.13,12C10.13,10.95 10.97,10.11 12,10.11M7.37,20C8,20.38 9.38,19.8 10.97,18.3C10.45,17.71 9.94,17.07 9.46,16.4C8.64,16.32 7.83,16.2 7.06,16.04C6.55,18.18 6.74,19.65 7.37,20M8.08,14.26L7.79,13.75C7.68,14.04 7.57,14.33 7.5,14.61C7.77,14.67 8.07,14.72 8.38,14.77C8.28,14.6 8.18,14.43 8.08,14.26M14.62,13.5L15.43,12L14.62,10.5C14.32,9.97 14,9.5 13.71,9.03C13.17,9 12.6,9 12,9C11.4,9 10.83,9 10.29,9.03C10,9.5 9.68,9.97 9.38,10.5L8.57,12L9.38,13.5C9.68,14.03 10,14.5 10.29,14.97C10.83,15 11.4,15 12,15C12.6,15 13.17,15 13.71,14.97C14,14.5 14.32,14.03 14.62,13.5M12,6.78C11.81,7 11.61,7.23 11.41,7.5C11.61,7.5 11.8,7.5 12,7.5C12.2,7.5 12.39,7.5 12.59,7.5C12.39,7.23 12.19,7 12,6.78M12,17.22C12.19,17 12.39,16.77 12.59,16.5C12.39,16.5 12.2,16.5 12,16.5C11.8,16.5 11.61,16.5 11.41,16.5C11.61,16.77 11.81,17 12,17.22M16.62,4C16,3.62 14.62,4.2 13.03,5.7C13.55,6.29 14.06,6.93 14.54,7.6C15.36,7.68 16.17,7.8 16.94,7.96C17.45,5.82 17.26,4.35 16.62,4M15.92,9.74L16.21,10.25C16.32,9.96 16.43,9.67 16.5,9.39C16.23,9.33 15.93,9.28 15.62,9.23C15.72,9.4 15.82,9.57 15.92,9.74M17.37,2.69C18.84,3.53 19,5.74 18.38,8.32C20.92,9.07 22.75,10.31 22.75,12C22.75,13.69 20.92,14.93 18.38,15.68C19,18.26 18.84,20.47 17.37,21.31C15.91,22.15 13.92,21.19 12,19.36C10.08,21.19 8.09,22.15 6.62,21.31C5.16,20.47 5,18.26 5.62,15.68C3.08,14.93 1.25,13.69 1.25,12C1.25,10.31 3.08,9.07 5.62,8.32C5,5.74 5.16,3.53 6.62,2.69C8.09,1.85 10.08,2.81 12,4.64C13.92,2.81 15.91,1.85 17.37,2.69M17.08,12C17.42,12.75 17.72,13.5 17.97,14.26C20.07,13.63 21.25,12.73 21.25,12C21.25,11.27 20.07,10.37 17.97,9.74C17.72,10.5 17.42,11.25 17.08,12M6.92,12C6.58,11.25 6.28,10.5 6.03,9.74C3.93,10.37 2.75,11.27 2.75,12C2.75,12.73 3.93,13.63 6.03,14.26C6.28,13.5 6.58,12.75 6.92,12M15.92,14.26C15.82,14.43 15.72,14.6 15.62,14.77C15.93,14.72 16.23,14.67 16.5,14.61C16.43,14.33 16.32,14.04 16.21,13.75L15.92,14.26M13.03,18.3C14.62,19.8 16,20.38 16.62,20C17.26,19.65 17.45,18.18 16.94,16.04C16.17,16.2 15.36,16.32 14.54,16.4C14.06,17.07 13.55,17.71 13.03,18.3M8.08,9.74C8.18,9.57 8.28,9.4 8.38,9.23C8.07,9.28 7.77,9.33 7.5,9.39C7.57,9.67 7.68,9.96 7.79,10.25L8.08,9.74M10.97,5.7C9.38,4.2 8,3.62 7.37,4C6.74,4.35 6.55,5.82 7.06,7.96C7.83,7.8 8.64,7.68 9.46,7.6C9.94,6.93 10.45,6.29 10.97,5.7Z" /></svg>',tooltip:"Custom Component",className:"gs-utl-mt-auto",layout:{id:"customLayout",layout:{type:"custom",component:()=>c.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const j3={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var E3={NODE_ENV:"production"};class P3{constructor(t,n){var o,i;this.projectType=jt.web,this.editor=void 0,this.sdkProps={},this.sdkLicenseError="",this.licenseCheckRetry=0,this.showPoweredBy=!1,this.isInPreview=!1,this.isCssPanelActive=!1,this.isLeftSidebarOpen=!0,this.isRightSidebarOpen=!0,this.isTopSidebarOpen=!0,this.isBottomSidebarOpen=!0,this.isSelectingTarget=!1,this.leftSidebarSize=240,this.rightSidebarSize=240,this.transitionTime=152,this.topBarSize=36,this.isDev=!1,this.isStage=!1,this.editorKey=0,this.appInstalled=!1,this.licenseKey="",this.licenseCheckStarted=!1,this.studioSdkVersion=E3.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(a=>{const l=a,u=n[l];u!==void 0&&(this[l]=u)});const s=os()?window.location.search:"";this.queryParams=CS(s),hn(this,{sdkProps:!1},{autoBind:!0});const r=(i=(o=this.sdkProps.options)==null?void 0:o.customTheme)==null?void 0:i.icons;r&&DE(r)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return mf({isDev:t,isStage:n})}get projectId(){var s,r;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((r=(s=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:s.custom)==null?void 0:r.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:s}=this,{customConfig:r}=s.layoutStore,o=(r==null?void 0:r.responsive)||(t==null?void 0:t.responsive);let i=(r==null?void 0:r.default)||(t==null?void 0:t.default)||j3;if(n&&o){const l=Object.keys(o).map(Number).sort((u,d)=>u-d).find(u=>n<=u);i=l?o[l]:i}return i}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===jt.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,s=this.sdkIdentityId;if(!n||!s)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===kp.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===kp.cloud}get publicStateTheme(){const{theme:t,resolvedTheme:n}=this.store.localSettingsStore;return{theme:t,resolvedTheme:n}}setPublicStateTheme(t){t.theme!==void 0&&(this.store.localSettingsStore.theme=t.theme)}*init(){var p,f;const{store:t,sdkOptions:n}=this,{lastProjectId:s,lastProjectType:r}=t.localSettingsStore,o=(p=n.project)==null?void 0:p.default,{project:i}=n.storage||{};let a,l;r&&(this.store.templatesStore._projectTypeFilter=r),s&&(a=(f=(yield N0(r)).find(m=>m.id===s))==null?void 0:f.data),a?l=a:i?l=i:o&&(l=o);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:s,data:r,isTemplate:o}=t,i=n.Storage.getConfig().options.local,a=o?`${s}__${jS()}`:s;this._projectId=a,i.key=a,SS(r)||this.loadProjectData({...r,custom:{...r.custom,id:a,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||jt.web,this.editor&&C3(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(T3(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const s=this.editor;s.loadProjectData(t),s.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:s,studioSdkVersion:r}=this;t==null||t.trigger(rS,{baseApiUrl:s});const o=yield Zs.post(`${s}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:r}});if(o instanceof Error)throw o;const i=o.result||{},{license:a,error:l,plan:u,info:d}=i;this.licensePlan=u,this.loadsInfo=d,l?this.sdkLicenseError=l:(this.sdkLicense=a,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(dp,i)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(dp,{}))}}*updateStudio(){const{pluginStore:t}=this.store,{projectType:n}=this.projectDataCustom;yield t.initProjectPlugins(n),this.setEditor(),this.editorKey++}refreshStudio(){var t;this.editorKey&&(this.setNextProjectData((t=this.editor)==null?void 0:t.getProjectData()),this.store.layoutStore.clear(),this.setEditor(),this.editorKey++)}refreshEditorCanvas(){var t;(t=this.editor)==null||t.refresh({tools:!0})}}const T3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||jt.web},xe=()=>En().appEditorStore,Z0=()=>ng().appEditorStore,O3=()=>{try{return ng().appEditorStore}catch{}},mh=()=>{const[e,t]=h.useState(0),n=En().appEditorStore,{transitionTime:s}=n;return h.useEffect(()=>{setTimeout(()=>t(r=>++r),s)},[s]),[e]},vh=()=>{const{baseApiUrl:e}=Z0();return`${e}/assets/sdk`},_3=e=>`${vh()}/${e}`,A3=async(e,t,n)=>{const s=await Zs.get(vh(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((s==null?void 0:s.result)??[]).map(({asset:r,cdnUrl:o})=>({...r,size:parseInt(r.size),src:o}))},L3=async(e,t,n,s)=>{const r=await Zs.post(vh(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},M3=async(e,t)=>await Zs.put(t,{body:e,rawText:!0}),N3=async(e,t,n,s)=>Promise.all(e.map(r=>L3({name:r.name,size:r.size,type:r.type},t,n,s).then(async o=>{if(!o)throw new Error("No asset");const{asset:i,cdnUrl:a,uploadUrl:l}=o,u=await M3(r,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...i,size:parseInt(i.size),src:a,type:To.image}}))),$3=async(e,t,n,s)=>{const r=await Zs.delete(_3(e),{body:JSON.stringify({projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},gm=async(e,t,n,s)=>Promise.all(e.map(r=>$3(r.id||r.src,t,n,s)));function Rr(e,t,n){let s,r,o,i,a;const l=t===void 0?100:t;function u(){const p=Date.now()-i;p<l&&p>=0?s=setTimeout(u,l-p):(s=null,a=e.apply(o,r),o=r=null)}const d=function(){return o=this,r=arguments,i=Date.now(),s||(s=setTimeout(u,l)),a};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(a=e.apply(o,r),o=r=null,clearTimeout(s),s=null)},d}class mm{constructor(t,n){this.assetsStore=t,this.layoutPanelId=n,this.itemLayout=void 0,this.isLoadingAssets=!1,this.typeFilter=void 0,this.searchValue="",this.customTypes=void 0,this.customProviders=void 0,this.providerFilter=void 0,this.customAssetProps=void 0,this.customPages=void 0,this.totalItems=void 0,this.optionalType=!1,this.optionalProvider=!0,hn(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Rr(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(s=>s.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter(To.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var a,l,u,d;const{assetsStore:n}=this,{editor:s}=n;if(!s||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const r=((a=this.customPages)==null?void 0:a.length)??0,o=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,i=await this.provider.onLoad({editor:s,assetTypeFilter:this.typeFilter,pageIndex:r,searchValue:this.searchValue,pageCustomData:o})??[];if(Array.isArray(i)){const p=i.map(n.toAssetProps);this.setCustomAssetProps(p)}else{const p={...i,items:i.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],p])}this.setItemLayout((d=this.provider)==null?void 0:d.itemLayout)}async loadAssets(t=!0){const{assetsStore:n}=this,{toastStore:s}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(r){console.error(r),s.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:s}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&s&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:s}=this,{appEditorStore:r}=n.store,{editor:o}=r;if(!(!o||!s))try{n.setIsLoadingAssets(!0),await s({assets:[n.toAsset(t)],assetProps:[t],editor:o,loadAssets:i=>this.reloadAssets(i)})}catch(i){console.error(i),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:i==null?void 0:i.message})}finally{n.setIsLoadingAssets(!1)}}}const Y0=e=>En().assetsStore.assetPanelStores[e];class k3{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${L0()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new mm(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),hn(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===$p.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===$p.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,r=n.options.licenseKey,o=t.sdkProjectId,i=t.sdkIdentityId,a=({files:l})=>N3(l,r,o,i);return this.isUsingAssetCloud?a:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:s}=this;return n?t?async r=>{await t(r),this.deleteFromProjectAssets(r)}:void 0:s?async r=>{var l,u;const{sdkOptions:o}=this.store.appEditorStore,i=(l=o.project)==null?void 0:l.id,a=(u=o.identity)==null?void 0:u.id;await gm(r.assetProps,o.licenseKey,i,a),this.deleteFromProjectAssets(r)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var a,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,s=(a=n.project)==null?void 0:a.id,r=(l=n.identity)==null?void 0:l.id,o=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:To.image,onLoad:()=>A3(o,s,r),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await gm(d,o,s,r),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=Rr(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const s=n.Assets.events.all;n.on(s,t),this.loadProjectAssets()}addSdkProviders(){var s;const t=((s=this.sdkAssetConfig)==null?void 0:s.providers)??[],n=tt(t)?t({providers:us(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const s=[...this.allProviders];let r=this.allProviders.findIndex(i=>i.id===t.id);const o=r!==-1;s.splice(n,0,t),o&&(r>=n&&(r+=1),s.splice(r,1)),this.setAllProviders(s)}hasType(t){return!!this.allProviders.find(n=>dt(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new mm(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:s,customOnLoad:r}=this,{toastStore:o}=this.store;let i;if(t){try{if(this.setIsLoadingAssets(!0),n&&r)if(s)i=s;else{const a=await r({editor:t});this.cachedOnLoadAssetProps=a.map(this.toAssetProps),i=this.cachedOnLoadAssetProps}else i=t.Assets.getAll().map(this.toAssetProps)}catch(a){console.error(a),o.addError("assets-error-load",{header:this.t("errorLoad"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}i&&this.setProjectAssetProps(i)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:s}){const{cachedOnLoadAssetProps:r,customOnLoad:o}=this;if(o){if(r){const i=s.map(a=>a.id);this.cachedOnLoadAssetProps=r.filter(({id:a})=>!i.includes(a)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(i=>n.Assets.remove(i)),dm(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:s,customOnLoad:r}=this;r?s&&(this.cachedOnLoadAssetProps=[...t,...s],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),dm(n))}async handleUpload(t){var o,i;const{editor:n,onCloudOrCustomUpload:s}=this,{toastStore:r}=this.store;if(!(!n||!s))try{this.setIsLoadingAssets(!0);const a=((o=t.dataTransfer)==null?void 0:o.files)||((i=t.target)==null?void 0:i.files)||[],l=Array.from(a),u=await s({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(a){console.error(a),r.addError("assets-error-upload",{header:this.t("errorUpload"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const s=t;return{...s.attributes,id:s.attributes.id||s.getSrc(),src:s.getSrc(),name:s.attributes.name??s.getFilename(),type:s.attributes.type??s.getType()??To.image,asset:s}}return{...t,type:t.type||To.image,id:t.id||t.src}}toAsset(t){const{editor:n}=this.store.appEditorStore;if(n)return t.asset??new n.AssetManager.Asset(t)}setProjectAssetProps(t){this.projectAssetProps=t}setIsLoadingAssets(t){this.isLoadingAssets=t}setAllProviders(t){this.allProviders=t}}const ul=()=>En().assetsStore;class R3{constructor(t){var s;this.store=t,this.fonts={},hn(this,{},{autoBind:!0});const n=(s=this.sdkFontOptions)==null?void 0:s.default;this.sdkDefaultFonts=tt(n)?n({baseDefault:im}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>dt(t)?{id:t,label:t}:am(t)?t:null).filter(t=>!!t):im}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!dt(n)&&!am(n)).map(n=>ca(n.family,n)):[]}get sortedFonts(){return u3(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return d3([...this.staticFonts,...Object.values(this.fonts).map(t)])}get sdkFontOptions(){return this.store.appEditorStore.sdkOptions.fonts}get enableFontManager(){var t;return(t=this.sdkFontOptions)==null?void 0:t.enableFontManager}get sdkShowProjectFonts(){const{showProjectFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=Ei(t)??{},{fonts:s}=n??{};if(s)for(const[r,o]of Object.entries(s)){const i=ca(r,o);this.addFont(i,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=Ro(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:s=!0}={}){const r=ca(t.family,t),{editor:o}=this.store.appEditorStore;if(!o)return;const{family:i}=r;!s&&this.fonts[i]||(this.fonts[i]=r,n||this.updateProjectFonts(o))}removeFont(t){t=Ro(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const s={...Ei(t).globalPageSettings,fonts:us(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:s}),U0(t),t.trigger(Hn.pageSettingsUpdate,{data:s})}}const dl=()=>En().fontsStore;class I3{constructor(t){this.store=t,hn(this,{},{autoBind:!0})}t(t,n={}){var r;const{editor:s}=this.store.appEditorStore;return((r=s==null?void 0:s.I18n)==null?void 0:r.t(t,n))||""}tScoped(t){return(n,s)=>this.t(`${t}.${n}`,s)}}const Ie=()=>En().i18nStore,Xn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),vm="gs-custom-layout",V3=Zt(function({className:t,component:n,noWrapper:s,id:r,render:o,componentProps:i,...a},l){const{editor:u}=xe(),d=h.useRef(null),p=n,f=p&&u?c.jsx(p,{...i,editor:u}):null,g=M(vm,r&&`${vm}__${r}`,t),m=s&&!o;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const v=d.current;if(!o||!v)return;const b=w=>v.appendChild(w),x=w=>v.removeChild(w),y=o({editor:u,addEl:b,removeEl:x});if(dt(y))v.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{x(y)};if(tt(y))return()=>{y()}}},[o,u,d.current]),m?f:c.jsx("div",{className:g,ref:d,...a,children:f})}),Vp=ce(V3),H3=(e,t,n)=>{const s=e==null?void 0:e[t];return s&&s({props:n.props,editor:n.editor})||n.props};class D3{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,hn(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}get layoutOverrides(){var s,r;const t=(s=this.store.appEditorStore.sdkLayoutConfig)==null?void 0:s.overrides,n=(r=this.customConfig)==null?void 0:r.overrides;return{...t,...n}}getOverrideProps(t,n){return H3(this.layoutOverrides,t,{props:n.props,editor:n.editor??this.editor})}add(t,n){var s;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(s=this.editor)==null||s.trigger(`${Hn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var r;const s=n==null?void 0:n.layout;s&&this.layouts.forEach(o=>{o.id===t&&Object.assign(o,s)}),this.layouts=n!=null&&n.force?this.layouts.filter(o=>o.id!==t):this.layouts.map(o=>o.id===t?{...o,toRemove:!0}:o),(r=this.editor)==null||r.trigger(`${Hn.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var s;const{children:t}=this.store.appEditorStore.sdkProps,n=((s=Xn(t,Vp))==null?void 0:s.filter(Boolean))||[];return new Map(n.map(({props:r})=>[r.id,r]))}}const wu=()=>En().layoutStore,F3=()=>ng().layoutStore;class B3{constructor(t){this.isActive=!1,this.content="",this.store=t,hn(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class z3{constructor(t){this.store=t,this._projectSourceFilter=Pa.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,hn(this,{},{autoBind:!0})}get projectTypeFilter(){return this._projectTypeFilter}get projectSourceFilter(){return this._projectSourceFilter}get templates(){return this._loadedTemplates}get projects(){return this._loadedProjects}get filteredTemplates(){return this.projectSourceFilter===Pa.Existing?this.projects:this.templates}async loadProjects(){const t=await N0(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var r;const t=(r=this.store.appEditorStore.sdkOptions.templates)==null?void 0:r.onLoad,n=async()=>await UA(this.projectTypeFilter);let s;if(t){const o=this.store.appEditorStore.editor;s=await t({editor:o,fetchCommunityTemplates:n})}else s=await n();this.setTemplates(s)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){FA(mu.Projects,t)}async setProjectTypeFilter(t){this._projectTypeFilter=t,this.setProjects(void 0),this.setTemplates(void 0)}setProjectSourceFilter(t){this._projectSourceFilter=t}setTemplates(t){this._loadedTemplates=t}setProjects(t){this._loadedProjects=t}}const X0=()=>En().templatesStore;class U3{constructor(t){this.toasts=[],this.store=t,hn(this,{},{autoBind:!0})}add(t,n){this.toasts.find(s=>s.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:un.Error})}addWarning(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:un.Warning})}addSuccess(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:un.Success})}addInfo(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:un.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class W3{constructor(t){this.isOpen=!1,this.store=t,hn(this,{},{autoBind:!0})}setOpen(t){this.isOpen=t,this.triggerEvent()}toggleOpen(){this.isOpen=!this.isOpen,this.triggerEvent()}triggerEvent(){var t;(t=this.store.appEditorStore.editor)==null||t.trigger(Hn.toggleBlocksPanel,{isOpen:this.isOpen})}}const G3=()=>En().blockManagerStore,J0=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",q3=J0+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",K3="["+J0+"]["+q3+"]*",Z3=new RegExp("^"+K3+"$");function Q0(e,t){const n=[];let s=t.exec(e);for(;s;){const r=[];r.startIndex=t.lastIndex-s[0].length;const o=s.length;for(let i=0;i<o;i++)r.push(s[i]);n.push(r),s=t.exec(e)}return n}const Su=function(e){const t=Z3.exec(e);return!(t===null||typeof t>"u")};function Y3(e){return typeof e<"u"}const X3={allowBooleanAttributes:!1,unpairedTags:[]};function J3(e,t){t=Object.assign({},X3,t);const n=[];let s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=ym(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=xm(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let l="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
37
- `&&e[o]!=="\r";o++)l+=e[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!i4(l)){let p;return l.trim().length===0?p="Invalid space after '<'.":p="Tag '"+l+"' is an invalid name.",Nt("InvalidTag",p,on(e,o))}const u=t4(e,o);if(u===!1)return Nt("InvalidAttr","Attributes for '"+l+"' have open quote.",on(e,o));let d=u.value;if(o=u.index,d[d.length-1]==="/"){const p=o-d.length;d=d.substring(0,d.length-1);const f=wm(d,t);if(f===!0)s=!0;else return Nt(f.err.code,f.err.msg,on(e,p+f.err.line))}else if(a)if(u.tagClosed){if(d.trim().length>0)return Nt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",on(e,i));if(n.length===0)return Nt("InvalidTag","Closing tag '"+l+"' has not been opened.",on(e,i));{const p=n.pop();if(l!==p.tagName){let f=on(e,p.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+l+"'.",on(e,i))}n.length==0&&(r=!0)}}else return Nt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",on(e,o));else{const p=wm(d,t);if(p!==!0)return Nt(p.err.code,p.err.msg,on(e,o-d.length+p.err.line));if(r===!0)return Nt("InvalidXml","Multiple possible root nodes found.",on(e,o));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:i}),s=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=xm(e,o);continue}else if(e[o+1]==="?"){if(o=ym(e,++o),o.err)return o}else break;else if(e[o]==="&"){const p=r4(e,o);if(p==-1)return Nt("InvalidChar","char '&' is not expected.",on(e,o));o=p}else if(r===!0&&!bm(e[o]))return Nt("InvalidXml","Extra text at the end",on(e,o));e[o]==="<"&&o--}}else{if(bm(e[o]))continue;return Nt("InvalidChar","char '"+e[o]+"' is not expected.",on(e,o))}if(s){if(n.length==1)return Nt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",on(e,n[0].tagStartPos));if(n.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0}function bm(e){return e===" "||e===" "||e===`
38
- `||e==="\r"}function ym(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return Nt("InvalidXml","XML declaration allowed only at the start of the document.",on(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function xm(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const Q3='"',e4="'";function t4(e,t){let n="",s="",r=!1;for(;t<e.length;t++){if(e[t]===Q3||e[t]===e4)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:r}}const n4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function wm(e,t){const n=Q0(e,n4),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return Nt("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",Ki(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return Nt("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",Ki(n[r]));if(n[r][3]===void 0&&!t.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",Ki(n[r]));const o=n[r][2];if(!o4(o))return Nt("InvalidAttr","Attribute '"+o+"' is an invalid name.",Ki(n[r]));if(!s.hasOwnProperty(o))s[o]=1;else return Nt("InvalidAttr","Attribute '"+o+"' is repeated.",Ki(n[r]))}return!0}function s4(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function r4(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,s4(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Nt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function o4(e){return Su(e)}function i4(e){return Su(e)}function on(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Ki(e){return e.startIndex+e[1].length}const a4={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},l4=function(e){return Object.assign({},a4,e)};let kc;typeof Symbol!="function"?kc="@@xmlMetadata":kc=Symbol("XML Node Metadata");class yo{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][kc]={startIndex:n})}static getMetaDataSymbol(){return kc}}class c4{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const s={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let r=1,o=!1,i=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!i){if(o&&ho(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(s[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(o&&ho(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(o&&ho(t,"!ATTLIST",n))n+=8;else if(o&&ho(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(ho(t,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[n]===">"){if(i?t[n-1]==="-"&&t[n-2]==="-"&&(i=!1,r--):r--,r===0)break}else t[n]==="["?o=!0:a+=t[n];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:n}}readEntityExp(t,n){n=vn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)s+=t[n],n++;if(Zi(s),n=vn(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let r="";return[n,r]=this.readIdentifierVal(t,n,"entity"),n--,[s,r,n]}readNotationExp(t,n){n=vn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;!this.suppressValidationErr&&Zi(s),n=vn(t,n);const r=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&r!=="SYSTEM"&&r!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);n+=r.length,n=vn(t,n);let o=null,i=null;if(r==="PUBLIC")[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),n=vn(t,n),(t[n]==='"'||t[n]==="'")&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(r==="SYSTEM"&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(t,n,s){let r="";const o=t[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<t.length&&t[n]!==o;)r+=t[n],n++;if(t[n]!==o)throw new Error(`Unterminated ${s} value`);return n++,[n,r]}readElementExp(t,n){n=vn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;if(!this.suppressValidationErr&&!Su(s))throw new Error(`Invalid element name: "${s}"`);n=vn(t,n);let r="";if(t[n]==="E"&&ho(t,"MPTY",n))n+=4;else if(t[n]==="A"&&ho(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)r+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:s,contentModel:r.trim(),index:n}}readAttlistExp(t,n){n=vn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;Zi(s),n=vn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!Zi(r))throw new Error(`Invalid attribute name: "${r}"`);n=vn(t,n);let o="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=vn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Zi(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),t[n]==="|"&&(n++,n=vn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=vn(t,n);let i="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:s,attributeName:r,attributeType:o,defaultValue:i,index:n}}}const vn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function ho(e,t,n){for(let s=0;s<t.length;s++)if(t[s]!==e[n+s+1])return!1;return!0}function Zi(e){if(Su(e))return e;throw new Error(`Invalid entity name ${e}`)}const u4=/^[-+]?0x[a-fA-F0-9]+$/,d4=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,p4={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function f4(e,t={}){if(t=Object.assign({},p4,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&u4.test(n))return v4(n,16);if(n.search(/.+[eE].+/)!==-1)return g4(e,n,t);{const s=d4.exec(n);if(s){const r=s[1]||"",o=s[2];let i=m4(s[3]);const a=r?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!a))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===i||u===`${r}${i}`?l:e;let d=o?i:n;return o?d===u||r+d===u?l:e:d===u||d===r+u?l:e}}else return e}}const h4=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function g4(e,t,n){if(!n.eNotation)return e;const s=t.match(h4);if(s){let r=s[1]||"";const o=s[3].indexOf("e")===-1?"E":"e",i=s[2],a=r?e[i.length+1]===o:e[i.length]===o;return i.length>1&&a?e:i.length===1&&(s[3].startsWith(`.${o}`)||s[3][0]===o)?Number(t):n.leadingZeros&&!a?(t=(s[1]||"")+s[3],Number(t)):e}else return e}function m4(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function v4(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function ey(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class b4{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=y4,this.parseXml=j4,this.parseTextData=x4,this.resolveNameSpace=w4,this.buildAttributesMap=C4,this.isItStopNode=O4,this.replaceEntitiesValue=P4,this.readStopNodeData=A4,this.saveTextToParentTag=T4,this.addChild=E4,this.ignoreAttributesFn=ey(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const s=this.options.stopNodes[n];typeof s=="string"&&(s.startsWith("*.")?this.stopNodesWildcard.add(s.substring(2)):this.stopNodesExact.add(s))}}}}function y4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function x4(e,t,n,s,r,o,i){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,r,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Dp(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Dp(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function w4(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const S4=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function C4(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=Q0(e,S4),r=s.length,o={};for(let i=0;i<r;i++){const a=this.resolveNameSpace(s[i][1]);if(this.ignoreAttributesFn(a,t))continue;let l=s[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(a,l,t);d==null?o[u]=l:typeof d!=typeof l||d!==l?o[u]=d:o[u]=Dp(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const j4=function(e){e=e.replace(/\r\n?/g,`
39
- `);const t=new yo("!xml");let n=t,s="",r="";const o=new c4(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const l=wo(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+2,l).trim();if(this.options.removeNSPrefix){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(s=this.saveTextToParentTag(s,n,r));const d=r.substring(r.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=r.lastIndexOf("."),r=r.substring(0,p),n=this.tagsNodeStack.pop(),s="",i=l}else if(e[i+1]==="?"){let l=Hp(e,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,r),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new yo(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,r,l.tagName)),this.addChild(n,u,r,i)}i=l.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const l=wo(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,l-2);s=this.saveTextToParentTag(s,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=l}else if(e.substr(i+1,2)==="!D"){const l=o.readDocType(e,i);this.docTypeEntities=l.entities,i=l.i}else if(e.substr(i+1,2)==="!["){const l=wo(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,l);s=this.saveTextToParentTag(s,n,r);let d=this.parseTextData(u,n.tagname,r,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),i=l+2}else{let l=Hp(e,i,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,f=l.attrExpPresent,g=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,r,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),u!==t.tagname&&(r+=r?"."+u:u);const v=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,r,u)){let b="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),p=u):p=p.substr(0,p.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=l.closeIndex;else{const y=this.readStopNodeData(e,d,g+1);if(!y)throw new Error(`Unexpected end of ${d}`);i=y.i,b=y.tagContent}const x=new yo(u);u!==p&&f&&(x[":@"]=this.buildAttributesMap(p,r,u)),b&&(b=this.parseTextData(b,u,r,!0,f,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),x.add(this.options.textNodeName,b),this.addChild(n,x,r,v)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new yo(u);u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,r,u)),this.addChild(n,b,r,v),r=r.substr(0,r.lastIndexOf("."))}else{const b=new yo(u);this.tagsNodeStack.push(n),u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,r,u)),this.addChild(n,b,r,v),n=b}s="",i=g}}else s+=e[i];return t.child};function E4(e,t,n,s){this.options.captureMetaData||(s=void 0);const r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t,s))}const P4=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function T4(e,t,n,s){return e&&(s===void 0&&(s=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function O4(e,t,n,s){return!!(t&&t.has(s)||e&&e.has(n))}function _4(e,t,n=">"){let s,r="";for(let o=t;o<e.length;o++){let i=e[o];if(s)i===s&&(s="");else if(i==='"'||i==="'")s=i;else if(i===n[0])if(n[1]){if(e[o+1]===n[1])return{data:r,index:o}}else return{data:r,index:o};else i===" "&&(i=" ");r+=i}}function wo(e,t,n,s){const r=e.indexOf(t,n);if(r===-1)throw new Error(s);return r+t.length-1}function Hp(e,t,n,s=">"){const r=_4(e,t+1,s);if(!r)return;let o=r.data;const i=r.index,a=o.search(/\s/);let l=o,u=!0;a!==-1&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const p=l.indexOf(":");p!==-1&&(l=l.substr(p+1),u=l!==r.data.substr(p+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:u,rawTagName:d}}function A4(e,t,n){const s=n;let r=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const o=wo(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,n),i:o};n=o}else if(e[n+1]==="?")n=wo(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=wo(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=wo(e,"]]>",n,"StopNode is not closed.")-2;else{const o=Hp(e,n,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&r++,n=o.closeIndex)}}function Dp(e,t,n){if(t&&typeof e=="string"){const s=e.trim();return s==="true"?!0:s==="false"?!1:f4(e,n)}else return Y3(e)?e:""}const yd=yo.getMetaDataSymbol();function L4(e,t){return ty(e,t)}function ty(e,t,n){let s;const r={};for(let o=0;o<e.length;o++){const i=e[o],a=M4(i);let l="";if(n===void 0?l=a:l=n+"."+a,a===t.textNodeName)s===void 0?s=i[a]:s+=""+i[a];else{if(a===void 0)continue;if(i[a]){let u=ty(i[a],t,l);const d=$4(u,t);i[yd]!==void 0&&(u[yd]=i[yd]),i[":@"]?N4(u,i[":@"],l,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(u)):t.isArray(a,l,d)?r[a]=[u]:r[a]=u}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function M4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(s!==":@")return s}}function N4(e,t,n,s){if(t){const r=Object.keys(t),o=r.length;for(let i=0;i<o;i++){const a=r[i];s.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function $4(e,t){const{textNodeName:n}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class k4{constructor(t){this.externalEntities={},this.options=l4(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=J3(t,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const s=new b4(this.options);s.addExternalEntities(this.externalEntities);const r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:L4(r,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return yo.getMetaDataSymbol()}}const R4=`
40
- `;function I4(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=R4),ny(e,t,"",n)}function ny(e,t,n,s){let r="",o=!1;for(let i=0;i<e.length;i++){const a=e[i],l=V4(a);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=a[l];H4(u,t)||(m=t.tagValueProcessor(l,m),m=sy(m,t)),o&&(r+=s),r+=m,o=!1;continue}else if(l===t.cdataPropName){o&&(r+=s),r+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}else if(l===t.commentPropName){r+=s+`<!--${a[l][0][t.textNodeName]}-->`,o=!0;continue}else if(l[0]==="?"){const m=Sm(a[":@"],t),v=l==="?xml"?"":s;let b=a[l][0][t.textNodeName];b=b.length!==0?" "+b:"",r+=v+`<${l}${b}${m}?>`,o=!0;continue}let d=s;d!==""&&(d+=t.indentBy);const p=Sm(a[":@"],t),f=s+`<${l}${p}`,g=ny(a[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?r+=f+">":r+=f+"/>":(!g||g.length===0)&&t.suppressEmptyNode?r+=f+"/>":g&&g.endsWith(">")?r+=f+`>${g}${s}</${l}>`:(r+=f+">",g&&s!==""&&(g.includes("/>")||g.includes("</"))?r+=s+t.indentBy+g+s:r+=g,r+=`</${l}>`),o=!0}return r}function V4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(e.hasOwnProperty(s)&&s!==":@")return s}}function Sm(e,t){let n="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let r=t.attributeValueProcessor(s,e[s]);r=sy(r,t),r===!0&&t.suppressBooleanAttributes?n+=` ${s.substr(t.attributeNamePrefix.length)}`:n+=` ${s.substr(t.attributeNamePrefix.length)}="${r}"`}return n}function H4(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+n)return!0;return!1}function sy(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const s=t.entities[n];e=e.replace(s.regex,s.val)}return e}const D4={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function so(e){this.options=Object.assign({},D4,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=ey(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=z4),this.processTextOrObjNode=F4,this.options.format?(this.indentate=B4,this.tagEndChar=`>
34
+ </style>`:""},P3=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),T3=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),fm=e=>!!e.id,ei=e=>t=>(t.tagName||"").toLowerCase()===e,ks=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),O3=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},mi=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},Zr=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},pl=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},fl=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},_3=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),Fp=(e,t,n="html")=>{const{Pages:s}=e,r=an({page:t,key:"slug"})??"";return`${s.getMain()===t?"index":Jc(r||t.getName())}.${n}`},A3=(e,t)=>{const{toolbar:n}=e;n.some(r=>r.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},Vc="custom-html-body",Hc="data-custom-html-body",gm="data-global-custom-html-head",hm="data-global-custom-html-body",mm="global",M3=function(e,t){const n=r=>{if(!r)return e.em.logError("loadGlobalHead: document not found");const o=Bp(t.appStore);let i=r.querySelector(`[${gm}]`);i||(i=r.createElement("div"),i.setAttribute(gm,"true"),r.head.insertBefore(i,r.head.firstChild));const a=Y0(o.fonts),l=o.customCodeHead,u=[a,l].filter(d=>!!d).join(`
35
+ `);i.innerHTML=u,gh(i)},s=r=>{if(!r)return e.em.logError("loadGlobalBody: document not found");const o=Bp(t.appStore);let i=r.querySelector(`[${hm}]`);if(!i){i=r.createElement("div"),i.setAttribute(hm,"true");const a=r.querySelector('[data-gjs-type="wrapper"]');a==null||a.appendChild(i)}i.innerHTML=o.customCodeBody||"",gh(i)};e.on(e.Canvas.events.frameLoad,r=>{var o;return n((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(e.Canvas.events.frameLoadBody,r=>{var o;return s((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(Dn.pageSettingsUpdate,r=>{var i,a;if(r.page)return;const o=(a=(i=e.Canvas.getFrames()[0])==null?void 0:i.view)==null?void 0:a.getDoc();n(o),s(o)}),e.Components.addType(Vc,{isComponent:r=>pl(r,Hc),model:{defaults:{attributes:{[Hc]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:r}=t,{globalPageSettings:o}=r.projectDataCustom;let i=(o==null?void 0:o.customCodeHead)||"",a=(o==null?void 0:o.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),p=[];d.forEach(m=>{m.has(mm)&&p.push(m)}),p.forEach(m=>{const b=m.toHTML();i.includes(b)||(i+=b),m.remove()});const f=[];u.findType(Vc).forEach(m=>{m.has(mm)&&f.push(m)}),f.forEach(m=>{const b=m.getInnerHTML();a.includes(b)||(a+=b),m.remove()})}),(i||a)&&r.setProjectDataCustom({globalPageSettings:{...o,customCodeHead:i,customCodeBody:a}})})},La="page://",Su="href-params__",L3=`data-gjs-${Su}`,Cu=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},ju=e=>!!Cu(e),bm=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},X0=e=>!!(e!=null&&e.Components.getType("mjml")),J0=e=>ju(e)?K.database:xg(e)?K.home:"",Q0=e=>!!e.getSymbolOverride()?c.jsx(ne,{icon:K.rhombusOutline,size:oe.s3x}):c.jsx(Bv,{className:L("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),ey=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},xg=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},gt={title:({cmp:e})=>e.tagName==="title",favicon:({cmp:e})=>{var t;return e.tagName==="link"&&((t=e.attributes.attributes)==null?void 0:t.rel)==="icon"},description:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="description"},keywords:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="keywords"},socialTitle:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:title"},socialImage:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:image"},socialDescription:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.property)==="og:description"},charset:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.charset)},viewport:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="viewport"},robots:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="robots"},generator:({cmp:e})=>{var t;return e.tagName==="meta"&&((t=e.attributes.attributes)==null?void 0:t.name)==="generator"}},ty=e=>{for(const t in gt){const n=t;if(gt[n]({cmp:e}))return n}},ny=(e,t,n)=>{const s=[];let r=n;return e.getMainComponent().findType(Vc).forEach(o=>{s.push(o),r=(r||"")+o.getInnerHTML()}),{components:s,html:r,changed:r!==t}},N3=(e,t)=>{const n={...t},s=e.getMainComponent(),{head:r}=s;if(r){const i=[],a=r.components();a.forEach(u=>{gt.title({cmp:u})?(u.components(t.title),delete n.title):gt.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):gt.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):gt.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):gt.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):gt.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):gt.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):ty(u)||i.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(a.remove(i),l.head.components&&a.add(l.head.components),delete n.customCodeHead)}const o=ny(e,n.customCodeBody);if(o.changed){const[i,...a]=o.components;(i||s.append({type:Vc})[0]).components(n.customCodeBody),a.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},$3=(e,t={})=>{var o;const n={...e.get("settings")??{}},s=e.getMainComponent(),{head:r}=s;if(r){const i=[];r.components().forEach(a=>{const{content:l,href:u}=a.getAttributes({noClass:!0,noStyle:!0});gt.title({cmp:a})?n.title=a.getInnerHTML():gt.favicon({cmp:a})?n.favicon=u:gt.description({cmp:a})?n.description=l:gt.keywords({cmp:a})?n.keywords=l:gt.socialTitle({cmp:a})?n.socialTitle=l:gt.socialDescription({cmp:a})?n.socialDescription=l:gt.socialImage({cmp:a})?n.socialImage=l:ty(a)||i.push(a.toHTML())}),i.length&&(n.customCodeHead=i.join(`
36
+ `))}if(n.customCodeBody=ny(e,n.customCodeBody).html,t.replaceDataSources&&Cu(e)){const{currentItem:i}=((o=s.getCollectionsState)==null?void 0:o.call(s))||{};i&&Object.keys(n).forEach(a=>{const l=a,u=n[l];pt(u)&&(n[l]=sy(u,i))})}return n},sy=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,s)=>{const r=t[s.trim()];return r!==void 0?String(r):""}),ry=(e,t={})=>{const{currentItem:n}=t,s=t.ext??"html",r=an({page:e,key:"slug"})??"",o=n?sy(r,n):r,i=o.lastIndexOf("/"),a=i>=0,l=a?o.substring(i+1):o,u=a?o.substring(0,i):void 0,d=`${Jc(l)}${s?`.${s}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},k3=(e,t)=>e.get(`${Su}${t}`)||"",R3=(e,t,n)=>{e.set({[`${Su}${t}`]:n})},I3=(e,t)=>{Object.entries(t).forEach(([n,s])=>{e[`${L3}${n}`]=s})},V3=(e,t)=>{e.getModel().set("customData",{...Ti(e),...t})},Ti=e=>e.getModel().get("customData")??{},Bp=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},an=e=>{const{page:t,key:n,appEditorStore:s,def:r,defPage:o,opts:i}=e;return t?$3(t,i)[n]??o:Bp(s)[n]??r},_r=(e,t,n)=>{const s=e.em.getEditor(),o=Ti(s).globalPageSettings||{};return an({page:e,key:t,opts:n})||o[t]},vm=(e,t)=>{const n=(e==null?void 0:e.getName())??"",s={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:an({...s,key:"slug",defPage:Jc(n)}),title:an({...s,key:"title",defPage:n}),description:an({...s,key:"description"}),favicon:an({...s,key:"favicon"}),keywords:an({...s,key:"keywords"}),socialTitle:an({...s,key:"socialTitle",defPage:n}),socialImage:an({...s,key:"socialImage"}),socialDescription:an({...s,key:"socialDescription"}),customCodeHead:an({...s,key:"customCodeHead"}),customCodeBody:an({...s,key:"customCodeBody"})}},Hl=({icon:e,layout:t,tooltip:n,className:s,forceRemove:r,removeLayouts:o})=>({type:"button",icon:e,tooltip:n,className:s,size:"s",editorEvents:{[`${Dn.layoutToggleId}${t.id}`]:({fromEvent:i,setState:a})=>{a({active:i.isOpen})}},onClick:({editor:i})=>{o==null||o.forEach(a=>i.runCommand(te.layoutRemove,{id:a,force:r})),i.runCommand(te.layoutToggle,{...t})}}),ym={type:"static",layoutId:"leftPanelsContainer"},xm={width:240,overflow:"hidden"};Hl({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:xm,placer:ym}}),Hl({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:xm,placer:ym}}),Hl({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Hl({icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,10.11C13.03,10.11 13.87,10.95 13.87,12C13.87,13 13.03,13.85 12,13.85C10.97,13.85 10.13,13 10.13,12C10.13,10.95 10.97,10.11 12,10.11M7.37,20C8,20.38 9.38,19.8 10.97,18.3C10.45,17.71 9.94,17.07 9.46,16.4C8.64,16.32 7.83,16.2 7.06,16.04C6.55,18.18 6.74,19.65 7.37,20M8.08,14.26L7.79,13.75C7.68,14.04 7.57,14.33 7.5,14.61C7.77,14.67 8.07,14.72 8.38,14.77C8.28,14.6 8.18,14.43 8.08,14.26M14.62,13.5L15.43,12L14.62,10.5C14.32,9.97 14,9.5 13.71,9.03C13.17,9 12.6,9 12,9C11.4,9 10.83,9 10.29,9.03C10,9.5 9.68,9.97 9.38,10.5L8.57,12L9.38,13.5C9.68,14.03 10,14.5 10.29,14.97C10.83,15 11.4,15 12,15C12.6,15 13.17,15 13.71,14.97C14,14.5 14.32,14.03 14.62,13.5M12,6.78C11.81,7 11.61,7.23 11.41,7.5C11.61,7.5 11.8,7.5 12,7.5C12.2,7.5 12.39,7.5 12.59,7.5C12.39,7.23 12.19,7 12,6.78M12,17.22C12.19,17 12.39,16.77 12.59,16.5C12.39,16.5 12.2,16.5 12,16.5C11.8,16.5 11.61,16.5 11.41,16.5C11.61,16.77 11.81,17 12,17.22M16.62,4C16,3.62 14.62,4.2 13.03,5.7C13.55,6.29 14.06,6.93 14.54,7.6C15.36,7.68 16.17,7.8 16.94,7.96C17.45,5.82 17.26,4.35 16.62,4M15.92,9.74L16.21,10.25C16.32,9.96 16.43,9.67 16.5,9.39C16.23,9.33 15.93,9.28 15.62,9.23C15.72,9.4 15.82,9.57 15.92,9.74M17.37,2.69C18.84,3.53 19,5.74 18.38,8.32C20.92,9.07 22.75,10.31 22.75,12C22.75,13.69 20.92,14.93 18.38,15.68C19,18.26 18.84,20.47 17.37,21.31C15.91,22.15 13.92,21.19 12,19.36C10.08,21.19 8.09,22.15 6.62,21.31C5.16,20.47 5,18.26 5.62,15.68C3.08,14.93 1.25,13.69 1.25,12C1.25,10.31 3.08,9.07 5.62,8.32C5,5.74 5.16,3.53 6.62,2.69C8.09,1.85 10.08,2.81 12,4.64C13.92,2.81 15.91,1.85 17.37,2.69M17.08,12C17.42,12.75 17.72,13.5 17.97,14.26C20.07,13.63 21.25,12.73 21.25,12C21.25,11.27 20.07,10.37 17.97,9.74C17.72,10.5 17.42,11.25 17.08,12M6.92,12C6.58,11.25 6.28,10.5 6.03,9.74C3.93,10.37 2.75,11.27 2.75,12C2.75,12.73 3.93,13.63 6.03,14.26C6.28,13.5 6.58,12.75 6.92,12M15.92,14.26C15.82,14.43 15.72,14.6 15.62,14.77C15.93,14.72 16.23,14.67 16.5,14.61C16.43,14.33 16.32,14.04 16.21,13.75L15.92,14.26M13.03,18.3C14.62,19.8 16,20.38 16.62,20C17.26,19.65 17.45,18.18 16.94,16.04C16.17,16.2 15.36,16.32 14.54,16.4C14.06,17.07 13.55,17.71 13.03,18.3M8.08,9.74C8.18,9.57 8.28,9.4 8.38,9.23C8.07,9.28 7.77,9.33 7.5,9.39C7.57,9.67 7.68,9.96 7.79,10.25L8.08,9.74M10.97,5.7C9.38,4.2 8,3.62 7.37,4C6.74,4.35 6.55,5.82 7.06,7.96C7.83,7.8 8.64,7.68 9.46,7.6C9.94,6.93 10.45,6.29 10.97,5.7Z" /></svg>',tooltip:"Custom Component",className:"gs-utl-mt-auto",layout:{id:"customLayout",layout:{type:"custom",component:()=>c.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const H3={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var D3={NODE_ENV:"production"};class F3{constructor(t,n){var o,i;this.projectType=Et.web,this.editor=void 0,this.sdkProps={},this.sdkLicenseError="",this.licenseCheckRetry=0,this.showPoweredBy=!1,this.isInPreview=!1,this.isCssPanelActive=!1,this.isLeftSidebarOpen=!0,this.isRightSidebarOpen=!0,this.isTopSidebarOpen=!0,this.isBottomSidebarOpen=!0,this.isSelectingTarget=!1,this.leftSidebarSize=240,this.rightSidebarSize=240,this.transitionTime=152,this.topBarSize=36,this.isDev=!1,this.isStage=!1,this.editorKey=0,this.appInstalled=!1,this.licenseKey="",this.licenseCheckStarted=!1,this.studioSdkVersion=D3.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(a=>{const l=a,u=n[l];u!==void 0&&(this[l]=u)});const s=is()?window.location.search:"";this.queryParams=IS(s),gn(this,{sdkProps:!1},{autoBind:!0});const r=(i=(o=this.sdkProps.options)==null?void 0:o.customTheme)==null?void 0:i.icons;r&&eP(r)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return wf({isDev:t,isStage:n})}get projectId(){var s,r;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((r=(s=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:s.custom)==null?void 0:r.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:s}=this,{customConfig:r}=s.layoutStore,o=(r==null?void 0:r.responsive)||(t==null?void 0:t.responsive);let i=(r==null?void 0:r.default)||(t==null?void 0:t.default)||H3;if(n&&o){const l=Object.keys(o).map(Number).sort((u,d)=>u-d).find(u=>n<=u);i=l?o[l]:i}return i}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===Et.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,s=this.sdkIdentityId;if(!n||!s)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Dp.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===Dp.cloud}get publicStateTheme(){const{theme:t,resolvedTheme:n}=this.store.localSettingsStore;return{theme:t,resolvedTheme:n}}setPublicStateTheme(t){t.theme!==void 0&&(this.store.localSettingsStore.theme=t.theme)}*init(){var p,f;const{store:t,sdkOptions:n}=this,{lastProjectId:s,lastProjectType:r}=t.localSettingsStore,o=(p=n.project)==null?void 0:p.default,{project:i}=n.storage||{};let a,l;r&&(this.store.templatesStore._projectTypeFilter=r),s&&(a=(f=(yield B0(r)).find(m=>m.id===s))==null?void 0:f.data),a?l=a:i?l=i:o&&(l=o);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:s,data:r,isTemplate:o}=t,i=n.Storage.getConfig().options.local,a=o?`${s}__${VS()}`:s;this._projectId=a,i.key=a,Gb(r)||this.loadProjectData({...r,custom:{...r.custom,id:a,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||Et.web,this.editor&&V3(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(B3(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const s=this.editor;s.loadProjectData(t),s.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:s,studioSdkVersion:r}=this;t==null||t.trigger(yS,{baseApiUrl:s});const o=yield Js.post(`${s}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:r}});if(o instanceof Error)throw o;const i=o.result||{},{license:a,error:l,plan:u,info:d}=i;this.licensePlan=u,this.loadsInfo=d,l?this.sdkLicenseError=l:(this.sdkLicense=a,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(hp,i)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(hp,{}))}}*updateStudio(){const{pluginStore:t}=this.store,{projectType:n}=this.projectDataCustom;yield t.initProjectPlugins(n),this.setEditor(),this.editorKey++}refreshStudio(){var t;this.editorKey&&(this.setNextProjectData((t=this.editor)==null?void 0:t.getProjectData()),this.store.layoutStore.clear(),this.setEditor(),this.editorKey++)}refreshEditorCanvas(){var t;(t=this.editor)==null||t.refresh({tools:!0})}}const B3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||Et.web},Se=()=>En().appEditorStore,oy=()=>ah().appEditorStore,z3=()=>{try{return ah().appEditorStore}catch{}},wg=()=>{const[e,t]=g.useState(0),n=En().appEditorStore,{transitionTime:s}=n;return g.useEffect(()=>{setTimeout(()=>t(r=>++r),s)},[s]),[e]},Sg=()=>{const{baseApiUrl:e}=oy();return`${e}/assets/sdk`},U3=e=>`${Sg()}/${e}`,W3=async(e,t,n)=>{const s=await Js.get(Sg(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((s==null?void 0:s.result)??[]).map(({asset:r,cdnUrl:o})=>({...r,size:parseInt(r.size),src:o}))},G3=async(e,t,n,s)=>{const r=await Js.post(Sg(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},q3=async(e,t)=>await Js.put(t,{body:e,rawText:!0}),K3=async(e,t,n,s)=>Promise.all(e.map(r=>G3({name:r.name,size:r.size,type:r.type},t,n,s).then(async o=>{if(!o)throw new Error("No asset");const{asset:i,cdnUrl:a,uploadUrl:l}=o,u=await q3(r,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...i,size:parseInt(i.size),src:a,type:Oo.image}}))),Z3=async(e,t,n,s)=>{const r=await Js.delete(U3(e),{body:JSON.stringify({projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},wm=async(e,t,n,s)=>Promise.all(e.map(r=>Z3(r.id||r.src,t,n,s)));function Vr(e,t,n){let s,r,o,i,a;const l=t===void 0?100:t;function u(){const p=Date.now()-i;p<l&&p>=0?s=setTimeout(u,l-p):(s=null,a=e.apply(o,r),o=r=null)}const d=function(){return o=this,r=arguments,i=Date.now(),s||(s=setTimeout(u,l)),a};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(a=e.apply(o,r),o=r=null,clearTimeout(s),s=null)},d}class Sm{constructor(t,n){this.assetsStore=t,this.layoutPanelId=n,this.itemLayout=void 0,this.isLoadingAssets=!1,this.typeFilter=void 0,this.searchValue="",this.customTypes=void 0,this.customProviders=void 0,this.providerFilter=void 0,this.customAssetProps=void 0,this.customPages=void 0,this.totalItems=void 0,this.optionalType=!1,this.optionalProvider=!0,gn(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Vr(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(s=>s.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter(Oo.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var a,l,u,d;const{assetsStore:n}=this,{editor:s}=n;if(!s||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const r=((a=this.customPages)==null?void 0:a.length)??0,o=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,i=await this.provider.onLoad({editor:s,assetTypeFilter:this.typeFilter,pageIndex:r,searchValue:this.searchValue,pageCustomData:o})??[];if(Array.isArray(i)){const p=i.map(n.toAssetProps);this.setCustomAssetProps(p)}else{const p={...i,items:i.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],p])}this.setItemLayout((d=this.provider)==null?void 0:d.itemLayout)}async loadAssets(t=!0){const{assetsStore:n}=this,{toastStore:s}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(r){console.error(r),s.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:s}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&s&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:s}=this,{appEditorStore:r}=n.store,{editor:o}=r;if(!(!o||!s))try{n.setIsLoadingAssets(!0),await s({assets:[n.toAsset(t)],assetProps:[t],editor:o,loadAssets:i=>this.reloadAssets(i)})}catch(i){console.error(i),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:i==null?void 0:i.message})}finally{n.setIsLoadingAssets(!1)}}}const iy=e=>En().assetsStore.assetPanelStores[e];class Y3{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${D0()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new Sm(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),gn(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Hp.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Hp.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,r=n.options.licenseKey,o=t.sdkProjectId,i=t.sdkIdentityId,a=({files:l})=>K3(l,r,o,i);return this.isUsingAssetCloud?a:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:s}=this;return n?t?async r=>{await t(r),this.deleteFromProjectAssets(r)}:void 0:s?async r=>{var l,u;const{sdkOptions:o}=this.store.appEditorStore,i=(l=o.project)==null?void 0:l.id,a=(u=o.identity)==null?void 0:u.id;await wm(r.assetProps,o.licenseKey,i,a),this.deleteFromProjectAssets(r)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var a,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,s=(a=n.project)==null?void 0:a.id,r=(l=n.identity)==null?void 0:l.id,o=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:Oo.image,onLoad:()=>W3(o,s,r),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await wm(d,o,s,r),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=Vr(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const s=n.Assets.events.all;n.on(s,t),this.loadProjectAssets()}addSdkProviders(){var s;const t=((s=this.sdkAssetConfig)==null?void 0:s.providers)??[],n=rt(t)?t({providers:ds(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const s=[...this.allProviders];let r=this.allProviders.findIndex(i=>i.id===t.id);const o=r!==-1;s.splice(n,0,t),o&&(r>=n&&(r+=1),s.splice(r,1)),this.setAllProviders(s)}hasType(t){return!!this.allProviders.find(n=>pt(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new Sm(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:s,customOnLoad:r}=this,{toastStore:o}=this.store;let i;if(t){try{if(this.setIsLoadingAssets(!0),n&&r)if(s)i=s;else{const a=await r({editor:t});this.cachedOnLoadAssetProps=a.map(this.toAssetProps),i=this.cachedOnLoadAssetProps}else i=t.Assets.getAll().map(this.toAssetProps)}catch(a){console.error(a),o.addError("assets-error-load",{header:this.t("errorLoad"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}i&&this.setProjectAssetProps(i)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:s}){const{cachedOnLoadAssetProps:r,customOnLoad:o}=this;if(o){if(r){const i=s.map(a=>a.id);this.cachedOnLoadAssetProps=r.filter(({id:a})=>!i.includes(a)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(i=>n.Assets.remove(i)),bm(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:s,customOnLoad:r}=this;r?s&&(this.cachedOnLoadAssetProps=[...t,...s],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),bm(n))}async handleUpload(t){var o,i;const{editor:n,onCloudOrCustomUpload:s}=this,{toastStore:r}=this.store;if(!(!n||!s))try{this.setIsLoadingAssets(!0);const a=((o=t.dataTransfer)==null?void 0:o.files)||((i=t.target)==null?void 0:i.files)||[],l=Array.from(a),u=await s({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(a){console.error(a),r.addError("assets-error-upload",{header:this.t("errorUpload"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const s=t;return{...s.attributes,id:s.attributes.id||s.getSrc(),src:s.getSrc(),name:s.attributes.name??s.getFilename(),type:s.attributes.type??s.getType()??Oo.image,asset:s}}return{...t,type:t.type||Oo.image,id:t.id||t.src}}toAsset(t){const{editor:n}=this.store.appEditorStore;if(n)return t.asset??new n.AssetManager.Asset(t)}setProjectAssetProps(t){this.projectAssetProps=t}setIsLoadingAssets(t){this.isLoadingAssets=t}setAllProviders(t){this.allProviders=t}}const gl=()=>En().assetsStore;class X3{constructor(t){var s;this.store=t,this.fonts={},gn(this,{},{autoBind:!0});const n=(s=this.sdkFontOptions)==null?void 0:s.default;this.sdkDefaultFonts=rt(n)?n({baseDefault:pm}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>pt(t)?{id:t,label:t}:fm(t)?t:null).filter(t=>!!t):pm}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!pt(n)&&!fm(n)).map(n=>da(n.family,n)):[]}get sortedFonts(){return P3(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return T3([...this.staticFonts,...Object.values(this.fonts).map(t)])}get sdkFontOptions(){return this.store.appEditorStore.sdkOptions.fonts}get enableFontManager(){var t;return(t=this.sdkFontOptions)==null?void 0:t.enableFontManager}get sdkShowProjectFonts(){const{showProjectFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=Ti(t)??{},{fonts:s}=n??{};if(s)for(const[r,o]of Object.entries(s)){const i=da(r,o);this.addFont(i,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=Io(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:s=!0}={}){const r=da(t.family,t),{editor:o}=this.store.appEditorStore;if(!o)return;const{family:i}=r;!s&&this.fonts[i]||(this.fonts[i]=r,n||this.updateProjectFonts(o))}removeFont(t){t=Io(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const s={...Ti(t).globalPageSettings,fonts:ds(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:s}),ey(t),t.trigger(Dn.pageSettingsUpdate,{data:s})}}const hl=()=>En().fontsStore;class J3{constructor(t){this.store=t,gn(this,{},{autoBind:!0})}t(t,n={}){var r;const{editor:s}=this.store.appEditorStore;return((r=s==null?void 0:s.I18n)==null?void 0:r.t(t,n))||""}tScoped(t){return(n,s)=>this.t(`${t}.${n}`,s)}}const $e=()=>En().i18nStore,Jn=(e,t)=>g.Children.map(e,n=>n&&n.type===t?n:null),Cm="gs-custom-layout",Q3=Yt(function({className:t,component:n,noWrapper:s,id:r,render:o,componentProps:i,...a},l){const{editor:u}=Se(),d=g.useRef(null),p=n,f=p&&u?c.jsx(p,{...i,editor:u}):null,h=L(Cm,r&&`${Cm}__${r}`,t),m=s&&!o;return g.useImperativeHandle(l,()=>d.current,[]),g.useEffect(()=>{const b=d.current;if(!o||!b)return;const v=w=>b.appendChild(w),x=w=>b.removeChild(w),y=o({editor:u,addEl:v,removeEl:x});if(pt(y))b.innerHTML=y;else{if(y instanceof HTMLElement)return v(y),()=>{x(y)};if(rt(y))return()=>{y()}}},[o,u,d.current]),m?f:c.jsx("div",{className:h,ref:d,...a,children:f})}),zp=ue(Q3),e4=(e,t,n)=>{const s=e==null?void 0:e[t];return s&&s({props:n.props,editor:n.editor})||n.props};class t4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,gn(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}get layoutOverrides(){var s,r;const t=(s=this.store.appEditorStore.sdkLayoutConfig)==null?void 0:s.overrides,n=(r=this.customConfig)==null?void 0:r.overrides;return{...t,...n}}getOverrideProps(t,n){return e4(this.layoutOverrides,t,{props:n.props,editor:n.editor??this.editor})}add(t,n){var s;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(s=this.editor)==null||s.trigger(`${Dn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var r;const s=n==null?void 0:n.layout;s&&this.layouts.forEach(o=>{o.id===t&&Object.assign(o,s)}),this.layouts=n!=null&&n.force?this.layouts.filter(o=>o.id!==t):this.layouts.map(o=>o.id===t?{...o,toRemove:!0}:o),(r=this.editor)==null||r.trigger(`${Dn.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var s;const{children:t}=this.store.appEditorStore.sdkProps,n=((s=Jn(t,zp))==null?void 0:s.filter(Boolean))||[];return new Map(n.map(({props:r})=>[r.id,r]))}}const Eu=()=>En().layoutStore,n4=()=>ah().layoutStore;class s4{constructor(t){this.isActive=!1,this.content="",this.store=t,gn(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class r4{constructor(t){this.store=t,this._projectSourceFilter=Aa.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,gn(this,{},{autoBind:!0})}get projectTypeFilter(){return this._projectTypeFilter}get projectSourceFilter(){return this._projectSourceFilter}get templates(){return this._loadedTemplates}get projects(){return this._loadedProjects}get filteredTemplates(){return this.projectSourceFilter===Aa.Existing?this.projects:this.templates}async loadProjects(){const t=await B0(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var r;const t=(r=this.store.appEditorStore.sdkOptions.templates)==null?void 0:r.onLoad,n=async()=>await i3(this.projectTypeFilter);let s;if(t){const o=this.store.appEditorStore.editor;s=await t({editor:o,fetchCommunityTemplates:n})}else s=await n();this.setTemplates(s)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){s3(xu.Projects,t)}async setProjectTypeFilter(t){this._projectTypeFilter=t,this.setProjects(void 0),this.setTemplates(void 0)}setProjectSourceFilter(t){this._projectSourceFilter=t}setTemplates(t){this._loadedTemplates=t}setProjects(t){this._loadedProjects=t}}const ay=()=>En().templatesStore;class o4{constructor(t){this.toasts=[],this.store=t,gn(this,{},{autoBind:!0})}add(t,n){this.toasts.find(s=>s.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...pt(n)?{header:n}:n,variant:un.Error})}addWarning(t,n){this.add(t,{...pt(n)?{header:n}:n,variant:un.Warning})}addSuccess(t,n){this.add(t,{...pt(n)?{header:n}:n,variant:un.Success})}addInfo(t,n){this.add(t,{...pt(n)?{header:n}:n,variant:un.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class i4{constructor(t){this.isOpen=!1,this.store=t,gn(this,{},{autoBind:!0})}setOpen(t){this.isOpen=t,this.triggerEvent()}toggleOpen(){this.isOpen=!this.isOpen,this.triggerEvent()}triggerEvent(){var t;(t=this.store.appEditorStore.editor)==null||t.trigger(Dn.toggleBlocksPanel,{isOpen:this.isOpen})}}const a4=()=>En().blockManagerStore,ly=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",l4=ly+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",c4="["+ly+"]["+l4+"]*",u4=new RegExp("^"+c4+"$");function cy(e,t){const n=[];let s=t.exec(e);for(;s;){const r=[];r.startIndex=t.lastIndex-s[0].length;const o=s.length;for(let i=0;i<o;i++)r.push(s[i]);n.push(r),s=t.exec(e)}return n}const Pu=function(e){const t=u4.exec(e);return!(t===null||typeof t>"u")};function d4(e){return typeof e<"u"}const p4={allowBooleanAttributes:!1,unpairedTags:[]};function f4(e,t){t=Object.assign({},p4,t);const n=[];let s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=Em(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=Pm(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let l="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
37
+ `&&e[o]!=="\r";o++)l+=e[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!w4(l)){let p;return l.trim().length===0?p="Invalid space after '<'.":p="Tag '"+l+"' is an invalid name.",$t("InvalidTag",p,on(e,o))}const u=m4(e,o);if(u===!1)return $t("InvalidAttr","Attributes for '"+l+"' have open quote.",on(e,o));let d=u.value;if(o=u.index,d[d.length-1]==="/"){const p=o-d.length;d=d.substring(0,d.length-1);const f=Tm(d,t);if(f===!0)s=!0;else return $t(f.err.code,f.err.msg,on(e,p+f.err.line))}else if(a)if(u.tagClosed){if(d.trim().length>0)return $t("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",on(e,i));if(n.length===0)return $t("InvalidTag","Closing tag '"+l+"' has not been opened.",on(e,i));{const p=n.pop();if(l!==p.tagName){let f=on(e,p.tagStartPos);return $t("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+l+"'.",on(e,i))}n.length==0&&(r=!0)}}else return $t("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",on(e,o));else{const p=Tm(d,t);if(p!==!0)return $t(p.err.code,p.err.msg,on(e,o-d.length+p.err.line));if(r===!0)return $t("InvalidXml","Multiple possible root nodes found.",on(e,o));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:i}),s=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=Pm(e,o);continue}else if(e[o+1]==="?"){if(o=Em(e,++o),o.err)return o}else break;else if(e[o]==="&"){const p=y4(e,o);if(p==-1)return $t("InvalidChar","char '&' is not expected.",on(e,o));o=p}else if(r===!0&&!jm(e[o]))return $t("InvalidXml","Extra text at the end",on(e,o));e[o]==="<"&&o--}}else{if(jm(e[o]))continue;return $t("InvalidChar","char '"+e[o]+"' is not expected.",on(e,o))}if(s){if(n.length==1)return $t("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",on(e,n[0].tagStartPos));if(n.length>0)return $t("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return $t("InvalidXml","Start tag expected.",1);return!0}function jm(e){return e===" "||e===" "||e===`
38
+ `||e==="\r"}function Em(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return $t("InvalidXml","XML declaration allowed only at the start of the document.",on(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Pm(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const g4='"',h4="'";function m4(e,t){let n="",s="",r=!1;for(;t<e.length;t++){if(e[t]===g4||e[t]===h4)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:r}}const b4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Tm(e,t){const n=cy(e,b4),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return $t("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",Yi(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return $t("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",Yi(n[r]));if(n[r][3]===void 0&&!t.allowBooleanAttributes)return $t("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",Yi(n[r]));const o=n[r][2];if(!x4(o))return $t("InvalidAttr","Attribute '"+o+"' is an invalid name.",Yi(n[r]));if(!s.hasOwnProperty(o))s[o]=1;else return $t("InvalidAttr","Attribute '"+o+"' is repeated.",Yi(n[r]))}return!0}function v4(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function y4(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,v4(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function $t(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function x4(e){return Pu(e)}function w4(e){return Pu(e)}function on(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Yi(e){return e.startIndex+e[1].length}const S4={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},C4=function(e){return Object.assign({},S4,e)};let Dc;typeof Symbol!="function"?Dc="@@xmlMetadata":Dc=Symbol("XML Node Metadata");class yo{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][Dc]={startIndex:n})}static getMetaDataSymbol(){return Dc}}class j4{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const s={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let r=1,o=!1,i=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!i){if(o&&mo(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(s[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(o&&mo(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(o&&mo(t,"!ATTLIST",n))n+=8;else if(o&&mo(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(mo(t,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[n]===">"){if(i?t[n-1]==="-"&&t[n-2]==="-"&&(i=!1,r--):r--,r===0)break}else t[n]==="["?o=!0:a+=t[n];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:n}}readEntityExp(t,n){n=bn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)s+=t[n],n++;if(Xi(s),n=bn(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let r="";return[n,r]=this.readIdentifierVal(t,n,"entity"),n--,[s,r,n]}readNotationExp(t,n){n=bn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;!this.suppressValidationErr&&Xi(s),n=bn(t,n);const r=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&r!=="SYSTEM"&&r!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);n+=r.length,n=bn(t,n);let o=null,i=null;if(r==="PUBLIC")[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),n=bn(t,n),(t[n]==='"'||t[n]==="'")&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(r==="SYSTEM"&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(t,n,s){let r="";const o=t[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<t.length&&t[n]!==o;)r+=t[n],n++;if(t[n]!==o)throw new Error(`Unterminated ${s} value`);return n++,[n,r]}readElementExp(t,n){n=bn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;if(!this.suppressValidationErr&&!Pu(s))throw new Error(`Invalid element name: "${s}"`);n=bn(t,n);let r="";if(t[n]==="E"&&mo(t,"MPTY",n))n+=4;else if(t[n]==="A"&&mo(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)r+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:s,contentModel:r.trim(),index:n}}readAttlistExp(t,n){n=bn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;Xi(s),n=bn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!Xi(r))throw new Error(`Invalid attribute name: "${r}"`);n=bn(t,n);let o="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=bn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Xi(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),t[n]==="|"&&(n++,n=bn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=bn(t,n);let i="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:s,attributeName:r,attributeType:o,defaultValue:i,index:n}}}const bn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function mo(e,t,n){for(let s=0;s<t.length;s++)if(t[s]!==e[n+s+1])return!1;return!0}function Xi(e){if(Pu(e))return e;throw new Error(`Invalid entity name ${e}`)}const E4=/^[-+]?0x[a-fA-F0-9]+$/,P4=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,T4={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function O4(e,t={}){if(t=Object.assign({},T4,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&E4.test(n))return L4(n,16);if(n.search(/.+[eE].+/)!==-1)return A4(e,n,t);{const s=P4.exec(n);if(s){const r=s[1]||"",o=s[2];let i=M4(s[3]);const a=r?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!a))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===i||u===`${r}${i}`?l:e;let d=o?i:n;return o?d===u||r+d===u?l:e:d===u||d===r+u?l:e}}else return e}}const _4=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function A4(e,t,n){if(!n.eNotation)return e;const s=t.match(_4);if(s){let r=s[1]||"";const o=s[3].indexOf("e")===-1?"E":"e",i=s[2],a=r?e[i.length+1]===o:e[i.length]===o;return i.length>1&&a?e:i.length===1&&(s[3].startsWith(`.${o}`)||s[3][0]===o)?Number(t):n.leadingZeros&&!a?(t=(s[1]||"")+s[3],Number(t)):e}else return e}function M4(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function L4(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function uy(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class N4{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=$4,this.parseXml=H4,this.parseTextData=k4,this.resolveNameSpace=R4,this.buildAttributesMap=V4,this.isItStopNode=z4,this.replaceEntitiesValue=F4,this.readStopNodeData=W4,this.saveTextToParentTag=B4,this.addChild=D4,this.ignoreAttributesFn=uy(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const s=this.options.stopNodes[n];typeof s=="string"&&(s.startsWith("*.")?this.stopNodesWildcard.add(s.substring(2)):this.stopNodesExact.add(s))}}}}function $4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function k4(e,t,n,s,r,o,i){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,r,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?Wp(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Wp(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function R4(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const I4=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function V4(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=cy(e,I4),r=s.length,o={};for(let i=0;i<r;i++){const a=this.resolveNameSpace(s[i][1]);if(this.ignoreAttributesFn(a,t))continue;let l=s[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(a,l,t);d==null?o[u]=l:typeof d!=typeof l||d!==l?o[u]=d:o[u]=Wp(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const H4=function(e){e=e.replace(/\r\n?/g,`
39
+ `);const t=new yo("!xml");let n=t,s="",r="";const o=new j4(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const l=wo(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+2,l).trim();if(this.options.removeNSPrefix){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(s=this.saveTextToParentTag(s,n,r));const d=r.substring(r.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=r.lastIndexOf("."),r=r.substring(0,p),n=this.tagsNodeStack.pop(),s="",i=l}else if(e[i+1]==="?"){let l=Up(e,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,r),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new yo(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,r,l.tagName)),this.addChild(n,u,r,i)}i=l.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const l=wo(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,l-2);s=this.saveTextToParentTag(s,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=l}else if(e.substr(i+1,2)==="!D"){const l=o.readDocType(e,i);this.docTypeEntities=l.entities,i=l.i}else if(e.substr(i+1,2)==="!["){const l=wo(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,l);s=this.saveTextToParentTag(s,n,r);let d=this.parseTextData(u,n.tagname,r,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),i=l+2}else{let l=Up(e,i,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,f=l.attrExpPresent,h=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,r,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),u!==t.tagname&&(r+=r?"."+u:u);const b=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,r,u)){let v="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),p=u):p=p.substr(0,p.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=l.closeIndex;else{const y=this.readStopNodeData(e,d,h+1);if(!y)throw new Error(`Unexpected end of ${d}`);i=y.i,v=y.tagContent}const x=new yo(u);u!==p&&f&&(x[":@"]=this.buildAttributesMap(p,r,u)),v&&(v=this.parseTextData(v,u,r,!0,f,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),x.add(this.options.textNodeName,v),this.addChild(n,x,r,b)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const v=new yo(u);u!==p&&f&&(v[":@"]=this.buildAttributesMap(p,r,u)),this.addChild(n,v,r,b),r=r.substr(0,r.lastIndexOf("."))}else{const v=new yo(u);this.tagsNodeStack.push(n),u!==p&&f&&(v[":@"]=this.buildAttributesMap(p,r,u)),this.addChild(n,v,r,b),n=v}s="",i=h}}else s+=e[i];return t.child};function D4(e,t,n,s){this.options.captureMetaData||(s=void 0);const r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t,s))}const F4=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function B4(e,t,n,s){return e&&(s===void 0&&(s=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function z4(e,t,n,s){return!!(t&&t.has(s)||e&&e.has(n))}function U4(e,t,n=">"){let s,r="";for(let o=t;o<e.length;o++){let i=e[o];if(s)i===s&&(s="");else if(i==='"'||i==="'")s=i;else if(i===n[0])if(n[1]){if(e[o+1]===n[1])return{data:r,index:o}}else return{data:r,index:o};else i===" "&&(i=" ");r+=i}}function wo(e,t,n,s){const r=e.indexOf(t,n);if(r===-1)throw new Error(s);return r+t.length-1}function Up(e,t,n,s=">"){const r=U4(e,t+1,s);if(!r)return;let o=r.data;const i=r.index,a=o.search(/\s/);let l=o,u=!0;a!==-1&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const p=l.indexOf(":");p!==-1&&(l=l.substr(p+1),u=l!==r.data.substr(p+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:u,rawTagName:d}}function W4(e,t,n){const s=n;let r=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const o=wo(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,n),i:o};n=o}else if(e[n+1]==="?")n=wo(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=wo(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=wo(e,"]]>",n,"StopNode is not closed.")-2;else{const o=Up(e,n,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&r++,n=o.closeIndex)}}function Wp(e,t,n){if(t&&typeof e=="string"){const s=e.trim();return s==="true"?!0:s==="false"?!1:O4(e,n)}else return d4(e)?e:""}const Cd=yo.getMetaDataSymbol();function G4(e,t){return dy(e,t)}function dy(e,t,n){let s;const r={};for(let o=0;o<e.length;o++){const i=e[o],a=q4(i);let l="";if(n===void 0?l=a:l=n+"."+a,a===t.textNodeName)s===void 0?s=i[a]:s+=""+i[a];else{if(a===void 0)continue;if(i[a]){let u=dy(i[a],t,l);const d=Z4(u,t);i[Cd]!==void 0&&(u[Cd]=i[Cd]),i[":@"]?K4(u,i[":@"],l,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(u)):t.isArray(a,l,d)?r[a]=[u]:r[a]=u}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function q4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(s!==":@")return s}}function K4(e,t,n,s){if(t){const r=Object.keys(t),o=r.length;for(let i=0;i<o;i++){const a=r[i];s.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function Z4(e,t){const{textNodeName:n}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class Y4{constructor(t){this.externalEntities={},this.options=C4(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=f4(t,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const s=new N4(this.options);s.addExternalEntities(this.externalEntities);const r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:G4(r,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return yo.getMetaDataSymbol()}}const X4=`
40
+ `;function J4(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=X4),py(e,t,"",n)}function py(e,t,n,s){let r="",o=!1;for(let i=0;i<e.length;i++){const a=e[i],l=Q4(a);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=a[l];eM(u,t)||(m=t.tagValueProcessor(l,m),m=fy(m,t)),o&&(r+=s),r+=m,o=!1;continue}else if(l===t.cdataPropName){o&&(r+=s),r+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}else if(l===t.commentPropName){r+=s+`<!--${a[l][0][t.textNodeName]}-->`,o=!0;continue}else if(l[0]==="?"){const m=Om(a[":@"],t),b=l==="?xml"?"":s;let v=a[l][0][t.textNodeName];v=v.length!==0?" "+v:"",r+=b+`<${l}${v}${m}?>`,o=!0;continue}let d=s;d!==""&&(d+=t.indentBy);const p=Om(a[":@"],t),f=s+`<${l}${p}`,h=py(a[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?r+=f+">":r+=f+"/>":(!h||h.length===0)&&t.suppressEmptyNode?r+=f+"/>":h&&h.endsWith(">")?r+=f+`>${h}${s}</${l}>`:(r+=f+">",h&&s!==""&&(h.includes("/>")||h.includes("</"))?r+=s+t.indentBy+h+s:r+=h,r+=`</${l}>`),o=!0}return r}function Q4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(e.hasOwnProperty(s)&&s!==":@")return s}}function Om(e,t){let n="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let r=t.attributeValueProcessor(s,e[s]);r=fy(r,t),r===!0&&t.suppressBooleanAttributes?n+=` ${s.substr(t.attributeNamePrefix.length)}`:n+=` ${s.substr(t.attributeNamePrefix.length)}="${r}"`}return n}function eM(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+n)return!0;return!1}function fy(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const s=t.entities[n];e=e.replace(s.regex,s.val)}return e}const tM={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function oo(e){this.options=Object.assign({},tM,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=uy(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=rM),this.processTextOrObjNode=nM,this.options.format?(this.indentate=sM,this.tagEndChar=`>
41
41
  `,this.newLine=`
42
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}so.prototype.build=function(e){return this.options.preserveOrder?I4(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};so.prototype.j2x=function(e,t,n){let s="",r="";const o=n.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(r+="");else if(e[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?r+="":i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))s+=this.buildAttrPairStr(a,""+e[i]);else if(!a)if(i===this.options.textNodeName){let l=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const a=e[i].length;let l="",u="";for(let d=0;d<a;d++){const p=e[i][d];if(!(typeof p>"u"))if(p===null)i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const f=this.j2x(p,t+1,n.concat(i));l+=f.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=f.attrStr)}else l+=this.processTextOrObjNode(p,i,t,n);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(i,p);f=this.replaceEntitiesValue(f),l+=f}else l+=this.buildTextValNode(p,i,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,i,u,t)),r+=l}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const a=Object.keys(e[i]),l=a.length;for(let u=0;u<l;u++)s+=this.buildAttrPairStr(a[u],""+e[i][a[u]])}else r+=this.processTextOrObjNode(e[i],i,t,n);return{attrStr:s,val:r}};so.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function F4(e,t,n,s){const r=this.j2x(e,n+1,s.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}so.prototype.buildObjectNode=function(e,t,n,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+n+"?"+this.tagEndChar:this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",r=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+n+o+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+n+o+this.tagEndChar+e+this.indentate(s)+r}};so.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};so.prototype.buildTextValNode=function(e,t,n,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+n+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+n+">"+r+"</"+t+this.tagEndChar}};so.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function B4(e){return this.options.indentBy.repeat(e)}function z4(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Cu="mjml-code-to-html";function ry(e,t){const n=t==null?void 0:t.sanitizer;if(tt(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(j,E)=>E??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),f=["br","hr"],g=new Set(f),m=j=>{const E=[];for(const O of j){const P=Object.keys(O).find(T=>T!==":@");if(P&&g.has(P)){const T=O[P];Array.isArray(T)&&T.length>0?(E.push({...O,[P]:[]}),E.push(...m(T))):E.push(O)}else P&&Array.isArray(O[P])?E.push({...O,[P]:m(O[P])}):E.push(O)}return E},v={commentPropName:"#comment",unpairedTags:f,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new k4({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),x=new so({...v}),w=b.parse(`<root>${p}</root>`)[0].root,S=m(w);return x.build(S)}function s(p){const f=document.createElement("textarea");return f.innerHTML=p,f.value}const r=s(e||""),o=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],i={crossorigin:"anonymous","full-width":"true"},a=new RegExp(`\\s+(${o.join("|")})(?=\\s|\\/?>)`,"gi");return r.replace(/<[^>]+>/g,p=>p.replace(a,(f,g)=>{const m=i[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(p,f,g)=>{const m=g.slice(1,-1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");return`${f}"${m}"`}).replace(/&(?!#?\w+;)/g,(p,f,g)=>f>0&&g[f-1]==="&"?p:"&amp;").replace(/(<[a-zA-Z!/])|</g,(p,f)=>f??"&lt;")}var _a=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(_a||{}),bh=(e=>(e.attributes="mj-attributes",e.breakpoint="mj-breakpoint",e.font="mj-font",e.htmlAttributes="mj-html-attributes",e.preview="mj-preview",e.style="mj-style",e.title="mj-title",e.class="mj-class",e.all="mj-all",e))(bh||{}),Lr=(e=>(e.accordion="mj-accordion",e.accordionElement="mj-accordion-element",e.accordionTitle="mj-accordion-title",e.accordionText="mj-accordion-text",e.button="mj-button",e.carousel="mj-carousel",e.carouselImage="mj-carousel-image",e.column="mj-column",e.divider="mj-divider",e.group="mj-group",e.hero="mj-hero",e.image="mj-image",e.navbar="mj-navbar",e.navbarLink="mj-navbar-link",e.raw="mj-raw",e.section="mj-section",e.social="mj-social",e.socialElement="mj-social-element",e.spacer="mj-spacer",e.table="mj-table",e.text="mj-text",e.wrapper="mj-wrapper",e))(Lr||{}),Wo=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Wo||{});function U4(e){const t=new Map,n={items:[]};return e.forEach(r=>{const{category:o,item:i}=r;if(o){const a=t.get(o.id);a?(a.items.push(i),a.category={...a.category,...o}):t.set(o.id,{category:o,items:[i]})}else n.items.push(i)}),[...Array.from(t).map(([,r])=>r),n].filter(r=>r.items.length)}const oy=e=>(e==null?void 0:e.get("groups"))||[],iy=(e,t)=>oy(e).includes(t),W4=(e,t)=>{iy(e,t)||e.set("groups",[...oy(e),t])};class G4{constructor(t){this.dataSourceKeyid=Wo.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,hn(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,s=[],r=t.reduce((o,i)=>(o.set(i.get("id"),i),o),new Map);return n.forEach(({id:o})=>{const i=r.get(o);i&&(s.push(i),r.delete(o))}),Array.from(r).map(([,o])=>{o.get("_internal")||s.push(o)}),U4(s.map(o=>({category:o.get("category"),item:o})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(s=>iy(s,t))}addStyleRule(t,n={}){var p,f;const{editor:s}=this;if(!s)return;const r=t.get("id"),o=t.get("selector")||"",i=t.get("property"),a=t.getPath("value"),l=`${this.dataSourceKeyid}:${r}`,u={[i]:{type:"data-variable",path:a,defaultValue:t.get("defaultValue")}};if(s&&Vv(s)&&o.startsWith("mj-")){const g=s.Components.getWrapper(),{head:m}=_a,{attributes:v}=bh,b=g.findFirstType(_a.root);if(!b)return;const x=b.findFirstType(m)||b.append({type:m},{at:0})[0],y=x.findFirstType(v)||x.append({type:v})[0],w=y.findType(o).pop()||y.append({type:o})[0],S=(w.get("attributes")||{})[i];Dt(S)&&S!==""&&t.set("value",S),w.addAttributes(u,{silent:!0});return}let d=((f=(p=n.selectorToRuleMap)==null?void 0:p.get(o))==null?void 0:f.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=s.CssComposer.addCollection([{selectors:[],selectorsAdd:o,style:u}],{extend:!0,at:t.index})[0],d&&W4(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var o,i;const{sdkOptionStyles:t}=this,n=new Map,s=(o=this.editor)==null?void 0:o.Css;if(!t.length){this.records=[];return}const r=this.getDataSource()||this.createDataSource();t.forEach(a=>{const{id:l,selector:u,label:d,field:p,property:f,category:g}=a,m=r.getRecord(l);if(m){const v={label:d,field:p,category:g};m.set({...v,_undo:!0})}else{const v=n.get(u),b=(v==null?void 0:v.rule)||(s==null?void 0:s.getRule(u)),x=(v==null?void 0:v.styles)||(b==null?void 0:b.getStyle())||{},y=x[f]||a.defaultValue;n.set(u,{rule:b,styles:x}),r.addRecord({value:void 0,...a,defaultValue:y,_internal:!0,_undo:!0})}}),r.getRecords().forEach(a=>{this.addStyleRule(a,{selectorToRuleMap:n})}),r.listenTo(r.records,"add",a=>{this.addStyleRule(a)}),(i=this.editor)==null||i.UndoManager.add(r.records),this.records=r.getRecords()}}const q4=()=>En().globalStylesStore,K4=(e,t)=>{let n;try{const s=os()&&e&&localStorage.getItem(e);s&&(n=JSON.parse(s))}catch(s){console.error(s)}return{lastProjectId:"",...t,...n}},Cm=(e,t)=>{const s={...K4(e),...t};try{os()&&e&&localStorage.setItem(e,JSON.stringify(s))}catch(r){console.error(r)}return s},jm="gs-utl-dark",Z4=()=>os()&&window.matchMedia("(prefers-color-scheme: dark)").matches,ay=e=>e==="dark"||e==="auto"&&Z4(),Em=(e,t)=>{if(e&&os()&&t.rootEl){const{classList:n}=t.rootEl;let s=!1;if(ay(e)?(n.add(jm),s=!0):n.remove(jm),t.updateAppShell){const r=document.head.querySelector('meta[name="theme-color"]');r&&(r.content=s?"#18181b":"#ffffff")}t.resolvedTheme=s?Hr.dark:Hr.light}};class Y4{constructor(t){this.key="",this.theme=Hr.auto,this.resolvedTheme=Hr.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),this.resolvedTheme=this.theme,hn(this,{},{autoBind:!0}),this.init()}init(){Em(this.theme,this)}changeTheme(t){Em(t,this),Cm(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),Cm(this.key,t)}get isDarkTheme(){return ay(this.theme)}}const Ys=()=>En().localSettingsStore;class X4{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,hn(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:s,confirmButton:r,...o}){this.isOpen=!0,this.content=t;const i=()=>{s==null||s(),this.close()};this.setModalProps({...o,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:i,size:"m2",variant:"pr",...r}]})}}const Mi=()=>En().modalStore,Pm="column1",Tm="column2",Om="column3",Fp="column3-7",J4=function(e,t={}){const{Components:n,Blocks:s}=e,r="gridRow",o="gridColumn",i="gjs-grid-row",a="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,p=1,f=1;n.addType(r,{isComponent:b=>qr(b,i),model:{defaults:{emptyState:!0,droppable:Ms(o),highlightable:!1,attributes:{class:i},resizable:{...l,keyHeight:"min-height"},icon:`
42
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}oo.prototype.build=function(e){return this.options.preserveOrder?J4(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};oo.prototype.j2x=function(e,t,n){let s="",r="";const o=n.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(r+="");else if(e[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?r+="":i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))s+=this.buildAttrPairStr(a,""+e[i]);else if(!a)if(i===this.options.textNodeName){let l=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const a=e[i].length;let l="",u="";for(let d=0;d<a;d++){const p=e[i][d];if(!(typeof p>"u"))if(p===null)i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const f=this.j2x(p,t+1,n.concat(i));l+=f.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=f.attrStr)}else l+=this.processTextOrObjNode(p,i,t,n);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(i,p);f=this.replaceEntitiesValue(f),l+=f}else l+=this.buildTextValNode(p,i,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,i,u,t)),r+=l}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const a=Object.keys(e[i]),l=a.length;for(let u=0;u<l;u++)s+=this.buildAttrPairStr(a[u],""+e[i][a[u]])}else r+=this.processTextOrObjNode(e[i],i,t,n);return{attrStr:s,val:r}};oo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function nM(e,t,n,s){const r=this.j2x(e,n+1,s.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}oo.prototype.buildObjectNode=function(e,t,n,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+n+"?"+this.tagEndChar:this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",r=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+n+o+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+n+o+this.tagEndChar+e+this.indentate(s)+r}};oo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};oo.prototype.buildTextValNode=function(e,t,n,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+n+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+n+">"+r+"</"+t+this.tagEndChar}};oo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function sM(e){return this.options.indentBy.repeat(e)}function rM(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Tu="mjml-code-to-html";function gy(e,t){const n=t==null?void 0:t.sanitizer;if(rt(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(C,E)=>E??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),f=["br","hr"],h=new Set(f),m=C=>{const E=[];for(const O of C){const P=Object.keys(O).find(T=>T!==":@");if(P&&h.has(P)){const T=O[P];Array.isArray(T)&&T.length>0?(E.push({...O,[P]:[]}),E.push(...m(T))):E.push(O)}else P&&Array.isArray(O[P])?E.push({...O,[P]:m(O[P])}):E.push(O)}return E},b={commentPropName:"#comment",unpairedTags:f,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},v=new Y4({...b,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),x=new oo({...b}),w=v.parse(`<root>${p}</root>`)[0].root,S=m(w);return x.build(S)}function s(p){const f=document.createElement("textarea");return f.innerHTML=p,f.value}const r=s(e||""),o=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],i={crossorigin:"anonymous","full-width":"true"},a=new RegExp(`\\s+(${o.join("|")})(?=\\s|\\/?>)`,"gi");return r.replace(/<[^>]+>/g,p=>p.replace(a,(f,h)=>{const m=i[h]??h;return` ${h}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(p,f,h)=>{const m=h.slice(1,-1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");return`${f}"${m}"`}).replace(/&(?!#?\w+;)/g,(p,f,h)=>f>0&&h[f-1]==="&"?p:"&amp;").replace(/(<[a-zA-Z!/])|</g,(p,f)=>f??"&lt;")}var Na=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Na||{}),Cg=(e=>(e.attributes="mj-attributes",e.breakpoint="mj-breakpoint",e.font="mj-font",e.htmlAttributes="mj-html-attributes",e.preview="mj-preview",e.style="mj-style",e.title="mj-title",e.class="mj-class",e.all="mj-all",e))(Cg||{}),$r=(e=>(e.accordion="mj-accordion",e.accordionElement="mj-accordion-element",e.accordionTitle="mj-accordion-title",e.accordionText="mj-accordion-text",e.button="mj-button",e.carousel="mj-carousel",e.carouselImage="mj-carousel-image",e.column="mj-column",e.divider="mj-divider",e.group="mj-group",e.hero="mj-hero",e.image="mj-image",e.navbar="mj-navbar",e.navbarLink="mj-navbar-link",e.raw="mj-raw",e.section="mj-section",e.social="mj-social",e.socialElement="mj-social-element",e.spacer="mj-spacer",e.table="mj-table",e.text="mj-text",e.wrapper="mj-wrapper",e))($r||{}),Go=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Go||{});function oM(e){const t=new Map,n={items:[]};return e.forEach(r=>{const{category:o,item:i}=r;if(o){const a=t.get(o.id);a?(a.items.push(i),a.category={...a.category,...o}):t.set(o.id,{category:o,items:[i]})}else n.items.push(i)}),[...Array.from(t).map(([,r])=>r),n].filter(r=>r.items.length)}const hy=e=>(e==null?void 0:e.get("groups"))||[],my=(e,t)=>hy(e).includes(t),iM=(e,t)=>{my(e,t)||e.set("groups",[...hy(e),t])};class aM{constructor(t){this.dataSourceKeyid=Go.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,gn(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,s=[],r=t.reduce((o,i)=>(o.set(i.get("id"),i),o),new Map);return n.forEach(({id:o})=>{const i=r.get(o);i&&(s.push(i),r.delete(o))}),Array.from(r).map(([,o])=>{o.get("_internal")||s.push(o)}),oM(s.map(o=>({category:o.get("category"),item:o})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(s=>my(s,t))}addStyleRule(t,n={}){var p,f;const{editor:s}=this;if(!s)return;const r=t.get("id"),o=t.get("selector")||"",i=t.get("property"),a=t.getPath("value"),l=`${this.dataSourceKeyid}:${r}`,u={[i]:{type:"data-variable",path:a,defaultValue:t.get("defaultValue")}};if(s&&qb(s)&&o.startsWith("mj-")){const h=s.Components.getWrapper(),{head:m}=Na,{attributes:b}=Cg,v=h.findFirstType(Na.root);if(!v)return;const x=v.findFirstType(m)||v.append({type:m},{at:0})[0],y=x.findFirstType(b)||x.append({type:b})[0],w=y.findType(o).pop()||y.append({type:o})[0],S=(w.get("attributes")||{})[i];Dt(S)&&S!==""&&t.set("value",S),w.addAttributes(u,{silent:!0});return}let d=((f=(p=n.selectorToRuleMap)==null?void 0:p.get(o))==null?void 0:f.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=s.CssComposer.addCollection([{selectors:[],selectorsAdd:o,style:u}],{extend:!0,at:t.index})[0],d&&iM(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var o,i;const{sdkOptionStyles:t}=this,n=new Map,s=(o=this.editor)==null?void 0:o.Css;if(!t.length){this.records=[];return}const r=this.getDataSource()||this.createDataSource();t.forEach(a=>{const{id:l,selector:u,label:d,field:p,property:f,category:h}=a,m=r.getRecord(l);if(m){const b={label:d,field:p,category:h};m.set({...b,_undo:!0})}else{const b=n.get(u),v=(b==null?void 0:b.rule)||(s==null?void 0:s.getRule(u)),x=(b==null?void 0:b.styles)||(v==null?void 0:v.getStyle())||{},y=x[f]||a.defaultValue;n.set(u,{rule:v,styles:x}),r.addRecord({value:void 0,...a,defaultValue:y,_internal:!0,_undo:!0})}}),r.getRecords().forEach(a=>{this.addStyleRule(a,{selectorToRuleMap:n})}),r.listenTo(r.records,"add",a=>{this.addStyleRule(a)}),(i=this.editor)==null||i.UndoManager.add(r.records),this.records=r.getRecords()}}const lM=()=>En().globalStylesStore,cM=(e,t)=>{let n;try{const s=is()&&e&&localStorage.getItem(e);s&&(n=JSON.parse(s))}catch(s){console.error(s)}return{lastProjectId:"",...t,...n}},_m=(e,t)=>{const s={...cM(e),...t};try{is()&&e&&localStorage.setItem(e,JSON.stringify(s))}catch(r){console.error(r)}return s},uM=()=>is()&&window.matchMedia("(prefers-color-scheme: dark)").matches,by=e=>e==="dark"||e==="auto"&&uM(),Am=(e,t)=>{if(e&&is()&&t.rootEl){const{classList:n}=t.rootEl;let s=!1;if(by(e)?(n.add(ph),s=!0):n.remove(ph),t.updateAppShell){const r=document.head.querySelector('meta[name="theme-color"]');r&&(r.content=s?"#18181b":"#ffffff")}t.resolvedTheme=s?Fr.dark:Fr.light}};class dM{constructor(t){this.key="",this.theme=Fr.auto,this.resolvedTheme=Fr.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),this.resolvedTheme=this.theme,gn(this,{},{autoBind:!0}),this.init()}init(){Am(this.theme,this)}changeTheme(t){Am(t,this),_m(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),_m(this.key,t)}get isDarkTheme(){return by(this.theme)}}const Ps=()=>En().localSettingsStore;class pM{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,gn(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:s,confirmButton:r,...o}){this.isOpen=!0,this.content=t;const i=()=>{s==null||s(),this.close()};this.setModalProps({...o,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:i,size:"m2",variant:"pr",...r}]})}}const $i=()=>En().modalStore,Mm="column1",Lm="column2",Nm="column3",Gp="column3-7",fM=function(e,t={}){const{Components:n,Blocks:s}=e,r="gridRow",o="gridColumn",i="gjs-grid-row",a="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,p=1,f=1;n.addType(r,{isComponent:v=>Zr(v,i),model:{defaults:{emptyState:!0,droppable:ks(o),highlightable:!1,attributes:{class:i},resizable:{...l,keyHeight:"min-height"},icon:`
43
43
  <svg viewBox="0 0 24 24">
44
44
  <path d="M22 14c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4z"></path>
45
45
  </svg>
46
- `,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:b=>{b.getSelected().components().add({type:o})}}],styles:`
46
+ `,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:v=>{v.getSelected().components().add({type:o})}}],styles:`
47
47
  .${i} {
48
48
  display: flex;
49
49
  justify-content: flex-start;
@@ -57,7 +57,7 @@ ${t}
57
57
  flex-direction: column;
58
58
  }
59
59
  }
60
- `}}}),n.addType(o,{isComponent:b=>qr(b,a),model:{defaults:{emptyState:!0,attributes:{class:a},draggable:Ms(r),resizable:{...l,bc:0,keyWidth:u,currentUnit:f,minDim:d,step:p},icon:`
60
+ `}}}),n.addType(o,{isComponent:v=>Zr(v,a),model:{defaults:{emptyState:!0,attributes:{class:a},draggable:ks(r),resizable:{...l,bc:0,keyWidth:u,currentUnit:f,minDim:d,step:p},icon:`
61
61
  <svg viewBox="0 0 24 24">
62
62
  <path d="M8 2h8c1.1 0 2 .9 2 2v16c0 1.1-.9 2-2 2H8c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8z"></path>
63
63
  </svg>
@@ -66,50 +66,50 @@ ${t}
66
66
  flex: 1 1 0%;
67
67
  padding: 5px 0;
68
68
  }
69
- `},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const b=this.get("center-content");this.addStyle({display:b?"flex":"block","align-items":b?"center":"","justify-content":b?"center":""})}}});const g={label:r,content:{type:r,components:[{type:o},{type:o},{type:o}]},...t.block},m={merge:!0},v=b=>{var x;return((x=s.get(b))==null?void 0:x.category)||g.category};s.add(Pm,{...g,category:v(Pm),content:{type:r,components:[{type:o}]}},m),s.add(Tm,{...g,category:v(Tm),content:{type:r,components:[{type:o},{type:o}]}},m),s.add(Om,{...g,category:v(Om),content:{type:r,components:[{type:o},{type:o},{type:o}]}},m),s.add(Fp,{...g,category:v(Fp),content:{type:r,components:[{type:o,style:{"flex-basis":"30%","flex-grow":0}},{type:o}]}},m)},sa="section",xd="container",wd="gjs-section",Sd="gjs-container",Q4=function(e,t={}){const{Components:n,Blocks:s}=e;s.add(sa,{label:sa,media:`
69
+ `},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const v=this.get("center-content");this.addStyle({display:v?"flex":"block","align-items":v?"center":"","justify-content":v?"center":""})}}});const h={label:r,content:{type:r,components:[{type:o},{type:o},{type:o}]},...t.block},m={merge:!0},b=v=>{var x;return((x=s.get(v))==null?void 0:x.category)||h.category};s.add(Mm,{...h,category:b(Mm),content:{type:r,components:[{type:o}]}},m),s.add(Lm,{...h,category:b(Lm),content:{type:r,components:[{type:o},{type:o}]}},m),s.add(Nm,{...h,category:b(Nm),content:{type:r,components:[{type:o},{type:o},{type:o}]}},m),s.add(Gp,{...h,category:b(Gp),content:{type:r,components:[{type:o,style:{"flex-basis":"30%","flex-grow":0}},{type:o}]}},m)},oa="section",jd="container",Ed="gjs-section",Pd="gjs-container",gM=function(e,t={}){const{Components:n,Blocks:s}=e;s.add(oa,{label:oa,media:`
70
70
  <svg viewBox="0 0 24 24">
71
71
  <path fill="currentColor" d="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" />
72
72
  </svg>
73
- `,content:{type:sa},...t.block},{at:cl(e,Fp)+1}),n.addType(sa,{isComponent:r=>qr(r,wd),model:{defaults:{tagName:"section",emptyState:!0,draggable:Ms("wrapper"),droppable:Ms(xd),attributes:{class:wd},components:{type:xd},styles:`
74
- .${wd} {
73
+ `,content:{type:oa},...t.block},{at:fl(e,Gp)+1}),n.addType(oa,{isComponent:r=>Zr(r,Ed),model:{defaults:{tagName:"section",emptyState:!0,draggable:ks("wrapper"),droppable:ks(jd),attributes:{class:Ed},components:{type:jd},styles:`
74
+ .${Ed} {
75
75
  display: flex;
76
76
  padding: 50px 0;
77
77
  }
78
- `}}}),n.addType(xd,{isComponent:r=>qr(r,Sd),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Sd},styles:`
79
- .${Sd} {
78
+ `}}}),n.addType(jd,{isComponent:r=>Zr(r,Pd),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Pd},styles:`
79
+ .${Pd} {
80
80
  width: 90%;
81
81
  margin: 0 auto;
82
82
  max-width: 1200px;
83
83
  }
84
- `}}})},eL=function(e,t={}){const{Components:n,Blocks:s}=e,r="divider",o="gjs-divider";s.add(r,{label:r,media:`
84
+ `}}})},hM=function(e,t={}){const{Components:n,Blocks:s}=e,r="divider",o="gjs-divider";s.add(r,{label:r,media:`
85
85
  <svg viewBox="0 0 24 24">
86
86
  <path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
87
87
  </svg>
88
- `,content:{type:r},...t.block},{at:cl(e,sa)+1}),n.addType(r,{isComponent:i=>qr(i,o),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:o},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
88
+ `,content:{type:r},...t.block},{at:fl(e,oa)+1}),n.addType(r,{isComponent:i=>Zr(i,o),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:o},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
89
89
  .${o} {
90
90
  height: 3px;
91
91
  width: 100%;
92
92
  margin: 10px;
93
93
  background-color: rgba(0, 0, 0, 0.05);
94
94
  }
95
- `}}})},tL=function(e){const{Components:t,Blocks:n}=e,r=t.getType("wrapper").model.getDefaults(),o=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...r.stylable,"padding","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","vertical-align","text-decoration","text-transform","direction","white-space"]}}}),t.addType("head",{model:{components(u,d){return o.prototype.components.call(this,u,{...d,skipDomReset:!0})}},view:{updateContent(){}}}),t.addType("text",{model:{defaults:{highlightable:!1,emptyState:{styleIn:"min-height: auto; font-size: inherit;"}}}}),t.addType("image",{model:{defaults:{traits:[{type:"image",name:"src",label:"Image",changeProp:!0,typeProps:{inputField:!0}},"alt",{type:"checkbox",name:"loading",valueTrue:"lazy"}]}}});const a=t.getType("link").model;a.typeExtends.add("text"),t.addType("link",{model:{defaults:{emptyState:!0,traits:["title",{type:"checkbox",name:"target",valueTrue:"_blank"},{type:"href",name:"href"}]},getAttrToHTML(){const u=a.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(Oa)){const p=d.replace(Oa,""),f=e.Pages.get(p);if(u.href=f?`./${Rp(e,f)}`:"##",f&&xu(f)){const g={id:x3(this,"id")},m=K0(f,{currentItem:g});u.href=m.fullPath,S3(u,{...g,page:p})}}return u}}}),n.add("link",{label:"Link",content:{type:"link",content:"Link",style:{color:"#d983a6",padding:"10px"}}},{merge:!0}),t.addType("select",{model:{defaults:{traits:[{name:"name"},{type:"checkbox",name:"required"},{name:"options",type:"stack",getValue({component:u}){return u.components().map(d=>({id:d.getAttributes().value||"",label:d.getInnerHTML()}))},setValue:({component:u,value:d,emitUpdate:p})=>{u.components(d.map(f=>({type:"option",content:f.label,attributes:{value:f.id}}))),p()},properties:[{name:"id"},{name:"label"}]}]}}});const l="contentEditable";t.addType(l,{extend:"text",model:{defaults:{name:"Content",tagName:"span",hoverable:!1,draggable:!1,selectable:!1},toHTML(u){return this.getInnerHTML(u)}},view:{onRender(){this.el.style.display="contents"}}}),t.addType("button",{model:{defaults:{components:[{type:l,components:{type:"textnode",content:"Button"}}],traits:[{type:"select",name:"type",options:[{id:"button",label:"Button"},{id:"submit",label:"Submit"},{id:"reset",label:"Reset"}]}]},init(){var d;const u=[...this.components().models];(u.length>1||!((d=u[0])!=null&&d.is(l)))&&this.append({type:l})[0].append(u)}}})},nL=function(e,t={}){const{Components:n,Blocks:s}=e,r="heading";s.add(r,{label:r,media:`
95
+ `}}})},mM=function(e){const{Components:t,Blocks:n}=e,r=t.getType("wrapper").model.getDefaults(),o=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...r.stylable,"padding","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","vertical-align","text-decoration","text-transform","direction","white-space"]}}}),t.addType("head",{model:{components(u,d){return o.prototype.components.call(this,u,{...d,skipDomReset:!0})}},view:{updateContent(){}}}),t.addType("text",{model:{defaults:{highlightable:!1,emptyState:{styleIn:"min-height: auto; font-size: inherit;"}}}}),t.addType("image",{model:{defaults:{traits:[{type:"image",name:"src",label:"Image",changeProp:!0,typeProps:{inputField:!0}},"alt",{type:"checkbox",name:"loading",valueTrue:"lazy"}]}}});const a=t.getType("link").model;a.typeExtends.add("text"),t.addType("link",{model:{defaults:{emptyState:!0,traits:["title",{type:"checkbox",name:"target",valueTrue:"_blank"},{type:"href",name:"href"}]},getAttrToHTML(){const u=a.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(La)){const p=d.replace(La,""),f=e.Pages.get(p);if(u.href=f?`./${Fp(e,f)}`:"##",f&&ju(f)){const h={id:k3(this,"id")},m=ry(f,{currentItem:h});u.href=m.fullPath,I3(u,{...h,page:p})}}return u}}}),n.add("link",{label:"Link",content:{type:"link",content:"Link",style:{color:"#d983a6",padding:"10px"}}},{merge:!0}),t.addType("select",{model:{defaults:{traits:[{name:"name"},{type:"checkbox",name:"required"},{name:"options",type:"stack",getValue({component:u}){return u.components().map(d=>({id:d.getAttributes().value||"",label:d.getInnerHTML()}))},setValue:({component:u,value:d,emitUpdate:p})=>{u.components(d.map(f=>({type:"option",content:f.label,attributes:{value:f.id}}))),p()},properties:[{name:"id"},{name:"label"}]}]}}});const l="contentEditable";t.addType(l,{extend:"text",model:{defaults:{name:"Content",tagName:"span",hoverable:!1,draggable:!1,selectable:!1},toHTML(u){return this.getInnerHTML(u)}},view:{onRender(){this.el.style.display="contents"}}}),t.addType("button",{model:{defaults:{components:[{type:l,components:{type:"textnode",content:"Button"}}],traits:[{type:"select",name:"type",options:[{id:"button",label:"Button"},{id:"submit",label:"Submit"},{id:"reset",label:"Reset"}]}]},init(){var d;const u=[...this.components().models];(u.length>1||!((d=u[0])!=null&&d.is(l)))&&this.append({type:l})[0].append(u)}}})},bM=function(e,t={}){const{Components:n,Blocks:s}=e,r="heading";s.add(r,{label:r,media:`
96
96
  <svg viewBox="0 0 24 24">
97
97
  <path d="M8.3 11.5h7.4V6.9l-.2-1.6a1 1 0 00-.5-.5c-.3-.2-.7-.3-1-.3h-.6v-.4h6.8v.4h-.6c-.4 0-.7.1-1 .3a1 1 0 00-.6.6L18 6.9v10.3c0 .8 0 1.3.2 1.6 0 .2.2.3.4.5.4.2.7.3 1.1.3h.6v.4h-6.8v-.4h.5c.7 0 1.2-.2 1.5-.6.2-.3.3-.9.3-1.8v-4.9H8.3v4.9l.1 1.6.5.5c.3.2.7.3 1 .3h.7v.4H3.7v-.4h.6c.7 0 1.1-.2 1.4-.6.2-.3.3-.9.3-1.8V6.9L6 5.3a1 1 0 00-.5-.5l-1-.3h-.7v-.4h6.9v.4H10c-.4 0-.8.1-1 .3a1 1 0 00-.6.6l-.1 1.5v4.6z"></path>
98
98
  </svg>
99
- `,content:{type:r,components:"Insert your text here"},...t.block},{at:cl(e,"text")}),n.addType(r,{extend:"text",isComponent:o=>p3(o,"H1","H2","H3","H4","H5","H6"),model:{defaults:{emptyState:!0,tagName:"h1",traits:[{type:"select",options:[{value:"h1",name:"One (largest)"},{value:"h2",name:"Two"},{value:"h3",name:"Three"},{value:"h4",name:"Four"},{value:"h5",name:"Five"},{value:"h6",name:"Six (smallest)"}],label:"Size",name:"tagName",changeProp:!0}]}}})},sL=function(e,t={}){const{Components:n,Blocks:s}=e,r=e.Components.getType("default").model,o="imageBox",i="gjs-image-box";s.add(o,{label:o,media:`
99
+ `,content:{type:r,components:"Insert your text here"},...t.block},{at:fl(e,"text")}),n.addType(r,{extend:"text",isComponent:o=>O3(o,"H1","H2","H3","H4","H5","H6"),model:{defaults:{emptyState:!0,tagName:"h1",traits:[{type:"select",options:[{value:"h1",name:"One (largest)"},{value:"h2",name:"Two"},{value:"h3",name:"Three"},{value:"h4",name:"Four"},{value:"h5",name:"Five"},{value:"h6",name:"Six (smallest)"}],label:"Size",name:"tagName",changeProp:!0}]}}})},vM=function(e,t={}){const{Components:n,Blocks:s}=e,r=e.Components.getType("default").model,o="imageBox",i="gjs-image-box";s.add(o,{label:o,media:`
100
100
  <svg viewBox="0 0 24 24">
101
101
  <path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" />
102
102
  </svg>
103
- `,content:{type:o},...t.block},{at:cl(e,"image")+1}),n.addType(o,{extend:"image",isComponent:a=>qr(a,i),model:{defaults:{tagName:"div",void:!1,droppable:!0,emptyState:!1,resizable:{tl:0,tc:0,tr:0,cl:0,cr:0,bl:0,br:0},traits:["title"],attributes:{class:i},styles:`
103
+ `,content:{type:o},...t.block},{at:fl(e,"image")+1}),n.addType(o,{extend:"image",isComponent:a=>Zr(a,i),model:{defaults:{tagName:"div",void:!1,droppable:!0,emptyState:!1,resizable:{tl:0,tc:0,tr:0,cl:0,cr:0,bl:0,br:0},traits:["title"],attributes:{class:i},styles:`
104
104
  .${i} {
105
105
  height: 200px;
106
106
  width: 100%;
107
107
  }
108
- `},getAttrToHTML(...a){return r.prototype.getAttrToHTML.apply(this,a)}},view:{tagName:"div",updateSrc(){const{model:a,em:l}=this,u=a.getSrcResult(),d=a.isDefaultSrc(),p=a.getStyle(),f=`url('${u}')`;u&&a.addStyle({"background-image":d&&p["background-image"]||f,"background-size":p["background-size"]||"contain","background-position":p["background-position"]||"center center","background-attachment":p["background-attachment"]||"scroll","background-repeat":p["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},rL=function(e,t={}){const{Components:n,Blocks:s}=e,r="linkBox",o="gjs-link-box";s.add(r,{label:r,media:`
108
+ `},getAttrToHTML(...a){return r.prototype.getAttrToHTML.apply(this,a)}},view:{tagName:"div",updateSrc(){const{model:a,em:l}=this,u=a.getSrcResult(),d=a.isDefaultSrc(),p=a.getStyle(),f=`url('${u}')`;u&&a.addStyle({"background-image":d&&p["background-image"]||f,"background-size":p["background-size"]||"contain","background-position":p["background-position"]||"center center","background-attachment":p["background-attachment"]||"scroll","background-repeat":p["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},yM=function(e,t={}){const{Components:n,Blocks:s}=e,r="linkBox",o="gjs-link-box";s.add(r,{label:r,media:`
109
109
  <svg viewBox="0 0 24 24">
110
110
  <path d="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,19H5V5H19V19M11,16H10C8.39,16 6,14.94 6,12C6,9.07 8.39,8 10,8H11V10H10C9.54,10 8,10.17 8,12C8,13.9 9.67,14 10,14H11V16M14,16H13V14H14C14.46,14 16,13.83 16,12C16,10.1 14.33,10 14,10H13V8H14C15.61,8 18,9.07 18,12C18,14.94 15.61,16 14,16M15,13H9V11H15V13Z" />
111
111
  </svg>
112
- `,content:{type:r},...t.block},{at:cl(e,"link")+1}),n.addType(r,{isComponent:i=>qr(i,o),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:o},styles:`
112
+ `,content:{type:r},...t.block},{at:fl(e,"link")+1}),n.addType(r,{isComponent:i=>Zr(i,o),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:o},styles:`
113
113
  .${o} {
114
114
  color: inherit;
115
115
  display: inline-block;
@@ -118,9 +118,9 @@ ${t}
118
118
  max-width: 100%;
119
119
  text-decoration: none;
120
120
  }
121
- `}}})};function oL(e){const t={};if(e.padding){const n=e.padding.split(" ");let s=n[0],r=n[0],o=n[0],i=n[0];n.length===4?(s=n[0],r=n[1],o=n[2],i=n[3]):n.length===3?(s=n[0],r=n[1],i=n[1],o=n[2]):n.length===2&&(s=n[0],r=n[1],i=n[1],o=n[0]),t["padding-top"]=e["padding-top"]||s,t["padding-right"]=e["padding-right"]||r,t["padding-bottom"]=e["padding-bottom"]||o,t["padding-left"]=e["padding-left"]||i,delete e.padding}return{...e,...t}}const iL={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},_m=`<svg viewBox="0 0 24 24">
121
+ `}}})};function xM(e){const t={};if(e.padding){const n=e.padding.split(" ");let s=n[0],r=n[0],o=n[0],i=n[0];n.length===4?(s=n[0],r=n[1],o=n[2],i=n[3]):n.length===3?(s=n[0],r=n[1],i=n[1],o=n[2]):n.length===2&&(s=n[0],r=n[1],i=n[1],o=n[0]),t["padding-top"]=e["padding-top"]||s,t["padding-right"]=e["padding-right"]||r,t["padding-bottom"]=e["padding-bottom"]||o,t["padding-left"]=e["padding-left"]||i,delete e.padding}return{...e,...t}}const wM={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},$m=`<svg viewBox="0 0 24 24">
122
122
  <path d="M16 9h3l-5 7m-4-7h4l-2 8M5 9h3l2 7m5-12h2l2 3h-3m-5-3h2l1 3h-4M7 4h2L8 7H5m1-5L2 8l10 14L22 8l-4-6H6z"></path>
123
- </svg>`,aL=function(e,t={}){const{Components:n,Blocks:s}=e,r="icon",o="gjs-icon",i="data-type-icon";s.add(r,{label:"Icon",media:_m,content:{type:r},...t.block}),n.addType(r,{isComponent:a=>qr(a,o)||ll(a,i),model:{defaults:{droppable:!1,attributes:{class:o,[i]:!0},resizable:iL,components:_m,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:a}){return a.getInnerHTML()},setValue:Rr(({editor:a,component:l,value:u})=>{const d=a.Parser.parseHtml(u).html,p=Array.isArray(d)?d[0]:d;p&&p.tagName==="svg"&&l.components(p)},500)}],styles:`
123
+ </svg>`,SM=function(e,t={}){const{Components:n,Blocks:s}=e,r="icon",o="gjs-icon",i="data-type-icon";s.add(r,{label:"Icon",media:$m,content:{type:r},...t.block}),n.addType(r,{isComponent:a=>Zr(a,o)||pl(a,i),model:{defaults:{droppable:!1,attributes:{class:o,[i]:!0},resizable:wM,components:$m,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:a}){return a.getInnerHTML()},setValue:Vr(({editor:a,component:l,value:u})=>{const d=a.Parser.parseHtml(u).html,p=Array.isArray(d)?d[0]:d;p&&p.tagName==="svg"&&l.components(p)},500)}],styles:`
124
124
  .${o} {
125
125
  display: inline-block;
126
126
  text-decoration: none;
@@ -130,9 +130,9 @@ ${t}
130
130
  width: 50px;
131
131
  height: 50px;
132
132
  }
133
- `},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(a=>a.set("layerable",!1))}},view:{init(){const{model:a}=this;this.listenTo(a.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(a=>{var u;const l=(u=a.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},Cd="__nc",lL=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const s=n.getName();n.get("changeProp")||delete t[s]}),delete t.id,delete t.__p,t};function cL(e){const{Components:t}=e,n=s=>{const{model:r,id:o}=s,i=r.getDefaults();t.addType(o,{model:{defaults:{traits:[...i.traits,{name:"customAttributes",type:"stack",getValue({component:a}){const l=lL(a);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:a,value:l,options:u,emitUpdate:d})=>{const p=u.removed,f=u.previous,g=u.item;if(p)a.removeAttributes(p.id);else{f&&g&&f.id!==g.id&&a.removeAttributes(f.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});a.addAttributes(m)}d()},addItem:()=>({id:Cd,value:!1}),labelItem:a=>a.id===Cd||!a.id&&!a.value?"- Empty -":`${a.id||""}="${a.value||""}"`,properties:[{name:"id",label:"Name",getValue:a=>a===Cd?"":a,setValue:(a,l)=>a.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:a=>typeof a=="boolean"?"":a}]}]}}})};t.getTypes().forEach(n)}const uL="Basic";function jd(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=oL;const s=e.Parser.getConfig().optionsHtml;s.htmlType="text/html";const r=n.sdkOptions.pages||{};(Dt(r.allowDocuments)?r.allowDocuments:!0)&&(s.detectDocument=!0,s.allowScripts=!0),e.Components.addType("trait-check",{model:{defaults:{traits:["id","title",{type:"select",name:"select-type",options:[{id:"value1",label:"Value 1"},{id:"value2",label:"Value 2"},{id:"value3",label:"Value 3"}]},{type:"number",name:"number-type",units:["px","rem","%"]},{type:"checkbox",name:"checkbox-type"},{type:"color",name:"color-type"},{type:"button",name:"button-type",label:"Delete",command:"core:component-delete"}]}}});const i={category:uL,select:!0,activate:!0};g3(e,t),tL(e),J4(e,{block:i}),nL(e,{block:i}),Q4(e,{block:i}),eL(e,{block:i}),sL(e,{block:i}),rL(e,{block:i}),aL(e,{block:i}),cL(e)}function ly(e){const{code:t,appStore:n,showToastError:s}=e,{appEditorStore:r,toastStore:o,i18nStore:i}=n.store,{isProjectTypeEmail:a,editor:l}=r,u=(t||"").trim(),d=new DOMParser,p={input:t,output:"",error:""};let f="";try{if(a){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=ry(u,{sanitizer:m});if(g.htmlType==="text/xml"){const x=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");p.error=(x==null?void 0:x.textContent)||""}m&&(l==null||l.runCommand(Cu,{mjml:v})),f=v}else{const g=d.parseFromString(u,"text/html");cy(g.documentElement);const m=g.querySelectorAll("style"),v=[];m.forEach(x=>v.push(x.innerHTML));const b=v.filter(Boolean).join(`
134
- `).trim();b&&(l==null||l.Parser.parserCss.parse(b,{throwOnError:!0}))}}catch(g){p.error=g.message}return p.error?s&&o.addError("error-parser",{header:i.t("actions.importCode.parseError"),content:p.error}):p.output=f||u,p}function cy(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const s of t)e.setAttribute(s.name,s.value);for(const s of n)cy(s)}function dL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Lm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Am(Object(n),!0).forEach(function(s){dL(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Am(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function pL(e,t){if(e==null)return{};var n={},s=Object.keys(e),r,o;for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}function fL(e,t){if(e==null)return{};var n=pL(e,t),s,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)s=o[r],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function hL(e,t){return gL(e)||mL(e,t)||vL(e,t)||bL()}function gL(e){if(Array.isArray(e))return e}function mL(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,r=!1,o=void 0;try{for(var i=e[Symbol.iterator](),a;!(s=(a=i.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){r=!0,o=l}finally{try{!s&&i.return!=null&&i.return()}finally{if(r)throw o}}return n}}function vL(e,t){if(e){if(typeof e=="string")return Mm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mm(e,t)}}function Mm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function bL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
135
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function $m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nm(Object(n),!0).forEach(function(s){yL(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nm(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function xL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(s){return t.reduceRight(function(r,o){return o(r)},s)}}function ra(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function Rc(e){return{}.toString.call(e).includes("Object")}function wL(e){return!Object.keys(e).length}function Aa(e){return typeof e=="function"}function SL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function CL(e,t){return Rc(t)||Fr("changeType"),Object.keys(t).some(function(n){return!SL(e,n)})&&Fr("changeField"),t}function jL(e){Aa(e)||Fr("selectorType")}function EL(e){Aa(e)||Rc(e)||Fr("handlerType"),Rc(e)&&Object.values(e).some(function(t){return!Aa(t)})&&Fr("handlersType")}function PL(e){e||Fr("initialIsRequired"),Rc(e)||Fr("initialType"),wL(e)&&Fr("initialContent")}function TL(e,t){throw new Error(e[t]||e.default)}var OL={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Fr=ra(TL)(OL),Rl={changes:CL,selector:jL,handler:EL,initial:PL};function _L(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Rl.initial(e),Rl.handler(t);var n={current:e},s=ra(ML)(n,t),r=ra(LL)(n),o=ra(Rl.changes)(e),i=ra(AL)(n);function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Rl.selector(u),u(n.current)}function l(u){xL(s,r,o,i)(u)}return[a,l]}function AL(e,t){return Aa(t)?t(e.current):t}function LL(e,t){return e.current=$m($m({},e.current),t),t}function ML(e,t,n){return Aa(t)?t(e.current):Object.keys(n).forEach(function(s){var r;return(r=t[s])===null||r===void 0?void 0:r.call(t,e.current[s])}),n}var NL={create:_L},$L={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function kL(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function RL(e){return{}.toString.call(e).includes("Object")}function IL(e){return e||km("configIsRequired"),RL(e)||km("configType"),e.urls?(VL(),{paths:{vs:e.urls.monacoBase}}):e}function VL(){console.warn(uy.deprecation)}function HL(e,t){throw new Error(e[t]||e.default)}var uy={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
133
+ `},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(a=>a.set("layerable",!1))}},view:{init(){const{model:a}=this;this.listenTo(a.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(a=>{var u;const l=(u=a.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},Td="__nc",CM=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const s=n.getName();n.get("changeProp")||delete t[s]}),delete t.id,delete t.__p,t};function jM(e){const{Components:t}=e,n=s=>{const{model:r,id:o}=s,i=r.getDefaults();t.addType(o,{model:{defaults:{traits:[...i.traits,{name:"customAttributes",type:"stack",getValue({component:a}){const l=CM(a);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:a,value:l,options:u,emitUpdate:d})=>{const p=u.removed,f=u.previous,h=u.item;if(p)a.removeAttributes(p.id);else{f&&h&&f.id!==h.id&&a.removeAttributes(f.id);const m=l.reduce((b,v)=>(b[v.id]=v.value||"",b),{});a.addAttributes(m)}d()},addItem:()=>({id:Td,value:!1}),labelItem:a=>a.id===Td||!a.id&&!a.value?"- Empty -":`${a.id||""}="${a.value||""}"`,properties:[{name:"id",label:"Name",getValue:a=>a===Td?"":a,setValue:(a,l)=>a.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:a=>typeof a=="boolean"?"":a}]}]}}})};t.getTypes().forEach(n)}const EM="Basic";function Od(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=xM;const s=e.Parser.getConfig().optionsHtml;s.htmlType="text/html";const r=n.sdkOptions.pages||{};(Dt(r.allowDocuments)?r.allowDocuments:!0)&&(s.detectDocument=!0,s.allowScripts=!0),e.Components.addType("trait-check",{model:{defaults:{traits:["id","title",{type:"select",name:"select-type",options:[{id:"value1",label:"Value 1"},{id:"value2",label:"Value 2"},{id:"value3",label:"Value 3"}]},{type:"number",name:"number-type",units:["px","rem","%"]},{type:"checkbox",name:"checkbox-type"},{type:"color",name:"color-type"},{type:"button",name:"button-type",label:"Delete",command:"core:component-delete"}]}}});const i={category:EM,select:!0,activate:!0};M3(e,t),mM(e),fM(e,{block:i}),bM(e,{block:i}),gM(e,{block:i}),hM(e,{block:i}),vM(e,{block:i}),yM(e,{block:i}),SM(e,{block:i}),jM(e)}function vy(e){const{code:t,appStore:n,showToastError:s}=e,{appEditorStore:r,toastStore:o,i18nStore:i}=n.store,{isProjectTypeEmail:a,editor:l}=r,u=(t||"").trim(),d=new DOMParser,p={input:t,output:"",error:""};let f="";try{if(a){const h=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=h.codeSanitizer,b=gy(u,{sanitizer:m});if(h.htmlType==="text/xml"){const x=d.parseFromString(`<div>${b}</div>`,"text/xml").querySelector("parsererror div");p.error=(x==null?void 0:x.textContent)||""}m&&(l==null||l.runCommand(Tu,{mjml:b})),f=b}else{const h=d.parseFromString(u,"text/html");yy(h.documentElement);const m=h.querySelectorAll("style"),b=[];m.forEach(x=>b.push(x.innerHTML));const v=b.filter(Boolean).join(`
134
+ `).trim();v&&(l==null||l.Parser.parserCss.parse(v,{throwOnError:!0}))}}catch(h){p.error=h.message}return p.error?s&&o.addError("error-parser",{header:i.t("actions.importCode.parseError"),content:p.error}):p.output=f||u,p}function yy(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const s of t)e.setAttribute(s.name,s.value);for(const s of n)yy(s)}function PM(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function km(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Rm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?km(Object(n),!0).forEach(function(s){PM(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):km(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function TM(e,t){if(e==null)return{};var n={},s=Object.keys(e),r,o;for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}function OM(e,t){if(e==null)return{};var n=TM(e,t),s,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)s=o[r],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function _M(e,t){return AM(e)||MM(e,t)||LM(e,t)||NM()}function AM(e){if(Array.isArray(e))return e}function MM(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,r=!1,o=void 0;try{for(var i=e[Symbol.iterator](),a;!(s=(a=i.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){r=!0,o=l}finally{try{!s&&i.return!=null&&i.return()}finally{if(r)throw o}}return n}}function LM(e,t){if(e){if(typeof e=="string")return Im(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Im(e,t)}}function Im(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function NM(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
135
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $M(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Hm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vm(Object(n),!0).forEach(function(s){$M(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vm(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function kM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(s){return t.reduceRight(function(r,o){return o(r)},s)}}function ia(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function Fc(e){return{}.toString.call(e).includes("Object")}function RM(e){return!Object.keys(e).length}function $a(e){return typeof e=="function"}function IM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function VM(e,t){return Fc(t)||zr("changeType"),Object.keys(t).some(function(n){return!IM(e,n)})&&zr("changeField"),t}function HM(e){$a(e)||zr("selectorType")}function DM(e){$a(e)||Fc(e)||zr("handlerType"),Fc(e)&&Object.values(e).some(function(t){return!$a(t)})&&zr("handlersType")}function FM(e){e||zr("initialIsRequired"),Fc(e)||zr("initialType"),RM(e)&&zr("initialContent")}function BM(e,t){throw new Error(e[t]||e.default)}var zM={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},zr=ia(BM)(zM),Dl={changes:VM,selector:HM,handler:DM,initial:FM};function UM(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Dl.initial(e),Dl.handler(t);var n={current:e},s=ia(qM)(n,t),r=ia(GM)(n),o=ia(Dl.changes)(e),i=ia(WM)(n);function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Dl.selector(u),u(n.current)}function l(u){kM(s,r,o,i)(u)}return[a,l]}function WM(e,t){return $a(t)?t(e.current):t}function GM(e,t){return e.current=Hm(Hm({},e.current),t),t}function qM(e,t,n){return $a(t)?t(e.current):Object.keys(n).forEach(function(s){var r;return(r=t[s])===null||r===void 0?void 0:r.call(t,e.current[s])}),n}var KM={create:UM},ZM={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function YM(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function XM(e){return{}.toString.call(e).includes("Object")}function JM(e){return e||Dm("configIsRequired"),XM(e)||Dm("configType"),e.urls?(QM(),{paths:{vs:e.urls.monacoBase}}):e}function QM(){console.warn(xy.deprecation)}function eL(e,t){throw new Error(e[t]||e.default)}var xy={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
136
136
  You are using deprecated way of configuration.
137
137
 
138
138
  Instead of using
@@ -141,7 +141,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
141
141
  monaco.config({ paths: { vs: '...' } })
142
142
 
143
143
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
144
- `},km=kL(HL)(uy),DL={config:IL},FL=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}};function dy(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],dy(e[n],t[n]))}),Lm(Lm({},e),t)}var BL={type:"cancelation",msg:"operation is manually canceled"};function Ed(e){var t=!1,n=new Promise(function(s,r){e.then(function(o){return t?r(BL):s(o)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var zL=NL.create({config:$L,isInitialized:!1,resolve:null,reject:null,monaco:null}),py=hL(zL,2),pl=py[0],ju=py[1];function UL(e){var t=DL.config(e),n=t.monaco,s=fL(t,["monaco"]);ju(function(r){return{config:dy(r.config,s),monaco:n}})}function WL(){var e=pl(function(t){var n=t.monaco,s=t.isInitialized,r=t.resolve;return{monaco:n,isInitialized:s,resolve:r}});if(!e.isInitialized){if(ju({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ed(Pd);if(window.monaco&&window.monaco.editor)return fy(window.monaco),e.resolve(window.monaco),Ed(Pd);FL(GL,KL)(ZL)}return Ed(Pd)}function GL(e){return document.body.appendChild(e)}function qL(e){var t=document.createElement("script");return e&&(t.src=e),t}function KL(e){var t=pl(function(s){var r=s.config,o=s.reject;return{config:r,reject:o}}),n=qL("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function ZL(){var e=pl(function(n){var s=n.config,r=n.resolve,o=n.reject;return{config:s,resolve:r,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){fy(n),e.resolve(n)},function(n){e.reject(n)})}function fy(e){pl().monaco||ju({monaco:e})}function YL(){return pl(function(e){var t=e.monaco;return t})}var Pd=new Promise(function(e,t){return ju({resolve:e,reject:t})}),hy={config:UL,init:WL,__getMonacoInstance:YL},XL={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Td=XL,JL={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},QL=JL;function eM({children:e}){return h.createElement("div",{style:QL.container},e)}var tM=eM,nM=tM;function sM({width:e,height:t,isEditorReady:n,loading:s,_ref:r,className:o,wrapperProps:i}){return h.createElement("section",{style:{...Td.wrapper,width:e,height:t},...i},!n&&h.createElement(nM,null,s),h.createElement("div",{ref:r,style:{...Td.fullWidth,...!n&&Td.hide},className:o}))}var rM=sM,gy=h.memo(rM);function oM(e){h.useEffect(e,[])}var my=oM;function iM(e,t,n=!0){let s=h.useRef(!0);h.useEffect(s.current||!n?()=>{s.current=!1}:e,t)}var An=iM;function ua(){}function ui(e,t,n,s){return aM(e,s)||lM(e,t,n,s)}function aM(e,t){return e.editor.getModel(vy(e,t))}function lM(e,t,n,s){return e.editor.createModel(t,n,s?vy(e,s):void 0)}function vy(e,t){return e.Uri.parse(t)}function cM({original:e,modified:t,language:n,originalLanguage:s,modifiedLanguage:r,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:p={},height:f="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=ua,onMount:x=ua}){let[y,w]=h.useState(!1),[S,C]=h.useState(!0),j=h.useRef(null),E=h.useRef(null),O=h.useRef(null),P=h.useRef(x),T=h.useRef(b),A=h.useRef(!1);my(()=>{let L=hy.init();return L.then(V=>(E.current=V)&&C(!1)).catch(V=>(V==null?void 0:V.type)!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>j.current?D():L.cancel()}),An(()=>{if(j.current&&E.current){let L=j.current.getOriginalEditor(),V=ui(E.current,e||"",s||n||"text",o||"");V!==L.getModel()&&L.setModel(V)}},[o],y),An(()=>{if(j.current&&E.current){let L=j.current.getModifiedEditor(),V=ui(E.current,t||"",r||n||"text",i||"");V!==L.getModel()&&L.setModel(V)}},[i],y),An(()=>{let L=j.current.getModifiedEditor();L.getOption(E.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),An(()=>{var L,V;(V=(L=j.current)==null?void 0:L.getModel())==null||V.original.setValue(e||"")},[e],y),An(()=>{let{original:L,modified:V}=j.current.getModel();E.current.editor.setModelLanguage(L,s||n||"text"),E.current.editor.setModelLanguage(V,r||n||"text")},[n,s,r],y),An(()=>{var L;(L=E.current)==null||L.editor.setTheme(u)},[u],y),An(()=>{var L;(L=j.current)==null||L.updateOptions(p)},[p],y);let _=h.useCallback(()=>{var U;if(!E.current)return;T.current(E.current);let L=ui(E.current,e||"",s||n||"text",o||""),V=ui(E.current,t||"",r||n||"text",i||"");(U=j.current)==null||U.setModel({original:L,modified:V})},[n,t,r,e,s,o,i]),N=h.useCallback(()=>{var L;!A.current&&O.current&&(j.current=E.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...p}),_(),(L=E.current)==null||L.editor.setTheme(u),w(!0),A.current=!0)},[p,u,_]);h.useEffect(()=>{y&&P.current(j.current,E.current)},[y]),h.useEffect(()=>{!S&&!y&&N()},[S,y,N]);function D(){var V,U,H,B;let L=(V=j.current)==null?void 0:V.getModel();a||((U=L==null?void 0:L.original)==null||U.dispose()),l||((H=L==null?void 0:L.modified)==null||H.dispose()),(B=j.current)==null||B.dispose()}return h.createElement(gy,{width:g,height:f,isEditorReady:y,loading:d,_ref:O,className:m,wrapperProps:v})}var uM=cM;h.memo(uM);function dM(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var pM=dM,Il=new Map;function fM({defaultValue:e,defaultLanguage:t,defaultPath:n,value:s,language:r,path:o,theme:i="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:x=ua,onMount:y=ua,onChange:w,onValidate:S=ua}){let[C,j]=h.useState(!1),[E,O]=h.useState(!0),P=h.useRef(null),T=h.useRef(null),A=h.useRef(null),_=h.useRef(y),N=h.useRef(x),D=h.useRef(),L=h.useRef(s),V=pM(o),U=h.useRef(!1),H=h.useRef(!1);my(()=>{let I=hy.init();return I.then(R=>(P.current=R)&&O(!1)).catch(R=>(R==null?void 0:R.type)!=="cancelation"&&console.error("Monaco initialization: error:",R)),()=>T.current?k():I.cancel()}),An(()=>{var R,W,Z,X;let I=ui(P.current,e||s||"",t||r||"",o||n||"");I!==((R=T.current)==null?void 0:R.getModel())&&(p&&Il.set(V,(W=T.current)==null?void 0:W.saveViewState()),(Z=T.current)==null||Z.setModel(I),p&&((X=T.current)==null||X.restoreViewState(Il.get(o))))},[o],C),An(()=>{var I;(I=T.current)==null||I.updateOptions(u)},[u],C),An(()=>{!T.current||s===void 0||(T.current.getOption(P.current.editor.EditorOption.readOnly)?T.current.setValue(s):s!==T.current.getValue()&&(H.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),T.current.pushUndoStop(),H.current=!1))},[s],C),An(()=>{var R,W;let I=(R=T.current)==null?void 0:R.getModel();I&&r&&((W=P.current)==null||W.editor.setModelLanguage(I,r))},[r],C),An(()=>{var I;a!==void 0&&((I=T.current)==null||I.revealLine(a))},[a],C),An(()=>{var I;(I=P.current)==null||I.editor.setTheme(i)},[i],C);let B=h.useCallback(()=>{var I;if(!(!A.current||!P.current)&&!U.current){N.current(P.current);let R=o||n,W=ui(P.current,s||e||"",t||r||"",R||"");T.current=(I=P.current)==null?void 0:I.editor.create(A.current,{model:W,automaticLayout:!0,...u},d),p&&T.current.restoreViewState(Il.get(R)),P.current.editor.setTheme(i),a!==void 0&&T.current.revealLine(a),j(!0),U.current=!0}},[e,t,n,s,r,o,u,d,p,i,a]);h.useEffect(()=>{C&&_.current(T.current,P.current)},[C]),h.useEffect(()=>{!E&&!C&&B()},[E,C,B]),L.current=s,h.useEffect(()=>{var I,R;C&&w&&((I=D.current)==null||I.dispose(),D.current=(R=T.current)==null?void 0:R.onDidChangeModelContent(W=>{H.current||w(T.current.getValue(),W)}))},[C,w]),h.useEffect(()=>{if(C){let I=P.current.editor.onDidChangeMarkers(R=>{var Z;let W=(Z=T.current.getModel())==null?void 0:Z.uri;if(W&&R.find(X=>X.path===W.path)){let X=P.current.editor.getModelMarkers({resource:W});S==null||S(X)}});return()=>{I==null||I.dispose()}}return()=>{}},[C,S]);function k(){var I,R;(I=D.current)==null||I.dispose(),f?p&&Il.set(o,T.current.saveViewState()):(R=T.current.getModel())==null||R.dispose(),T.current.dispose()}return h.createElement(gy,{width:g,height:m,isEditorReady:C,loading:l,_ref:A,className:v,wrapperProps:b})}var hM=fM,gM=h.memo(hM),mM=gM;function Kr({className:e,as:t="label",bold:n,m:s="gjs-mb-1",size:r="m",capitalize:o=!0,children:i,tip:a,onClear:l,...u}){const d=t,p=!!l;return c.jsxs(d,{className:M(e,s,p&&z.tAo,o&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",r==="s"&&"gs-utl-text-sm",a||p?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...p&&{htmlFor:""},...u,children:[!!a&&c.jsx(zt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:a,children:c.jsx(se,{icon:K.information,size:oe.s2x})}),i,p&&c.jsx(St,{title:"Clear value",onClick:l,icon:{icon:K.close,size:oe.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var by=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(by||{}),yy=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(yy||{});const vM="gs-cmp-button",Eu=h.memo(ce(function({classNameBtn:t,className:n,children:s,tooltip:r,variant:o,onClick:i,editorEvents:a,label:l,size:u,icon:d,active:p,buttonType:f,disabled:g,...m}){const{editor:v}=xe(),[b,x]=h.useState(()=>({disabled:g,variant:o,active:p,className:n,classNameBtn:t,tooltip:r,icon:d,size:u,label:l})),y=b.variant,w=y==="outline",S=y==="secondary",j=y==="primary"?"pr":y==="danger"?"danger":w||S?"out-clear":void 0,E=b.label,O=T=>{v&&(i==null||i({event:T,editor:v,state:b,setState:A=>x(_=>({..._,...A}))}))};h.useEffect(()=>{if(!a||!v)return;const T=Object.keys(a).reduce((_,N)=>(_[N]=(D={})=>{a[N]({fromEvent:D,editor:v,state:b,setState:L=>x(V=>({...V,...L}))})},_),{}),A=Object.keys(T);return A.forEach(_=>v.on(_,T[_])),()=>{A.forEach(_=>v.off(_,T[_]))}},[v,b]);const P=b.tooltip;return c.jsx(St,{className:M(vM,b.classNameBtn),classNameWrp:b.className,variant:j,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:O,border:w||S,type:f,withBg:S,block:!0,...dt(P)?{title:P}:{tooltipProps:P},...m,children:E?tt(E)?E({editor:v}):E:s})}));var yh=(e=>(e.m="m",e.s="s",e))(yh||{});const xy="gs-input-field",Ic=e=>Dt(e)?e:"",fl=(e={})=>M("gs-utl-w-full",z.bgTr,zr.inputText,e.disabled&&z.txtLowEmphasis),xh=({size:e="m"}={})=>M("gs-input-container gs-utl-w-full",z.bg,te.b,te.rnd,z.br,e==="m"&&Pe.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),ro=({className:e,style:t,row:n})=>({className:M(e,"gs-utl-w-full gs-utl-flex",n?`${xy}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),js=e=>{const{as:t,size:n="m",label:s,description:r,hasClear:o,onChange:i,tip:a,row:l,afterLabel:u,afterLabelButtons:d}=e,p=!!s,f=!!r,g=o!=null&&o(e)?()=>i==null?void 0:i(""):void 0;if(!p&&!(d!=null&&d.length)&&!f)return null;const m=c.jsx(c.Fragment,{children:p&&c.jsx(Kr,{as:t,className:"gs-utl-w-full",size:n,tip:f?void 0:a,onClear:g,m:"",children:s})}),v=u||d!=null&&d.length?c.jsxs($,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,x)=>c.jsx(Eu,{...b},b.id??x))]}):null;return c.jsxs($,{className:M("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs($,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,f&&c.jsx(Kr,{size:n,tip:a,as:"span",className:M(z.txtLowEmphasis),capitalize:!1,children:r})]})},ot=Zt(function(t,n){const{className:s,pattern:r,value:o,type:i,placeholder:a,required:l,disabled:u,readOnly:d,name:p,autoFocus:f,onInput:g,onChange:m,onBlur:v,onKeyDown:b,labelAs:x}=t,[y,w]=h.useState(Ic(o)),S=fl(t),C=h.useRef(null);h.useImperativeHandle(n,()=>C.current,[]),h.useEffect(()=>{w(Ic(o))},[o]),h.useEffect(()=>{const A=C.current;if(A&&f){const _=A.querySelector("input"),N=setTimeout(()=>_==null?void 0:_.focus(),_f);return()=>clearTimeout(N)}},[C.current,f]);const j=(A,_)=>{m==null||m(A,_)},E=A=>{const{key:_}=A;switch(b==null||b(A),_){case"Escape":return w(o);case"Enter":return j(y)}},O=()=>{j(y),v==null||v()},P=A=>{const _=A.target.value;w(_),g==null||g(_)},T=ro({...t,className:M(xy,s)});return c.jsxs("div",{...T,ref:C,children:[c.jsx(js,{...t,as:x}),c.jsxs($,{className:xh(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(F,{grow:!0,children:c.jsx("input",{className:S,name:p,pattern:r,value:y,onChange:P,placeholder:a,required:l,onBlur:O,onKeyDown:E,readOnly:d,disabled:u,type:i,minLength:t.minLength,maxLength:t.maxLength})}),t.afterInput]})]})}),wy=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},bM="gs-field-code",yM={minimap:{enabled:!1},lineNumbers:"off",scrollBeyondLastLine:!1,contextmenu:!1,fixedOverflowWidgets:!0,showFoldingControls:"always",suggestOnTriggerCharacters:!1,lineDecorationsWidth:0,renderLineHighlight:"none",wordWrapOverride1:"off",tabSize:2,scrollbar:{verticalScrollbarSize:8,horizontal:"hidden",alwaysConsumeMouseWheel:!1}};function mr(e){const{defaultValue:t,value:n,language:s,onChange:r,clean:o,padding:i,isDarkTheme:a,className:l,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:f,name:g,required:m,disabled:v,formatOnMount:b=!0,monacoOptions:x,labelAs:y}=e,w=n!==void 0,S=s,C=w?n:t,j=typeof C=="string"?C:JSON.stringify(C??"",null,2),E=ro({...e,className:M(bM,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),O=M("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...E,children:[c.jsx(js,{...e,as:y}),c.jsxs("div",{className:O,style:{minHeight:d},children:[g&&c.jsx("input",{className:_e.hiddenVisually,name:g,value:j,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:M("gs-utl-absolute gs-utl-inset-0",v&&_e.disabled),children:c.jsx(mM,{...w?{language:S,value:j}:{defaultLanguage:S,defaultValue:j},theme:a?"vs-dark":"light",className:M(te.b,te.rnd,z.br,l),options:{...yM,readOnly:f,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Dt(i)&&{lineDecorationsWidth:i*2,padding:{top:i,bottom:i}},...x},onChange:r,onMount:(P,T)=>{if(b){let A=!1;const _=()=>wy(P);P.onDidChangeModelLanguageConfiguration(_),P.onDidScrollChange(()=>{A||(A=!0,_())}),setTimeout(_,10)}p==null||p(P,T)}})})]})]})}const Sy=ce(function({buttonProps:t,content:n,code:s,onAction:r}){const o=Mi(),i=Ie(),a=xe(),{isProjectTypeEmail:l}=a,u=a.editor,{isDarkTheme:d}=Ys(),[p,f]=h.useState(),g=()=>{let v=(p||"").trim();const b=ly({code:v,appStore:a,showToastError:!0});if(!b.error)v=b.output;else return;r?r(v):l?u.loadProjectData({pages:[{component:v}]}):u.setComponents(v),o.close()};h.useEffect(()=>{s?f(s):(async()=>{var S,C;const b=await u.runCommand(ne.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),x=(S=b.find(j=>j.mimeType==="text/html"))==null?void 0:S.content,y=(C=b.find(j=>j.mimeType==="text/mjml"))==null?void 0:C.content,w=l?y:x;w&&f(w)})()},[]);const m=(t==null?void 0:t.children)||i.t("actions.importCode.button");return c.jsxs($,{gap:"m",col:!0,full:!0,children:[c.jsx(F,{children:n??i.t("actions.importCode.content")}),c.jsx(F,{grow:!0,children:p!==void 0&&c.jsx(mr,{defaultValue:p,onChange:v=>f(v||""),isDarkTheme:d,language:"html"})}),c.jsx($,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),Bp="data-type-empty",Rm=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:s}=n,r=Array.from(s.getDoc().querySelectorAll(`style[${Bp}]`));for(const o of r)o.disabled=!t})},xM=(e,t,n="Empty",s={})=>{const r=`[${Bp}="${t}"]`;if(!e.frameView.getDoc())return;const o=e.frameView.getHead(),{midSelector:i="",styleOut:a="",styleIn:l=""}=s;if(!o.querySelector(`style${r}`)){const u=document.createElement("style");u.setAttribute(Bp,t),u.innerHTML=`
144
+ `},Dm=YM(eL)(xy),tL={config:JM},nL=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}};function wy(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],wy(e[n],t[n]))}),Rm(Rm({},e),t)}var sL={type:"cancelation",msg:"operation is manually canceled"};function _d(e){var t=!1,n=new Promise(function(s,r){e.then(function(o){return t?r(sL):s(o)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var rL=KM.create({config:ZM,isInitialized:!1,resolve:null,reject:null,monaco:null}),Sy=_M(rL,2),ml=Sy[0],Ou=Sy[1];function oL(e){var t=tL.config(e),n=t.monaco,s=OM(t,["monaco"]);Ou(function(r){return{config:wy(r.config,s),monaco:n}})}function iL(){var e=ml(function(t){var n=t.monaco,s=t.isInitialized,r=t.resolve;return{monaco:n,isInitialized:s,resolve:r}});if(!e.isInitialized){if(Ou({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),_d(Ad);if(window.monaco&&window.monaco.editor)return Cy(window.monaco),e.resolve(window.monaco),_d(Ad);nL(aL,cL)(uL)}return _d(Ad)}function aL(e){return document.body.appendChild(e)}function lL(e){var t=document.createElement("script");return e&&(t.src=e),t}function cL(e){var t=ml(function(s){var r=s.config,o=s.reject;return{config:r,reject:o}}),n=lL("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function uL(){var e=ml(function(n){var s=n.config,r=n.resolve,o=n.reject;return{config:s,resolve:r,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){Cy(n),e.resolve(n)},function(n){e.reject(n)})}function Cy(e){ml().monaco||Ou({monaco:e})}function dL(){return ml(function(e){var t=e.monaco;return t})}var Ad=new Promise(function(e,t){return Ou({resolve:e,reject:t})}),jy={config:oL,init:iL,__getMonacoInstance:dL},pL={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Md=pL,fL={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},gL=fL;function hL({children:e}){return g.createElement("div",{style:gL.container},e)}var mL=hL,bL=mL;function vL({width:e,height:t,isEditorReady:n,loading:s,_ref:r,className:o,wrapperProps:i}){return g.createElement("section",{style:{...Md.wrapper,width:e,height:t},...i},!n&&g.createElement(bL,null,s),g.createElement("div",{ref:r,style:{...Md.fullWidth,...!n&&Md.hide},className:o}))}var yL=vL,Ey=g.memo(yL);function xL(e){g.useEffect(e,[])}var Py=xL;function wL(e,t,n=!0){let s=g.useRef(!0);g.useEffect(s.current||!n?()=>{s.current=!1}:e,t)}var Mn=wL;function pa(){}function pi(e,t,n,s){return SL(e,s)||CL(e,t,n,s)}function SL(e,t){return e.editor.getModel(Ty(e,t))}function CL(e,t,n,s){return e.editor.createModel(t,n,s?Ty(e,s):void 0)}function Ty(e,t){return e.Uri.parse(t)}function jL({original:e,modified:t,language:n,originalLanguage:s,modifiedLanguage:r,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:p={},height:f="100%",width:h="100%",className:m,wrapperProps:b={},beforeMount:v=pa,onMount:x=pa}){let[y,w]=g.useState(!1),[S,j]=g.useState(!0),C=g.useRef(null),E=g.useRef(null),O=g.useRef(null),P=g.useRef(x),T=g.useRef(v),A=g.useRef(!1);Py(()=>{let M=jy.init();return M.then(I=>(E.current=I)&&j(!1)).catch(I=>(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)),()=>C.current?V():M.cancel()}),Mn(()=>{if(C.current&&E.current){let M=C.current.getOriginalEditor(),I=pi(E.current,e||"",s||n||"text",o||"");I!==M.getModel()&&M.setModel(I)}},[o],y),Mn(()=>{if(C.current&&E.current){let M=C.current.getModifiedEditor(),I=pi(E.current,t||"",r||n||"text",i||"");I!==M.getModel()&&M.setModel(I)}},[i],y),Mn(()=>{let M=C.current.getModifiedEditor();M.getOption(E.current.editor.EditorOption.readOnly)?M.setValue(t||""):t!==M.getValue()&&(M.executeEdits("",[{range:M.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),M.pushUndoStop())},[t],y),Mn(()=>{var M,I;(I=(M=C.current)==null?void 0:M.getModel())==null||I.original.setValue(e||"")},[e],y),Mn(()=>{let{original:M,modified:I}=C.current.getModel();E.current.editor.setModelLanguage(M,s||n||"text"),E.current.editor.setModelLanguage(I,r||n||"text")},[n,s,r],y),Mn(()=>{var M;(M=E.current)==null||M.editor.setTheme(u)},[u],y),Mn(()=>{var M;(M=C.current)==null||M.updateOptions(p)},[p],y);let _=g.useCallback(()=>{var U;if(!E.current)return;T.current(E.current);let M=pi(E.current,e||"",s||n||"text",o||""),I=pi(E.current,t||"",r||n||"text",i||"");(U=C.current)==null||U.setModel({original:M,modified:I})},[n,t,r,e,s,o,i]),N=g.useCallback(()=>{var M;!A.current&&O.current&&(C.current=E.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...p}),_(),(M=E.current)==null||M.editor.setTheme(u),w(!0),A.current=!0)},[p,u,_]);g.useEffect(()=>{y&&P.current(C.current,E.current)},[y]),g.useEffect(()=>{!S&&!y&&N()},[S,y,N]);function V(){var I,U,F,W;let M=(I=C.current)==null?void 0:I.getModel();a||((U=M==null?void 0:M.original)==null||U.dispose()),l||((F=M==null?void 0:M.modified)==null||F.dispose()),(W=C.current)==null||W.dispose()}return g.createElement(Ey,{width:h,height:f,isEditorReady:y,loading:d,_ref:O,className:m,wrapperProps:b})}var EL=jL;g.memo(EL);function PL(e){let t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}var TL=PL,Fl=new Map;function OL({defaultValue:e,defaultLanguage:t,defaultPath:n,value:s,language:r,path:o,theme:i="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:f=!1,width:h="100%",height:m="100%",className:b,wrapperProps:v={},beforeMount:x=pa,onMount:y=pa,onChange:w,onValidate:S=pa}){let[j,C]=g.useState(!1),[E,O]=g.useState(!0),P=g.useRef(null),T=g.useRef(null),A=g.useRef(null),_=g.useRef(y),N=g.useRef(x),V=g.useRef(),M=g.useRef(s),I=TL(o),U=g.useRef(!1),F=g.useRef(!1);Py(()=>{let R=jy.init();return R.then($=>(P.current=$)&&O(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>T.current?H():R.cancel()}),Mn(()=>{var $,B,Z,Y;let R=pi(P.current,e||s||"",t||r||"",o||n||"");R!==(($=T.current)==null?void 0:$.getModel())&&(p&&Fl.set(I,(B=T.current)==null?void 0:B.saveViewState()),(Z=T.current)==null||Z.setModel(R),p&&((Y=T.current)==null||Y.restoreViewState(Fl.get(o))))},[o],j),Mn(()=>{var R;(R=T.current)==null||R.updateOptions(u)},[u],j),Mn(()=>{!T.current||s===void 0||(T.current.getOption(P.current.editor.EditorOption.readOnly)?T.current.setValue(s):s!==T.current.getValue()&&(F.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),T.current.pushUndoStop(),F.current=!1))},[s],j),Mn(()=>{var $,B;let R=($=T.current)==null?void 0:$.getModel();R&&r&&((B=P.current)==null||B.editor.setModelLanguage(R,r))},[r],j),Mn(()=>{var R;a!==void 0&&((R=T.current)==null||R.revealLine(a))},[a],j),Mn(()=>{var R;(R=P.current)==null||R.editor.setTheme(i)},[i],j);let W=g.useCallback(()=>{var R;if(!(!A.current||!P.current)&&!U.current){N.current(P.current);let $=o||n,B=pi(P.current,s||e||"",t||r||"",$||"");T.current=(R=P.current)==null?void 0:R.editor.create(A.current,{model:B,automaticLayout:!0,...u},d),p&&T.current.restoreViewState(Fl.get($)),P.current.editor.setTheme(i),a!==void 0&&T.current.revealLine(a),C(!0),U.current=!0}},[e,t,n,s,r,o,u,d,p,i,a]);g.useEffect(()=>{j&&_.current(T.current,P.current)},[j]),g.useEffect(()=>{!E&&!j&&W()},[E,j,W]),M.current=s,g.useEffect(()=>{var R,$;j&&w&&((R=V.current)==null||R.dispose(),V.current=($=T.current)==null?void 0:$.onDidChangeModelContent(B=>{F.current||w(T.current.getValue(),B)}))},[j,w]),g.useEffect(()=>{if(j){let R=P.current.editor.onDidChangeMarkers($=>{var Z;let B=(Z=T.current.getModel())==null?void 0:Z.uri;if(B&&$.find(Y=>Y.path===B.path)){let Y=P.current.editor.getModelMarkers({resource:B});S==null||S(Y)}});return()=>{R==null||R.dispose()}}return()=>{}},[j,S]);function H(){var R,$;(R=V.current)==null||R.dispose(),f?p&&Fl.set(o,T.current.saveViewState()):($=T.current.getModel())==null||$.dispose(),T.current.dispose()}return g.createElement(Ey,{width:h,height:m,isEditorReady:j,loading:l,_ref:A,className:b,wrapperProps:v})}var _L=OL,AL=g.memo(_L),ML=AL;function Yr({className:e,as:t="label",bold:n,m:s="gjs-mb-1",size:r="m",capitalize:o=!0,children:i,tip:a,onClear:l,...u}){const d=t,p=!!l;return c.jsxs(d,{className:L(e,s,p&&z.tAo,o&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",r==="s"&&"gs-utl-text-sm",a||p?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...p&&{htmlFor:""},...u,children:[!!a&&c.jsx(Ut,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:a,children:c.jsx(ne,{icon:K.information,size:oe.s2x})}),i,p&&c.jsx(St,{title:"Clear value",onClick:l,icon:{icon:K.close,size:oe.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var Oy=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(Oy||{}),_y=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(_y||{});const LL="gs-cmp-button",_u=g.memo(ue(function({classNameBtn:t,className:n,children:s,tooltip:r,variant:o,onClick:i,editorEvents:a,label:l,size:u,icon:d,active:p,buttonType:f,disabled:h,...m}){const{editor:b}=Se(),[v,x]=g.useState(()=>({disabled:h,variant:o,active:p,className:n,classNameBtn:t,tooltip:r,icon:d,size:u,label:l})),y=v.variant,w=y==="outline",S=y==="secondary",C=y==="primary"?"pr":y==="danger"?"danger":w||S?"out-clear":void 0,E=v.label,O=T=>{b&&(i==null||i({event:T,editor:b,state:v,setState:A=>x(_=>({..._,...A}))}))};g.useEffect(()=>{if(!a||!b)return;const T=Object.keys(a).reduce((_,N)=>(_[N]=(V={})=>{a[N]({fromEvent:V,editor:b,state:v,setState:M=>x(I=>({...I,...M}))})},_),{}),A=Object.keys(T);return A.forEach(_=>b.on(_,T[_])),()=>{A.forEach(_=>b.off(_,T[_]))}},[b,v]);const P=v.tooltip;return c.jsx(St,{className:L(LL,v.classNameBtn),classNameWrp:v.className,variant:C,icon:v.icon,active:v.active,size:v.size,disabled:v.disabled,onClick:O,border:w||S,type:f,withBg:S,block:!0,...pt(P)?{title:P}:{tooltipProps:P},...m,children:E?rt(E)?E({editor:b}):E:s})}));var jg=(e=>(e.m="m",e.s="s",e))(jg||{});const Ay="gs-input-field",Bc=e=>Dt(e)?e:"",bl=(e={})=>L("gs-utl-w-full",z.bgTr,Wr.inputText,e.disabled&&z.txtLowEmphasis),Eg=({size:e="m"}={})=>L("gs-input-container gs-utl-w-full",z.bg,se.b,se.rnd,z.br,e==="m"&&Pe.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),io=({className:e,style:t,row:n})=>({className:L(e,"gs-utl-w-full gs-utl-flex",n?`${Ay}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),Ts=e=>{const{as:t,size:n="m",label:s,description:r,hasClear:o,onChange:i,tip:a,row:l,afterLabel:u,afterLabelButtons:d}=e,p=!!s,f=!!r,h=o!=null&&o(e)?()=>i==null?void 0:i(""):void 0;if(!p&&!(d!=null&&d.length)&&!f)return null;const m=c.jsx(c.Fragment,{children:p&&c.jsx(Yr,{as:t,className:"gs-utl-w-full",size:n,tip:f?void 0:a,onClear:h,m:"",children:s})}),b=u||d!=null&&d.length?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((v,x)=>c.jsx(_u,{...v},v.id??x))]}):null;return c.jsxs(k,{className:L("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[b?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[m,b]}):m,f&&c.jsx(Yr,{size:n,tip:a,as:"span",className:L(z.txtLowEmphasis),capitalize:!1,children:r})]})},at=Yt(function(t,n){const{className:s,pattern:r,value:o,type:i,placeholder:a,required:l,disabled:u,readOnly:d,name:p,autoFocus:f,onInput:h,onChange:m,onBlur:b,onKeyDown:v,labelAs:x}=t,[y,w]=g.useState(Bc(o)),S=bl(t),j=g.useRef(null);g.useImperativeHandle(n,()=>j.current,[]),g.useEffect(()=>{w(Bc(o))},[o]),g.useEffect(()=>{const A=j.current;if(A&&f){const _=A.querySelector("input"),N=setTimeout(()=>_==null?void 0:_.focus(),$f);return()=>clearTimeout(N)}},[j.current,f]);const C=(A,_)=>{m==null||m(A,_)},E=A=>{const{key:_}=A;switch(v==null||v(A),_){case"Escape":return w(o);case"Enter":return C(y)}},O=()=>{C(y),b==null||b()},P=A=>{const _=A.target.value;w(_),h==null||h(_)},T=io({...t,className:L(Ay,s)});return c.jsxs("div",{...T,ref:j,children:[c.jsx(Ts,{...t,as:x}),c.jsxs(k,{className:Eg(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(D,{grow:!0,children:c.jsx("input",{className:S,name:p,pattern:r,value:y,onChange:P,placeholder:a,required:l,onBlur:O,onKeyDown:E,readOnly:d,disabled:u,type:i,minLength:t.minLength,maxLength:t.maxLength})}),t.afterInput]})]})}),My=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},Bl=(e,t)=>{var s;const n=(s=e==null?void 0:e.getModel())==null?void 0:s.getFullModelRange();e==null||e.executeEdits("update-value",[{range:n,text:t,forceMoveMarkers:!0}])},NL="gs-field-code",$L={minimap:{enabled:!1},lineNumbers:"off",scrollBeyondLastLine:!1,contextmenu:!1,fixedOverflowWidgets:!0,showFoldingControls:"always",suggestOnTriggerCharacters:!1,lineDecorationsWidth:0,renderLineHighlight:"none",wordWrapOverride1:"off",tabSize:2,scrollbar:{verticalScrollbarSize:8,horizontal:"hidden",alwaysConsumeMouseWheel:!1}};function Cs(e){const{defaultValue:t,value:n,language:s,onChange:r,clean:o,padding:i,isDarkTheme:a,className:l,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:f,name:h,required:m,disabled:b,formatOnMount:v=!0,monacoOptions:x,labelAs:y}=e,w=n!==void 0,S=s,j=w?n:t,C=typeof j=="string"?j:JSON.stringify(j??"",null,2),E=io({...e,className:L(NL,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),O=L("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...E,children:[c.jsx(Ts,{...e,as:y}),c.jsxs("div",{className:O,style:{minHeight:d},children:[h&&c.jsx("input",{className:Ae.hiddenVisually,name:h,value:C,disabled:b,required:m,onChange:()=>{}}),c.jsx("div",{className:L("gs-utl-absolute gs-utl-inset-0",b&&Ae.disabled),children:c.jsx(ML,{...w?{language:S,value:C}:{defaultLanguage:S,defaultValue:C},theme:a?"vs-dark":"light",className:L(se.b,se.rnd,z.br,l),options:{...$L,readOnly:f,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Dt(i)&&{lineDecorationsWidth:i*2,padding:{top:i,bottom:i}},...x},onChange:r,onMount:(P,T)=>{if(v){let A=!1;const _=()=>My(P);P.onDidChangeModelLanguageConfiguration(_),P.onDidScrollChange(()=>{A||(A=!0,_())}),setTimeout(_,10)}p==null||p(P,T)}})})]})]})}const Ly=ue(function({buttonProps:t,content:n,code:s,onAction:r}){const o=$i(),i=$e(),a=Se(),{isProjectTypeEmail:l}=a,u=a.editor,{isDarkTheme:d}=Ps(),[p,f]=g.useState(),h=()=>{let b=(p||"").trim();const v=vy({code:b,appStore:a,showToastError:!0});if(!v.error)b=v.output;else return;r?r(b):l?u.loadProjectData({pages:[{component:b}]}):u.setComponents(b),o.close()};g.useEffect(()=>{s?f(s):(async()=>{var S,j;const v=await u.runCommand(te.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),x=(S=v.find(C=>C.mimeType==="text/html"))==null?void 0:S.content,y=(j=v.find(C=>C.mimeType==="text/mjml"))==null?void 0:j.content,w=l?y:x;w&&f(w)})()},[]);const m=(t==null?void 0:t.children)||i.t("actions.importCode.button");return c.jsxs(k,{gap:"m",col:!0,full:!0,nowrap:!0,children:[c.jsx(D,{children:n??i.t("actions.importCode.content")}),c.jsx(D,{grow:!0,children:p!==void 0&&c.jsx(Cs,{defaultValue:p,onChange:b=>f(b||""),isDarkTheme:d,language:"html"})}),c.jsx(k,{justify:"end",children:c.jsx(Qe,{size:"m2",variant:"pr",onClick:h,...t,children:m})})]})}),qp="data-type-empty",Fm=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:s}=n,r=Array.from(s.getDoc().querySelectorAll(`style[${qp}]`));for(const o of r)o.disabled=!t})},kL=(e,t,n="Empty",s={})=>{const r=`[${qp}="${t}"]`;if(!e.frameView.getDoc())return;const o=e.frameView.getHead(),{midSelector:i="",styleOut:a="",styleIn:l=""}=s;if(!o.querySelector(`style${r}`)){const u=document.createElement("style");u.setAttribute(qp,t),u.innerHTML=`
145
145
  [data-gjs-type="${t}"]${i}:empty {
146
146
  text-decoration: none;
147
147
  padding: 5px;
@@ -169,18 +169,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
169
169
  ${s.limitH?"height: auto;":""}
170
170
  ${s.smallH?"min-height: 30px;":""}
171
171
  ${l}
172
- }`,o.appendChild(u)}},Cy=(e,t)=>{const{model:n}=t,s=n.constructor.getDefaults(),r=s.emptyState,o=n.get("type");if(!r||s.void===!0||o!==e)return;const i=r===!0?{}:r;xM(t,o,n.getName({noCustom:!0}),i)},wM=function(t){const{Components:n}=t,s=({id:r})=>{n.addType(r,{extendFnView:["onRender"],view:{onRender(){Cy(r,this)}}})};n.getTypes().forEach(s),t.on("component:type:add",s)},Od=e=>`<${e}></${e}>`,SM=(e={})=>Object.entries(e).filter(([,t])=>t!==""&&t!==void 0&&t!==null).map(([t,n])=>` ${t}="${n}"`).join("");function CM(e=[],t=-1){if(!e.length)return{before:"",after:""};if(t<0||t>=e.length)return{before:"",after:e.map(Od).join("")};const n=e.slice(0,t).map(Od).join(""),s=e.slice(t+1).map(Od).join("");return{before:n,after:s}}function jM({rootTag:e,head:t="",parentNodes:n,withSiblings:s,siblingTags:r=[],currentSiblingIndex:o=-1,beforeRootEnd:i=""}){const a=n.map(f=>`<${f.tagName}${SM(f.attributes)}>`).reverse().join(""),l=n.map(f=>`</${f.tagName}>`).join(""),u=s?CM(r,o):void 0,d=(u==null?void 0:u.before)||"",p=(u==null?void 0:u.after)||"";return{start:`<${e}>${t}${a}${d}`,end:`${p}${l}${i}</${e}>`}}function EM(e,t){const{Components:n}=e,s=n.events,{modalStore:r,i18nStore:o,fontsStore:i}=t.appStore.store,{root:a,head:l,body:u}=_a,{attributes:d,class:p,font:f,all:g,preview:m,title:v,style:b,breakpoint:x}=bh,{wrapper:y,section:w,column:S,text:C,button:j,image:E,divider:O,group:P,social:T,socialElement:A,spacer:_,navbar:N,navbarLink:D,table:L,raw:V}=Lr,{model:U}=n.getType("default"),{model:H}=n.getType(a),{model:B}=n.getType(u),{model:k}=n.getType(f),{model:I,view:R}=n.getType(l),{model:W,view:Z}=n.getType(N),{model:X,view:J}=n.getType(D),{model:Q,view:G}=n.getType(y),{model:ee,view:ae}=n.getType(w),{model:ge,view:je}=n.getType(S),{model:Se,view:et}=n.getType(C),{model:Ye,view:Ct}=n.getType(j),{model:ct}=n.getType(E),{model:we,view:nt}=n.getType(O),{model:st,view:vt}=n.getType(_),{view:Me,model:pt}=n.getType(T),{view:ut,model:Fe}=n.getType(A),{view:Yt,model:he}=n.getType(P),Ve=Wo.globalStyles,De="css-class",$e={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Ot={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Ft={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},er={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},po={label:"Content",getValue:({component:q})=>q.getInnerHTML(),setValue:({component:q,value:ue})=>q.components(ue)},Xe=q=>{r.open({title:q.getName({noCustom:!0}),content:()=>c.jsx(Sy,{content:"",code:q.getInnerHTML(),onAction:ue=>q.components(ue),buttonProps:{children:o.t("save")}})})},bt=q=>{var de;const ue=q.getChildrenContainer();((de=ue==null?void 0:ue.innerHTML)==null?void 0:de.trim())===""&&(ue.innerHTML="")},Xt=q=>q.set({void:!1},{silent:!0});function Pn(q={}){return U.prototype.toHTML.call(this,q)}function Gt(q){const ue=q.closestType(a),de=ue==null?void 0:ue.findType(l)[0];return(de==null?void 0:de.toHTML())||""}function fo(q){const ue=q.toHTML(),de=e.runCommand(Cu,{mjml:ue}),_t=new DOMParser().parseFromString(de.html,"text/html");return{mjml:ue,mjmlToHtml:de,document:_t}}const mn=function(q){const ue=q.model,de=Rr(()=>{var Ce;return(Ce=ue.closestType(a))==null?void 0:Ce.trigger("rerender")});q.listenTo(ue.components(),"add remove reset change",de)},wr=(q,ue)=>q.replace(`<${a}>`,`<${a}>${Gt(ue)}`),Sr=q=>`cls-${q.tagName}-${q.getId()}`,Cr=(q,ue)=>{const de={...q.get("attributes")||{}};return delete de.style,{...de,[De]:`${de[De]||""} ${Sr(q)}`.trim()}},jr=(q,ue)=>{const de=q.closestType(a),Ce=(de==null?void 0:de.findFirstType(l))||(de==null?void 0:de.append({type:l})[0]);Ce==null||Ce.trigger(ue?"rerenderHeadImmediate":"rerenderHead")},Er=q=>function(){return Cr(this)},rn=(q,ue)=>function(de){const Ce=de.querySelector(`.${Sr(this.model)}`);return(ue?Ce:Ce==null?void 0:Ce.outerHTML)||q.prototype.getTemplateFromEl.call(this,de)},as=q=>function(...ue){const de=q.prototype.toJSON.apply(this,ue),Ce=de.attributes||{};return delete de.style,delete Ce.style,delete Ce.__p,de},jl=q=>function(...ue){const de=q.prototype.getAttrToHTML.apply(this,ue);delete de.__p;for(const Ce in de)de[Ce]===""&&delete de[Ce];return de};function Ko(){return{start:`<mjml>${Gt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function qu(){var de;const q=(de=this.model.parent())==null?void 0:de.is(d),ue=rg(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:ue.start,end:ue.end}}function qw(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const rg=(q,ue={})=>{var Bn;const de=q.parents().filter(ls=>ls.tagName.startsWith("mj-")),Ce=ue.withHead?Gt(q):"",_t=(Bn=q.parent())==null?void 0:Bn.components(),kt=(_t==null?void 0:_t.map(({tagName:ls})=>ls))||[],Tn=(_t==null?void 0:_t.indexOf(q))??-1;return jM({rootTag:a,head:Ce,parentNodes:de.map(ls=>{var Fi;return{tagName:ls.tagName,attributes:(Fi=ls.getMjmlAttributes)==null?void 0:Fi.call(ls)}}),withSiblings:ue.withSiblings,siblingTags:kt,currentSiblingIndex:Tn,beforeRootEnd:ue.beforeRootEnd})},Jt=({model:q,noVoid:ue})=>({init(){const de={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",de),this.set("style",de),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),ue&&Xt(this)},handleStyleChange(de,Ce,_t){if(_t.fromAttr||_t.fromSync)return;const kt=this.getStylesToAttributes();this.set("attributes",kt,{..._t,fromStyle:!0,fromSync:!0})},handleAttributeChange(de,Ce,_t){if(_t.fromStyle||_t.fromSync)return;const kt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(kt,{..._t,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const de=this.getStyle({skipResolve:!0})||{};return delete de.__p,de},toHTML:Pn,getAttrToHTML:jl(q),getMjmlAttributes:Er(),toJSON:as(q)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:q=>q.findType(a)[0]}},init(){this.on(`${s.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(a)&&e.Layers.setRoot(this)}}}),n.addType(a,{model:{...Jt({model:H}),defaults:{tagName:a,name:"Root",toolbar:[]},toHTML:Pn},view:{reset(){this.render()}}}),n.addType(l,{model:{defaults:{tagName:l,name:"Head",copyable:!1,stylable:!1,traits:[],icon:'<svg viewBox="0 0 24 24"><path d="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /></svg>'},toJSON:as(I)},view:{init(){this.renderHeadDebounced=Rr(this.renderHead,30);const{em:q,el:ue,model:de}=this,Ce=de.components(),_t="core:preview",kt=q.Commands.events;this.listenTo(q,`${kt.runCommand}${_t}`,()=>{ue.style.display="none"}),this.listenTo(q,`${kt.stopCommand}${_t}`,()=>{ue.style.display=""}),this.listenTo(Ce,"change",this.onComponentsChange),this.listenTo(Ce,"add remove reset",this.renderHead),this.listenTo(de,"rerenderHead",this.renderHeadDebounced),this.listenTo(de,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(q){const ue=Object.keys(q.changedAttributes());ue.length===1&&ue[0]==="status"||this.renderHead()},renderHead(){var ls;const{model:q,el:ue,em:de}=this,Ce=ue.ownerDocument;if(!(Ce&&Ce!==document)||de.destroyed)return;const kt=q.closestType(a),Tn=kt&&fo(kt),Bn=(ls=Tn==null?void 0:Tn.document)==null?void 0:ls.head;if(Bn){const Fi="mjml-head-result",Ku=Ce.querySelector(Fi)||Ce.createElement(Fi);Ku.innerHTML=Bn.innerHTML,!Ce.head.contains(Ku)&&Ce.head.prepend(Ku)}},render(...q){const ue=R.prototype.render.apply(this,q);return this.renderHeadDebounced(),ue}}}),n.addType(d,{isComponent:Qo(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Ms(l),traits:[]},toJSON:as(U)},view:{onRender(){this.el.style.display="none"},init(){mn(this)}}}),n.addType(p,{isComponent:Qo(p),model:{defaults:{tagName:p,name:"Class",stylable:!1,draggable:Ms(d),traits:[]},toJSON:as(U)}}),n.addType(f,{model:{...Jt({model:k}),defaults:{tagName:f,name:"Font",stylable:!1,draggable:Ms(l),icon:'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1-3.5 7H18V9M5 3h5a2 2 0 0 1 2 2v11H9v-5H6v5H3V5a2 2 0 0 1 2-2m1 2v4h3V5H6Z"/></svg>',traits:[{name:"name",placeholder:"Name of the font"},{name:"href",placeholder:"URL of a hosted CSS file"}]}},view:{tagName:()=>"div",render(){return this.el.style.cssText="",this}}}),n.addType(x,{extend:a,isComponent:Qo(x),model:{defaults:{tagName:x,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Ms(l),icon:'<svg viewBox="0 0 24 24"><path d="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z" /></svg>',traits:[]}},view:{attributes:{},render(){return this.el.style.cssText="",this}}}),n.addType(g,{isComponent:Qo(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Ms(d),traits:[]},toHTML(...q){return H.prototype.toHTML.apply(this,q)},toJSON:as(U)}}),n.addType(m,{isComponent:Qo(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Ms(l),traits:[po],icon:`<svg viewBox="0 0 24 24">
172
+ }`,o.appendChild(u)}},Ny=(e,t)=>{const{model:n}=t,s=n.constructor.getDefaults(),r=s.emptyState,o=n.get("type");if(!r||s.void===!0||o!==e)return;const i=r===!0?{}:r;kL(t,o,n.getName({noCustom:!0}),i)},RL=function(t){const{Components:n}=t,s=({id:r})=>{n.addType(r,{extendFnView:["onRender"],view:{onRender(){Ny(r,this)}}})};n.getTypes().forEach(s),t.on("component:type:add",s)},Ld=e=>`<${e}></${e}>`,IL=(e={})=>Object.entries(e).filter(([,t])=>t!==""&&t!==void 0&&t!==null).map(([t,n])=>` ${t}="${n}"`).join("");function VL(e=[],t=-1){if(!e.length)return{before:"",after:""};if(t<0||t>=e.length)return{before:"",after:e.map(Ld).join("")};const n=e.slice(0,t).map(Ld).join(""),s=e.slice(t+1).map(Ld).join("");return{before:n,after:s}}function HL({rootTag:e,head:t="",parentNodes:n,withSiblings:s,siblingTags:r=[],currentSiblingIndex:o=-1,beforeRootEnd:i=""}){const a=n.map(f=>`<${f.tagName}${IL(f.attributes)}>`).reverse().join(""),l=n.map(f=>`</${f.tagName}>`).join(""),u=s?VL(r,o):void 0,d=(u==null?void 0:u.before)||"",p=(u==null?void 0:u.after)||"";return{start:`<${e}>${t}${a}${d}`,end:`${p}${l}${i}</${e}>`}}function DL(e,t){const{Components:n}=e,s=n.events,{modalStore:r,i18nStore:o,fontsStore:i}=t.appStore.store,{root:a,head:l,body:u}=Na,{attributes:d,class:p,font:f,all:h,preview:m,title:b,style:v,breakpoint:x}=Cg,{wrapper:y,section:w,column:S,text:j,button:C,image:E,divider:O,group:P,social:T,socialElement:A,spacer:_,navbar:N,navbarLink:V,table:M,raw:I}=$r,{model:U}=n.getType("default"),{model:F}=n.getType(a),{model:W}=n.getType(u),{model:H}=n.getType(f),{model:R,view:$}=n.getType(l),{model:B,view:Z}=n.getType(N),{model:Y,view:ee}=n.getType(V),{model:X,view:G}=n.getType(y),{model:Q,view:ie}=n.getType(w),{model:ae,view:me}=n.getType(S),{model:ve,view:ke}=n.getType(j),{model:Re,view:ot}=n.getType(C),{model:Ue}=n.getType(E),{model:we,view:ze}=n.getType(O),{model:Xe,view:vt}=n.getType(_),{view:Le,model:ft}=n.getType(T),{view:dt,model:We}=n.getType(A),{view:Xt,model:he}=n.getType(P),De=Go.globalStyles,Be="css-class",Ie={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},_t={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Ft={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},nr={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},go={label:"Content",getValue:({component:q})=>q.getInnerHTML(),setValue:({component:q,value:de})=>q.components(de)},tt=q=>{r.open({title:q.getName({noCustom:!0}),content:()=>c.jsx(Ly,{content:"",code:q.getInnerHTML(),onAction:de=>q.components(de),buttonProps:{children:o.t("save")}})})},yt=q=>{var pe;const de=q.getChildrenContainer();((pe=de==null?void 0:de.innerHTML)==null?void 0:pe.trim())===""&&(de.innerHTML="")},Jt=q=>q.set({void:!1},{silent:!0});function Pn(q={}){return U.prototype.toHTML.call(this,q)}function qt(q){const de=q.closestType(a),pe=de==null?void 0:de.findType(l)[0];return(pe==null?void 0:pe.toHTML())||""}function ho(q){const de=q.toHTML(),pe=e.runCommand(Tu,{mjml:de}),At=new DOMParser().parseFromString(pe.html,"text/html");return{mjml:de,mjmlToHtml:pe,document:At}}const mn=function(q){const de=q.model,pe=Vr(()=>{var je;return(je=de.closestType(a))==null?void 0:je.trigger("rerender")});q.listenTo(de.components(),"add remove reset change",pe)},Cr=(q,de)=>q.replace(`<${a}>`,`<${a}>${qt(de)}`),jr=q=>`cls-${q.tagName}-${q.getId()}`,Er=(q,de)=>{const pe={...q.get("attributes")||{}};return delete pe.style,{...pe,[Be]:`${pe[Be]||""} ${jr(q)}`.trim()}},Pr=(q,de)=>{const pe=q.closestType(a),je=(pe==null?void 0:pe.findFirstType(l))||(pe==null?void 0:pe.append({type:l})[0]);je==null||je.trigger(de?"rerenderHeadImmediate":"rerenderHead")},Tr=q=>function(){return Er(this)},rn=(q,de)=>function(pe){const je=pe.querySelector(`.${jr(this.model)}`);return(de?je:je==null?void 0:je.outerHTML)||q.prototype.getTemplateFromEl.call(this,pe)},ls=q=>function(...de){const pe=q.prototype.toJSON.apply(this,de),je=pe.attributes||{};return delete pe.style,delete je.style,delete je.__p,pe},Ol=q=>function(...de){const pe=q.prototype.getAttrToHTML.apply(this,de);delete pe.__p;for(const je in pe)pe[je]===""&&delete pe[je];return pe};function Zo(){return{start:`<mjml>${qt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function Xu(){var pe;const q=(pe=this.model.parent())==null?void 0:pe.is(d),de=ch(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:de.start,end:de.end}}function lS(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const ch=(q,de={})=>{var zn;const pe=q.parents().filter(cs=>cs.tagName.startsWith("mj-")),je=de.withHead?qt(q):"",At=(zn=q.parent())==null?void 0:zn.components(),kt=(At==null?void 0:At.map(({tagName:cs})=>cs))||[],Tn=(At==null?void 0:At.indexOf(q))??-1;return HL({rootTag:a,head:je,parentNodes:pe.map(cs=>{var zi;return{tagName:cs.tagName,attributes:(zi=cs.getMjmlAttributes)==null?void 0:zi.call(cs)}}),withSiblings:de.withSiblings,siblingTags:kt,currentSiblingIndex:Tn,beforeRootEnd:de.beforeRootEnd})},Qt=({model:q,noVoid:de})=>({init(){const pe={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",pe),this.set("style",pe),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),de&&Jt(this)},handleStyleChange(pe,je,At){if(At.fromAttr||At.fromSync)return;const kt=this.getStylesToAttributes();this.set("attributes",kt,{...At,fromStyle:!0,fromSync:!0})},handleAttributeChange(pe,je,At){if(At.fromStyle||At.fromSync)return;const kt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(kt,{...At,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const pe=this.getStyle({skipResolve:!0})||{};return delete pe.__p,pe},toHTML:Pn,getAttrToHTML:Ol(q),getMjmlAttributes:Tr(),toJSON:ls(q)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:q=>q.findType(a)[0]}},init(){this.on(`${s.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(a)&&e.Layers.setRoot(this)}}}),n.addType(a,{model:{...Qt({model:F}),defaults:{tagName:a,name:"Root",toolbar:[]},toHTML:Pn},view:{reset(){this.render()}}}),n.addType(l,{model:{defaults:{tagName:l,name:"Head",copyable:!1,stylable:!1,traits:[],icon:'<svg viewBox="0 0 24 24"><path d="M14.6,16.6L19.2,12L14.6,7.4L16,6L22,12L16,18L14.6,16.6M9.4,16.6L4.8,12L9.4,7.4L8,6L2,12L8,18L9.4,16.6Z" /></svg>'},toJSON:ls(R)},view:{init(){this.renderHeadDebounced=Vr(this.renderHead,30);const{em:q,el:de,model:pe}=this,je=pe.components(),At="core:preview",kt=q.Commands.events;this.listenTo(q,`${kt.runCommand}${At}`,()=>{de.style.display="none"}),this.listenTo(q,`${kt.stopCommand}${At}`,()=>{de.style.display=""}),this.listenTo(je,"change",this.onComponentsChange),this.listenTo(je,"add remove reset",this.renderHead),this.listenTo(pe,"rerenderHead",this.renderHeadDebounced),this.listenTo(pe,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(q){const de=Object.keys(q.changedAttributes());de.length===1&&de[0]==="status"||this.renderHead()},renderHead(){var cs;const{model:q,el:de,em:pe}=this,je=de.ownerDocument;if(!(je&&je!==document)||pe.destroyed)return;const kt=q.closestType(a),Tn=kt&&ho(kt),zn=(cs=Tn==null?void 0:Tn.document)==null?void 0:cs.head;if(zn){const zi="mjml-head-result",Ju=je.querySelector(zi)||je.createElement(zi);Ju.innerHTML=zn.innerHTML,!je.head.contains(Ju)&&je.head.prepend(Ju)}},render(...q){const de=$.prototype.render.apply(this,q);return this.renderHeadDebounced(),de}}}),n.addType(d,{isComponent:ei(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:ks(l),traits:[]},toJSON:ls(U)},view:{onRender(){this.el.style.display="none"},init(){mn(this)}}}),n.addType(p,{isComponent:ei(p),model:{defaults:{tagName:p,name:"Class",stylable:!1,draggable:ks(d),traits:[]},toJSON:ls(U)}}),n.addType(f,{model:{...Qt({model:H}),defaults:{tagName:f,name:"Font",stylable:!1,draggable:ks(l),icon:'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1-3.5 7H18V9M5 3h5a2 2 0 0 1 2 2v11H9v-5H6v5H3V5a2 2 0 0 1 2-2m1 2v4h3V5H6Z"/></svg>',traits:[{name:"name",placeholder:"Name of the font"},{name:"href",placeholder:"URL of a hosted CSS file"}]}},view:{tagName:()=>"div",render(){return this.el.style.cssText="",this}}}),n.addType(x,{extend:a,isComponent:ei(x),model:{defaults:{tagName:x,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:ks(l),icon:'<svg viewBox="0 0 24 24"><path d="M22,17H18V10H22M23,8H17A1,1 0 0,0 16,9V19A1,1 0 0,0 17,20H23A1,1 0 0,0 24,19V9A1,1 0 0,0 23,8M4,6H22V4H4A2,2 0 0,0 2,6V17H0V20H14V17H4V6Z" /></svg>',traits:[]}},view:{attributes:{},render(){return this.el.style.cssText="",this}}}),n.addType(h,{isComponent:ei(h),model:{defaults:{tagName:h,name:"All",stylable:!1,void:!0,draggable:ks(d),traits:[]},toHTML(...q){return F.prototype.toHTML.apply(this,q)},toJSON:ls(U)}}),n.addType(m,{isComponent:ei(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:ks(l),traits:[go],icon:`<svg viewBox="0 0 24 24">
173
173
  <path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
174
- </svg>`},toJSON:as(U)},view:{tagName:()=>"div",init(){const q=this.model.components();this.onRender=Rr(this.onRender,1),this.listenTo(q,"add remove reset change",this.onRender)},onRender(){const{model:q,el:ue}=this,de=q.getName({noCustom:!0}),Ce=q.getInnerHTML();ue.innerHTML=`<b>${de}</b>: ${Ce}`,ue.style.padding="5px 10px",ue.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:Qo(v),extend:m,model:{defaults:{tagName:v,name:"Title",icon:'<svg viewBox="0 0 24 24"><path d="M5,4V7H10.5V19H13.5V7H19V4H5Z" /></svg>'}}}),n.addType(b,{model:{defaults:{tagName:b,name:"Style",droppable:!1,layerable:!1,stylable:!1,traits:[]},toJSON:as(U)},view:{render(){return this}}}),n.addType(u,{model:{...Jt({model:B,noVoid:!0}),defaults:{tagName:u,icon:'<svg viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M6,8V16H18V8H6Z" /></svg>',traits:[],emptyState:{midSelector:">div",styleOut:"height: 100vh;"}}}}),n.addType(y,{model:{...Jt({model:Q,noVoid:!0}),defaults:{tagName:y,icon:'<svg viewBox="0 0 24 24"><path d="M19 16H5V8h14m0-5H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>',stylable:["background-position","padding","padding-top","padding-left","padding-right","padding-bottom","border","border-width","border-style","border-color","background-color","background-url","background-repeat","background-size","text-align","border-radius","gap"],traits:[Ft]}},view:{attributes:{},getMjmlTemplate:qu,getTemplateFromEl:rn(G),init(){qw.bind(this)();const{model:q}=this;this.listenTo(q,"change:attributes:gap",this.render),this.listenTo(q.components(),"add remove reset",this.render)}}}),n.addType(w,{model:{...Jt({model:ee,noVoid:!0}),defaults:{tagName:w,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[er,Ft],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:rn(ae),getMjmlTemplate:qu,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return bt(this),this}}}),n.addType(P,{model:{...Jt({model:he,noVoid:!0}),defaults:{tagName:P,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[er]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:rn(Yt,!0),getChildrenContainer(){return this.el},getMjmlTemplate:qu,render(){const q=this.getTemplateFromMjml(),ue=oS(q);return this.renderAttributes(),this.$el.attr(ue),this.el.innerHTML=q.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const Kw=[C,E,j,O,_,T,A,V,L,P,N,D,Lr.carousel,Lr.carouselImage,Lr.accordion,Lr.accordionElement,Lr.accordionTitle,Lr.accordionText];n.addType(S,{model:{...Jt({model:ge,noVoid:!0}),defaults:{tagName:S,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[],stylable:[...ge.getDefaults().stylable,"inner-background-color"],droppable:q=>Kw.includes(q.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var de;const q=(de=this.model.parent())==null?void 0:de.is(d),ue=rg(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:ue.start,end:ue.end}},getTemplateFromEl:rn(je,!0),getChildrenContainer(){const{el:q}=this;return q.querySelector("td > table tbody")||q.querySelector("table tbody")||q},render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),jr(this.model,!0),this}}}),n.addType(C,{model:{...Jt({model:Se}),defaults:{tagName:C,emptyState:{midSelector:' [contenteditable="false"]:not([data-type-data-variable])',styleIn:"min-height: 20px;",styleOut:"padding: 0 5px;"},traits:[],"style-default":{padding:"10px 25px"}}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(et),attributes:{style:"display: table; width: 100%"}}}),n.addType(j,{model:{...Jt({model:Ye,noVoid:!0}),defaults:{tagName:j,traits:[$e],stylable:[...Ye.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(Ct)}}),n.addType(E,{model:{...Jt({model:ct}),defaults:{tagName:E,"style-default":{align:"center"},traits:[Ot,{id:"altText",name:"alt",placeholder:"Image description"},"title",$e,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const q=ct.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete q.src,q},getMjmlAttributes(){const q=Cr(this);return this.isDefaultSrc()&&delete q.src,q}},view:{updateSrc(){const{model:q}=this,ue=q.get("src",{skipResolve:!0})||q.getSrcResult();q.addAttributes({src:ue}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Gt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(q){var ue,de,Ce;return(Ce=(de=(ue=q.querySelector("img"))==null?void 0:ue.closest("table"))==null?void 0:de.closest("tr"))==null?void 0:Ce.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(O,{model:{...Jt({model:we}),defaults:{tagName:O,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(se,{icon:K.alignHorizontalLeft,size:oe.sx})},{id:"center",title:"Center",labelReact:c.jsx(se,{icon:K.alignHorizontalCenter,size:oe.sx})},{id:"right",title:"Right",labelReact:c.jsx(se,{icon:K.alignHorizontalRight,size:oe.sx})}]}]}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(nt)}}),n.addType(T,{model:{...Jt({model:pt}),defaults:{tagName:T,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...pt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(Me)}}),n.addType(A,{model:{...Jt({model:Fe,noVoid:!0}),defaults:{tagName:A,"style-default":{align:"center"},traits:[{type:"select",label:"Icon",name:"name",options:[{id:"custom",name:"Custom"},{id:"facebook",name:"Facebook"},{id:"twitter",name:"Twitter/X"},{id:"google",name:"Google"},{id:"instagram",name:"Instagram"},{id:"web",name:"Web"},{id:"youtube",name:"YouTube"},{id:"pinterest",name:"Pinterest"},{id:"linkedin",name:"Linkedin"},{id:"snapchat",name:"Snapchat"},{id:"vimeo",name:"Vimeo"},{id:"tumblr",name:"Tumblr"},{id:"github",name:"Github"},{id:"soundcloud",name:"SoundCloud"},{id:"medium",name:"Medium"},{id:"dribbble",name:"Dribbble"},{id:"xing",name:"Xing"}]},Ot,$e,po]},getMjmlAttributes(){const q=Cr(this);return{...this.getDefaultIconProps()[q.name],...q}},getAttrToHTML(){const q=Fe.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[q.name],...q}},getDefaultIconProps(){return{twitter:{src:"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png","background-color":"black"}}}},extendFnView:["init"],view:{init(){this.listenTo(this.model,"component:update:components",this.rerender)},getMjmlTemplate(){const{start:q,end:ue}=ut.prototype.getMjmlTemplate.call(this);return{start:wr(q,this.model),end:ue}},getInnerMjmlTemplate(){var Ce;const{start:q,end:ue}=ut.prototype.getInnerMjmlTemplate.call(this),de=((Ce=this.model.getInnerHTML())==null?void 0:Ce.trim())||"";return{start:`${q}${de}`,end:ue}},getChildrenContainer(){var Ce;const{el:q}=this,ue=(Ce=q.querySelector("tbody > tr > td"))==null?void 0:Ce.nextElementSibling;return(ue==null?void 0:ue.firstElementChild)||q.querySelector("img")||q}}}),n.addType(_,{model:{...Jt({model:st}),defaults:{tagName:_,traits:[]}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(vt)}}),n.addType(N,{model:{...Jt({model:W}),defaults:{tagName:N,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Ko,getTemplateFromEl:rn(Z,!0),render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),jr(this.model),this}}}),n.addType(D,{model:{...Jt({model:X}),defaults:{tagName:D,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:q,end:ue}=J.prototype.getMjmlTemplate.call(this);return{start:wr(q,this.model),end:ue}},getTemplateFromEl(q){return q.querySelector(".mj-inline-links").innerHTML}}}),n.addType(V,{extendFn:["initToolbar"],model:{defaults:{tagName:V,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){h3(this,{id:"edit",command:()=>Xe(this),label:`<svg viewBox="0 0 24 24">
174
+ </svg>`},toJSON:ls(U)},view:{tagName:()=>"div",init(){const q=this.model.components();this.onRender=Vr(this.onRender,1),this.listenTo(q,"add remove reset change",this.onRender)},onRender(){const{model:q,el:de}=this,pe=q.getName({noCustom:!0}),je=q.getInnerHTML();de.innerHTML=`<b>${pe}</b>: ${je}`,de.style.padding="5px 10px",de.style.fontFamily="system-ui"}}}),n.addType(b,{isComponent:ei(b),extend:m,model:{defaults:{tagName:b,name:"Title",icon:'<svg viewBox="0 0 24 24"><path d="M5,4V7H10.5V19H13.5V7H19V4H5Z" /></svg>'}}}),n.addType(v,{model:{defaults:{tagName:v,name:"Style",droppable:!1,layerable:!1,stylable:!1,traits:[]},toJSON:ls(U)},view:{render(){return this}}}),n.addType(u,{model:{...Qt({model:W,noVoid:!0}),defaults:{tagName:u,icon:'<svg viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M6,8V16H18V8H6Z" /></svg>',traits:[],emptyState:{midSelector:">div",styleOut:"height: 100vh;"}}}}),n.addType(y,{model:{...Qt({model:X,noVoid:!0}),defaults:{tagName:y,icon:'<svg viewBox="0 0 24 24"><path d="M19 16H5V8h14m0-5H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>',stylable:["background-position","padding","padding-top","padding-left","padding-right","padding-bottom","border","border-width","border-style","border-color","background-color","background-url","background-repeat","background-size","text-align","border-radius","gap"],traits:[Ft]}},view:{attributes:{},getMjmlTemplate:Xu,getTemplateFromEl:rn(G),init(){lS.bind(this)();const{model:q}=this;this.listenTo(q,"change:attributes:gap",this.render),this.listenTo(q.components(),"add remove reset",this.render)}}}),n.addType(w,{model:{...Qt({model:Q,noVoid:!0}),defaults:{tagName:w,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[nr,Ft],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:rn(ie),getMjmlTemplate:Xu,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return yt(this),this}}}),n.addType(P,{model:{...Qt({model:he,noVoid:!0}),defaults:{tagName:P,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[nr]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:rn(Xt,!0),getChildrenContainer(){return this.el},getMjmlTemplate:Xu,render(){const q=this.getTemplateFromMjml(),de=xS(q);return this.renderAttributes(),this.$el.attr(de),this.el.innerHTML=q.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const cS=[j,E,C,O,_,T,A,I,M,P,N,V,$r.carousel,$r.carouselImage,$r.accordion,$r.accordionElement,$r.accordionTitle,$r.accordionText];n.addType(S,{model:{...Qt({model:ae,noVoid:!0}),defaults:{tagName:S,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[],stylable:[...ae.getDefaults().stylable,"inner-background-color"],droppable:q=>cS.includes(q.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var pe;const q=(pe=this.model.parent())==null?void 0:pe.is(d),de=ch(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:de.start,end:de.end}},getTemplateFromEl:rn(me,!0),getChildrenContainer(){const{el:q}=this;return q.querySelector("td > table tbody")||q.querySelector("table tbody")||q},render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),Pr(this.model,!0),this}}}),n.addType(j,{model:{...Qt({model:ve}),defaults:{tagName:j,emptyState:{midSelector:' [contenteditable="false"]:not([data-type-data-variable])',styleIn:"min-height: 20px;",styleOut:"padding: 0 5px;"},traits:[],"style-default":{padding:"10px 25px"}}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(ke),attributes:{style:"display: table; width: 100%"}}}),n.addType(C,{model:{...Qt({model:Re,noVoid:!0}),defaults:{tagName:C,traits:[Ie],stylable:[...Re.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(ot)}}),n.addType(E,{model:{...Qt({model:Ue}),defaults:{tagName:E,"style-default":{align:"center"},traits:[_t,{id:"altText",name:"alt",placeholder:"Image description"},"title",Ie,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const q=Ue.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete q.src,q},getMjmlAttributes(){const q=Er(this);return this.isDefaultSrc()&&delete q.src,q}},view:{updateSrc(){const{model:q}=this,de=q.get("src",{skipResolve:!0})||q.getSrcResult();q.addAttributes({src:de}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${qt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(q){var de,pe,je;return(je=(pe=(de=q.querySelector("img"))==null?void 0:de.closest("table"))==null?void 0:pe.closest("tr"))==null?void 0:je.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(O,{model:{...Qt({model:we}),defaults:{tagName:O,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(ne,{icon:K.alignHorizontalLeft,size:oe.sx})},{id:"center",title:"Center",labelReact:c.jsx(ne,{icon:K.alignHorizontalCenter,size:oe.sx})},{id:"right",title:"Right",labelReact:c.jsx(ne,{icon:K.alignHorizontalRight,size:oe.sx})}]}]}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(ze)}}),n.addType(T,{model:{...Qt({model:ft}),defaults:{tagName:T,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...ft.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(Le)}}),n.addType(A,{model:{...Qt({model:We,noVoid:!0}),defaults:{tagName:A,"style-default":{align:"center"},traits:[{type:"select",label:"Icon",name:"name",options:[{id:"custom",name:"Custom"},{id:"facebook",name:"Facebook"},{id:"twitter",name:"Twitter/X"},{id:"google",name:"Google"},{id:"instagram",name:"Instagram"},{id:"web",name:"Web"},{id:"youtube",name:"YouTube"},{id:"pinterest",name:"Pinterest"},{id:"linkedin",name:"Linkedin"},{id:"snapchat",name:"Snapchat"},{id:"vimeo",name:"Vimeo"},{id:"tumblr",name:"Tumblr"},{id:"github",name:"Github"},{id:"soundcloud",name:"SoundCloud"},{id:"medium",name:"Medium"},{id:"dribbble",name:"Dribbble"},{id:"xing",name:"Xing"}]},_t,Ie,go]},getMjmlAttributes(){const q=Er(this);return{...this.getDefaultIconProps()[q.name],...q}},getAttrToHTML(){const q=We.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[q.name],...q}},getDefaultIconProps(){return{twitter:{src:"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png","background-color":"black"}}}},extendFnView:["init"],view:{init(){this.listenTo(this.model,"component:update:components",this.rerender)},getMjmlTemplate(){const{start:q,end:de}=dt.prototype.getMjmlTemplate.call(this);return{start:Cr(q,this.model),end:de}},getInnerMjmlTemplate(){var je;const{start:q,end:de}=dt.prototype.getInnerMjmlTemplate.call(this),pe=((je=this.model.getInnerHTML())==null?void 0:je.trim())||"";return{start:`${q}${pe}`,end:de}},getChildrenContainer(){var je;const{el:q}=this,de=(je=q.querySelector("tbody > tr > td"))==null?void 0:je.nextElementSibling;return(de==null?void 0:de.firstElementChild)||q.querySelector("img")||q}}}),n.addType(_,{model:{...Qt({model:Xe}),defaults:{tagName:_,traits:[]}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(vt)}}),n.addType(N,{model:{...Qt({model:B}),defaults:{tagName:N,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Zo,getTemplateFromEl:rn(Z,!0),render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),Pr(this.model),this}}}),n.addType(V,{model:{...Qt({model:Y}),defaults:{tagName:V,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:q,end:de}=ee.prototype.getMjmlTemplate.call(this);return{start:Cr(q,this.model),end:de}},getTemplateFromEl(q){return q.querySelector(".mj-inline-links").innerHTML}}}),n.addType(I,{extendFn:["initToolbar"],model:{defaults:{tagName:I,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){A3(this,{id:"edit",command:()=>tt(this),label:`<svg viewBox="0 0 24 24">
175
175
  <path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path>
176
- </svg>`})},toJSON:as(U)},view:{events:{dblclick:"onActive"},onActive(){Xe(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:q=>{var ue,de;if(((ue=q.tagName)==null?void 0:ue.toLowerCase())===b&&((de=q.getAttribute)==null?void 0:de.call(q,"css-class"))===Ve)return{type:"textnode",components:[],content:""}}});const Zw=q=>{const{id:ue,view:de}=q,Ce=de.prototype;n.addType(ue,{view:{render(){return Ce.render.apply(this,arguments),Cy(ue,this),this}}})};[u,w,S,C,N,T,V].forEach(q=>Zw(n.getType(q))),n.getTypes().forEach(({id:q,view:ue})=>{ue.prototype.disableEditing&&n.addType(q,{view:{onDisable(de={}){this.disableEditing({...de,parserOptions:{htmlType:"text/html"}})}}})});const og=()=>{const q="projectFonts",de=e.Components.getWrapper().findFirstType(a);if(!de)return;const Ce=de.findFirstType(l)||de.append({type:l})[0];Ce.findType(b).filter(Bn=>Bn.getAttributes()[De]===q||Bn.attributes[H0]===D0).forEach(Bn=>Bn.remove());const kt=V0(i.fonts);if(!kt)return;const Tn=Ce.append({type:b,content:kt})[0];Tn==null||Tn.addAttributes({[De]:q})},ig=()=>{const q=e.Css.rules.filter(kt=>{const Tn=kt.attributes.groups;return!!(Tn!=null&&Tn.some(Bn=>Bn.startsWith(`${Ve}:`)))}).map(kt=>kt.toCSS());if(!q.length)return;const de=e.Components.getWrapper().findFirstType(_a.root);if(!de)return;const Ce=de.findFirstType(l)||de.append({type:l})[0];(Ce.findType(b).find(kt=>kt.getAttributes()[De]===Ve)||Ce.append({type:b,attributes:{[De]:Ve}})[0]).set("content",q.join(`
177
- `))},Yw=Rr(ig,100);e.on(Hn.pageSettingsUpdate,q=>{q.page||og()}),e.on(e.events.projectLoad,({loaded:q})=>{q&&(ig(),og())}),e.on(e.Parser.events.htmlBefore,q=>{var de;const ue=(de=e.Parser.config.optionsHtml)==null?void 0:de.codeSanitizer;q.input=ry(q.input,{sanitizer:ue})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${Ve}`,Yw)})}function PM(e){const{Blocks:t}=e,n="Content",s="Layout",r={className:"gs-block-item__media h-7",full:!0,space:"s",nowrap:!0},o={category:s,full:!0},i="gjs-border-2 gjs-border-current gjs-rounded-sm",a=(l,u)=>{t.add(l,{select:!0,category:n,...u})};a("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
176
+ </svg>`})},toJSON:ls(U)},view:{events:{dblclick:"onActive"},onActive(){tt(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:q=>{var de,pe;if(((de=q.tagName)==null?void 0:de.toLowerCase())===v&&((pe=q.getAttribute)==null?void 0:pe.call(q,"css-class"))===De)return{type:"textnode",components:[],content:""}}});const uS=q=>{const{id:de,view:pe}=q,je=pe.prototype;n.addType(de,{view:{render(){return je.render.apply(this,arguments),Ny(de,this),this}}})};[u,w,S,j,N,T,I].forEach(q=>uS(n.getType(q))),n.getTypes().forEach(({id:q,view:de})=>{de.prototype.disableEditing&&n.addType(q,{view:{onDisable(pe={}){this.disableEditing({...pe,parserOptions:{htmlType:"text/html"}})}}})});const uh=()=>{const q="projectFonts",pe=e.Components.getWrapper().findFirstType(a);if(!pe)return;const je=pe.findFirstType(l)||pe.append({type:l})[0];je.findType(v).filter(zn=>zn.getAttributes()[Be]===q||zn.attributes[K0]===Z0).forEach(zn=>zn.remove());const kt=q0(i.fonts);if(!kt)return;const Tn=je.append({type:v,content:kt})[0];Tn==null||Tn.addAttributes({[Be]:q})},dh=()=>{const q=e.Css.rules.filter(kt=>{const Tn=kt.attributes.groups;return!!(Tn!=null&&Tn.some(zn=>zn.startsWith(`${De}:`)))}).map(kt=>kt.toCSS());if(!q.length)return;const pe=e.Components.getWrapper().findFirstType(Na.root);if(!pe)return;const je=pe.findFirstType(l)||pe.append({type:l})[0];(je.findType(v).find(kt=>kt.getAttributes()[Be]===De)||je.append({type:v,attributes:{[Be]:De}})[0]).set("content",q.join(`
177
+ `))},dS=Vr(dh,100);e.on(Dn.pageSettingsUpdate,q=>{q.page||uh()}),e.on(e.events.projectLoad,({loaded:q})=>{q&&(dh(),uh())}),e.on(e.Parser.events.htmlBefore,q=>{var pe;const de=(pe=e.Parser.config.optionsHtml)==null?void 0:pe.codeSanitizer;q.input=gy(q.input,{sanitizer:de})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${De}`,dS)})}function FL(e){const{Blocks:t}=e,n="Content",s="Layout",r={className:"gs-block-item__media h-7",full:!0,space:"s",nowrap:!0},o={category:s,full:!0},i="gjs-border-2 gjs-border-current gjs-rounded-sm",a=(l,u)=>{t.add(l,{select:!0,category:n,...u})};a("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
178
178
  <path fill="currentColor" d="M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z" />
179
179
  </svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),a("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
180
180
  <path fill="currentColor" d="M20 20.5C20 21.3 19.3 22 18.5 22H13C12.6 22 12.3 21.9 12 21.6L8 17.4L8.7 16.6C8.9 16.4 9.2 16.3 9.5 16.3H9.7L12 18V9C12 8.4 12.4 8 13 8S14 8.4 14 9V13.5L15.2 13.6L19.1 15.8C19.6 16 20 16.6 20 17.1V20.5M20 2H4C2.9 2 2 2.9 2 4V12C2 13.1 2.9 14 4 14H8V12H4V4H20V12H18V14H20C21.1 14 22 13.1 22 12V4C22 2.9 21.1 2 20 2Z" />
181
181
  </svg>`,content:"<mj-button>Button</mj-button>"}),a("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
182
182
  <path fill="currentColor" d="M21,3H3C2,3 1,4 1,5V19A2,2 0 0,0 3,21H21C22,21 23,20 23,19V5C23,4 22,3 21,3M5,17L8.5,12.5L11,15.5L14.5,11L19,17H5Z" />
183
- </svg>`,content:`<mj-image src="${mS}"/>`,activate:!0}),a("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
183
+ </svg>`,content:`<mj-image src="${MS}"/>`,activate:!0}),a("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
184
184
  <path fill="currentColor" d="M21 18H2V20H21V18M19 10V14H4V10H19M20 8H3C2.45 8 2 8.45 2 9V15C2 15.55 2.45 16 3 16H20C20.55 16 21 15.55 21 15V9C21 8.45 20.55 8 20 8M21 4H2V6H21V4Z" />
185
185
  </svg>`,content:"<mj-divider/>"}),a("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
186
186
  <path fill="currentColor" d="M18,16.08C17.24,16.08 16.56,16.38 16.04,16.85L8.91,12.7C8.96,12.47 9,12.24 9,12C9,11.76 8.96,11.53 8.91,11.3L15.96,7.19C16.5,7.69 17.21,8 18,8A3,3 0 0,0 21,5A3,3 0 0,0 18,2A3,3 0 0,0 15,5C15,5.24 15.04,5.47 15.09,5.7L8.04,9.81C7.5,9.31 6.79,9 6,9A3,3 0 0,0 3,12A3,3 0 0,0 6,15C6.79,15 7.5,14.69 8.04,14.19L15.16,18.34C15.11,18.55 15.08,18.77 15.08,19C15.08,20.61 16.39,21.91 18,21.91C19.61,21.91 20.92,20.61 20.92,19A2.92,2.92 0 0,0 18,16.08Z" />
@@ -201,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
201
201
  <mj-navbar-link>BLOG</mj-navbar-link>
202
202
  </mj-navbar>`}),a("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
203
203
  <path fill="currentColor" d="M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4M6,9H18V11H6V9M6,13H16V15H6V13Z" />
204
- </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${Iv({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
204
+ </svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${Wb({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
205
205
  <mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
206
206
  Heading title
207
207
  </mj-text>
@@ -215,49 +215,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
215
215
  <path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" />
216
216
  </svg>`,content:`<mj-raw>
217
217
  <span>Insert here you custom HTML</span>
218
- </mj-raw>`}),a("mj-1-column",{...o,label:"1 Column",mediaReact:c.jsx($,{...r,children:c.jsx(F,{className:i,grow:!0})}),content:`<mj-section>
218
+ </mj-raw>`}),a("mj-1-column",{...o,label:"1 Column",mediaReact:c.jsx(k,{...r,children:c.jsx(D,{className:i,grow:!0})}),content:`<mj-section>
219
219
  <mj-column></mj-column>
220
- </mj-section>`}),a("mj-2-columns-50-50",{...o,label:"2 Columns 50/50",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
220
+ </mj-section>`}),a("mj-2-columns-50-50",{...o,label:"2 Columns 50/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0})]}),content:`<mj-section>
221
221
  <mj-column></mj-column>
222
222
  <mj-column></mj-column>
223
- </mj-section>`}),a("mj-2-columns-25-75",{...o,label:"2 Columns 25/75",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-3/4")})]}),content:`<mj-section>
223
+ </mj-section>`}),a("mj-2-columns-25-75",{...o,label:"2 Columns 25/75",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-1/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-3/4")})]}),content:`<mj-section>
224
224
  <mj-column width="25%"></mj-column>
225
225
  <mj-column width="75%"></mj-column>
226
- </mj-section>`}),a("mj-2-columns-33-67",{...o,label:"2 Columns 33/67",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/3")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/3")})]}),content:`<mj-section>
226
+ </mj-section>`}),a("mj-2-columns-33-67",{...o,label:"2 Columns 33/67",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-1/3")}),c.jsx(D,{className:le(i,"gs-utl-basis-2/3")})]}),content:`<mj-section>
227
227
  <mj-column width="33%"></mj-column>
228
228
  <mj-column width="67%"></mj-column>
229
- </mj-section>`}),a("mj-2-columns-67-33",{...o,label:"2 Columns 67/33",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-2/3")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/3")})]}),content:`<mj-section>
229
+ </mj-section>`}),a("mj-2-columns-67-33",{...o,label:"2 Columns 67/33",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-2/3")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/3")})]}),content:`<mj-section>
230
230
  <mj-column width="67%"></mj-column>
231
231
  <mj-column width="33%"></mj-column>
232
- </mj-section>`}),a("mj-2-columns-75-25",{...o,label:"2 Columns 75/25",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-3/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
232
+ </mj-section>`}),a("mj-2-columns-75-25",{...o,label:"2 Columns 75/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-3/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
233
233
  <mj-column width="75%"></mj-column>
234
234
  <mj-column width="25%"></mj-column>
235
- </mj-section>`}),a("mj-3-columns",{...o,label:"3 Columns",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
235
+ </mj-section>`}),a("mj-3-columns",{...o,label:"3 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0})]}),content:`<mj-section>
236
236
  <mj-column></mj-column>
237
237
  <mj-column></mj-column>
238
238
  <mj-column></mj-column>
239
- </mj-section>`}),a("mj-3-columns-25-25-50",{...o,label:"3 Columns 25/25/50",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")})]}),content:`<mj-section>
239
+ </mj-section>`}),a("mj-3-columns-25-25-50",{...o,label:"3 Columns 25/25/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-1/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-2/4")})]}),content:`<mj-section>
240
240
  <mj-column width="25%"></mj-column>
241
241
  <mj-column width="25%"></mj-column>
242
242
  <mj-column width="50%"></mj-column>
243
- </mj-section>`}),a("mj-3-columns-25-50-25",{...o,label:"3 Columns 25/50/25",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
243
+ </mj-section>`}),a("mj-3-columns-25-50-25",{...o,label:"3 Columns 25/50/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-1/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-2/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
244
244
  <mj-column width="25%"></mj-column>
245
245
  <mj-column width="50%"></mj-column>
246
246
  <mj-column width="25%"></mj-column>
247
- </mj-section>`}),a("mj-3-columns-50-25-25",{...o,label:"3 Columns 50/25/25",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
247
+ </mj-section>`}),a("mj-3-columns-50-25-25",{...o,label:"3 Columns 50/25/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:le(i,"gs-utl-basis-2/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/4")}),c.jsx(D,{className:le(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
248
248
  <mj-column width="50%"></mj-column>
249
249
  <mj-column width="25%"></mj-column>
250
250
  <mj-column width="25%"></mj-column>
251
- </mj-section>`}),a("mj-4-columns",{...o,label:"4 Columns",mediaReact:c.jsxs($,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
251
+ </mj-section>`}),a("mj-4-columns",{...o,label:"4 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0}),c.jsx(D,{className:i,grow:!0})]}),content:`<mj-section>
252
252
  <mj-column></mj-column>
253
253
  <mj-column></mj-column>
254
254
  <mj-column></mj-column>
255
255
  <mj-column></mj-column>
256
- </mj-section>`})}const TM=(e,t)=>({[jt.web]:s=>jd(s,t),[jt.document]:s=>jd(s,t),[jt.react]:s=>jd(s,t),[jt.email]:s=>EM(s,t)})[e],Ni="https://cdn.jsdelivr.net/npm/",_d={id:"gjs-blocks-basic",src:`${Ni}grapesjs-blocks-basic@1.0.1/dist/index.js`},OM={id:"grapesjs-plugin-forms",src:`${Ni}grapesjs-plugin-forms@2.0.5/dist/index.js`},Ad={id:"grapesjs-parser-postcss",src:`${Ni}grapesjs-parser-postcss@1.0.1/dist/index.js`},_M={id:"grapesjs-navbar",src:`${Ni}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},Ld={id:"grapesjs-plugin-export",src:`${Ni}grapesjs-plugin-export@1.0.11/dist/index.js`,options:{isBinary:(e,t)=>{const n=t.split(".")[1];return/[\x00-\x08\x0E-\x1F]/.test(e)&&!(n&&["html","css"].indexOf(n)>=0)}}},AM={id:"grapesjs-mjml",src:`${Ni}grapesjs-mjml@1.0.8/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},LM={[jt.email]:[PM,AM],[jt.web]:[_d,OM,Ld,Ad,_M],[jt.document]:[_d,Ld,Ad],[jt.react]:[_d,Ld,Ad]};function MM(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",s=>{const r=-s.canvasOffset.left;s.left<r&&(s.left=r)})}function jy({onCopy:e,getValue:t,value:n,title:s="Copy",...r}){const[o,i]=h.useState(!1),a=()=>{aS((t==null?void 0:t())??n),i(!0),e==null||e()};return h.useEffect(()=>{if(!o)return;const l=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(l)},[o]),c.jsx(St,{onClick:a,title:s,type:"button",size:"lg",withBg:!0,...r,children:c.jsx(se,{className:ie(o&&z.tA),icon:o?K.check:K.contentCopy,size:oe.s})})}const NM=(e,t)=>e.filter(n=>n.id===t)[0]||null,Ey=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),$M=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,Py=Y("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),wh={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},Im=os()&&document.body,kM=(e={})=>({...wh,modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Im}},{name:"preventOverflow",options:{boundary:e.boundary??Im}}]});function Vm(e){var o;const{option:t,active:n,selected:s}=e,r=((o=e.isSelected)==null?void 0:o.call(e))||!0;return c.jsxs($,{items:"center",className:Y([Pe.xy,n&&Af.bgH]),children:[c.jsx(F,{className:Y("truncate"),grow:!0,children:t.label}),c.jsx(F,{className:Y("gjs-pl-2"),children:Ey(t,s)&&r&&c.jsx(se,{className:Y(z.tA),icon:K.check,size:oe.s})})]})}const RM="gs-select-field";function Hm({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(se,{...dt(e.icon)?{icon:e.icon,size:oe.s2x}:e.icon}),c.jsx(F,{className:Y("truncate"),grow:!0,children:e.content||e.label})]})}function Ae(e){const{value:t,onChange:n,onBlur:s,onFocus:r,handlerSelected:o,label:i,options:a,includeEmpty:l,className:u,search:d,open:p,caret:f=K.chevronDown,size:g="m",border:m,emptyState:v="- Select an option -",name:b,required:x,disabled:y,classNameContainer:w,autoFocus:S,labelAs:C,hideCaret:j}=e,[E,O]=h.useState(null),[P,T]=h.useState(null),[A,_]=h.useState(""),{styles:N,attributes:D}=al(E,P,kM()),L=typeof d=="object"?d.onChange:void 0,V=[...a].filter(Q=>d?L||$M(Q,A):Q),U=d&&(typeof d=="object"&&d.value||A),H=U&&V.length?V[0]:NM(V,t),B=Q=>n(Q.id,Q),k={id:null,label:v},I=(H==null?void 0:H.content)||(H==null?void 0:H.label),R=H?o?o(H):H.icon?c.jsx($,{items:"center",gap:"s",children:c.jsx(Hm,{option:H})}):I:o?o(k):v;l&&V.unshift(k);const W=Q=>{const{value:G}=Q.target,ee=G.trim();switch(Q.key){case"Escape":n(null);break;case"Enter":n((V.length?V[0].id:ee)||null,V[0]);break;case" ":Oo(Q);break}},Z=M("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,Ca.focus),X=()=>{s==null||s()},J=ro({...e,className:M(RM,w,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(Ui,{value:H,onChange:B,disabled:y,children:({open:Q})=>c.jsxs("div",{...J,children:[i&&c.jsx(Ui.Label,{as:C,className:e.classNameLabel,children:c.jsx(js,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(H==null?void 0:H.id)??"",onChange:()=>{},className:Y("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:x,disabled:y}),c.jsx(Ui.Button,{ref:O,className:Z,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:S,value:typeof d=="object"&&d.value||A,className:M([u,"gs-utl-w-full",te.rnd,Ca.focus,Pe.xyS]),onChange:G=>{_(G.target.value),L==null||L(G.target.value)},onKeyDown:W,onClick:Oo,onBlur:X,onFocus:r}):c.jsx(rs,{border:m,size:g,title:R,icon:j?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:f,shadow:!1,className:Y(u),titleClass:"",disabled:y})}),c.jsx(Ui.Options,{static:p,className:Py,ref:T,style:N.popper,...D.popper,children:c.jsxs(rs,{padding:!1,className:Y("h-full"),style:{minWidth:`${E==null?void 0:E.offsetWidth}px`,maxHeight:200},children:[!V.length&&d&&d!==!0&&c.jsx("div",{className:Y(Pe.xy),children:d.empty}),V.map((G,ee)=>c.jsx(Ui.Option,{value:G,children:({active:ae})=>c.jsxs($,{items:"center",gap:"s",className:Y([G.className,Pe.xy,ae&&Af.bgH]),nowrap:!0,children:[c.jsx(Hm,{option:G}),c.jsx(F,{className:Y("gjs-pl-2"),children:Ey(G,H)&&!U&&c.jsx(se,{className:Y(z.tA),icon:K.check,size:oe.s})})]})},ee))]})})]})})}const Ty=h.createContext(null),IM=({children:e})=>{const[t,n]=h.useState({setEditor:s=>{n(r=>({...r,editor:s}))}});return c.jsx(Ty.Provider,{value:t,children:e})},is=()=>{const e=h.useContext(Ty);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},hl=()=>{const{editor:e}=is();if(!e)throw new Error("useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.");return e},VM=()=>is().editor,Oy=h.createContext(null),HM=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(s){n(r=>({...r,refCanvas:s}))},setCustomModal(s){n(r=>({...r,customModal:s}))},setCustomAssets(s){n(r=>({...r,customAssets:s}))},setCustomBlocks(s){n(r=>({...r,customBlocks:s}))},setCustomRte(s){n(r=>({...r,customRte:s}))},setCustomStyles(s){n(r=>({...r,customStyles:s}))},setCustomLayers(s){n(r=>({...r,customLayers:s}))},setCustomSelectors(s){n(r=>({...r,customSelectors:s}))},setCustomTraits(s){n(r=>({...r,customTraits:s}))},setReady(s){n(r=>({...r,ready:s}))}}));return c.jsx(Oy.Provider,{value:t,children:e})},Xs=()=>{const e=h.useContext(Oy);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function DM(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function oo(e){return typeof e=="function"}function ms(){}const _y=e=>typeof e=="string",FM=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},Ay=e=>{const t=_y(e)?{id:e,src:e}:e;return new Promise((n,s)=>{const r=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);r.src=t.src,r.onload=()=>n(t.id),r.onerror=()=>s(t.id),document.head.appendChild(r)})},BM=e=>{const t=e.map(n=>Ay(n));return Promise.allSettled(t)},Dm=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(_y(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Fm=new WeakMap;function $i(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Fm.get(e);if(t)return t;const n=function({children:s}){return $n.createPortal(h.createElement("div",null,s),e)};return Fm.set(e,n),n}h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(!1),[o,i]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const a=t.Assets.events.custom,l=({open:u,assets:d,types:p,select:f,close:g,container:m})=>{u&&i({assets:d,types:p,select:f,close:g,Container:$i(m)}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?oo(e)?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(()=>({blocks:[],dragStart:ms,dragStop:ms,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const o=t.Blocks.events.custom,i=({blocks:a,container:l,dragStart:u,dragStop:d})=>{const p=a.reduce((f,g)=>{const m=g.getCategoryLabel(),v=f.get(m);return v?v.push(g):f.set(m,[g]),f},new Map);r({blocks:a,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:$i(l)})};return t.on(o,i),t.Blocks.__trgCustom(),()=>{t.off(o,i)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?oo(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function zM({children:e,...t}){const n=Xs(),s=h.useRef(null);return h.useEffect(()=>{s.current&&n.setRefCanvas(s.current)},[s.current]),c.jsx("div",{...t,ref:s,children:e})}const UM=h.memo(function({children:e}){const{editor:t}=is(),[n,s]=h.useState(()=>({devices:[],selected:"",select:ms}));return h.useEffect(()=>{if(!t)return;const{Devices:r}=t,o=r.events.all,i=()=>{var a;s({devices:r.getDevices(),selected:(a=r.getSelected())==null?void 0:a.id,select:l=>r.select(l)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?oo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),WM=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function GM(e){const t=e.map(({id:o,src:i})=>({id:o,src:i})),n=e.reduce((o,i)=>(o[i.id]=i,o),{}),s=[],r=[];return(await BM(t)).forEach(o=>{o.status==="fulfilled"?s.push(n[o.value]):r.push(n[o.reason])}),{loaded:s,failed:r}}const qM=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{WM(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await GM(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},KM=h.memo(function({children:e,className:t,style:n,options:s={},plugins:r=[],grapesjs:o,grapesjsCss:i,onEditor:a=ms,onReady:l,onUpdate:u,waitReady:d,...p}){const{setEditor:f}=is(),g=Xs(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const E=b.current,O=g.refCanvas;let P,T={},A=[];const _=N=>{const D={height:"100%",...s,plugins:[...A,...s.plugins||[]],pluginsOpts:{...s.pluginsOpts,...T},modal:{custom:!!g.customModal,...s.modal},assetManager:{custom:!!g.customAssets,...s.assetManager},styleManager:{custom:!!g.customStyles,...s.styleManager},blockManager:{custom:!!g.customBlocks,...s.blockManager},richTextEditor:{custom:!!g.customRte,...s.richTextEditor},layerManager:{custom:!!g.customLayers,...s.layerManager},traitManager:{custom:!!g.customTraits,...s.traitManager},selectorManager:{custom:!!g.customSelectors,...s.selectorManager},container:O||E,customUI:!!O,...O?{panels:{defaults:[]}}:{}};P=N.init(D),f(P),a(P),u&&P.on("update",()=>{u(P.getProjectData(),P)}),P.onReady(()=>{v(!0),l==null||l(P)})};return(async()=>{i&&await FM(i);const N=await qM(r);A=N.plugins,T=N.pluginOptions,typeof o=="string"?(await Ay(o),_(window.grapesjs)):_(o)})(),()=>P==null?void 0:P.destroy()},[g.ready]);const x=s.height??"100%",y=s.width??"100%",w=DM("gjs-editor-wrapper",t),S=d&&!m,C=h.useMemo(()=>({...n,height:x,width:y}),[x,y,n]),j=h.useMemo(()=>({...C,...S?{opacity:0,width:0,height:0}:{}}),[C,S]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:w,style:C,children:d}):null,c.jsx("div",{...p,ref:b,className:w,style:j,children:e})]})}),ZM=h.memo(function(){const e=Xs();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(IM,{children:c.jsx(HM,{children:c.jsxs(KM,{...t,children:[e,c.jsx(ZM,{})]})})})});const Ly=h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:o}=t,i=o.events.custom,a=({container:l})=>{r({root:o.getRoot(),Container:$i(l)})};return t.on(i,a),o.__trgCustom({}),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?oo(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(!1),[o,i]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:ms});return h.useEffect(()=>{if(!t)return;const a="modal",l=({open:u,title:d,content:p,close:f,attributes:g})=>{u&&i({title:h.createElement(Dm(d)),content:h.createElement(Dm(p)),attributes:g,close:f}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const My=h.memo(function({children:e}){const{editor:t}=is(),[n,s]=h.useState(()=>({pages:[],selected:void 0,select:ms,add:ms,remove:ms}));return h.useEffect(()=>{if(!t)return;const{Pages:r}=t,o=r.events.all,i=()=>{s({pages:r.getAll(),selected:r.getSelected(),select:(...a)=>r.select(...a),add:(...a)=>r.add(...a),remove:(...a)=>r.remove(...a)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?oo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ny=h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:ms,removeSelector:ms,setState:ms,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:o}=t,i=o.events.custom,a=({container:l})=>{r({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>o.addSelected(...u),removeSelector:(...u)=>o.removeSelected(...u),setState:(...u)=>o.setState(...u),Container:$i(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?oo(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),$y=h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:o}=t,i=o.events.custom,a=({container:l})=>{r({sectors:o.getSectors({visible:!0}),Container:$i(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?oo(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),zp=h.memo(function({children:e}){const{editor:t}=is(),n=Xs(),[s,r]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:o}=t,i=o.events.custom,a=({container:l})=>{r({traits:o.getCurrent(),Container:$i(l)})};return t.on(i,a),o.__trgCustom(),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?oo(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),gl=({children:e})=>VM()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function Sh(e){return e=e.trimStart(),e=e.replace(/\s*([\{\}\:\;\,])\s*/g,"$1"),e=e.replace(/;\s*;/g,";"),e=e.replace(/\,[\s\.\#\d]*{/g,"{"),e=e.replace(/([^\s])\{([^\s])/g,`$1 {
256
+ </mj-section>`})}const BL=(e,t)=>({[Et.web]:s=>Od(s,t),[Et.document]:s=>Od(s,t),[Et.react]:s=>Od(s,t),[Et.email]:s=>DL(s,t)})[e],ki="https://cdn.jsdelivr.net/npm/",Nd={id:"gjs-blocks-basic",src:`${ki}grapesjs-blocks-basic@1.0.1/dist/index.js`},zL={id:"grapesjs-plugin-forms",src:`${ki}grapesjs-plugin-forms@2.0.5/dist/index.js`},$d={id:"grapesjs-parser-postcss",src:`${ki}grapesjs-parser-postcss@1.0.1/dist/index.js`},UL={id:"grapesjs-navbar",src:`${ki}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},kd={id:"grapesjs-plugin-export",src:`${ki}grapesjs-plugin-export@1.0.11/dist/index.js`,options:{isBinary:(e,t)=>{const n=t.split(".")[1];return/[\x00-\x08\x0E-\x1F]/.test(e)&&!(n&&["html","css"].indexOf(n)>=0)}}},WL={id:"grapesjs-mjml",src:`${ki}grapesjs-mjml@1.0.8/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},GL={[Et.email]:[FL,WL],[Et.web]:[Nd,zL,kd,$d,UL],[Et.document]:[Nd,kd,$d],[Et.react]:[Nd,kd,$d]};function qL(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",s=>{const r=-s.canvasOffset.left;s.left<r&&(s.left=r)})}function $y({onCopy:e,getValue:t,value:n,title:s="Copy",...r}){const[o,i]=g.useState(!1),a=()=>{SS((t==null?void 0:t())??n),i(!0),e==null||e()};return g.useEffect(()=>{if(!o)return;const l=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(l)},[o]),c.jsx(St,{onClick:a,title:s,type:"button",size:"lg",withBg:!0,...r,children:c.jsx(ne,{className:le(o&&z.tA),icon:o?K.check:K.contentCopy,size:oe.s})})}const KL=(e,t)=>e.filter(n=>n.id===t)[0]||null,ky=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),ZL=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,Ry=J("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),Pg={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]},Bm=is()&&document.body,YL=(e={})=>({...Pg,modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Bm}},{name:"preventOverflow",options:{boundary:e.boundary??Bm}}]});function zm(e){var o;const{option:t,active:n,selected:s}=e,r=((o=e.isSelected)==null?void 0:o.call(e))||!0;return c.jsxs(k,{items:"center",className:J([Pe.xy,n&&kf.bgH]),children:[c.jsx(D,{className:J("truncate"),grow:!0,children:t.label}),c.jsx(D,{className:J("gjs-pl-2"),children:ky(t,s)&&r&&c.jsx(ne,{className:J(z.tA),icon:K.check,size:oe.s})})]})}const XL="gs-select-field";function Um({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(ne,{...pt(e.icon)?{icon:e.icon,size:oe.s2x}:e.icon}),c.jsx(D,{className:J("truncate"),grow:!0,children:e.content||e.label})]})}function _e(e){const{value:t,onChange:n,onBlur:s,onFocus:r,handlerSelected:o,label:i,options:a,includeEmpty:l,className:u,search:d,open:p,caret:f=K.chevronDown,size:h="m",border:m,emptyState:b="- Select an option -",name:v,required:x,disabled:y,classNameContainer:w,autoFocus:S,labelAs:j,hideCaret:C}=e,[E,O]=g.useState(null),[P,T]=g.useState(null),[A,_]=g.useState(""),{styles:N,attributes:V}=dl(E,P,YL()),M=typeof d=="object"?d.onChange:void 0,I=[...a].filter(X=>d?M||ZL(X,A):X),U=d&&(typeof d=="object"&&d.value||A),F=U&&I.length?I[0]:KL(I,t),W=X=>n(X.id,X),H={id:null,label:b},R=(F==null?void 0:F.content)||(F==null?void 0:F.label),$=F?o?o(F):F.icon?c.jsx(k,{items:"center",gap:"s",children:c.jsx(Um,{option:F})}):R:o?o(H):b;l&&I.unshift(H);const B=X=>{const{value:G}=X.target,Q=G.trim();switch(X.key){case"Escape":n(null);break;case"Enter":n((I.length?I[0].id:Q)||null,I[0]);break;case" ":_o(X);break}},Z=L("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",se.rnd,Ta.focus),Y=()=>{s==null||s()},ee=io({...e,className:L(XL,w,"gs-utl-relative",h.includes("s")&&"gs-utl-text-xs")});return c.jsx(Gi,{value:F,onChange:W,disabled:y,children:({open:X})=>c.jsxs("div",{...ee,children:[i&&c.jsx(Gi.Label,{as:j,className:e.classNameLabel,children:c.jsx(Ts,{as:"span",...e})}),v&&c.jsx("input",{type:"input",name:v,value:(F==null?void 0:F.id)??"",onChange:()=>{},className:J("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:x,disabled:y}),c.jsx(Gi.Button,{ref:O,className:Z,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:S,value:typeof d=="object"&&d.value||A,className:L([u,"gs-utl-w-full",se.rnd,Ta.focus,Pe.xyS]),onChange:G=>{_(G.target.value),M==null||M(G.target.value)},onKeyDown:B,onClick:_o,onBlur:Y,onFocus:r}):c.jsx(os,{border:m,size:h,title:$,icon:C?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:f,shadow:!1,className:J(u),titleClass:"",disabled:y})}),c.jsx(Gi.Options,{static:p,className:Ry,ref:T,style:N.popper,...V.popper,children:c.jsxs(os,{padding:!1,className:J("h-full"),style:{minWidth:`${E==null?void 0:E.offsetWidth}px`,maxHeight:200},children:[!I.length&&d&&d!==!0&&c.jsx("div",{className:J(Pe.xy),children:d.empty}),I.map((G,Q)=>c.jsx(Gi.Option,{value:G,children:({active:ie})=>c.jsxs(k,{items:"center",gap:"s",className:J([G.className,Pe.xy,ie&&kf.bgH]),nowrap:!0,children:[c.jsx(Um,{option:G}),c.jsx(D,{className:J("gjs-pl-2"),children:ky(G,F)&&!U&&c.jsx(ne,{className:J(z.tA),icon:K.check,size:oe.s})})]})},Q))]})})]})})}const Iy=g.createContext(null),JL=({children:e})=>{const[t,n]=g.useState({setEditor:s=>{n(r=>({...r,editor:s}))}});return c.jsx(Iy.Provider,{value:t,children:e})},as=()=>{const e=g.useContext(Iy);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},vl=()=>{const{editor:e}=as();if(!e)throw new Error("useEditor used before the load of the editor instance. You can wrap your component in `<WithEditor>` or make use of `useEditorMaybe` hook and ensure the `editor` exists.");return e},QL=()=>as().editor,Vy=g.createContext(null),eN=({children:e})=>{const[t,n]=g.useState(()=>({setRefCanvas(s){n(r=>({...r,refCanvas:s}))},setCustomModal(s){n(r=>({...r,customModal:s}))},setCustomAssets(s){n(r=>({...r,customAssets:s}))},setCustomBlocks(s){n(r=>({...r,customBlocks:s}))},setCustomRte(s){n(r=>({...r,customRte:s}))},setCustomStyles(s){n(r=>({...r,customStyles:s}))},setCustomLayers(s){n(r=>({...r,customLayers:s}))},setCustomSelectors(s){n(r=>({...r,customSelectors:s}))},setCustomTraits(s){n(r=>({...r,customTraits:s}))},setReady(s){n(r=>({...r,ready:s}))}}));return c.jsx(Vy.Provider,{value:t,children:e})},Qs=()=>{const e=g.useContext(Vy);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function tN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function ao(e){return typeof e=="function"}function bs(){}const Hy=e=>typeof e=="string",nN=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},Dy=e=>{const t=Hy(e)?{id:e,src:e}:e;return new Promise((n,s)=>{const r=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);r.src=t.src,r.onload=()=>n(t.id),r.onerror=()=>s(t.id),document.head.appendChild(r)})},sN=e=>{const t=e.map(n=>Dy(n));return Promise.allSettled(t)},Wm=e=>function(){const t=g.useRef(null);return g.useEffect(()=>{const{current:n}=t;n&&(Hy(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Gm=new WeakMap;function Ri(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Gm.get(e);if(t)return t;const n=function({children:s}){return kn.createPortal(g.createElement("div",null,s),e)};return Gm.set(e,n),n}g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(!1),[o,i]=g.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return g.useEffect(()=>{if(!t)return;const a=t.Assets.events.custom,l=({open:u,assets:d,types:p,select:f,close:h,container:m})=>{u&&i({assets:d,types:p,select:f,close:h,Container:Ri(m)}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),g.useEffect(()=>n.setCustomAssets(!0),[]),t?ao(e)?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(()=>({blocks:[],dragStart:bs,dragStop:bs,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const o=t.Blocks.events.custom,i=({blocks:a,container:l,dragStart:u,dragStop:d})=>{const p=a.reduce((f,h)=>{const m=h.getCategoryLabel(),b=f.get(m);return b?b.push(h):f.set(m,[h]),f},new Map);r({blocks:a,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:Ri(l)})};return t.on(o,i),t.Blocks.__trgCustom(),()=>{t.off(o,i)}},[t]),g.useEffect(()=>n.setCustomBlocks(!0),[]),t?ao(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function rN({children:e,...t}){const n=Qs(),s=g.useRef(null);return g.useEffect(()=>{s.current&&n.setRefCanvas(s.current)},[s.current]),c.jsx("div",{...t,ref:s,children:e})}const oN=g.memo(function({children:e}){const{editor:t}=as(),[n,s]=g.useState(()=>({devices:[],selected:"",select:bs}));return g.useEffect(()=>{if(!t)return;const{Devices:r}=t,o=r.events.all,i=()=>{var a;s({devices:r.getDevices(),selected:(a=r.getSelected())==null?void 0:a.id,select:l=>r.select(l)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?ao(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),iN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function aN(e){const t=e.map(({id:o,src:i})=>({id:o,src:i})),n=e.reduce((o,i)=>(o[i.id]=i,o),{}),s=[],r=[];return(await sN(t)).forEach(o=>{o.status==="fulfilled"?s.push(n[o.value]):r.push(n[o.reason])}),{loaded:s,failed:r}}const lN=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{iN(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await aN(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},cN=g.memo(function({children:e,className:t,style:n,options:s={},plugins:r=[],grapesjs:o,grapesjsCss:i,onEditor:a=bs,onReady:l,onUpdate:u,waitReady:d,...p}){const{setEditor:f}=as(),h=Qs(),[m,b]=g.useState(!1),v=g.useRef(null);g.useEffect(()=>{if(!h.ready||!v.current)return;const E=v.current,O=h.refCanvas;let P,T={},A=[];const _=N=>{const V={height:"100%",...s,plugins:[...A,...s.plugins||[]],pluginsOpts:{...s.pluginsOpts,...T},modal:{custom:!!h.customModal,...s.modal},assetManager:{custom:!!h.customAssets,...s.assetManager},styleManager:{custom:!!h.customStyles,...s.styleManager},blockManager:{custom:!!h.customBlocks,...s.blockManager},richTextEditor:{custom:!!h.customRte,...s.richTextEditor},layerManager:{custom:!!h.customLayers,...s.layerManager},traitManager:{custom:!!h.customTraits,...s.traitManager},selectorManager:{custom:!!h.customSelectors,...s.selectorManager},container:O||E,customUI:!!O,...O?{panels:{defaults:[]}}:{}};P=N.init(V),f(P),a(P),u&&P.on("update",()=>{u(P.getProjectData(),P)}),P.onReady(()=>{b(!0),l==null||l(P)})};return(async()=>{i&&await nN(i);const N=await lN(r);A=N.plugins,T=N.pluginOptions,typeof o=="string"?(await Dy(o),_(window.grapesjs)):_(o)})(),()=>P==null?void 0:P.destroy()},[h.ready]);const x=s.height??"100%",y=s.width??"100%",w=tN("gjs-editor-wrapper",t),S=d&&!m,j=g.useMemo(()=>({...n,height:x,width:y}),[x,y,n]),C=g.useMemo(()=>({...j,...S?{opacity:0,width:0,height:0}:{}}),[j,S]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:w,style:j,children:d}):null,c.jsx("div",{...p,ref:v,className:w,style:C,children:e})]})}),uN=g.memo(function(){const e=Qs();return g.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});g.memo(function({children:e,...t}){return c.jsx(JL,{children:c.jsx(eN,{children:c.jsxs(cN,{...t,children:[e,c.jsx(uN,{})]})})})});const Fy=g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Layers:o}=t,i=o.events.custom,a=({container:l})=>{r({root:o.getRoot(),Container:Ri(l)})};return t.on(i,a),o.__trgCustom({}),()=>{t.off(i,a)}},[t]),g.useEffect(()=>n.setCustomLayers(!0),[]),t?ao(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(!1),[o,i]=g.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:bs});return g.useEffect(()=>{if(!t)return;const a="modal",l=({open:u,title:d,content:p,close:f,attributes:h})=>{u&&i({title:g.createElement(Wm(d)),content:g.createElement(Wm(p)),attributes:h,close:f}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),g.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const By=g.memo(function({children:e}){const{editor:t}=as(),[n,s]=g.useState(()=>({pages:[],selected:void 0,select:bs,add:bs,remove:bs}));return g.useEffect(()=>{if(!t)return;const{Pages:r}=t,o=r.events.all,i=()=>{s({pages:r.getAll(),selected:r.getSelected(),select:(...a)=>r.select(...a),add:(...a)=>r.add(...a),remove:(...a)=>r.remove(...a)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?ao(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),zy=g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:bs,removeSelector:bs,setState:bs,Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Selectors:o}=t,i=o.events.custom,a=({container:l})=>{r({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>o.addSelected(...u),removeSelector:(...u)=>o.removeSelected(...u),setState:(...u)=>o.setState(...u),Container:Ri(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),g.useEffect(()=>n.setCustomSelectors(!0),[]),t?ao(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Uy=g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Styles:o}=t,i=o.events.custom,a=({container:l})=>{r({sectors:o.getSectors({visible:!0}),Container:Ri(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),g.useEffect(()=>n.setCustomStyles(!0),[]),t?ao(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Kp=g.memo(function({children:e}){const{editor:t}=as(),n=Qs(),[s,r]=g.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return g.useEffect(()=>{if(!t)return;const{Traits:o}=t,i=o.events.custom,a=({container:l})=>{r({traits:o.getCurrent(),Container:Ri(l)})};return t.on(i,a),o.__trgCustom(),()=>{t.off(i,a)}},[t]),g.useEffect(()=>n.setCustomTraits(!0),[]),t?ao(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),yl=({children:e})=>QL()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function Tg(e){return e=e.trimStart(),e=e.replace(/\s*([\{\}\:\;\,])\s*/g,"$1"),e=e.replace(/;\s*;/g,";"),e=e.replace(/\,[\s\.\#\d]*{/g,"{"),e=e.replace(/([^\s])\{([^\s])/g,`$1 {
257
257
  $2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
258
258
  }
259
259
  $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
260
- $2`),e}const ky=ce(function(){const t=hl(),n=Ie(),{Styles:s}=t,{isDarkTheme:r}=Ys(),o=s.getSelected(),[i,a]=h.useState(0),l=o?Sh(o==null?void 0:o.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const f=()=>a(m=>++m),g=s.events.custom;return t.on(g,f),()=>{t.off(g,f)}},[s,t]);const p=()=>{if(u){const f=t.Parser.parseCss(u)[0];f&&(o==null||o.setStyle(f.style))}};return c.jsxs($,{className:Y("relative"),col:!0,full:!0,children:[c.jsx(F,{grow:!0,children:o?c.jsx(mr,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:r,clean:!0},i):n.t("noCode")}),c.jsx(Ke,{className:Y("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),Bm=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],YM=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(ne.projectFiles),s={};for(const r in n){const o=n[r],{filename:i,content:a}=o;if(o.path){const l=o.path.split("/").filter(Boolean);let u=s;for(const d of l)u[d]=u[d]||{},u=u[d];u[i]=a}else s[i]=a}return s}})},XM=ce(function(t){const n=Ie(),s=xe(),{isProjectTypeEmail:r}=s,o=s.editor,[i,a]=h.useState(Bm[0].id),[l,u]=h.useState(),{isDarkTheme:d}=Ys(),[p]=h.useState(()=>Sh(o.getCss())),[f,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...r?{export:!1}:{}},b=()=>YM(o);h.useEffect(()=>{(async()=>{var E,O;const w=await o.runCommand(ne.projectFiles,{page:o.Pages.getSelected(),skipProject:!0,styles:"skip"}),S=((E=w.find(P=>P.mimeType==="text/html"))==null?void 0:E.content)??"",C=((O=w.find(P=>P.mimeType==="text/mjml"))==null?void 0:O.content)??"";u(i==="mjml"?C:S)})()},[i]),h.useEffect(()=>{var y;f&&((y=f.getModel())==null||y.setValue(l),wy(f))},[f,l]);const x={padding:5,isDarkTheme:d,clean:!0};return c.jsxs($,{gap:"m",col:!0,full:!0,children:[c.jsxs($,{gap:"m",className:"flex-grow",children:[c.jsxs(F,{className:Y("relative"),grow:!0,children:[r&&c.jsxs($,{className:Y("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Ae,{value:i,onChange:a,options:Bm,className:Y("min-w-24")}),c.jsx(jy,{getValue:()=>f.getModel().getValue()})]}),l!==void 0&&c.jsx(mr,{defaultValue:l,language:"html",onMount:g,...x})]}),!r&&c.jsx(F,{grow:!0,children:c.jsx(mr,{defaultValue:p,language:"css",...x})})]}),v.export!==!1&&c.jsx($,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function JM(e,t){h.useEffect(()=>{const n="pointerdown",{current:s}=e;if(!s||!t.enabled)return;function r(o){const i=o.target;s&&i&&!s.contains(i)&&t.onTrigger(i)}return document.addEventListener(n,r),()=>{document.removeEventListener(n,r)}},[e.current,t.enabled])}const Ry=e=>{const{ref:t,show:n,node:s,styles:r,update:o,reload:i}=e,a={all:"initial",zIndex:"10",fontFamily:"inherit",...r};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const p=l.attachShadow({mode:"closed"});l.__sh=Xw.createRoot(p)}l.__sh.render(s),Object.keys(a).forEach(p=>{l.style.setProperty(bS(p),a[p],"important")});const u=new MutationObserver(i);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(l)&&i()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,o])},QM="gs-cmp-popover";function Es({children:e,handler:t,title:n,size:s,padding:r=!0,border:o=!0,overlay:i,clickAway:a,topIcon:l,placement:u="auto",offset:d,open:p,onClose:f,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:x,hideCloseButton:y}){const[w,S]=h.useState(!!p),[C,j]=h.useState(w),[E,O]=h.useState(null),[P,T]=h.useState(null),A=al(E,P,{...sg({offset:d}),placement:u}),_=()=>{j(!1),f==null||f()};JM({current:P},{onTrigger:_,enabled:a&&w}),h.useEffect(()=>{j(!!p)},[p]),h.useEffect(()=>{var L;w&&((L=A.update)==null||L.call(A))},[w,A.update]),h.useEffect(()=>{const L=setTimeout(()=>S(C),10);return()=>clearTimeout(L)},[C]);const N=Y("w-full transition-colors",x&&"pointer-events-none",...Vb({border:!1,size:"",...b})),D=Y(["fixed z-20",l&&"gjs-mt-5",s==="s"&&"w-full max-w-64",s==="sm"&&"w-full max-w-sm",s==="md"&&"w-full max-w-md"]);return c.jsxs(fd,{className:Y(QM,"relative flex",m),children:[c.jsx(fd.Button,{ref:O,as:g,className:N,children:c.jsx("div",{onClick:L=>{Oo(L),!(Dt(p)||x)&&j(!w)},children:t})}),w&&i&&c.jsx("div",{onClick:_,className:Y("z-10 fixed inset-0")}),C&&c.jsx(fd.Panel,{static:!0,className:D,ref:T,style:A.styles.popper,...A.attributes.popper,children:c.jsx(rh,{as:h.Fragment,show:w,unmount:!1,...kb,children:c.jsx(rs,{classNameBody:v,title:n,onClose:y?void 0:_,padding:r,border:o,children:typeof e=="function"?e({close:_,open:w}):e})})})]})}function ki(e){const{action:t,icon:n,label:s,className:r,items:o,onItemClick:i,selected:a,...l}=e,u=h.useRef(null),[d,p]=h.useState(),f=u.current,g=M([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Pe.xy,te.bb,l.disabled&&_e.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=b=>{tt(t)&&(t({event:b}),i==null||i({event:b,item:e}))};h.useEffect(()=>{if(!f)return;const b=setTimeout(()=>p(f.getBoundingClientRect()),l.active?0:_f);return()=>clearTimeout(b)},[f,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs($,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(F,{children:c.jsx(se,{icon:n,size:oe.sx})}),!!s&&c.jsx(F,{className:M(l.classNameLabel,_e.txtEllips),grow:!0,children:s}),!!a&&c.jsx(F,{children:c.jsx(se,{className:z.tA,icon:K.check,size:oe.s})}),!!(o!=null&&o.length)&&c.jsxs(c.Fragment,{children:[c.jsx(F,{children:c.jsx(se,{icon:K.chevronRight,size:oe.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(PV,{items:o,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:i,open:!0})]})]})}const Pu=({className:e,grow:t,alignItems:n,justifyContent:s})=>M(e,z.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",s==="start"&&"gs-utl-justify-start",s==="end"&&"gs-utl-justify-end",s==="center"&&"gs-utl-justify-center",s==="between"&&"gs-utl-justify-between",s==="around"&&"gs-utl-justify-around",s==="evenly"&&"gs-utl-justify-evenly"),Tu=({style:e,width:t,height:n,gap:s})=>({height:n,gap:s,width:t,...e}),jn=h.memo(ce(function({id:t,children:n,className:s,style:r,width:o,gap:i,height:a,grow:l,alignItems:u,justifyContent:d,htmlAttrs:p,...f}){const{layoutsById:g}=wu(),[m,v]=h.useState({}),{className:b,style:x,...y}=p||{},w=s??b,S=r??x,C=h.useMemo(()=>Tu({height:a,gap:i,width:o,style:S}),[S,o,a,i]),j=Pu({className:w,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:v}),()=>{g.delete(t)}},[g,m]);const E=f.as??"div";return c.jsx(E,{style:C,className:j,...f,...y,children:m.children??n})})),Vl="gs-cmp-button-menu",eN=h.memo(ce(function({className:t,style:n,icon:s,label:r,size:o,tooltip:i,value:a,disabled:l,options:u,children:d,editorEvents:p,classNameBtn:f,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:x}=xe(),[y,w]=h.useState(!1),[S,C]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:i,label:r,icon:s,iconMenu:g,size:o,disabled:l,value:a,options:u})),E={editor:x,state:S,setState:H=>C(B=>({...B,...H}))};xr({editor:x,editorEvents:p,localState:S,setLocalState:C});const O=H=>{m==null||m({...E,event:H})},P=H=>{b==null||b({...E,option:H}),w(!1)},T=S.tooltip,A=dt(T)?{title:T}:{tooltipProps:T},N=(()=>{var R,W;if(S.label)return tt(S.label)?S.label(E):S.label;const H=(R=S.options)==null?void 0:R.find(Z=>Z.id===S.value),B=(W=S.options)==null?void 0:W[0],k=H||B,I=M((H==null?void 0:H.id)===S.value&&z.tA);if(k!=null&&k.icon)return{type:"icon",className:I,icon:k.icon,size:18};if(k!=null&&k.label)return{type:"text",className:I,content:k.label}})(),D=$t(N),L=()=>{if(d){const H=tt(d)?d(E):d;return $t(H)}return S.options&&S.options.length>0?c.jsx("div",{className:`${Vl}-options`,children:S.options.map(H=>c.jsx(ki,{label:H.label,icon:H.icon,selected:H.id===S.value,action:()=>P(H)},H.id))}):null},V=H=>{H.stopPropagation(),v?v({...E,event:H}):w(!y)},U=c.jsx($,{items:"center",onClick:V,className:M(`${Vl}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(se,{icon:S.iconMenu,size:"14px"})});return c.jsx(jn,{className:M(Vl,"gs-utl-flex",S.className),style:S.style,children:c.jsx(Es,{handler:c.jsx(St,{className:M(`${Vl}__btn`,f),icon:S.icon,size:S.size,disabled:S.disabled,onClick:O,block:!0,...A,children:N?c.jsxs($,{items:"center",gap:"s",nowrap:!0,children:[c.jsx($,{items:"center",children:D}),U]}):U}),buttonAs:"div",open:y,onClose:()=>w(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:L()})})}));function tn(e){const{className:t,options:n,name:s,value:r,size:o="m",required:i,disabled:a,onChange:l,labelAs:u}=e,d=g=>{const m=n.filter(v=>v.id===g)[0];return n.indexOf(m)===n.length-1},p=(g,m)=>M("gs-utl-cursor-pointer",o==="m"&&Pe.xy,o==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",o==="xs"&&"gs-utl-p-1 text-sm",z.br,g&&z.bgO,!d(m)&&te.br),f=ro({...e,className:"gs-field-buttons"});return c.jsxs(Wg,{value:r,onChange:l,disabled:a,...f,children:[c.jsx(js,{...e,as:u}),s&&c.jsx("input",{type:"hidden",name:s,value:r,required:i}),c.jsx($,{className:M(t,te.b,te.rnd,z.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:v,icon:b})=>c.jsx(zt,{title:v,className:M("gs-utl-w-full"),classNameWrp:M("gs-utl-flex-1"),children:c.jsx(Wg.Option,{value:g,className:({checked:x})=>p(x,g),children:c.jsxs($,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(se,{...dt(b)?{icon:b,size:oe.s}:b}),m&&c.jsx(F,{children:m})]})})},g))})]})}const tN="gs-cmp-button-group-field",nN=h.memo(ce(function({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l,onChange:u,editorEvents:d}){const{editor:p}=xe(),[f,g]=h.useState(()=>({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l})),m=v=>{u({value:v,editor:p,state:f,setState:b=>g(x=>({...x,...b}))})};return xr({editor:p,editorEvents:d,localState:f,setLocalState:g}),c.jsx(tn,{className:M(tN,f.className),label:f.label,name:f.name,value:f.value,options:f.options??[],size:f.size,required:f.required,disabled:f.disabled,onChange:m})}));function Ou({colors:e,...t}){return e?c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 79 79",...t,children:[c.jsx("path",{fill:"url(#a)",d:"M39.6 77.1a37.5 37.5 0 1 0 0-75 37.5 37.5 0 0 0 0 75Z"}),c.jsx("path",{stroke:"#fff",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"5",d:"m40 19-14.58 8.79a6.36 6.36 0 0 0-2.82 5.33v14.13a6.14 6.14 0 0 0 3.12 5.13l11.21 5.8a6.12 6.12 0 0 0 6.14 0l11.41-6.3a6.09 6.09 0 0 0 3.12-5.13V33.12c0-1.28-1.4-2.07-2.52-1.48l-15.08 8"}),c.jsx("defs",{children:c.jsxs("linearGradient",{id:"a",x1:"2.1",x2:"77.2",y1:"39.6",y2:"39.6",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#D7709E"}),c.jsx("stop",{offset:"1",stopColor:"#A84A87"})]})})]}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",...t,children:c.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M64.117 64.117a37.5 37.5 0 1 1-53.034-53.034 37.5 37.5 0 0 1 53.034 53.034ZM39.29 19.14a2.5 2.5 0 1 0-2.582-4.282l-14.583 8.79-.05.03-.047.032a8.861 8.861 0 0 0-2.917 3.229 8.729 8.729 0 0 0-1.011 4.203V45.293l.002.047a8.64 8.64 0 0 0 1.25 4.164 8.78 8.78 0 0 0 3.115 3.043l.05.03.053.027 11.165 5.769a8.62 8.62 0 0 0 4.264 1.127c1.507 0 2.99-.394 4.295-1.145l11.394-6.276.006-.004a8.585 8.585 0 0 0 3.178-3.05 8.443 8.443 0 0 0 1.227-4.225V31.123c0-3.265-3.502-5.122-6.19-3.688l-.005.003-15.076 7.995a2.5 2.5 0 0 0 2.342 4.418l13.93-7.387v12.263a3.444 3.444 0 0 1-.502 1.703 3.584 3.584 0 0 1-1.326 1.271l-.003.002-11.409 6.284-.024.014-.023.013a3.619 3.619 0 0 1-1.814.486 3.62 3.62 0 0 1-1.814-.486l-.052-.03-.054-.028-11.155-5.764a3.78 3.78 0 0 1-1.297-1.283 3.642 3.642 0 0 1-.527-1.715V31.081a3.73 3.73 0 0 1 .432-1.806 3.858 3.858 0 0 1 1.23-1.377L39.29 19.14Z",clipRule:"evenodd"})})}const sN=h.memo(ce(function(){const{isStage:e,updateStudio:t}=xe(),{isDarkTheme:n}=Ys(),s=h.useRef(null),{bg:r,text:o}=Rb(n);return Ry({ref:s,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
260
+ $2`),e}const Wy=ue(function(){const t=vl(),n=$e(),{Styles:s}=t,{isDarkTheme:r}=Ps(),o=s.getSelected(),[i,a]=g.useState(0),l=o?Tg(o==null?void 0:o.toCSS({allowEmpty:!0})):"",[u,d]=g.useState(l);g.useEffect(()=>{const f=()=>a(m=>++m),h=s.events.custom;return t.on(h,f),()=>{t.off(h,f)}},[s,t]);const p=()=>{if(u){const f=t.Parser.parseCss(u)[0];f&&(o==null||o.setStyle(f.style))}};return c.jsxs(k,{className:J("relative"),col:!0,full:!0,children:[c.jsx(D,{grow:!0,children:o?c.jsx(Cs,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:r,clean:!0},i):n.t("noCode")}),c.jsx(Qe,{className:J("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),qm=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],dN=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(te.projectFiles),s={};for(const r in n){const o=n[r],{filename:i,content:a}=o;if(o.path){const l=o.path.split("/").filter(Boolean);let u=s;for(const d of l)u[d]=u[d]||{},u=u[d];u[i]=a}else s[i]=a}return s}})},pN=ue(function(t){const n=$e(),s=Se(),{isProjectTypeEmail:r}=s,o=s.editor,[i,a]=g.useState(qm[0].id),[l,u]=g.useState(),{isDarkTheme:d}=Ps(),[p]=g.useState(()=>Tg(o.getCss())),[f,h]=g.useState(),m=y=>n.t(`actions.showCode.${y}`),b={...t.options,...r?{export:!1}:{}},v=()=>dN(o);g.useEffect(()=>{(async()=>{var E,O;const w=await o.runCommand(te.projectFiles,{page:o.Pages.getSelected(),skipProject:!0,styles:"skip"}),S=((E=w.find(P=>P.mimeType==="text/html"))==null?void 0:E.content)??"",j=((O=w.find(P=>P.mimeType==="text/mjml"))==null?void 0:O.content)??"";u(i==="mjml"?j:S)})()},[i]),g.useEffect(()=>{var y;f&&((y=f.getModel())==null||y.setValue(l),My(f))},[f,l]);const x={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(k,{gap:"m",col:!0,full:!0,children:[c.jsxs(k,{gap:"m",className:"flex-grow",children:[c.jsxs(D,{className:J("relative"),grow:!0,children:[r&&c.jsxs(k,{className:J("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(_e,{value:i,onChange:a,options:qm,className:J("min-w-24")}),c.jsx($y,{getValue:()=>f.getModel().getValue()})]}),l!==void 0&&c.jsx(Cs,{defaultValue:l,language:"html",onMount:h,...x})]}),!r&&c.jsx(D,{grow:!0,children:c.jsx(Cs,{defaultValue:p,language:"css",...x})})]}),b.export!==!1&&c.jsx(k,{justify:"end",children:c.jsx(Qe,{size:"m2",variant:"pr",onClick:v,children:m("exportButton")})})]})});function fN(e,t){g.useEffect(()=>{const n="pointerdown",{current:s}=e;if(!s||!t.enabled)return;function r(o){const i=o.target;s&&i&&!s.contains(i)&&t.onTrigger(i)}return document.addEventListener(n,r),()=>{document.removeEventListener(n,r)}},[e.current,t.enabled])}const Gy=e=>{const{ref:t,show:n,node:s,styles:r,update:o,reload:i}=e,a={all:"initial",zIndex:"10",fontFamily:"inherit",...r};g.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const p=l.attachShadow({mode:"closed"});l.__sh=pS.createRoot(p)}l.__sh.render(s),Object.keys(a).forEach(p=>{l.style.setProperty(NS(p),a[p],"important")});const u=new MutationObserver(i);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(l)&&i()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,o])},gN="gs-cmp-popover";function Os({children:e,handler:t,title:n,size:s,padding:r=!0,border:o=!0,overlay:i,clickAway:a,topIcon:l,placement:u="auto",offset:d,open:p,onClose:f,buttonAs:h,className:m,classNameBody:b,buttonProps:v={},disabled:x,hideCloseButton:y}){const[w,S]=g.useState(!!p),[j,C]=g.useState(w),[E,O]=g.useState(null),[P,T]=g.useState(null),A=dl(E,P,{...lh({offset:d}),placement:u}),_=()=>{C(!1),f==null||f()};fN({current:P},{onTrigger:_,enabled:a&&w}),g.useEffect(()=>{C(!!p)},[p]),g.useEffect(()=>{var M;w&&((M=A.update)==null||M.call(A))},[w,A.update]),g.useEffect(()=>{const M=setTimeout(()=>S(j),10);return()=>clearTimeout(M)},[j]);const N=J("w-full transition-colors",x&&"pointer-events-none",...qv({border:!1,size:"",...v})),V=J(["fixed z-20",l&&"gjs-mt-5",s==="s"&&"w-full max-w-64",s==="sm"&&"w-full max-w-sm",s==="md"&&"w-full max-w-md"]);return c.jsxs(bd,{className:J(gN,"relative flex",m),children:[c.jsx(bd.Button,{ref:O,as:h,className:N,children:c.jsx("div",{onClick:M=>{_o(M),!(Dt(p)||x)&&C(!w)},children:t})}),w&&i&&c.jsx("div",{onClick:_,className:J("z-10 fixed inset-0")}),j&&c.jsx(bd.Panel,{static:!0,className:V,ref:T,style:A.styles.popper,...A.attributes.popper,children:c.jsx(cg,{as:g.Fragment,show:w,unmount:!1,...Uv,children:c.jsx(os,{classNameBody:b,title:n,onClose:y?void 0:_,padding:r,border:o,children:typeof e=="function"?e({close:_,open:w}):e})})})]})}function Ii(e){const{action:t,icon:n,label:s,className:r,items:o,onItemClick:i,selected:a,...l}=e,u=g.useRef(null),[d,p]=g.useState(),f=u.current,h=L([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Pe.xy,se.bb,l.disabled&&Ae.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=v=>{rt(t)&&(t({event:v}),i==null||i({event:v,item:e}))};g.useEffect(()=>{if(!f)return;const v=setTimeout(()=>p(f.getBoundingClientRect()),l.active?0:$f);return()=>clearTimeout(v)},[f,l.active]);const b=()=>{var v;return(v=l.onActive)==null?void 0:v.call(l)};return c.jsxs(k,{ref:u,items:"center",nowrap:!0,className:h,onClick:m,onPointerEnter:b,children:[n&&c.jsx(D,{children:c.jsx(ne,{icon:n,size:oe.sx})}),!!s&&c.jsx(D,{className:L(l.classNameLabel,Ae.txtEllips),grow:!0,children:s}),!!a&&c.jsx(D,{children:c.jsx(ne,{className:z.tA,icon:K.check,size:oe.s})}),!!(o!=null&&o.length)&&c.jsxs(c.Fragment,{children:[c.jsx(D,{children:c.jsx(ne,{icon:K.chevronRight,size:oe.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(XV,{items:o,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:i,open:!0})]})]})}const Au=({className:e,grow:t,alignItems:n,justifyContent:s})=>L(e,z.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",s==="start"&&"gs-utl-justify-start",s==="end"&&"gs-utl-justify-end",s==="center"&&"gs-utl-justify-center",s==="between"&&"gs-utl-justify-between",s==="around"&&"gs-utl-justify-around",s==="evenly"&&"gs-utl-justify-evenly"),Mu=({style:e,width:t,height:n,gap:s})=>({height:n,gap:s,width:t,...e}),jn=g.memo(ue(function({id:t,children:n,className:s,style:r,width:o,gap:i,height:a,grow:l,alignItems:u,justifyContent:d,htmlAttrs:p,...f}){const{layoutsById:h}=Eu(),[m,b]=g.useState({}),{className:v,style:x,...y}=p||{},w=s??v,S=r??x,j=g.useMemo(()=>Mu({height:a,gap:i,width:o,style:S}),[S,o,a,i]),C=Au({className:w,grow:l,alignItems:u,justifyContent:d});g.useEffect(()=>{if(t)return h.set(t,{state:m,setState:b}),()=>{h.delete(t)}},[h,m]);const E=f.as??"div";return c.jsx(E,{style:j,className:C,...f,...y,children:m.children??n})})),zl="gs-cmp-button-menu",hN=g.memo(ue(function({className:t,style:n,icon:s,label:r,size:o,tooltip:i,value:a,disabled:l,options:u,children:d,editorEvents:p,classNameBtn:f,iconMenu:h="chevronDown",onClick:m,onClickMenu:b,onOptionSelect:v}){const{editor:x}=Se(),[y,w]=g.useState(!1),[S,j]=g.useState(()=>({isOpen:y,className:t,style:n,tooltip:i,label:r,icon:s,iconMenu:h,size:o,disabled:l,value:a,options:u})),E={editor:x,state:S,setState:F=>j(W=>({...W,...F}))};Sr({editor:x,editorEvents:p,localState:S,setLocalState:j});const O=F=>{m==null||m({...E,event:F})},P=F=>{v==null||v({...E,option:F}),w(!1)},T=S.tooltip,A=pt(T)?{title:T}:{tooltipProps:T},N=(()=>{var $,B;if(S.label)return rt(S.label)?S.label(E):S.label;const F=($=S.options)==null?void 0:$.find(Z=>Z.id===S.value),W=(B=S.options)==null?void 0:B[0],H=F||W,R=L((F==null?void 0:F.id)===S.value&&z.tA);if(H!=null&&H.icon)return{type:"icon",className:R,icon:H.icon,size:18};if(H!=null&&H.label)return{type:"text",className:R,content:H.label}})(),V=Nt(N),M=()=>{if(d){const F=rt(d)?d(E):d;return Nt(F)}return S.options&&S.options.length>0?c.jsx("div",{className:`${zl}-options`,children:S.options.map(F=>c.jsx(Ii,{label:F.label,icon:F.icon,selected:F.id===S.value,action:()=>P(F)},F.id))}):null},I=F=>{F.stopPropagation(),b?b({...E,event:F}):w(!y)},U=c.jsx(k,{items:"center",onClick:I,className:L(`${zl}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(ne,{icon:S.iconMenu,size:"14px"})});return c.jsx(jn,{className:L(zl,"gs-utl-flex",S.className),style:S.style,children:c.jsx(Os,{handler:c.jsx(St,{className:L(`${zl}__btn`,f),icon:S.icon,size:S.size,disabled:S.disabled,onClick:O,block:!0,...A,children:N?c.jsxs(k,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(k,{items:"center",children:V}),U]}):U}),buttonAs:"div",open:y,onClose:()=>w(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:M()})})}));function tn(e){const{className:t,options:n,name:s,value:r,size:o="m",required:i,disabled:a,onChange:l,labelAs:u}=e,d=h=>{const m=n.filter(b=>b.id===h)[0];return n.indexOf(m)===n.length-1},p=(h,m)=>L("gs-utl-cursor-pointer",o==="m"&&Pe.xy,o==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",o==="xs"&&"gs-utl-p-1 text-sm",z.br,h&&z.bgO,!d(m)&&se.br),f=io({...e,className:"gs-field-buttons"});return c.jsxs(Xh,{value:r,onChange:l,disabled:a,...f,children:[c.jsx(Ts,{...e,as:u}),s&&c.jsx("input",{type:"hidden",name:s,value:r,required:i}),c.jsx(k,{className:L(t,se.b,se.rnd,z.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:h,label:m,title:b,icon:v})=>c.jsx(Ut,{title:b,className:L("gs-utl-w-full"),classNameWrp:L("gs-utl-flex-1"),children:c.jsx(Xh.Option,{value:h,className:({checked:x})=>p(x,h),children:c.jsxs(k,{justify:"center",gap:"s",full:!0,children:[!!v&&c.jsx(ne,{...pt(v)?{icon:v,size:oe.s}:v}),m&&c.jsx(D,{children:m})]})})},h))})]})}const mN="gs-cmp-button-group-field",bN=g.memo(ue(function({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l,onChange:u,editorEvents:d}){const{editor:p}=Se(),[f,h]=g.useState(()=>({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l})),m=b=>{u({value:b,editor:p,state:f,setState:v=>h(x=>({...x,...v}))})};return Sr({editor:p,editorEvents:d,localState:f,setLocalState:h}),c.jsx(tn,{className:L(mN,f.className),label:f.label,name:f.name,value:f.value,options:f.options??[],size:f.size,required:f.required,disabled:f.disabled,onChange:m})}));function Lu({colors:e,...t}){return e?c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 79 79",...t,children:[c.jsx("path",{fill:"url(#a)",d:"M39.6 77.1a37.5 37.5 0 1 0 0-75 37.5 37.5 0 0 0 0 75Z"}),c.jsx("path",{stroke:"#fff",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"5",d:"m40 19-14.58 8.79a6.36 6.36 0 0 0-2.82 5.33v14.13a6.14 6.14 0 0 0 3.12 5.13l11.21 5.8a6.12 6.12 0 0 0 6.14 0l11.41-6.3a6.09 6.09 0 0 0 3.12-5.13V33.12c0-1.28-1.4-2.07-2.52-1.48l-15.08 8"}),c.jsx("defs",{children:c.jsxs("linearGradient",{id:"a",x1:"2.1",x2:"77.2",y1:"39.6",y2:"39.6",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:"#D7709E"}),c.jsx("stop",{offset:"1",stopColor:"#A84A87"})]})})]}):c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",...t,children:c.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M64.117 64.117a37.5 37.5 0 1 1-53.034-53.034 37.5 37.5 0 0 1 53.034 53.034ZM39.29 19.14a2.5 2.5 0 1 0-2.582-4.282l-14.583 8.79-.05.03-.047.032a8.861 8.861 0 0 0-2.917 3.229 8.729 8.729 0 0 0-1.011 4.203V45.293l.002.047a8.64 8.64 0 0 0 1.25 4.164 8.78 8.78 0 0 0 3.115 3.043l.05.03.053.027 11.165 5.769a8.62 8.62 0 0 0 4.264 1.127c1.507 0 2.99-.394 4.295-1.145l11.394-6.276.006-.004a8.585 8.585 0 0 0 3.178-3.05 8.443 8.443 0 0 0 1.227-4.225V31.123c0-3.265-3.502-5.122-6.19-3.688l-.005.003-15.076 7.995a2.5 2.5 0 0 0 2.342 4.418l13.93-7.387v12.263a3.444 3.444 0 0 1-.502 1.703 3.584 3.584 0 0 1-1.326 1.271l-.003.002-11.409 6.284-.024.014-.023.013a3.619 3.619 0 0 1-1.814.486 3.62 3.62 0 0 1-1.814-.486l-.052-.03-.054-.028-11.155-5.764a3.78 3.78 0 0 1-1.297-1.283 3.642 3.642 0 0 1-.527-1.715V31.081a3.73 3.73 0 0 1 .432-1.806 3.858 3.858 0 0 1 1.23-1.377L39.29 19.14Z",clipRule:"evenodd"})})}const vN=g.memo(ue(function(){const{isStage:e,updateStudio:t}=Se(),{isDarkTheme:n}=Ps(),s=g.useRef(null),{bg:r,text:o}=Wv(n);return Gy({ref:s,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
261
261
  .gs-banner {
262
262
  box-shadow: 0 0 5px #1c1b1b21;
263
263
  padding: 30px 10px;
@@ -277,7 +277,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
277
277
  .gs-gs-logo {
278
278
  width: 35px;
279
279
  }
280
- `}),c.jsx(rs,{className:"gs-banner",children:c.jsxs($,{className:"gs-banner-row",children:[c.jsx(Ou,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:s})})),rN=()=>`https://grapesjs.com?ref=${window.location.host}`,oN=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=xe(),{isDarkTheme:n}=Ys(),s=h.useRef(null),{bg:r,text:o,link:i}=Rb(n);return Ry({ref:s,show:t,update:n,reload:e,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
280
+ `}),c.jsx(os,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx(Lu,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:s})})),yN=()=>`https://grapesjs.com?ref=${window.location.host}`,xN=g.memo(ue(function(){const{updateStudio:e,showPoweredBy:t}=Se(),{isDarkTheme:n}=Ps(),s=g.useRef(null),{bg:r,text:o,link:i}=Wv(n);return Gy({ref:s,show:t,update:n,reload:e,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
281
281
  .gs-banner {
282
282
  box-shadow: 0 0 5px #1c1b1b21;
283
283
  padding: 5px 10px;
@@ -300,7 +300,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
300
300
  .gs-logo {
301
301
  width: 20px;
302
302
  }
303
- `}),c.jsx(rs,{className:"gs-banner",children:c.jsxs($,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:rN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(Ou,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:s})})),zm="gs-canvas-content",iN=h.memo(ce(function({children:t}){const{isReady:n}=xe(),s=M(`${zm}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,z.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:zm,children:[c.jsx("div",{className:s}),!n&&c.jsx(Ur,{className:M("gs-utl-z-10"),abs:!0,full:!0}),n&&$t(t)]}),c.jsx(sN,{}),c.jsx(oN,{})]})})),aN="gs-canvas",Iy=h.memo(function({className:t,style:n,grow:s,children:r}){return c.jsx(zM,{style:n,className:M(aN,"gs-utl-relative",s&&"gs-utl-flex-grow",t),children:c.jsx(gl,{children:c.jsx(iN,{children:r})})})}),Ch=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),lN=Ch?Promise.resolve().then(function(){return hN}):Promise.resolve().then(function(){return xN});async function cN(...e){return(await lN).default(...e)}Ch?Promise.resolve().then(function(){return mN}):Promise.resolve().then(function(){return SN});const uN=Ch?Promise.resolve().then(function(){return bN}):Promise.resolve().then(function(){return jN});async function dN(...e){return(await uN).default(...e)}const pN=async e=>{const t=await e.getFile();return t.handle=e,t};var fN=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((r,o)=>{t[o]={description:r.description||"Files",accept:{}},r.mimeTypes?r.mimeTypes.map(i=>{t[o].accept[i]=r.extensions||[]}):t[o].accept["*/*"]=r.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),s=await Promise.all(n.map(pN));return e[0].multiple?s:s[0]},hN={__proto__:null,default:fN};function gc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var s=n.done;return Promise.resolve(n.value).then(function(r){return{value:r,done:s}})}return gc=function(n){this.s=n,this.n=n.next},gc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var s=this.s.return;return s===void 0?Promise.resolve({value:n,done:!0}):t(s.apply(this.s,arguments))},throw:function(n){var s=this.s.return;return s===void 0?Promise.reject(n):t(s.apply(this.s,arguments))}},new gc(e)}const Vy=async(e,t,n=e.name,s)=>{const r=[],o=[];var i,a=!1,l=!1;try{for(var u,d=function(p){var f,g,m,v=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);v--;){if(g&&(f=p[g])!=null)return f.call(p);if(m&&(f=p[m])!=null)return new gc(f.call(p));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());a=!(u=await d.next()).done;a=!1){const p=u.value,f=`${n}/${p.name}`;p.kind==="file"?o.push(p.getFile().then(g=>(g.directoryHandle=e,g.handle=p,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>f})))):p.kind!=="directory"||!t||s&&s(p)||r.push(Vy(p,t,f,s))}}catch(p){l=!0,i=p}finally{try{a&&d.return!=null&&await d.return()}finally{if(l)throw i}}return[...(await Promise.all(r)).flat(),...await Promise.all(o)]};var gN=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:Vy(t,e.recursive,void 0,e.skipDirectory)},mN={__proto__:null,default:gN},vN=async(e,t=[{}],n=null,s=!1,r=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const o=[];let i=null;if(e instanceof Blob&&e.type?i=e.type:e.headers&&e.headers.get("content-type")&&(i=e.headers.get("content-type")),t.forEach((u,d)=>{o[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&i&&u.mimeTypes.push(i),u.mimeTypes.map(p=>{o[d].accept[p]=u.extensions||[]})):i?o[d].accept[i]=u.extensions||[]:o[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,s)throw u}const a=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:o,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&r&&r(a);const l=await a.createWritable();return"stream"in e?(await e.stream().pipeTo(l),a):"body"in e?(await e.body.pipeTo(l),a):(await l.write(await e),await l.close(),a)},bN={__proto__:null,default:vN},yN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const s=document.createElement("input");s.type="file";const r=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();s.multiple=e[0].multiple||!1,s.accept=r||"",s.style.display="none",document.body.append(s);const o=l=>{typeof i=="function"&&i(),t(l)},i=e[0].legacySetup&&e[0].legacySetup(o,()=>i(n),s),a=()=>{window.removeEventListener("focus",a),s.remove()};s.addEventListener("click",()=>{window.addEventListener("focus",a)}),s.addEventListener("change",()=>{window.removeEventListener("focus",a),s.remove(),o(s.multiple?Array.from(s.files):s.files[0])}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),xN={__proto__:null,default:yN},wN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const s=document.createElement("input");s.type="file",s.webkitdirectory=!0;const r=i=>{typeof o=="function"&&o(),t(i)},o=e[0].legacySetup&&e[0].legacySetup(r,()=>o(n),s);s.addEventListener("change",()=>{let i=Array.from(s.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),r(i)}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),SN={__proto__:null,default:wN},CN=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let s=e;"body"in e&&(s=await async function(i,a){const l=i.getReader(),u=new ReadableStream({start:f=>async function g(){return l.read().then(({done:m,value:v})=>{if(!m)return f.enqueue(v),g();f.close()})}()}),d=new Response(u),p=await d.blob();return l.releaseLock(),new Blob([p],{type:a})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await s);const r=()=>{typeof o=="function"&&o()},o=t.legacySetup&&t.legacySetup(r,()=>o(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),r()}),n.click(),null},jN={__proto__:null,default:CN};function Br({children:e,label:t,s:n="m",pill:s,border:r,nopad:o,className:i,block:a,...l}){return c.jsx("div",{className:M(!a&&"gs-utl-inline-block",i,!o&&Pe.xyS2,s?te.pill:te.rnd,r&&`${te.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Um={NODE_ENV:"production"};const EN=Um.REACT_APP_VERSION??Um.NPM_PACKAGE_VERSION,PN=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs($,{col:!0,space:"m",children:[c.jsx($,{justify:"center",children:c.jsxs(F,{className:ie("relative"),children:[c.jsx(Ou,{className:ie("w-24 opacity-50")}),t&&c.jsx(Br,{className:ie(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(F,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:ie(zr.link),href:"https://grapesjs.com",children:"GrapesJS"})," ","library. Beyond pushing the evolution of the core library itself, this application aspires to empower individuals in creating and managing their web projects autonomously, free from subscriptions or dependency on the internet connection."]}),c.jsx("br",{}),c.jsxs("p",{children:["If you like the vision of this project and you're eager to play a role in its continued development, consider becoming a backer or sponsor through"," ",c.jsx("a",{className:ie(zr.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(F,{className:ie(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",EN]})]})}),TN=ce(function(){return c.jsxs($,{col:!0,space:"m",children:[c.jsx($,{justify:"center",children:c.jsx(F,{className:Y("relative"),children:c.jsx(Ou,{className:Y("w-24 opacity-50")})})}),c.jsx(F,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:Y(zr.link),href:"/dashboard/sdk/licenses",target:"_blank",children:"Studio SDK license page"}),c.jsx("br",{}),c.jsx("br",{}),"If you have any questions or need assistance with specific use cases, please fill out this"," ",c.jsx("a",{className:Y(zr.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),ON=()=>[{id:jt.web,label:Is(jt.web),content:c.jsxs($,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:K.web,size:oe.s}),c.jsx("span",{children:Is(jt.web)})]})},{id:jt.email,label:Is(jt.email),content:c.jsxs($,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:K.emailOutline,size:oe.s}),c.jsx("span",{children:Is(jt.email)})]})}],Hl="gs-cmp-tabs";function io({tabs:e,className:t,classNamePanel:n,classNameTab:s,variant:r,style:o,onChange:i=yS,value:a}){const l=r==="pills",u=l?M("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=v=>l?M("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?z.bg:""):M("gs-utl-border-b-2",Pe.xy),p=v=>{v&&(v.tabIndex=-1)},f=v=>{const b=v.currentTarget;setTimeout(()=>b.blur(),10)},g=Dt(a)?e.findIndex(v=>v.id===a):void 0,m=!e.some(v=>!!v.content);return c.jsxs(Wi.Group,{onChange:v=>i(e[v].id),defaultIndex:e.findIndex(v=>v.id===a),selectedIndex:g,children:[c.jsx(Wi.List,{as:$,className:M(Hl,t,u),style:o,full:!0,nowrap:!0,children:e.map(v=>c.jsx(Wi,{disabled:v.disabled,className:({selected:b})=>M(`${Hl}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",Ca.focus,d(b),b?`${z.tAo} ${z.bA}`:z.br,s),children:v.label},v.id))}),c.jsx(Wi.Panels,{className:M(`${Hl}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(v=>c.jsx(Wi.Panel,{tabIndex:-1,className:M(`${Hl}__panel`,"gs-utl-h-full"),ref:p,onFocus:f,children:v.content},v.id))})]})}const _u=0,ao=1,Ri=2,Hy=4;function Dy(e,t){return n=>e(t(n))}function _N(e,t){return t(e)}function Fy(e,t){return n=>e(t,n)}function Wm(e,t){return()=>e(t)}function Au(e,t){return t(e),e}function Tt(...e){return e}function AN(e){e()}function Gm(e){return()=>e}function LN(...e){return()=>{e.map(AN)}}function jh(e){return e!==void 0}function Ii(){}function at(e,t){return e(ao,t)}function ke(e,t){e(_u,t)}function Eh(e){e(Ri)}function sn(e){return e(Hy)}function ye(e,t){return at(e,Fy(t,_u))}function qs(e,t){const n=e(ao,s=>{n(),t(s)});return n}function We(){const e=[];return(t,n)=>{switch(t){case Ri:e.splice(0,e.length);return;case ao:return e.push(n),()=>{const s=e.indexOf(n);s>-1&&e.splice(s,1)};case _u:e.slice().forEach(s=>{s(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function pe(e){let t=e;const n=We();return(s,r)=>{switch(s){case ao:r(t);break;case _u:t=r;break;case Hy:return t}return n(s,r)}}function MN(e){let t,n;const s=()=>t&&t();return function(r,o){switch(r){case ao:return o?n===o?void 0:(s(),n=o,t=at(e,o),t):(s(),Ii);case Ri:s(),n=null;return;default:throw new Error(`unrecognized action ${r}`)}}}function In(e){return Au(We(),t=>ye(e,t))}function pn(e,t){return Au(pe(t),n=>ye(e,n))}function NN(...e){return t=>e.reduceRight(_N,t)}function le(e,...t){const n=NN(...t);return(s,r)=>{switch(s){case ao:return at(e,n(r));case Ri:Eh(e);return}}}function By(e,t){return e===t}function Et(e=By){let t;return n=>s=>{e(t,s)||(t=s,n(s))}}function Oe(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>Dy(t,e)}function Ns(e){return t=>()=>t(e)}function Hs(e,t){return n=>s=>n(t=e(t,s))}function Pi(e){return t=>n=>{e>0?e--:t(n)}}function Ir(e){let t=null,n;return s=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,s(t)},e))}}function qm(e){let t,n;return s=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{s(t)},e)}}function He(...e){const t=new Array(e.length);let n=0,s=null;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);at(o,l=>{const u=n;n=n|a,t[i]=l,u!==r&&n===r&&s&&(s(),s=null)})}),o=>i=>{const a=()=>o([i].concat(t));n===r?a():s=a}}function Km(...e){return function(t,n){switch(t){case ao:return LN(...e.map(s=>at(s,n)));case Ri:return;default:throw new Error(`unrecognized action ${t}`)}}}function Te(e,t=By){return le(e,Et(t))}function Wt(...e){const t=We(),n=new Array(e.length);let s=0;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);at(o,l=>{n[i]=l,s=s|a,s===r&&ke(t,n)})}),function(o,i){switch(o){case ao:return s===r&&i(n),at(t,i);case Ri:return Eh(t);default:throw new Error(`unrecognized action ${o}`)}}}function lt(e,t=[],{singleton:n}={singleton:!0}){return{id:$N(),constructor:e,dependencies:t,singleton:n}}const $N=()=>Symbol();function kN(e){const t=new Map,n=({id:s,constructor:r,dependencies:o,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function RN(e,t){const n={},s={};let r=0;const o=e.length;for(;r<o;)s[e[r]]=1,r+=1;for(const i in t)s.hasOwnProperty(i)||(n[i]=t[i]);return n}const Dl=typeof document<"u"?h.useLayoutEffect:h.useEffect;function zy(e,t,n){const s=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=h.createContext({});function l(x,y){x.propsReady&&ke(x.propsReady,!1);for(const w of s){const S=x[t.required[w]];ke(S,y[w])}for(const w of r)if(w in y){const S=x[t.optional[w]];ke(S,y[w])}x.propsReady&&ke(x.propsReady,!0)}function u(x){return o.reduce((y,w)=>(y[w]=S=>{const C=x[t.methods[w]];ke(C,S)},y),{})}function d(x){return i.reduce((y,w)=>(y[w]=MN(x[t.events[w]]),y),{})}const p=h.forwardRef((x,y)=>{const{children:w,...S}=x,[C]=h.useState(()=>Au(kN(e),O=>l(O,S))),[j]=h.useState(Wm(d,C));Dl(()=>{for(const O of i)O in S&&at(j[O],S[O]);return()=>{Object.values(j).map(Eh)}},[S,j,C]),Dl(()=>{l(C,S)}),h.useImperativeHandle(y,Gm(u(C)));const E=n;return c.jsx(a.Provider,{value:C,children:n?c.jsx(E,{...RN([...s,...r,...i],S),children:w}):w})}),f=x=>h.useCallback(Fy(ke,h.useContext(a)[x]),[x]),g=x=>{const w=h.useContext(a)[x],S=h.useCallback(C=>at(w,C),[w]);return h.useSyncExternalStore(S,()=>sn(w),()=>sn(w))},m=x=>{const w=h.useContext(a)[x],[S,C]=h.useState(Wm(sn,w));return Dl(()=>at(w,j=>{j!==S&&C(Gm(j))}),[w,S]),S},v=h.version.startsWith("18")?g:m;return{Component:p,usePublisher:f,useEmitterValue:v,useEmitter:(x,y)=>{const S=h.useContext(a)[x];Dl(()=>at(S,y),[y,S])}}}const Uy=typeof document<"u"?h.useLayoutEffect:h.useEffect;var Vn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Vn||{});const IN={0:"debug",1:"log",2:"warn",3:"error"},VN=()=>typeof globalThis>"u"?window:globalThis,lo=lt(()=>{const e=pe(3);return{log:pe((n,s,r=1)=>{var o;const i=(o=VN().VIRTUOSO_LOG_LEVEL)!=null?o:sn(e);r>=i&&console[IN[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,s)}),logLevel:e}},[],{singleton:!0});function Ph(e,t,n){const s=h.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=h.useMemo(()=>new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}),[e]);r=i=>{i&&t?(o.observe(i),s.current=i):(s.current&&o.unobserve(s.current),s.current=null)}}return{ref:s,callbackRef:r}}function Go(e,t,n){return Ph(e,t,n).callbackRef}function HN(e,t,n,s,r,o,i,a,l){const u=h.useCallback(d=>{const p=DN(d.children,t,a?"offsetWidth":"offsetHeight",r);let f=d.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const g=f.lastElementChild.dataset.viewportType==="window",m=i?a?i.scrollLeft:i.scrollTop:g?a?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:a?f.scrollLeft:f.scrollTop,v=i?a?i.scrollWidth:i.scrollHeight:g?a?document.documentElement.scrollWidth:document.documentElement.scrollHeight:a?f.scrollWidth:f.scrollHeight,b=i?a?i.offsetWidth:i.offsetHeight:g?a?window.innerWidth:window.innerHeight:a?f.offsetWidth:f.offsetHeight;s({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),o==null||o(a?Zm("column-gap",getComputedStyle(d).columnGap,r):Zm("row-gap",getComputedStyle(d).rowGap,r)),p!==null&&e(p)},[e,t,r,o,i,s]);return Ph(u,n,l)}function DN(e,t,n,s){const r=e.length;if(r===0)return null;const o=[];for(let i=0;i<r;i++){const a=e.item(i);if(!a||a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),u=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&s("Zero-sized element, this should not happen",{child:a},Vn.ERROR),d===u)continue;const p=o[o.length-1];o.length===0||p.size!==d||p.endIndex!==l-1?o.push({startIndex:l,endIndex:l,size:d}):o[o.length-1].endIndex++}return o}function Zm(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}function Zr(e,t){return Math.round(e.getBoundingClientRect()[t])}function Wy(e,t){return Math.abs(e-t)<1.01}function Gy(e,t,n,s=Ii,r,o){const i=h.useRef(null),a=h.useRef(null),l=h.useRef(null),u=h.useCallback(f=>{const g=f.target,m=g===window||g===document,v=o?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=o?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,x=o?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(v,0),scrollHeight:b,viewportHeight:x})};f.suppressFlushSync?y():$n.flushSync(y),a.current!==null&&(v===a.current||v<=0||v===b-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const f=r||i.current;return s(r||i.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{s(null),f.removeEventListener("scroll",u)}},[i,u,n,s,r]);function d(f){const g=i.current;if(!g||(o?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=f.behavior==="smooth";let v,b,x;g===window?(b=Math.max(Zr(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),v=o?window.innerWidth:window.innerHeight,x=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(b=g[o?"scrollWidth":"scrollHeight"],v=Zr(g,o?"width":"height"),x=g[o?"scrollLeft":"scrollTop"]);const y=b-v;if(f.top=Math.ceil(Math.max(Math.min(y,f.top),0)),Wy(v,b)||f.top===x){e({scrollTop:x,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(a.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,o&&(f={left:f.top,behavior:f.behavior}),g.scrollTo(f)}function p(f){o&&(f={left:f.top,behavior:f.behavior}),i.current.scrollBy(f)}return{scrollerRef:i,scrollByCallback:p,scrollToCallback:d}}const gn=lt(()=>{const e=We(),t=We(),n=pe(0),s=We(),r=pe(0),o=We(),i=We(),a=pe(0),l=pe(0),u=pe(0),d=pe(0),p=We(),f=We(),g=pe(!1),m=pe(!1),v=pe(!1);return ye(le(e,me(({scrollTop:b})=>b)),t),ye(le(e,me(({scrollHeight:b})=>b)),i),ye(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:a,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:i,smoothScrollTargetReached:s,horizontalDirection:m,skipAnimationFrameInResizeObserver:v,scrollTo:p,scrollBy:f,statefulScrollTop:r,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),La={lvl:0};function qy(e,t,n,s=La,r=La){return{k:e,v:t,lvl:n,l:s,r}}function mt(e){return e===La}function gi(){return La}function Up(e,t){if(mt(e))return La;const{k:n,l:s,r}=e;if(t===n){if(mt(s))return r;if(mt(r))return s;{const[o,i]=Ky(s);return mc(Vt(e,{k:o,v:i,l:Zy(s)}))}}else return t<n?mc(Vt(e,{l:Up(s,t)})):mc(Vt(e,{r:Up(r,t)}))}function Ma(e,t){if(!mt(e))return t===e.k?e.v:t<e.k?Ma(e.l,t):Ma(e.r,t)}function Ss(e,t,n="k"){if(mt(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const s=Ss(e.r,t,n);return s[0]===-1/0?[e.k,e.v]:s}return Ss(e.l,t,n)}function Nn(e,t,n){return mt(e)?qy(t,n,1):t===e.k?Vt(e,{k:t,v:n}):t<e.k?Ym(Vt(e,{l:Nn(e.l,t,n)})):Ym(Vt(e,{r:Nn(e.r,t,n)}))}function Wp(e,t,n){if(mt(e))return[];const{k:s,v:r,l:o,r:i}=e;let a=[];return s>t&&(a=a.concat(Wp(o,t,n))),s>=t&&s<=n&&a.push({k:s,v:r}),s<=n&&(a=a.concat(Wp(i,t,n))),a}function So(e){return mt(e)?[]:[...So(e.l),{k:e.k,v:e.v},...So(e.r)]}function Ky(e){return mt(e.r)?[e.k,e.v]:Ky(e.r)}function Zy(e){return mt(e.r)?e.l:mc(Vt(e,{r:Zy(e.r)}))}function Vt(e,t){return qy(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Md(e){return mt(e)||e.lvl>e.r.lvl}function Ym(e){return Gp(Xy(e))}function mc(e){const{l:t,r:n,lvl:s}=e;if(n.lvl>=s-1&&t.lvl>=s-1)return e;if(s>n.lvl+1){if(Md(t))return Xy(Vt(e,{lvl:s-1}));if(!mt(t)&&!mt(t.r))return Vt(t.r,{l:Vt(t,{r:t.r.l}),r:Vt(e,{l:t.r.r,lvl:s-1}),lvl:s});throw new Error("Unexpected empty nodes")}else{if(Md(e))return Gp(Vt(e,{lvl:s-1}));if(!mt(n)&&!mt(n.l)){const r=n.l,o=Md(r)?n.lvl-1:n.lvl;return Vt(r,{l:Vt(e,{r:r.l,lvl:s-1}),r:Gp(Vt(n,{l:r.r,lvl:o})),lvl:r.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Lu(e,t,n){if(mt(e))return[];const s=Ss(e,t)[0];return FN(Wp(e,s,n))}function Yy(e,t){const n=e.length;if(n===0)return[];let{index:s,value:r}=t(e[0]);const o=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);o.push({start:s,end:a-1,value:r}),s=a,r=l}return o.push({start:s,end:1/0,value:r}),o}function FN(e){return Yy(e,({k:t,v:n})=>({index:t,value:n}))}function Gp(e){const{r:t,lvl:n}=e;return!mt(t)&&!mt(t.r)&&t.lvl===n&&t.r.lvl===n?Vt(t,{l:Vt(e,{r:t.l}),lvl:n+1}):e}function Xy(e){const{l:t}=e;return!mt(t)&&t.lvl===e.lvl?Vt(t,{r:Vt(e,{l:t.r})}):e}function Vc(e,t,n,s=0){let r=e.length-1;for(;s<=r;){const o=Math.floor((s+r)/2),i=e[o],a=n(i,t);if(a===0)return o;if(a===-1){if(r-s<2)return o-1;r=o-1}else{if(r===s)return o;s=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Jy(e,t,n){return e[Vc(e,t,n)]}function BN(e,t,n,s){const r=Vc(e,t,s),o=Vc(e,n,s,r);return e.slice(r,o+1)}const Th=lt(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function zN(e){const{size:t,startIndex:n,endIndex:s}=e;return r=>r.start===n&&(r.end===s||r.end===1/0)&&r.value===t}function Xm(e,t){let n=0,s=0;for(;n<e;)n+=t[s+1]-t[s]-1,s++;return s-(n===e?0:1)}function UN(e,t){let n=mt(e)?0:1/0;for(const s of t){const{size:r,startIndex:o,endIndex:i}=s;if(n=Math.min(n,o),mt(e)){e=Nn(e,0,r);continue}const a=Lu(e,o-1,i+1);if(a.some(zN(s)))continue;let l=!1,u=!1;for(const{start:d,end:p,value:f}of a)l?(i>=d||r===f)&&(e=Up(e,d)):(u=f!==r,l=!0),p>i&&i>=d&&f!==r&&(e=Nn(e,i+1,f));u&&(e=Nn(e,o,r))}return[e,n]}function WN(){return{offsetTree:[],sizeTree:gi(),groupOffsetTree:gi(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function Oh({index:e},t){return t===e?0:t<e?-1:1}function GN({offset:e},t){return t===e?0:t<e?-1:1}function qN(e){return{index:e.index,value:e}}function KN(e,t,n,s=0){return s>0&&(t=Math.max(t,Jy(e,s,Oh).offset)),Yy(BN(e,t,n,GN),qN)}function qp(e,t,n,s){let r=e,o=0,i=0,a=0,l=0;if(t!==0){l=Vc(r,t-1,Oh),a=r[l].offset;const d=Ss(n,t-1);o=d[0],i=d[1],r.length&&r[l].size===Ss(n,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:u,value:d}of Lu(n,t,1/0)){const p=u-o,f=p*i+a+p*s;r.push({offset:f,size:d,index:u}),o=u,a=f,i=d}return{offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function ZN(e,[t,n,s,r]){t.length>0&&s("received item sizes",t,Vn.DEBUG);const o=e.sizeTree;let i=o,a=0;if(n.length>0&&mt(o)&&t.length===2){const f=t[0].size,g=t[1].size;i=n.reduce((m,v)=>Nn(Nn(m,v,f),v+1,g),i)}else[i,a]=UN(i,t);if(i===o)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:p}=qp(e.offsetTree,a,i,r);return{sizeTree:i,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:d,groupOffsetTree:n.reduce((f,g)=>Nn(f,g,Na(g,l,r)),gi()),groupIndices:n}}function Na(e,t,n){if(t.length===0)return 0;const{offset:s,index:r,size:o}=Jy(t,e,Oh),i=e-r,a=o*i+(i-1)*n+s;return a>0?a+n:a}function YN(e){return typeof e.groupIndex<"u"}function Qy(e,t,n){if(YN(e))return t.groupIndices[e.groupIndex]+1;{const s=e.index==="LAST"?n:e.index;let r=ex(s,t);return r=Math.max(0,r,Math.min(n,r)),r}}function ex(e,t){if(!Mu(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Mu(e){return!mt(e.groupOffsetTree)}function XN(e){return So(e).map(({k:t,v:n},s,r)=>{const o=r[s+1],i=o?o.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const JN={offsetHeight:"height",offsetWidth:"width"},Js=lt(([{log:e},{recalcInProgress:t}])=>{const n=We(),s=We(),r=pn(s,0),o=We(),i=We(),a=pe(0),l=pe([]),u=pe(void 0),d=pe(void 0),p=pe((C,j)=>Zr(C,JN[j])),f=pe(void 0),g=pe(0),m=WN(),v=pn(le(n,He(l,e,g),Hs(ZN,m),Et()),m),b=pn(le(l,Et(),Hs((C,j)=>({prev:C.current,current:j}),{prev:[],current:[]}),me(({prev:C})=>C)),[]);ye(le(l,Oe(C=>C.length>0),He(v,g),me(([C,j,E])=>{const O=C.reduce((P,T,A)=>Nn(P,T,Na(T,j.offsetTree,E)||A),gi());return{...j,groupIndices:C,groupOffsetTree:O}})),v),ye(le(s,He(v),Oe(([C,{lastIndex:j}])=>C<j),me(([C,{lastIndex:j,lastSize:E}])=>[{startIndex:C,endIndex:j,size:E}])),n),ye(u,d);const x=pn(le(u,me(C=>C===void 0)),!0);ye(le(d,Oe(C=>C!==void 0&&mt(sn(v).sizeTree)),me(C=>[{startIndex:0,endIndex:0,size:C}])),n);const y=In(le(n,He(v),Hs(({sizes:C},[j,E])=>({changed:E!==C,sizes:E}),{changed:!1,sizes:m}),me(C=>C.changed)));at(le(a,Hs((C,j)=>({diff:C.prev-j,prev:j}),{diff:0,prev:0}),me(C=>C.diff)),C=>{const{groupIndices:j}=sn(v);if(C>0)ke(t,!0),ke(o,C+Xm(C,j));else if(C<0){const E=sn(b);E.length>0&&(C-=Xm(-C,E)),ke(i,C)}}),at(le(a,He(e)),([C,j])=>{C<0&&j("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Vn.ERROR)});const w=In(o);ye(le(o,He(v),me(([C,j])=>{const E=j.groupIndices.length>0,O=[],P=j.lastSize;if(E){const T=Ma(j.sizeTree,0);let A=0,_=0;for(;A<C;){const L=j.groupIndices[_],V=j.groupIndices.length===_+1?1/0:j.groupIndices[_+1]-L-1;O.push({startIndex:L,endIndex:L,size:T}),O.push({startIndex:L+1,endIndex:L+1+V-1,size:P}),_++,A+=V+1}const N=So(j.sizeTree);return A!==C&&N.shift(),N.reduce((L,{k:V,v:U})=>{let H=L.ranges;return L.prevSize!==0&&(H=[...L.ranges,{startIndex:L.prevIndex,endIndex:V+C-1,size:L.prevSize}]),{ranges:H,prevIndex:V+C,prevSize:U}},{ranges:O,prevIndex:C,prevSize:0}).ranges}return So(j.sizeTree).reduce((T,{k:A,v:_})=>({ranges:[...T.ranges,{startIndex:T.prevIndex,endIndex:A+C-1,size:T.prevSize}],prevIndex:A+C,prevSize:_}),{ranges:[],prevIndex:0,prevSize:P}).ranges})),n);const S=In(le(i,He(v,g),me(([C,{offsetTree:j},E])=>{const O=-C;return Na(O,j,E)})));return ye(le(i,He(v,g),me(([C,j,E])=>{if(j.groupIndices.length>0){if(mt(j.sizeTree))return j;let P=gi();const T=sn(b);let A=0,_=0,N=0;for(;A<-C;){N=T[_];const L=T[_+1]-N-1;_++,A+=L+1}if(P=So(j.sizeTree).reduce((L,{k:V,v:U})=>Nn(L,Math.max(0,V+C),U),P),A!==-C){const L=Ma(j.sizeTree,N);P=Nn(P,0,L);const V=Ss(j.sizeTree,-C+1)[1];P=Nn(P,1,V)}return{...j,sizeTree:P,...qp(j.offsetTree,0,P,E)}}else{const P=So(j.sizeTree).reduce((T,{k:A,v:_})=>Nn(T,Math.max(0,A+C),_),gi());return{...j,sizeTree:P,...qp(j.offsetTree,0,P,E)}}})),v),{data:f,totalCount:s,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:o,shiftWith:i,shiftWithOffset:S,beforeUnshiftWith:w,firstItemIndex:a,gap:g,sizes:v,listRefresh:y,statefulTotalCount:r,trackItemSizes:x,itemSize:p}},Tt(lo,Th),{singleton:!0}),QN=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function tx(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!QN)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const ml=lt(([{sizes:e,totalCount:t,listRefresh:n,gap:s},{scrollingInProgress:r,viewportHeight:o,scrollTo:i,smoothScrollTargetReached:a,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p},{log:f}])=>{const g=We(),m=We(),v=pe(0);let b=null,x=null,y=null;function w(){b&&(b(),b=null),y&&(y(),y=null),x&&(clearTimeout(x),x=null),ke(r,!1)}return ye(le(g,He(e,o,t,v,l,u,f),He(s,d,p),me(([[S,C,j,E,O,P,T,A],_,N,D])=>{const L=tx(S),{align:V,behavior:U,offset:H}=L,B=E-1,k=Qy(L,C,B);let I=Na(k,C.offsetTree,_)+P;V==="end"?(I+=N+Ss(C.sizeTree,k)[1]-j+D,k===B&&(I+=T)):V==="center"?I+=(N+Ss(C.sizeTree,k)[1]-j+D)/2:I-=O,H&&(I+=H);const R=W=>{w(),W?(A("retrying to scroll to",{location:S},Vn.DEBUG),ke(g,S)):(ke(m,!0),A("list did not change, scroll successful",{},Vn.DEBUG))};if(w(),U==="smooth"){let W=!1;y=at(n,Z=>{W=W||Z}),b=qs(a,()=>{R(W)})}else b=qs(le(n,e$(150)),R);return x=setTimeout(()=>{w()},1200),ke(r,!0),A("scrolling from index to",{index:k,top:I,behavior:U},Vn.DEBUG),{top:I,behavior:U}})),i),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Tt(Js,gn,lo),{singleton:!0});function e$(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return s=>{s&&(t(!0),clearTimeout(n))}}}const $a="up",da="down",t$="none",n$={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},s$=0,vl=lt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:s,footerHeight:r,scrollBy:o}])=>{const i=pe(!1),a=pe(!0),l=We(),u=We(),d=pe(4),p=pe(s$),f=pn(le(Km(le(Te(t),Pi(1),Ns(!0)),le(Te(t),Pi(1),Ns(!1),qm(100))),Et()),!1),g=pn(le(Km(le(o,Ns(!0)),le(o,Ns(!1),qm(200))),Et()),!1);ye(le(Wt(Te(t),Te(p)),me(([y,w])=>y<=w),Et()),a),ye(le(a,Ir(50)),u);const m=In(le(Wt(e,Te(n),Te(s),Te(r),Te(d)),Hs((y,[{scrollTop:w,scrollHeight:S},C,j,E,O])=>{const P=w+C-S>-O,T={viewportHeight:C,scrollTop:w,scrollHeight:S};if(P){let _,N;return w>y.state.scrollTop?(_="SCROLLED_DOWN",N=y.state.scrollTop-w):(_="SIZE_DECREASED",N=y.state.scrollTop-w||y.scrollTopDelta),{atBottom:!0,state:T,atBottomBecause:_,scrollTopDelta:N}}let A;return T.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":C<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":w<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:T}},n$),Et((y,w)=>y&&y.atBottom===w.atBottom))),v=pn(le(e,Hs((y,{scrollTop:w,scrollHeight:S,viewportHeight:C})=>{if(Wy(y.scrollHeight,S))return{scrollTop:w,scrollHeight:S,jump:0,changed:!1};{const j=S-(w+C)<1;return y.scrollTop!==w&&j?{scrollHeight:S,scrollTop:w,jump:y.scrollTop-w,changed:!0}:{scrollHeight:S,scrollTop:w,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Oe(y=>y.changed),me(y=>y.jump)),0);ye(le(m,me(y=>y.atBottom)),i),ye(le(i,Ir(50)),l);const b=pe(da);ye(le(e,me(({scrollTop:y})=>y),Et(),Hs((y,w)=>sn(g)?{direction:y.direction,prevScrollTop:w}:{direction:w<y.prevScrollTop?$a:da,prevScrollTop:w},{direction:da,prevScrollTop:0}),me(y=>y.direction)),b),ye(le(e,Ir(50),Ns(t$)),b);const x=pe(0);return ye(le(f,Oe(y=>!y),Ns(0)),x),ye(le(t,Ir(100),He(f),Oe(([y,w])=>!!w),Hs(([y,w],[S])=>[w,S],[0,0]),me(([y,w])=>w-y)),x),{isScrolling:f,isAtTop:a,isAtBottom:i,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:v}},Tt(gn)),co=lt(([{log:e}])=>{const t=pe(!1),n=In(le(t,Oe(s=>s),Et()));return at(t,s=>{s&&sn(e)("props updated",{},Vn.DEBUG)}),{propsReady:t,didMount:n}},Tt(lo),{singleton:!0});function _h(e,t){e==0?t():requestAnimationFrame(()=>_h(e-1,t))}function Ah(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const bl=lt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:s},{scrollToIndex:r,scrollTargetReached:o},{didMount:i}])=>{const a=pe(!0),l=pe(0),u=pe(!0);return ye(le(i,He(l),Oe(([d,p])=>!!p),Ns(!1)),a),ye(le(i,He(l),Oe(([d,p])=>!!p),Ns(!1)),u),at(le(Wt(t,i),He(a,e,n,u),Oe(([[,d],p,{sizeTree:f},g,m])=>d&&(!mt(f)||jh(g))&&!p&&!m),He(l)),([,d])=>{qs(o,()=>{ke(u,!0)}),_h(4,()=>{qs(s,()=>{ke(a,!0)}),ke(r,d)})}),{scrolledToInitialItem:a,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Tt(Js,gn,ml,co),{singleton:!0});function Jm(e){return e?e==="smooth"?"smooth":"auto":!1}const r$=(e,t)=>typeof e=="function"?Jm(e(t)):t&&Jm(e),o$=lt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:s},{scrollToIndex:r},{scrolledToInitialItem:o},{propsReady:i,didMount:a},{log:l},{scrollingInProgress:u}])=>{const d=pe(!1),p=We();let f=null;function g(v){ke(r,{index:"LAST",align:"end",behavior:v})}at(le(Wt(le(Te(e),Pi(1)),a),He(Te(d),n,o,u),me(([[v,b],x,y,w,S])=>{let C=b&&w,j="auto";return C&&(j=r$(x,y||S),C=C&&!!j),{totalCount:v,shouldFollow:C,followOutputBehavior:j}}),Oe(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{f&&(f(),f=null),f=qs(t,()=>{sn(l)("following output to ",{totalCount:v},Vn.DEBUG),g(b),f=null})});function m(v){const b=qs(s,x=>{v&&!x.atBottom&&x.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(sn(l)("scrolling to bottom due to increased size",{},Vn.DEBUG),g("auto"))});setTimeout(b,100)}return at(le(Wt(Te(d),e,i),Oe(([v,,b])=>v&&b),Hs(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),Oe(({refreshed:v})=>v),He(d,e)),([,v])=>{sn(o)&&m(v!==!1)}),at(p,()=>{m(sn(d)!==!1)}),at(Wt(Te(d),s),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:p}},Tt(Js,vl,ml,bl,co,lo,gn));function i$(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const nx=lt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:s,headerHeight:r}])=>{const o=We(),i=We(),a=In(le(o,me(i$)));return ye(le(a,me(l=>l.totalCount)),e),ye(le(a,me(l=>l.groupIndices)),t),ye(le(Wt(s,n,r),Oe(([l,u])=>Mu(u)),me(([l,u,d])=>Ss(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Et(),me(l=>[l])),i),{groupCounts:o,topItemsIndexes:i}},Tt(Js,gn));function ka(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function sx(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Hc="top",Dc="bottom",Qm="none";function e1(e,t,n){return typeof e=="number"?n===$a&&t===Hc||n===da&&t===Dc?e:0:n===$a?t===Hc?e.main:e.reverse:t===Dc?e.main:e.reverse}function t1(e,t){return typeof e=="number"?e:e[t]||0}const Lh=lt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:s,fixedHeaderHeight:r}])=>{const o=We(),i=pe(0),a=pe(0),l=pe(0),u=pn(le(Wt(Te(e),Te(t),Te(s),Te(o,ka),Te(l),Te(i),Te(r),Te(n),Te(a)),me(([d,p,f,[g,m],v,b,x,y,w])=>{const S=d-y,C=b+x,j=Math.max(f-S,0);let E=Qm;const O=t1(w,Hc),P=t1(w,Dc);return g-=y,g+=f+x,m+=f+x,m-=y,g>d+C-O&&(E=$a),m<d-j+p+P&&(E=da),E!==Qm?[Math.max(S-f-e1(v,Hc,E)-O,0),S-j-x+p+e1(v,Dc,E)+P]:null}),Oe(d=>d!=null),Et(ka)),[0,0]);return{listBoundary:o,overscan:l,topListHeight:i,increaseViewportBy:a,visibleRange:u}},Tt(gn),{singleton:!0});function a$(e,t,n){if(Mu(t)){const s=ex(e,t);return[{index:Ss(t.groupOffsetTree,s)[0],size:0,offset:0},{index:s,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Nd={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function n1(e,t,n){if(e.length===0)return[];if(!Mu(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const s=e[0].index,r=e[e.length-1].index,o=[],i=Lu(t.groupOffsetTree,s,r);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;u.index===a.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},o.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return o}function vc(e,t,n,s,r,o){const{lastSize:i,lastOffset:a,lastIndex:l}=r;let u=0,d=0;if(e.length>0){u=e[0].offset;const v=e[e.length-1];d=v.offset+v.size}const p=n-l,f=a+p*i+(p-1)*s,g=u,m=f-d;return{items:n1(e,r,o),topItems:n1(t,r,o),topListHeight:t.reduce((v,b)=>b.size+v,0),offsetTop:u,offsetBottom:m,top:g,bottom:d,totalCount:n,firstItemIndex:o}}function rx(e,t,n,s,r,o){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=Ah(t,a),u=Array.from({length:a}).map((d,p)=>({index:p+l,size:0,offset:0,data:o[p+l]}));return vc(u,[],a,r,n,s)}const qo=lt(([{sizes:e,totalCount:t,data:n,firstItemIndex:s,gap:r},o,{visibleRange:i,listBoundary:a,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:p},f,{didMount:g},{recalcInProgress:m}])=>{const v=pe([]),b=pe(0),x=We();ye(o.topItemsIndexes,v);const y=pn(le(Wt(g,m,Te(i,ka),Te(t),Te(e),Te(d),u,Te(v),Te(s),Te(r),n),Oe(([j,E,,O,,,,,,,P])=>{const T=P&&P.length!==O;return j&&!E&&!T}),me(([,,[j,E],O,P,T,A,_,N,D,L])=>{const V=P,{sizeTree:U,offsetTree:H}=V,B=sn(b);if(O===0)return{...Nd,totalCount:O};if(j===0&&E===0)return B===0?{...Nd,totalCount:O}:rx(B,T,P,N,D,L||[]);if(mt(U))return B>0?null:vc(a$(Ah(T,O),V,L),[],O,D,V,N);const k=[];if(_.length>0){const X=_[0],J=_[_.length-1];let Q=0;for(const G of Lu(U,X,J)){const ee=G.value,ae=Math.max(G.start,X),ge=Math.min(G.end,J);for(let je=ae;je<=ge;je++)k.push({index:je,size:ee,offset:Q,data:L&&L[je]}),Q+=ee}}if(!A)return vc([],k,O,D,V,N);const I=_.length>0?_[_.length-1]+1:0,R=KN(H,j,E,I);if(R.length===0)return null;const W=O-1,Z=Au([],X=>{for(const J of R){const Q=J.value;let G=Q.offset,ee=J.start;const ae=Q.size;if(Q.offset<j){ee+=Math.floor((j-Q.offset+D)/(ae+D));const je=ee-J.start;G+=je*ae+je*D}ee<I&&(G+=(I-ee)*ae,ee=I);const ge=Math.min(J.end,W);for(let je=ee;je<=ge&&!(G>=E);je++)X.push({index:je,size:ae,offset:G,data:L&&L[je]}),G+=ae+D}});return vc(Z,k,O,D,V,N)}),Oe(j=>j!==null),Et()),Nd);ye(le(n,Oe(jh),me(j=>j==null?void 0:j.length)),t),ye(le(y,me(j=>j.topListHeight)),p),ye(p,l),ye(le(y,me(j=>[j.top,j.bottom])),a),ye(le(y,me(j=>j.items)),x);const w=In(le(y,Oe(({items:j})=>j.length>0),He(t,n),Oe(([{items:j},E])=>j[j.length-1].originalIndex===E-1),me(([,j,E])=>[j-1,E]),Et(ka),me(([j])=>j))),S=In(le(y,Ir(200),Oe(({items:j,topItems:E})=>j.length>0&&j[0].originalIndex===E.length),me(({items:j})=>j[0].index),Et())),C=In(le(y,Oe(({items:j})=>j.length>0),me(({items:j})=>{let E=0,O=j.length-1;for(;j[E].type==="group"&&E<O;)E++;for(;j[O].type==="group"&&O>E;)O--;return{startIndex:j[E].index,endIndex:j[O].index}}),Et(sx)));return{listState:y,topItemsIndexes:v,endReached:w,startReached:S,rangeChanged:C,itemsRendered:x,initialItemCount:b,...f}},Tt(Js,nx,Lh,bl,ml,vl,co,Th),{singleton:!0}),l$=lt(([{sizes:e,firstItemIndex:t,data:n,gap:s},{initialTopMostItemIndex:r},{initialItemCount:o,listState:i},{didMount:a}])=>(ye(le(a,He(o),Oe(([,l])=>l!==0),He(r,e,t,s,n),me(([[,l],u,d,p,f,g=[]])=>rx(l,u,d,p,f,g))),i),{}),Tt(Js,bl,qo,co),{singleton:!0}),ox=lt(([{scrollVelocity:e}])=>{const t=pe(!1),n=We(),s=pe(!1);return ye(le(e,He(s,t,n),Oe(([r,o])=>!!o),me(([r,o,i,a])=>{const{exit:l,enter:u}=o;if(i){if(l(r,a))return!1}else if(u(r,a))return!0;return i}),Et()),t),at(le(Wt(t,e,n),He(s)),([[r,o,i],a])=>r&&a&&a.change&&a.change(o,i)),{isSeeking:t,scrollSeekConfiguration:s,scrollVelocity:e,scrollSeekRangeChanged:n}},Tt(vl),{singleton:!0}),c$=lt(([{topItemsIndexes:e}])=>{const t=pe(0);return ye(le(t,Oe(n=>n>0),me(n=>Array.from({length:n}).map((s,r)=>r))),e),{topItemCount:t}},Tt(qo)),ix=lt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:s},{listState:r}])=>{const o=We(),i=pn(le(Wt(e,s,t,n,r),me(([a,l,u,d,p])=>a+l+u+d+p.offsetBottom+p.bottom)),0);return ye(Te(i),o),{totalListHeight:i,totalListHeightChanged:o}},Tt(gn,qo),{singleton:!0});function ax(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const u$=ax(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),d$=lt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:s},{isScrolling:r,isAtBottom:o,scrollDirection:i,lastJumpDueToItemResize:a},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:p,gap:f},{log:g},{recalcInProgress:m}])=>{const v=In(le(l,He(a),Hs(([,x,y,w],[{items:S,totalCount:C,bottom:j,offsetBottom:E},O])=>{const P=j+E;let T=0;return y===C&&x.length>0&&S.length>0&&(S[0].originalIndex===0&&x[0].originalIndex===0||(T=P-w,T!==0&&(T+=O))),[T,S,C,P]},[0,[],0,0]),Oe(([x])=>x!==0),He(t,i,s,o,g,m),Oe(([,x,y,w,,,S])=>!S&&!w&&x!==0&&y===$a),me(([[x],,,,,y])=>(y("Upward scrolling compensation",{amount:x},Vn.DEBUG),x))));function b(x){x>0?(ke(e,{top:-x,behavior:"auto"}),ke(n,0)):(ke(n,0),ke(e,{top:-x,behavior:"auto"}))}return at(le(v,He(n,r)),([x,y,w])=>{w&&u$()?ke(n,y-x):b(-x)}),at(le(Wt(pn(r,!1),n,m),Oe(([x,y,w])=>!x&&!w&&y!==0),me(([x,y])=>y),Ir(1)),b),ye(le(d,me(x=>({top:-x}))),e),at(le(u,He(p,f),me(([x,{lastSize:y,groupIndices:w,sizeTree:S},C])=>{function j(E){return E*(y+C)}if(w.length===0)return j(x);{let E=0;const O=Ma(S,0);let P=0,T=0;for(;P<x;){P++,E+=O;let A=w.length===T+1?1/0:w[T+1]-w[T]-1;P+A>x&&(E-=O,A=x-P+1),P+=A,E+=j(A),T++}return E}})),x=>{ke(n,x),requestAnimationFrame(()=>{ke(e,{top:x}),requestAnimationFrame(()=>{ke(n,0),ke(m,!1)})})}),{deviation:n}},Tt(gn,vl,qo,Js,lo,Th)),p$=lt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const s=pe(0);return at(le(e,He(s),Oe(([,r])=>r!==0),me(([,r])=>({top:r}))),r=>{qs(le(n,Pi(1),Oe(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{ke(t,r)})})}),{initialScrollTop:s}},Tt(co,gn,qo),{singleton:!0}),f$=lt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=pe(!1),s=pn(le(Wt(n,e,t),Oe(([r])=>r),me(([,r,o])=>Math.max(0,r-o)),Ir(0),Et()),0);return{alignToBottom:n,paddingTopAddition:s}},Tt(gn,ix),{singleton:!0}),Mh=lt(([{scrollTo:e,scrollContainerState:t}])=>{const n=We(),s=We(),r=We(),o=pe(!1),i=pe(void 0);return ye(le(Wt(n,s),me(([{viewportHeight:a,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:a}))),t),ye(le(e,He(s),me(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{useWindowScroll:o,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:s,windowScrollTo:r}},Tt(gn)),h$=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:s,locationParams:{behavior:r,align:o,...i}})=>e<n?{...i,behavior:r,align:o??"start"}:t>s?{...i,behavior:r,align:o??"end"}:null,g$=lt(([{sizes:e,totalCount:t,gap:n},{scrollTop:s,viewportHeight:r,headerHeight:o,fixedHeaderHeight:i,fixedFooterHeight:a,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=We();return ye(le(d,He(e,r,t,o,i,a,s),He(n),me(([[p,f,g,m,v,b,x,y],w])=>{const{done:S,behavior:C,align:j,calculateViewLocation:E=h$,...O}=p,P=Qy(p,f,m-1),T=Na(P,f.offsetTree,w)+v+b,A=T+Ss(f.sizeTree,P)[1],_=y+b,N=y+g-x,D=E({itemTop:T,itemBottom:A,viewportTop:_,viewportBottom:N,locationParams:{behavior:C,align:j,...O}});return D?S&&qs(le(l,Oe(L=>L===!1),Pi(sn(l)?1:2)),S):S&&S(),D}),Oe(p=>p!==null)),u),{scrollIntoView:d}},Tt(Js,gn,ml,qo,lo),{singleton:!0}),m$=lt(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:s},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=We(),d=pe(void 0),p=pe(null),f=pe(null);return ye(a,p),ye(l,f),at(le(u,He(e,n,i,p,f,s)),([g,m,v,b,x,y,w])=>{const S=XN(m.sizeTree);b&&x!==null&&y!==null&&(v=x.scrollTop-y.offsetTop),v-=w,g({ranges:S,scrollTop:v})}),ye(le(d,Oe(jh),me(v$)),r),ye(le(o,He(d),Oe(([,g])=>g!==void 0),Et(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Tt(Js,gn,bl,co,Mh));function v$(e){return{offset:e.scrollTop,index:0,align:"start"}}const b$=lt(([e,t,n,s,r,o,i,a,l,u])=>({...e,...t,...n,...s,...r,...o,...i,...a,...l,...u}),Tt(Lh,l$,co,ox,ix,p$,f$,Mh,g$,lo)),y$=lt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:s,trackItemSizes:r,itemSize:o,data:i,firstItemIndex:a,groupIndices:l,statefulTotalCount:u,gap:d,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,x,{listState:y,topItemsIndexes:w,...S},{scrollToIndex:C},j,{topItemCount:E},{groupCounts:O},P])=>(ye(S.rangeChanged,P.scrollSeekRangeChanged),ye(le(P.windowViewportRect,me(T=>T.visibleHeight)),v.viewportHeight),{totalCount:e,data:i,firstItemIndex:a,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:w,topItemCount:E,groupCounts:O,fixedItemHeight:n,defaultItemHeight:s,gap:d,...x,statefulTotalCount:u,listState:y,scrollToIndex:C,trackItemSizes:r,itemSize:o,groupIndices:l,...S,...P,...v,sizes:p,...b}),Tt(Js,bl,gn,m$,o$,qo,ml,d$,c$,nx,b$)),$d="-webkit-sticky",s1="sticky",lx=ax(()=>{if(typeof document>"u")return s1;const e=document.createElement("div");return e.style.position=$d,e.style.position===$d?$d:s1});function cx(e,t,n){const s=h.useRef(null),r=h.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let p,f;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;p=g.height-Math.max(0,m),f=m+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),f=u.top+window.pageYOffset;s.current={offsetTop:f,visibleHeight:p,visibleWidth:d},e(s.current)},[e,t]),{callbackRef:o,ref:i}=Ph(r,!0,n),a=h.useCallback(()=>{r(i.current)},[r,i]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",a);const l=new ResizeObserver(()=>{requestAnimationFrame(a)});return l.observe(t),()=>{t.removeEventListener("scroll",a),l.unobserve(t)}}else return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,t]),o}const ux=h.createContext(void 0),dx=h.createContext(void 0);function px(e){return e}const x$=lt(()=>{const e=pe(l=>`Item ${l}`),t=pe(null),n=pe(l=>`Group ${l}`),s=pe({}),r=pe(px),o=pe("div"),i=pe(Ii),a=(l,u=null)=>pn(le(s,me(d=>d[l]),Et()),u);return{context:t,itemContent:e,groupContent:n,components:s,computeItemKey:r,HeaderFooterTag:o,scrollerRef:i,FooterComponent:a("Footer"),HeaderComponent:a("Header"),TopItemListComponent:a("TopItemList"),ListComponent:a("List","div"),ItemComponent:a("Item","div"),GroupComponent:a("Group","div"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder")}}),w$=lt(([e,t])=>({...e,...t}),Tt(y$,x$)),S$=({height:e})=>c.jsx("div",{style:{height:e}}),C$={position:lx(),zIndex:1,overflowAnchor:"none"},fx={overflowAnchor:"none"},j$={...fx,display:"inline-block",height:"100%"},r1=h.memo(function({showTopList:t=!1}){const n=Le("listState"),s=Jn("sizeRanges"),r=Le("useWindowScroll"),o=Le("customScrollParent"),i=Jn("windowScrollContainerState"),a=Jn("scrollContainerState"),l=o||r?i:a,u=Le("itemContent"),d=Le("context"),p=Le("groupContent"),f=Le("trackItemSizes"),g=Le("itemSize"),m=Le("log"),v=Jn("gap"),b=Le("horizontalDirection"),{callbackRef:x}=HN(s,g,f,t?Ii:l,m,v,o,b,Le("skipAnimationFrameInResizeObserver")),[y,w]=h.useState(0);Nh("deviation",L=>{y!==L&&w(L)});const S=Le("EmptyPlaceholder"),C=Le("ScrollSeekPlaceholder")||S$,j=Le("ListComponent"),E=Le("ItemComponent"),O=Le("GroupComponent"),P=Le("computeItemKey"),T=Le("isSeeking"),A=Le("groupIndices").length>0,_=Le("alignToBottom"),N=Le("initialItemFinalLocationReached"),D=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:_?"auto":0}:{marginTop:y!==0?y:_?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...N?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&S?c.jsx(S,{...dn(S,d)}):c.jsx(j,{...dn(j,d),ref:x,style:D,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(L=>{const V=L.originalIndex,U=P(V+n.firstItemIndex,L.data,d);return T?h.createElement(C,{...dn(C,d),key:U,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?h.createElement(O,{...dn(O,d),key:U,"data-index":V,"data-known-size":L.size,"data-item-index":L.index,style:C$},p(L.index,d)):h.createElement(E,{...dn(E,d),...O$(E,L.data),key:U,"data-index":V,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,style:b?j$:fx},A?u(L.index,L.groupIndex,L.data,d):u(L.index,L.data,d))})})}),E$={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},P$={outline:"none",overflowX:"auto",position:"relative"},Nu=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),T$={width:"100%",position:lx(),top:0,zIndex:1};function dn(e,t){if(typeof e!="string")return{context:t}}function O$(e,t){return{item:typeof e=="string"?void 0:t}}const _$=h.memo(function(){const t=Le("HeaderComponent"),n=Jn("headerHeight"),s=Le("HeaderFooterTag"),r=Go(h.useMemo(()=>i=>n(Zr(i,"height")),[n]),!0,Le("skipAnimationFrameInResizeObserver")),o=Le("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),A$=h.memo(function(){const t=Le("FooterComponent"),n=Jn("footerHeight"),s=Le("HeaderFooterTag"),r=Go(h.useMemo(()=>i=>n(Zr(i,"height")),[n]),!0,Le("skipAnimationFrameInResizeObserver")),o=Le("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null});function hx({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("scrollerRef"),f=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:v,scrollToCallback:b}=Gy(l,d,u,p,void 0,g);t("scrollTo",b),t("scrollBy",v);const x=g?P$:E$;return c.jsx(u,{ref:m,style:{...x,...o},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...a,...dn(u,f),children:i})})}function gx({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("totalListHeight"),f=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:v,scrollByCallback:b,scrollToCallback:x}=Gy(l,d,u,Ii,g);return Uy(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",x),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...o,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...a,...dn(u,m),children:i})})}const L$=({children:e})=>{const t=h.useContext(ux),n=Jn("viewportHeight"),s=Jn("fixedItemHeight"),r=Le("alignToBottom"),o=Le("horizontalDirection"),i=h.useMemo(()=>Dy(n,l=>Zr(l,o?"width":"height")),[n,o]),a=Go(i,!0,Le("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),s(t.itemHeight))},[t,n,s]),c.jsx("div",{style:Nu(r),ref:a,"data-viewport-type":"element",children:e})},M$=({children:e})=>{const t=h.useContext(ux),n=Jn("windowViewportRect"),s=Jn("fixedItemHeight"),r=Le("customScrollParent"),o=cx(n,r,Le("skipAnimationFrameInResizeObserver")),i=Le("alignToBottom");return h.useEffect(()=>{t&&(s(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,s]),c.jsx("div",{ref:o,style:Nu(i),"data-viewport-type":"window",children:e})},N$=({children:e})=>{const t=Le("TopItemListComponent")||"div",n=Le("headerHeight"),s={...T$,marginTop:`${n}px`},r=Le("context");return c.jsx(t,{style:s,...dn(t,r),children:e})},$$=h.memo(function(t){const n=Le("useWindowScroll"),s=Le("topItemsIndexes").length>0,r=Le("customScrollParent"),o=r||n?I$:R$,i=r||n?M$:L$;return c.jsxs(o,{...t,children:[s&&c.jsx(N$,{children:c.jsx(r1,{showTopList:!0})}),c.jsxs(i,{children:[c.jsx(_$,{}),c.jsx(r1,{}),c.jsx(A$,{})]})]})}),{Component:k$,usePublisher:Jn,useEmitterValue:Le,useEmitter:Nh}=zy(w$,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},$$),R$=hx({usePublisher:Jn,useEmitterValue:Le,useEmitter:Nh}),I$=gx({usePublisher:Jn,useEmitterValue:Le,useEmitter:Nh}),V$=k$,o1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},H$={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:i1,ceil:a1,floor:Fc,min:kd,max:pa}=Math;function D$(e){return{...H$,items:e}}function l1(e,t,n){return Array.from({length:t-e+1}).map((s,r)=>{const o=n===null?null:n[r+e];return{index:r+e,data:o}})}function F$(e,t){return e&&e.column===t.column&&e.row===t.row}function Fl(e,t){return e&&e.width===t.width&&e.height===t.height}const B$=lt(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:s},{scrollTop:r,viewportHeight:o,scrollBy:i,scrollTo:a,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:p},f,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,windowScrollTo:S},C])=>{const j=pe(0),E=pe(0),O=pe(o1),P=pe({height:0,width:0}),T=pe({height:0,width:0}),A=We(),_=We(),N=pe(0),D=pe(null),L=pe({row:0,column:0}),V=We(),U=We(),H=pe(!1),B=pe(0),k=pe(!0),I=pe(!1),R=pe(!1);at(le(v,He(B),Oe(([G,ee])=>!!ee)),()=>{ke(k,!1)}),at(le(Wt(v,k,T,P,B,I),Oe(([G,ee,ae,ge,,je])=>G&&!ee&&ae.height!==0&&ge.height!==0&&!je)),([,,,,G])=>{ke(I,!0),_h(1,()=>{ke(A,G)}),qs(le(r),()=>{ke(n,[0,0]),ke(k,!0)})}),ye(le(U,Oe(G=>G!=null&&G.scrollTop>0),Ns(0)),E),at(le(v,He(U),Oe(([,G])=>G!=null)),([,G])=>{G&&(ke(P,G.viewport),ke(T,G==null?void 0:G.item),ke(L,G.gap),G.scrollTop>0&&(ke(H,!0),qs(le(r,Pi(1)),ee=>{ke(H,!1)}),ke(a,{top:G.scrollTop})))}),ye(le(P,me(({height:G})=>G)),o),ye(le(Wt(Te(P,Fl),Te(T,Fl),Te(L,(G,ee)=>G&&G.column===ee.column&&G.row===ee.row),Te(r)),me(([G,ee,ae,ge])=>({viewport:G,item:ee,gap:ae,scrollTop:ge}))),V),ye(le(Wt(Te(j),t,Te(L,F$),Te(T,Fl),Te(P,Fl),Te(D),Te(E),Te(H),Te(k),Te(B)),Oe(([,,,,,,,G])=>!G),me(([G,[ee,ae],ge,je,Se,et,Ye,,Ct,ct])=>{const{row:we,column:nt}=ge,{height:st,width:vt}=je,{width:Me}=Se;if(Ye===0&&(G===0||Me===0))return o1;if(vt===0){const Ft=Ah(ct,G),er=Math.max(Ft+Ye-1,0);return D$(l1(Ft,er,et))}const pt=mx(Me,vt,nt);let ut,Fe;Ct?ee===0&&ae===0&&Ye>0?(ut=0,Fe=Ye-1):(ut=pt*Fc((ee+we)/(st+we)),Fe=pt*a1((ae+we)/(st+we))-1,Fe=kd(G-1,pa(Fe,pt-1)),ut=kd(Fe,pa(0,ut))):(ut=0,Fe=-1);const Yt=l1(ut,Fe,et),{top:he,bottom:Ve}=c1(Se,ge,je,Yt),De=a1(G/pt),Ot=De*st+(De-1)*we-Ve;return{items:Yt,offsetTop:he,offsetBottom:Ot,top:he,bottom:Ve,itemHeight:st,itemWidth:vt}})),O),ye(le(D,Oe(G=>G!==null),me(G=>G.length)),j),ye(le(Wt(P,T,O,L),Oe(([G,ee,{items:ae}])=>ae.length>0&&ee.height!==0&&G.height!==0),me(([G,ee,{items:ae},ge])=>{const{top:je,bottom:Se}=c1(G,ge,ee,ae);return[je,Se]}),Et(ka)),n);const W=pe(!1);ye(le(r,He(W),me(([G,ee])=>ee||G!==0)),W);const Z=In(le(Te(O),Oe(({items:G})=>G.length>0),He(j,W),Oe(([{items:G},ee,ae])=>ae&&G[G.length-1].index===ee-1),me(([,G])=>G-1),Et())),X=In(le(Te(O),Oe(({items:G})=>G.length>0&&G[0].index===0),Ns(0),Et())),J=In(le(Te(O),He(H),Oe(([{items:G},ee])=>G.length>0&&!ee),me(([{items:G}])=>({startIndex:G[0].index,endIndex:G[G.length-1].index})),Et(sx),Ir(0)));ye(J,g.scrollSeekRangeChanged),ye(le(A,He(P,T,j,L),me(([G,ee,ae,ge,je])=>{const Se=tx(G),{align:et,behavior:Ye,offset:Ct}=Se;let ct=Se.index;ct==="LAST"&&(ct=ge-1),ct=pa(0,ct,kd(ge-1,ct));let we=Kp(ee,je,ae,ct);return et==="end"?we=i1(we-ee.height+ae.height):et==="center"&&(we=i1(we-ee.height/2+ae.height/2)),Ct&&(we+=Ct),{top:we,behavior:Ye}})),a);const Q=pn(le(O,me(G=>G.offsetBottom+G.bottom)),0);return ye(le(b,me(G=>({width:G.visibleWidth,height:G.visibleHeight}))),P),{data:D,totalCount:j,viewportDimensions:P,itemDimensions:T,scrollTop:r,scrollHeight:_,overscan:e,increaseViewportBy:s,scrollBy:i,scrollTo:a,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:S,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,deviation:N,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:E,gap:L,restoreStateFrom:U,...g,initialTopMostItemIndex:B,horizontalDirection:R,gridState:O,totalListHeight:Q,...f,startReached:X,endReached:Z,rangeChanged:J,stateChanged:V,propsReady:m,stateRestoreInProgress:H,...C}},Tt(Lh,gn,vl,ox,co,Mh,lo));function c1(e,t,n,s){const{height:r}=n;if(r===void 0||s.length===0)return{top:0,bottom:0};const o=Kp(e,t,n,s[0].index),i=Kp(e,t,n,s[s.length-1].index)+r;return{top:o,bottom:i}}function Kp(e,t,n,s){const r=mx(e.width,n.width,t.column),o=Fc(s/r),i=o*n.height+pa(0,o-1)*t.row;return i>0?i+t.row:i}function mx(e,t,n){return pa(1,Fc((e+n)/(Fc(t)+n)))}const z$=lt(()=>{const e=pe(p=>`Item ${p}`),t=pe({}),n=pe(null),s=pe("virtuoso-grid-item"),r=pe("virtuoso-grid-list"),o=pe(px),i=pe("div"),a=pe(Ii),l=(p,f=null)=>pn(le(t,me(g=>g[p]),Et()),f),u=pe(!1),d=pe(!1);return ye(Te(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:s,listClassName:r,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),U$=lt(([e,t])=>({...e,...t}),Tt(B$,z$)),W$=h.memo(function(){const t=At("gridState"),n=At("listClassName"),s=At("itemClassName"),r=At("itemContent"),o=At("computeItemKey"),i=At("isSeeking"),a=Qn("scrollHeight"),l=At("ItemComponent"),u=At("ListComponent"),d=At("ScrollSeekPlaceholder"),p=At("context"),f=Qn("itemDimensions"),g=Qn("gap"),m=At("log"),v=At("stateRestoreInProgress"),b=Qn("reportReadyState"),x=Go(h.useMemo(()=>y=>{const w=y.parentElement.parentElement.scrollHeight;a(w);const S=y.firstChild;if(S){const{width:C,height:j}=S.getBoundingClientRect();f({width:C,height:j})}g({row:u1("row-gap",getComputedStyle(y).rowGap,m),column:u1("column-gap",getComputedStyle(y).columnGap,m)})},[a,f,g,m]),!0,!1);return Uy(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:x,className:n,...dn(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const w=o(y.index,y.data,p);return i?c.jsx(d,{...dn(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},w):h.createElement(l,{...dn(l,p),className:s,"data-index":y.index,key:w},r(y.index,y.data,p))})})}),G$=h.memo(function(){const t=At("HeaderComponent"),n=Qn("headerHeight"),s=At("headerFooterTag"),r=Go(h.useMemo(()=>i=>n(Zr(i,"height")),[n]),!0,!1),o=At("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),q$=h.memo(function(){const t=At("FooterComponent"),n=Qn("footerHeight"),s=At("headerFooterTag"),r=Go(h.useMemo(()=>i=>n(Zr(i,"height")),[n]),!0,!1),o=At("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),K$=({children:e})=>{const t=h.useContext(dx),n=Qn("itemDimensions"),s=Qn("viewportDimensions"),r=Go(h.useMemo(()=>o=>{s(o.getBoundingClientRect())},[s]),!0,!1);return h.useEffect(()=>{t&&(s({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,s,n]),c.jsx("div",{style:Nu(!1),ref:r,children:e})},Z$=({children:e})=>{const t=h.useContext(dx),n=Qn("windowViewportRect"),s=Qn("itemDimensions"),r=At("customScrollParent"),o=cx(n,r,!1);return h.useEffect(()=>{t&&(s({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,s]),c.jsx("div",{ref:o,style:Nu(!1),children:e})},Y$=h.memo(function({...t}){const n=At("useWindowScroll"),s=At("customScrollParent"),r=s||n?Q$:J$,o=s||n?Z$:K$;return c.jsx(r,{...t,children:c.jsxs(o,{children:[c.jsx(G$,{}),c.jsx(W$,{}),c.jsx(q$,{})]})})}),{Component:X$,usePublisher:Qn,useEmitterValue:At,useEmitter:vx}=zy(U$,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Y$),J$=hx({usePublisher:Qn,useEmitterValue:At,useEmitter:vx}),Q$=gx({usePublisher:Qn,useEmitterValue:At,useEmitter:vx});function u1(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Vn.WARN),t==="normal"?0:parseInt(t??"0",10)}const $u=X$,$h=e=>{const t="gs-utl-grid-cols-4",n=parseInt(`${e||4}`,10);return n===1?"gs-utl-grid-cols-1":n===2?"gs-utl-grid-cols-2":n===3?"gs-utl-grid-cols-3":n===4?t:n===5?"gs-utl-grid-cols-5":n===6?"gs-utl-grid-cols-6":n===7?"gs-utl-grid-cols-7":n===8?"gs-utl-grid-cols-8":n===9?"gs-utl-grid-cols-9":n===10?"gs-utl-grid-cols-10":n===11?"gs-utl-grid-cols-11":n===12?"gs-utl-grid-cols-12":t},ek=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function tk(e){const t=e.map(({id:i,src:a})=>({id:i,src:a})),n=e.reduce((i,a)=>(i[a.id]=a,i),{}),s=[],r=[];return(await uS(t)).forEach(i=>{i.status==="fulfilled"?s.push(n[i.value]):r.push(n[i.reason])}),{loaded:s,failed:r}}const nk=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{ek(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await tk(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},sk=(e,t,n,s={})=>{const{skipReplace:r}=s;e.loadData(t);const o=e.getCss()||"",i=r?o:o.replace(/:root\s*{/gi,"[data-body]{");let a=`${e.getHtml()}<style>${i}</style>`;if(n===jt.email)try{a=e.runCommand(Cu).html}catch(l){console.error(l)}return s.removeScripts&&(a=a.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),r?a:a.replace("<body","<div data-body").replace("</body>","</div>")},rk=async(e,t,n)=>{const s=Bw(t,{appStore:n}),r=await nk(s);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...r.plugins,o=>{o.Storage.setCurrent("")}],pluginsOpts:r.pluginOptions,protectedCss:`
303
+ `}),c.jsx(os,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:yN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(Lu,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:s})})),Km="gs-canvas-content",wN=g.memo(ue(function({children:t}){const{isReady:n}=Se(),s=L(`${Km}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,z.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Km,children:[c.jsx("div",{className:s}),!n&&c.jsx(Gr,{className:L("gs-utl-z-10"),abs:!0,full:!0}),n&&Nt(t)]}),c.jsx(vN,{}),c.jsx(xN,{})]})})),SN="gs-canvas",qy=g.memo(function({className:t,style:n,grow:s,children:r}){return c.jsx(rN,{style:n,className:L(SN,"gs-utl-relative",s&&"gs-utl-flex-grow",t),children:c.jsx(yl,{children:c.jsx(wN,{children:r})})})}),Og=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),CN=Og?Promise.resolve().then(function(){return _N}):Promise.resolve().then(function(){return kN});async function jN(...e){return(await CN).default(...e)}Og?Promise.resolve().then(function(){return MN}):Promise.resolve().then(function(){return IN});const EN=Og?Promise.resolve().then(function(){return NN}):Promise.resolve().then(function(){return HN});async function PN(...e){return(await EN).default(...e)}const TN=async e=>{const t=await e.getFile();return t.handle=e,t};var ON=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((r,o)=>{t[o]={description:r.description||"Files",accept:{}},r.mimeTypes?r.mimeTypes.map(i=>{t[o].accept[i]=r.extensions||[]}):t[o].accept["*/*"]=r.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),s=await Promise.all(n.map(TN));return e[0].multiple?s:s[0]},_N={__proto__:null,default:ON};function xc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var s=n.done;return Promise.resolve(n.value).then(function(r){return{value:r,done:s}})}return xc=function(n){this.s=n,this.n=n.next},xc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var s=this.s.return;return s===void 0?Promise.resolve({value:n,done:!0}):t(s.apply(this.s,arguments))},throw:function(n){var s=this.s.return;return s===void 0?Promise.reject(n):t(s.apply(this.s,arguments))}},new xc(e)}const Ky=async(e,t,n=e.name,s)=>{const r=[],o=[];var i,a=!1,l=!1;try{for(var u,d=function(p){var f,h,m,b=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,m=Symbol.iterator);b--;){if(h&&(f=p[h])!=null)return f.call(p);if(m&&(f=p[m])!=null)return new xc(f.call(p));h="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());a=!(u=await d.next()).done;a=!1){const p=u.value,f=`${n}/${p.name}`;p.kind==="file"?o.push(p.getFile().then(h=>(h.directoryHandle=e,h.handle=p,Object.defineProperty(h,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>f})))):p.kind!=="directory"||!t||s&&s(p)||r.push(Ky(p,t,f,s))}}catch(p){l=!0,i=p}finally{try{a&&d.return!=null&&await d.return()}finally{if(l)throw i}}return[...(await Promise.all(r)).flat(),...await Promise.all(o)]};var AN=async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:Ky(t,e.recursive,void 0,e.skipDirectory)},MN={__proto__:null,default:AN},LN=async(e,t=[{}],n=null,s=!1,r=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const o=[];let i=null;if(e instanceof Blob&&e.type?i=e.type:e.headers&&e.headers.get("content-type")&&(i=e.headers.get("content-type")),t.forEach((u,d)=>{o[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&i&&u.mimeTypes.push(i),u.mimeTypes.map(p=>{o[d].accept[p]=u.extensions||[]})):i?o[d].accept[i]=u.extensions||[]:o[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,s)throw u}const a=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:o,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&r&&r(a);const l=await a.createWritable();return"stream"in e?(await e.stream().pipeTo(l),a):"body"in e?(await e.body.pipeTo(l),a):(await l.write(await e),await l.close(),a)},NN={__proto__:null,default:LN},$N=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const s=document.createElement("input");s.type="file";const r=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();s.multiple=e[0].multiple||!1,s.accept=r||"",s.style.display="none",document.body.append(s);const o=l=>{typeof i=="function"&&i(),t(l)},i=e[0].legacySetup&&e[0].legacySetup(o,()=>i(n),s),a=()=>{window.removeEventListener("focus",a),s.remove()};s.addEventListener("click",()=>{window.addEventListener("focus",a)}),s.addEventListener("change",()=>{window.removeEventListener("focus",a),s.remove(),o(s.multiple?Array.from(s.files):s.files[0])}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),kN={__proto__:null,default:$N},RN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const s=document.createElement("input");s.type="file",s.webkitdirectory=!0;const r=i=>{typeof o=="function"&&o(),t(i)},o=e[0].legacySetup&&e[0].legacySetup(r,()=>o(n),s);s.addEventListener("change",()=>{let i=Array.from(s.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),r(i)}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),IN={__proto__:null,default:RN},VN=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let s=e;"body"in e&&(s=await async function(i,a){const l=i.getReader(),u=new ReadableStream({start:f=>async function h(){return l.read().then(({done:m,value:b})=>{if(!m)return f.enqueue(b),h();f.close()})}()}),d=new Response(u),p=await d.blob();return l.releaseLock(),new Blob([p],{type:a})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await s);const r=()=>{typeof o=="function"&&o()},o=t.legacySetup&&t.legacySetup(r,()=>o(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),r()}),n.click(),null},HN={__proto__:null,default:VN};function Ur({children:e,label:t,s:n="m",pill:s,border:r,nopad:o,className:i,block:a,...l}){return c.jsx("div",{className:L(!a&&"gs-utl-inline-block",i,!o&&Pe.xyS2,s?se.pill:se.rnd,r&&`${se.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Zm={NODE_ENV:"production"};const DN=Zm.REACT_APP_VERSION??Zm.NPM_PACKAGE_VERSION,FN=ue(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsxs(D,{className:le("relative"),children:[c.jsx(Lu,{className:le("w-24 opacity-50")}),t&&c.jsx(Ur,{className:le(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(D,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:le(Wr.link),href:"https://grapesjs.com",children:"GrapesJS"})," ","library. Beyond pushing the evolution of the core library itself, this application aspires to empower individuals in creating and managing their web projects autonomously, free from subscriptions or dependency on the internet connection."]}),c.jsx("br",{}),c.jsxs("p",{children:["If you like the vision of this project and you're eager to play a role in its continued development, consider becoming a backer or sponsor through"," ",c.jsx("a",{className:le(Wr.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(D,{className:le(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",DN]})]})}),BN=ue(function(){return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsx(D,{className:J("relative"),children:c.jsx(Lu,{className:J("w-24 opacity-50")})})}),c.jsx(D,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:J(Wr.link),href:"/dashboard/sdk/licenses",target:"_blank",children:"Studio SDK license page"}),c.jsx("br",{}),c.jsx("br",{}),"If you have any questions or need assistance with specific use cases, please fill out this"," ",c.jsx("a",{className:J(Wr.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),zN=()=>[{id:Et.web,label:Ds(Et.web),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.web,size:oe.s}),c.jsx("span",{children:Ds(Et.web)})]})},{id:Et.email,label:Ds(Et.email),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.emailOutline,size:oe.s}),c.jsx("span",{children:Ds(Et.email)})]})}],Ul="gs-cmp-tabs";function lo({tabs:e,className:t,classNamePanel:n,classNameTab:s,variant:r,style:o,onChange:i=$S,value:a}){const l=r==="pills",u=l?L("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=b=>l?L("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",b?z.bg:""):L("gs-utl-border-b-2",Pe.xy),p=b=>{b&&(b.tabIndex=-1)},f=b=>{const v=b.currentTarget;setTimeout(()=>v.blur(),10)},h=Dt(a)?e.findIndex(b=>b.id===a):void 0,m=!e.some(b=>!!b.content);return c.jsxs(qi.Group,{onChange:b=>i(e[b].id),defaultIndex:e.findIndex(b=>b.id===a),selectedIndex:h,children:[c.jsx(qi.List,{as:k,className:L(Ul,t,u),style:o,full:!0,nowrap:!0,children:e.map(b=>c.jsx(qi,{disabled:b.disabled,className:({selected:v})=>L(`${Ul}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",b.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",Ta.focus,d(v),v?`${z.tAo} ${z.bA}`:z.br,s),children:b.label},b.id))}),c.jsx(qi.Panels,{className:L(`${Ul}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(b=>c.jsx(qi.Panel,{tabIndex:-1,className:L(`${Ul}__panel`,"gs-utl-h-full"),ref:p,onFocus:f,children:b.content},b.id))})]})}const Nu=0,co=1,Vi=2,Zy=4;function Yy(e,t){return n=>e(t(n))}function UN(e,t){return t(e)}function Xy(e,t){return n=>e(t,n)}function Ym(e,t){return()=>e(t)}function $u(e,t){return t(e),e}function Ot(...e){return e}function WN(e){e()}function Xm(e){return()=>e}function GN(...e){return()=>{e.map(WN)}}function _g(e){return e!==void 0}function Hi(){}function ct(e,t){return e(co,t)}function Ve(e,t){e(Nu,t)}function Ag(e){e(Vi)}function sn(e){return e(Zy)}function Ce(e,t){return ct(e,Xy(t,Nu))}function Ys(e,t){const n=e(co,s=>{n(),t(s)});return n}function Ze(){const e=[];return(t,n)=>{switch(t){case Vi:e.splice(0,e.length);return;case co:return e.push(n),()=>{const s=e.indexOf(n);s>-1&&e.splice(s,1)};case Nu:e.slice().forEach(s=>{s(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function fe(e){let t=e;const n=Ze();return(s,r)=>{switch(s){case co:r(t);break;case Nu:t=r;break;case Zy:return t}return n(s,r)}}function qN(e){let t,n;const s=()=>t&&t();return function(r,o){switch(r){case co:return o?n===o?void 0:(s(),n=o,t=ct(e,o),t):(s(),Hi);case Vi:s(),n=null;return;default:throw new Error(`unrecognized action ${r}`)}}}function Vn(e){return $u(Ze(),t=>Ce(e,t))}function pn(e,t){return $u(fe(t),n=>Ce(e,n))}function KN(...e){return t=>e.reduceRight(UN,t)}function ce(e,...t){const n=KN(...t);return(s,r)=>{switch(s){case co:return ct(e,n(r));case Vi:Ag(e);return}}}function Jy(e,t){return e===t}function Pt(e=Jy){let t;return n=>s=>{e(t,s)||(t=s,n(s))}}function Oe(e){return t=>n=>{e(n)&&t(n)}}function be(e){return t=>Yy(t,e)}function Rs(e){return t=>()=>t(e)}function Bs(e,t){return n=>s=>n(t=e(t,s))}function Oi(e){return t=>n=>{e>0?e--:t(n)}}function Hr(e){let t=null,n;return s=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,s(t)},e))}}function Jm(e){let t,n;return s=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{s(t)},e)}}function Fe(...e){const t=new Array(e.length);let n=0,s=null;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);ct(o,l=>{const u=n;n=n|a,t[i]=l,u!==r&&n===r&&s&&(s(),s=null)})}),o=>i=>{const a=()=>o([i].concat(t));n===r?a():s=a}}function Qm(...e){return function(t,n){switch(t){case co:return GN(...e.map(s=>ct(s,n)));case Vi:return;default:throw new Error(`unrecognized action ${t}`)}}}function Te(e,t=Jy){return ce(e,Pt(t))}function Gt(...e){const t=Ze(),n=new Array(e.length);let s=0;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);ct(o,l=>{n[i]=l,s=s|a,s===r&&Ve(t,n)})}),function(o,i){switch(o){case co:return s===r&&i(n),ct(t,i);case Vi:return Ag(t);default:throw new Error(`unrecognized action ${o}`)}}}function ut(e,t=[],{singleton:n}={singleton:!0}){return{id:ZN(),constructor:e,dependencies:t,singleton:n}}const ZN=()=>Symbol();function YN(e){const t=new Map,n=({id:s,constructor:r,dependencies:o,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function XN(e,t){const n={},s={};let r=0;const o=e.length;for(;r<o;)s[e[r]]=1,r+=1;for(const i in t)s.hasOwnProperty(i)||(n[i]=t[i]);return n}const Wl=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Qy(e,t,n){const s=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=g.createContext({});function l(x,y){x.propsReady&&Ve(x.propsReady,!1);for(const w of s){const S=x[t.required[w]];Ve(S,y[w])}for(const w of r)if(w in y){const S=x[t.optional[w]];Ve(S,y[w])}x.propsReady&&Ve(x.propsReady,!0)}function u(x){return o.reduce((y,w)=>(y[w]=S=>{const j=x[t.methods[w]];Ve(j,S)},y),{})}function d(x){return i.reduce((y,w)=>(y[w]=qN(x[t.events[w]]),y),{})}const p=g.forwardRef((x,y)=>{const{children:w,...S}=x,[j]=g.useState(()=>$u(YN(e),O=>l(O,S))),[C]=g.useState(Ym(d,j));Wl(()=>{for(const O of i)O in S&&ct(C[O],S[O]);return()=>{Object.values(C).map(Ag)}},[S,C,j]),Wl(()=>{l(j,S)}),g.useImperativeHandle(y,Xm(u(j)));const E=n;return c.jsx(a.Provider,{value:j,children:n?c.jsx(E,{...XN([...s,...r,...i],S),children:w}):w})}),f=x=>g.useCallback(Xy(Ve,g.useContext(a)[x]),[x]),h=x=>{const w=g.useContext(a)[x],S=g.useCallback(j=>ct(w,j),[w]);return g.useSyncExternalStore(S,()=>sn(w),()=>sn(w))},m=x=>{const w=g.useContext(a)[x],[S,j]=g.useState(Ym(sn,w));return Wl(()=>ct(w,C=>{C!==S&&j(Xm(C))}),[w,S]),S},b=g.version.startsWith("18")?h:m;return{Component:p,usePublisher:f,useEmitterValue:b,useEmitter:(x,y)=>{const S=g.useContext(a)[x];Wl(()=>ct(S,y),[y,S])}}}const ex=typeof document<"u"?g.useLayoutEffect:g.useEffect;var Hn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Hn||{});const JN={0:"debug",1:"log",2:"warn",3:"error"},QN=()=>typeof globalThis>"u"?window:globalThis,uo=ut(()=>{const e=fe(3);return{log:fe((n,s,r=1)=>{var o;const i=(o=QN().VIRTUOSO_LOG_LEVEL)!=null?o:sn(e);r>=i&&console[JN[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,s)}),logLevel:e}},[],{singleton:!0});function Mg(e,t,n){const s=g.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=g.useMemo(()=>new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}),[e]);r=i=>{i&&t?(o.observe(i),s.current=i):(s.current&&o.unobserve(s.current),s.current=null)}}return{ref:s,callbackRef:r}}function qo(e,t,n){return Mg(e,t,n).callbackRef}function e$(e,t,n,s,r,o,i,a,l){const u=g.useCallback(d=>{const p=t$(d.children,t,a?"offsetWidth":"offsetHeight",r);let f=d.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const h=f.lastElementChild.dataset.viewportType==="window",m=i?a?i.scrollLeft:i.scrollTop:h?a?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:a?f.scrollLeft:f.scrollTop,b=i?a?i.scrollWidth:i.scrollHeight:h?a?document.documentElement.scrollWidth:document.documentElement.scrollHeight:a?f.scrollWidth:f.scrollHeight,v=i?a?i.offsetWidth:i.offsetHeight:h?a?window.innerWidth:window.innerHeight:a?f.offsetWidth:f.offsetHeight;s({scrollTop:Math.max(m,0),scrollHeight:b,viewportHeight:v}),o==null||o(a?e1("column-gap",getComputedStyle(d).columnGap,r):e1("row-gap",getComputedStyle(d).rowGap,r)),p!==null&&e(p)},[e,t,r,o,i,s]);return Mg(u,n,l)}function t$(e,t,n,s){const r=e.length;if(r===0)return null;const o=[];for(let i=0;i<r;i++){const a=e.item(i);if(!a||a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),u=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&s("Zero-sized element, this should not happen",{child:a},Hn.ERROR),d===u)continue;const p=o[o.length-1];o.length===0||p.size!==d||p.endIndex!==l-1?o.push({startIndex:l,endIndex:l,size:d}):o[o.length-1].endIndex++}return o}function e1(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Hn.WARN),t==="normal"?0:parseInt(t??"0",10)}function Xr(e,t){return Math.round(e.getBoundingClientRect()[t])}function tx(e,t){return Math.abs(e-t)<1.01}function nx(e,t,n,s=Hi,r,o){const i=g.useRef(null),a=g.useRef(null),l=g.useRef(null),u=g.useCallback(f=>{const h=f.target,m=h===window||h===document,b=o?m?window.pageXOffset||document.documentElement.scrollLeft:h.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:h.scrollTop,v=o?m?document.documentElement.scrollWidth:h.scrollWidth:m?document.documentElement.scrollHeight:h.scrollHeight,x=o?m?window.innerWidth:h.offsetWidth:m?window.innerHeight:h.offsetHeight,y=()=>{e({scrollTop:Math.max(b,0),scrollHeight:v,viewportHeight:x})};f.suppressFlushSync?y():kn.flushSync(y),a.current!==null&&(b===a.current||b<=0||b===v-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);g.useEffect(()=>{const f=r||i.current;return s(r||i.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{s(null),f.removeEventListener("scroll",u)}},[i,u,n,s,r]);function d(f){const h=i.current;if(!h||(o?"offsetWidth"in h&&h.offsetWidth===0:"offsetHeight"in h&&h.offsetHeight===0))return;const m=f.behavior==="smooth";let b,v,x;h===window?(v=Math.max(Xr(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),b=o?window.innerWidth:window.innerHeight,x=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(v=h[o?"scrollWidth":"scrollHeight"],b=Xr(h,o?"width":"height"),x=h[o?"scrollLeft":"scrollTop"]);const y=v-b;if(f.top=Math.ceil(Math.max(Math.min(y,f.top),0)),tx(b,v)||f.top===x){e({scrollTop:x,scrollHeight:v,viewportHeight:b}),m&&t(!0);return}m?(a.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,o&&(f={left:f.top,behavior:f.behavior}),h.scrollTo(f)}function p(f){o&&(f={left:f.top,behavior:f.behavior}),i.current.scrollBy(f)}return{scrollerRef:i,scrollByCallback:p,scrollToCallback:d}}const hn=ut(()=>{const e=Ze(),t=Ze(),n=fe(0),s=Ze(),r=fe(0),o=Ze(),i=Ze(),a=fe(0),l=fe(0),u=fe(0),d=fe(0),p=Ze(),f=Ze(),h=fe(!1),m=fe(!1),b=fe(!1);return Ce(ce(e,be(({scrollTop:v})=>v)),t),Ce(ce(e,be(({scrollHeight:v})=>v)),i),Ce(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:a,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:i,smoothScrollTargetReached:s,horizontalDirection:m,skipAnimationFrameInResizeObserver:b,scrollTo:p,scrollBy:f,statefulScrollTop:r,deviation:n,scrollingInProgress:h}},[],{singleton:!0}),ka={lvl:0};function sx(e,t,n,s=ka,r=ka){return{k:e,v:t,lvl:n,l:s,r}}function bt(e){return e===ka}function bi(){return ka}function Zp(e,t){if(bt(e))return ka;const{k:n,l:s,r}=e;if(t===n){if(bt(s))return r;if(bt(r))return s;{const[o,i]=rx(s);return wc(Vt(e,{k:o,v:i,l:ox(s)}))}}else return t<n?wc(Vt(e,{l:Zp(s,t)})):wc(Vt(e,{r:Zp(r,t)}))}function Ra(e,t){if(!bt(e))return t===e.k?e.v:t<e.k?Ra(e.l,t):Ra(e.r,t)}function js(e,t,n="k"){if(bt(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const s=js(e.r,t,n);return s[0]===-1/0?[e.k,e.v]:s}return js(e.l,t,n)}function $n(e,t,n){return bt(e)?sx(t,n,1):t===e.k?Vt(e,{k:t,v:n}):t<e.k?t1(Vt(e,{l:$n(e.l,t,n)})):t1(Vt(e,{r:$n(e.r,t,n)}))}function Yp(e,t,n){if(bt(e))return[];const{k:s,v:r,l:o,r:i}=e;let a=[];return s>t&&(a=a.concat(Yp(o,t,n))),s>=t&&s<=n&&a.push({k:s,v:r}),s<=n&&(a=a.concat(Yp(i,t,n))),a}function So(e){return bt(e)?[]:[...So(e.l),{k:e.k,v:e.v},...So(e.r)]}function rx(e){return bt(e.r)?[e.k,e.v]:rx(e.r)}function ox(e){return bt(e.r)?e.l:wc(Vt(e,{r:ox(e.r)}))}function Vt(e,t){return sx(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Rd(e){return bt(e)||e.lvl>e.r.lvl}function t1(e){return Xp(ax(e))}function wc(e){const{l:t,r:n,lvl:s}=e;if(n.lvl>=s-1&&t.lvl>=s-1)return e;if(s>n.lvl+1){if(Rd(t))return ax(Vt(e,{lvl:s-1}));if(!bt(t)&&!bt(t.r))return Vt(t.r,{l:Vt(t,{r:t.r.l}),r:Vt(e,{l:t.r.r,lvl:s-1}),lvl:s});throw new Error("Unexpected empty nodes")}else{if(Rd(e))return Xp(Vt(e,{lvl:s-1}));if(!bt(n)&&!bt(n.l)){const r=n.l,o=Rd(r)?n.lvl-1:n.lvl;return Vt(r,{l:Vt(e,{r:r.l,lvl:s-1}),r:Xp(Vt(n,{l:r.r,lvl:o})),lvl:r.lvl+1})}else throw new Error("Unexpected empty nodes")}}function ku(e,t,n){if(bt(e))return[];const s=js(e,t)[0];return n$(Yp(e,s,n))}function ix(e,t){const n=e.length;if(n===0)return[];let{index:s,value:r}=t(e[0]);const o=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);o.push({start:s,end:a-1,value:r}),s=a,r=l}return o.push({start:s,end:1/0,value:r}),o}function n$(e){return ix(e,({k:t,v:n})=>({index:t,value:n}))}function Xp(e){const{r:t,lvl:n}=e;return!bt(t)&&!bt(t.r)&&t.lvl===n&&t.r.lvl===n?Vt(t,{l:Vt(e,{r:t.l}),lvl:n+1}):e}function ax(e){const{l:t}=e;return!bt(t)&&t.lvl===e.lvl?Vt(t,{r:Vt(e,{l:t.r})}):e}function zc(e,t,n,s=0){let r=e.length-1;for(;s<=r;){const o=Math.floor((s+r)/2),i=e[o],a=n(i,t);if(a===0)return o;if(a===-1){if(r-s<2)return o-1;r=o-1}else{if(r===s)return o;s=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function lx(e,t,n){return e[zc(e,t,n)]}function s$(e,t,n,s){const r=zc(e,t,s),o=zc(e,n,s,r);return e.slice(r,o+1)}const Lg=ut(()=>({recalcInProgress:fe(!1)}),[],{singleton:!0});function r$(e){const{size:t,startIndex:n,endIndex:s}=e;return r=>r.start===n&&(r.end===s||r.end===1/0)&&r.value===t}function n1(e,t){let n=0,s=0;for(;n<e;)n+=t[s+1]-t[s]-1,s++;return s-(n===e?0:1)}function o$(e,t){let n=bt(e)?0:1/0;for(const s of t){const{size:r,startIndex:o,endIndex:i}=s;if(n=Math.min(n,o),bt(e)){e=$n(e,0,r);continue}const a=ku(e,o-1,i+1);if(a.some(r$(s)))continue;let l=!1,u=!1;for(const{start:d,end:p,value:f}of a)l?(i>=d||r===f)&&(e=Zp(e,d)):(u=f!==r,l=!0),p>i&&i>=d&&f!==r&&(e=$n(e,i+1,f));u&&(e=$n(e,o,r))}return[e,n]}function i$(){return{offsetTree:[],sizeTree:bi(),groupOffsetTree:bi(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function Ng({index:e},t){return t===e?0:t<e?-1:1}function a$({offset:e},t){return t===e?0:t<e?-1:1}function l$(e){return{index:e.index,value:e}}function c$(e,t,n,s=0){return s>0&&(t=Math.max(t,lx(e,s,Ng).offset)),ix(s$(e,t,n,a$),l$)}function Jp(e,t,n,s){let r=e,o=0,i=0,a=0,l=0;if(t!==0){l=zc(r,t-1,Ng),a=r[l].offset;const d=js(n,t-1);o=d[0],i=d[1],r.length&&r[l].size===js(n,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:u,value:d}of ku(n,t,1/0)){const p=u-o,f=p*i+a+p*s;r.push({offset:f,size:d,index:u}),o=u,a=f,i=d}return{offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function u$(e,[t,n,s,r]){t.length>0&&s("received item sizes",t,Hn.DEBUG);const o=e.sizeTree;let i=o,a=0;if(n.length>0&&bt(o)&&t.length===2){const f=t[0].size,h=t[1].size;i=n.reduce((m,b)=>$n($n(m,b,f),b+1,h),i)}else[i,a]=o$(i,t);if(i===o)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:p}=Jp(e.offsetTree,a,i,r);return{sizeTree:i,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:d,groupOffsetTree:n.reduce((f,h)=>$n(f,h,Ia(h,l,r)),bi()),groupIndices:n}}function Ia(e,t,n){if(t.length===0)return 0;const{offset:s,index:r,size:o}=lx(t,e,Ng),i=e-r,a=o*i+(i-1)*n+s;return a>0?a+n:a}function d$(e){return typeof e.groupIndex<"u"}function cx(e,t,n){if(d$(e))return t.groupIndices[e.groupIndex]+1;{const s=e.index==="LAST"?n:e.index;let r=ux(s,t);return r=Math.max(0,r,Math.min(n,r)),r}}function ux(e,t){if(!Ru(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Ru(e){return!bt(e.groupOffsetTree)}function p$(e){return So(e).map(({k:t,v:n},s,r)=>{const o=r[s+1],i=o?o.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const f$={offsetHeight:"height",offsetWidth:"width"},er=ut(([{log:e},{recalcInProgress:t}])=>{const n=Ze(),s=Ze(),r=pn(s,0),o=Ze(),i=Ze(),a=fe(0),l=fe([]),u=fe(void 0),d=fe(void 0),p=fe((j,C)=>Xr(j,f$[C])),f=fe(void 0),h=fe(0),m=i$(),b=pn(ce(n,Fe(l,e,h),Bs(u$,m),Pt()),m),v=pn(ce(l,Pt(),Bs((j,C)=>({prev:j.current,current:C}),{prev:[],current:[]}),be(({prev:j})=>j)),[]);Ce(ce(l,Oe(j=>j.length>0),Fe(b,h),be(([j,C,E])=>{const O=j.reduce((P,T,A)=>$n(P,T,Ia(T,C.offsetTree,E)||A),bi());return{...C,groupIndices:j,groupOffsetTree:O}})),b),Ce(ce(s,Fe(b),Oe(([j,{lastIndex:C}])=>j<C),be(([j,{lastIndex:C,lastSize:E}])=>[{startIndex:j,endIndex:C,size:E}])),n),Ce(u,d);const x=pn(ce(u,be(j=>j===void 0)),!0);Ce(ce(d,Oe(j=>j!==void 0&&bt(sn(b).sizeTree)),be(j=>[{startIndex:0,endIndex:0,size:j}])),n);const y=Vn(ce(n,Fe(b),Bs(({sizes:j},[C,E])=>({changed:E!==j,sizes:E}),{changed:!1,sizes:m}),be(j=>j.changed)));ct(ce(a,Bs((j,C)=>({diff:j.prev-C,prev:C}),{diff:0,prev:0}),be(j=>j.diff)),j=>{const{groupIndices:C}=sn(b);if(j>0)Ve(t,!0),Ve(o,j+n1(j,C));else if(j<0){const E=sn(v);E.length>0&&(j-=n1(-j,E)),Ve(i,j)}}),ct(ce(a,Fe(e)),([j,C])=>{j<0&&C("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Hn.ERROR)});const w=Vn(o);Ce(ce(o,Fe(b),be(([j,C])=>{const E=C.groupIndices.length>0,O=[],P=C.lastSize;if(E){const T=Ra(C.sizeTree,0);let A=0,_=0;for(;A<j;){const M=C.groupIndices[_],I=C.groupIndices.length===_+1?1/0:C.groupIndices[_+1]-M-1;O.push({startIndex:M,endIndex:M,size:T}),O.push({startIndex:M+1,endIndex:M+1+I-1,size:P}),_++,A+=I+1}const N=So(C.sizeTree);return A!==j&&N.shift(),N.reduce((M,{k:I,v:U})=>{let F=M.ranges;return M.prevSize!==0&&(F=[...M.ranges,{startIndex:M.prevIndex,endIndex:I+j-1,size:M.prevSize}]),{ranges:F,prevIndex:I+j,prevSize:U}},{ranges:O,prevIndex:j,prevSize:0}).ranges}return So(C.sizeTree).reduce((T,{k:A,v:_})=>({ranges:[...T.ranges,{startIndex:T.prevIndex,endIndex:A+j-1,size:T.prevSize}],prevIndex:A+j,prevSize:_}),{ranges:[],prevIndex:0,prevSize:P}).ranges})),n);const S=Vn(ce(i,Fe(b,h),be(([j,{offsetTree:C},E])=>{const O=-j;return Ia(O,C,E)})));return Ce(ce(i,Fe(b,h),be(([j,C,E])=>{if(C.groupIndices.length>0){if(bt(C.sizeTree))return C;let P=bi();const T=sn(v);let A=0,_=0,N=0;for(;A<-j;){N=T[_];const M=T[_+1]-N-1;_++,A+=M+1}if(P=So(C.sizeTree).reduce((M,{k:I,v:U})=>$n(M,Math.max(0,I+j),U),P),A!==-j){const M=Ra(C.sizeTree,N);P=$n(P,0,M);const I=js(C.sizeTree,-j+1)[1];P=$n(P,1,I)}return{...C,sizeTree:P,...Jp(C.offsetTree,0,P,E)}}else{const P=So(C.sizeTree).reduce((T,{k:A,v:_})=>$n(T,Math.max(0,A+j),_),bi());return{...C,sizeTree:P,...Jp(C.offsetTree,0,P,E)}}})),b),{data:f,totalCount:s,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:o,shiftWith:i,shiftWithOffset:S,beforeUnshiftWith:w,firstItemIndex:a,gap:h,sizes:b,listRefresh:y,statefulTotalCount:r,trackItemSizes:x,itemSize:p}},Ot(uo,Lg),{singleton:!0}),g$=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function dx(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!g$)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const xl=ut(([{sizes:e,totalCount:t,listRefresh:n,gap:s},{scrollingInProgress:r,viewportHeight:o,scrollTo:i,smoothScrollTargetReached:a,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p},{log:f}])=>{const h=Ze(),m=Ze(),b=fe(0);let v=null,x=null,y=null;function w(){v&&(v(),v=null),y&&(y(),y=null),x&&(clearTimeout(x),x=null),Ve(r,!1)}return Ce(ce(h,Fe(e,o,t,b,l,u,f),Fe(s,d,p),be(([[S,j,C,E,O,P,T,A],_,N,V])=>{const M=dx(S),{align:I,behavior:U,offset:F}=M,W=E-1,H=cx(M,j,W);let R=Ia(H,j.offsetTree,_)+P;I==="end"?(R+=N+js(j.sizeTree,H)[1]-C+V,H===W&&(R+=T)):I==="center"?R+=(N+js(j.sizeTree,H)[1]-C+V)/2:R-=O,F&&(R+=F);const $=B=>{w(),B?(A("retrying to scroll to",{location:S},Hn.DEBUG),Ve(h,S)):(Ve(m,!0),A("list did not change, scroll successful",{},Hn.DEBUG))};if(w(),U==="smooth"){let B=!1;y=ct(n,Z=>{B=B||Z}),v=Ys(a,()=>{$(B)})}else v=Ys(ce(n,h$(150)),$);return x=setTimeout(()=>{w()},1200),Ve(r,!0),A("scrolling from index to",{index:H,top:R,behavior:U},Hn.DEBUG),{top:R,behavior:U}})),i),{scrollToIndex:h,scrollTargetReached:m,topListHeight:b}},Ot(er,hn,uo),{singleton:!0});function h$(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return s=>{s&&(t(!0),clearTimeout(n))}}}const Va="up",fa="down",m$="none",b$={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},v$=0,wl=ut(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:s,footerHeight:r,scrollBy:o}])=>{const i=fe(!1),a=fe(!0),l=Ze(),u=Ze(),d=fe(4),p=fe(v$),f=pn(ce(Qm(ce(Te(t),Oi(1),Rs(!0)),ce(Te(t),Oi(1),Rs(!1),Jm(100))),Pt()),!1),h=pn(ce(Qm(ce(o,Rs(!0)),ce(o,Rs(!1),Jm(200))),Pt()),!1);Ce(ce(Gt(Te(t),Te(p)),be(([y,w])=>y<=w),Pt()),a),Ce(ce(a,Hr(50)),u);const m=Vn(ce(Gt(e,Te(n),Te(s),Te(r),Te(d)),Bs((y,[{scrollTop:w,scrollHeight:S},j,C,E,O])=>{const P=w+j-S>-O,T={viewportHeight:j,scrollTop:w,scrollHeight:S};if(P){let _,N;return w>y.state.scrollTop?(_="SCROLLED_DOWN",N=y.state.scrollTop-w):(_="SIZE_DECREASED",N=y.state.scrollTop-w||y.scrollTopDelta),{atBottom:!0,state:T,atBottomBecause:_,scrollTopDelta:N}}let A;return T.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":j<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":w<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:T}},b$),Pt((y,w)=>y&&y.atBottom===w.atBottom))),b=pn(ce(e,Bs((y,{scrollTop:w,scrollHeight:S,viewportHeight:j})=>{if(tx(y.scrollHeight,S))return{scrollTop:w,scrollHeight:S,jump:0,changed:!1};{const C=S-(w+j)<1;return y.scrollTop!==w&&C?{scrollHeight:S,scrollTop:w,jump:y.scrollTop-w,changed:!0}:{scrollHeight:S,scrollTop:w,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Oe(y=>y.changed),be(y=>y.jump)),0);Ce(ce(m,be(y=>y.atBottom)),i),Ce(ce(i,Hr(50)),l);const v=fe(fa);Ce(ce(e,be(({scrollTop:y})=>y),Pt(),Bs((y,w)=>sn(h)?{direction:y.direction,prevScrollTop:w}:{direction:w<y.prevScrollTop?Va:fa,prevScrollTop:w},{direction:fa,prevScrollTop:0}),be(y=>y.direction)),v),Ce(ce(e,Hr(50),Rs(m$)),v);const x=fe(0);return Ce(ce(f,Oe(y=>!y),Rs(0)),x),Ce(ce(t,Hr(100),Fe(f),Oe(([y,w])=>!!w),Bs(([y,w],[S])=>[w,S],[0,0]),be(([y,w])=>w-y)),x),{isScrolling:f,isAtTop:a,isAtBottom:i,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:v,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:x,lastJumpDueToItemResize:b}},Ot(hn)),po=ut(([{log:e}])=>{const t=fe(!1),n=Vn(ce(t,Oe(s=>s),Pt()));return ct(t,s=>{s&&sn(e)("props updated",{},Hn.DEBUG)}),{propsReady:t,didMount:n}},Ot(uo),{singleton:!0});function $g(e,t){e==0?t():requestAnimationFrame(()=>$g(e-1,t))}function kg(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Sl=ut(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:s},{scrollToIndex:r,scrollTargetReached:o},{didMount:i}])=>{const a=fe(!0),l=fe(0),u=fe(!0);return Ce(ce(i,Fe(l),Oe(([d,p])=>!!p),Rs(!1)),a),Ce(ce(i,Fe(l),Oe(([d,p])=>!!p),Rs(!1)),u),ct(ce(Gt(t,i),Fe(a,e,n,u),Oe(([[,d],p,{sizeTree:f},h,m])=>d&&(!bt(f)||_g(h))&&!p&&!m),Fe(l)),([,d])=>{Ys(o,()=>{Ve(u,!0)}),$g(4,()=>{Ys(s,()=>{Ve(a,!0)}),Ve(r,d)})}),{scrolledToInitialItem:a,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Ot(er,hn,xl,po),{singleton:!0});function s1(e){return e?e==="smooth"?"smooth":"auto":!1}const y$=(e,t)=>typeof e=="function"?s1(e(t)):t&&s1(e),x$=ut(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:s},{scrollToIndex:r},{scrolledToInitialItem:o},{propsReady:i,didMount:a},{log:l},{scrollingInProgress:u}])=>{const d=fe(!1),p=Ze();let f=null;function h(b){Ve(r,{index:"LAST",align:"end",behavior:b})}ct(ce(Gt(ce(Te(e),Oi(1)),a),Fe(Te(d),n,o,u),be(([[b,v],x,y,w,S])=>{let j=v&&w,C="auto";return j&&(C=y$(x,y||S),j=j&&!!C),{totalCount:b,shouldFollow:j,followOutputBehavior:C}}),Oe(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:v})=>{f&&(f(),f=null),f=Ys(t,()=>{sn(l)("following output to ",{totalCount:b},Hn.DEBUG),h(v),f=null})});function m(b){const v=Ys(s,x=>{b&&!x.atBottom&&x.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(sn(l)("scrolling to bottom due to increased size",{},Hn.DEBUG),h("auto"))});setTimeout(v,100)}return ct(ce(Gt(Te(d),e,i),Oe(([b,,v])=>b&&v),Bs(({value:b},[,v])=>({refreshed:b===v,value:v}),{refreshed:!1,value:0}),Oe(({refreshed:b})=>b),Fe(d,e)),([,b])=>{sn(o)&&m(b!==!1)}),ct(p,()=>{m(sn(d)!==!1)}),ct(Gt(Te(d),s),([b,v])=>{b&&!v.atBottom&&v.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")}),{followOutput:d,autoscrollToBottom:p}},Ot(er,wl,xl,Sl,po,uo,hn));function w$(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const px=ut(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:s,headerHeight:r}])=>{const o=Ze(),i=Ze(),a=Vn(ce(o,be(w$)));return Ce(ce(a,be(l=>l.totalCount)),e),Ce(ce(a,be(l=>l.groupIndices)),t),Ce(ce(Gt(s,n,r),Oe(([l,u])=>Ru(u)),be(([l,u,d])=>js(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Pt(),be(l=>[l])),i),{groupCounts:o,topItemsIndexes:i}},Ot(er,hn));function Ha(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function fx(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Uc="top",Wc="bottom",r1="none";function o1(e,t,n){return typeof e=="number"?n===Va&&t===Uc||n===fa&&t===Wc?e:0:n===Va?t===Uc?e.main:e.reverse:t===Wc?e.main:e.reverse}function i1(e,t){return typeof e=="number"?e:e[t]||0}const Rg=ut(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:s,fixedHeaderHeight:r}])=>{const o=Ze(),i=fe(0),a=fe(0),l=fe(0),u=pn(ce(Gt(Te(e),Te(t),Te(s),Te(o,Ha),Te(l),Te(i),Te(r),Te(n),Te(a)),be(([d,p,f,[h,m],b,v,x,y,w])=>{const S=d-y,j=v+x,C=Math.max(f-S,0);let E=r1;const O=i1(w,Uc),P=i1(w,Wc);return h-=y,h+=f+x,m+=f+x,m-=y,h>d+j-O&&(E=Va),m<d-C+p+P&&(E=fa),E!==r1?[Math.max(S-f-o1(b,Uc,E)-O,0),S-C-x+p+o1(b,Wc,E)+P]:null}),Oe(d=>d!=null),Pt(Ha)),[0,0]);return{listBoundary:o,overscan:l,topListHeight:i,increaseViewportBy:a,visibleRange:u}},Ot(hn),{singleton:!0});function S$(e,t,n){if(Ru(t)){const s=ux(e,t);return[{index:js(t.groupOffsetTree,s)[0],size:0,offset:0},{index:s,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Id={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function a1(e,t,n){if(e.length===0)return[];if(!Ru(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const s=e[0].index,r=e[e.length-1].index,o=[],i=ku(t.groupOffsetTree,s,r);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;u.index===a.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},o.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return o}function Sc(e,t,n,s,r,o){const{lastSize:i,lastOffset:a,lastIndex:l}=r;let u=0,d=0;if(e.length>0){u=e[0].offset;const b=e[e.length-1];d=b.offset+b.size}const p=n-l,f=a+p*i+(p-1)*s,h=u,m=f-d;return{items:a1(e,r,o),topItems:a1(t,r,o),topListHeight:t.reduce((b,v)=>v.size+b,0),offsetTop:u,offsetBottom:m,top:h,bottom:d,totalCount:n,firstItemIndex:o}}function gx(e,t,n,s,r,o){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=kg(t,a),u=Array.from({length:a}).map((d,p)=>({index:p+l,size:0,offset:0,data:o[p+l]}));return Sc(u,[],a,r,n,s)}const Ko=ut(([{sizes:e,totalCount:t,data:n,firstItemIndex:s,gap:r},o,{visibleRange:i,listBoundary:a,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:p},f,{didMount:h},{recalcInProgress:m}])=>{const b=fe([]),v=fe(0),x=Ze();Ce(o.topItemsIndexes,b);const y=pn(ce(Gt(h,m,Te(i,Ha),Te(t),Te(e),Te(d),u,Te(b),Te(s),Te(r),n),Oe(([C,E,,O,,,,,,,P])=>{const T=P&&P.length!==O;return C&&!E&&!T}),be(([,,[C,E],O,P,T,A,_,N,V,M])=>{const I=P,{sizeTree:U,offsetTree:F}=I,W=sn(v);if(O===0)return{...Id,totalCount:O};if(C===0&&E===0)return W===0?{...Id,totalCount:O}:gx(W,T,P,N,V,M||[]);if(bt(U))return W>0?null:Sc(S$(kg(T,O),I,M),[],O,V,I,N);const H=[];if(_.length>0){const Y=_[0],ee=_[_.length-1];let X=0;for(const G of ku(U,Y,ee)){const Q=G.value,ie=Math.max(G.start,Y),ae=Math.min(G.end,ee);for(let me=ie;me<=ae;me++)H.push({index:me,size:Q,offset:X,data:M&&M[me]}),X+=Q}}if(!A)return Sc([],H,O,V,I,N);const R=_.length>0?_[_.length-1]+1:0,$=c$(F,C,E,R);if($.length===0)return null;const B=O-1,Z=$u([],Y=>{for(const ee of $){const X=ee.value;let G=X.offset,Q=ee.start;const ie=X.size;if(X.offset<C){Q+=Math.floor((C-X.offset+V)/(ie+V));const me=Q-ee.start;G+=me*ie+me*V}Q<R&&(G+=(R-Q)*ie,Q=R);const ae=Math.min(ee.end,B);for(let me=Q;me<=ae&&!(G>=E);me++)Y.push({index:me,size:ie,offset:G,data:M&&M[me]}),G+=ie+V}});return Sc(Z,H,O,V,I,N)}),Oe(C=>C!==null),Pt()),Id);Ce(ce(n,Oe(_g),be(C=>C==null?void 0:C.length)),t),Ce(ce(y,be(C=>C.topListHeight)),p),Ce(p,l),Ce(ce(y,be(C=>[C.top,C.bottom])),a),Ce(ce(y,be(C=>C.items)),x);const w=Vn(ce(y,Oe(({items:C})=>C.length>0),Fe(t,n),Oe(([{items:C},E])=>C[C.length-1].originalIndex===E-1),be(([,C,E])=>[C-1,E]),Pt(Ha),be(([C])=>C))),S=Vn(ce(y,Hr(200),Oe(({items:C,topItems:E})=>C.length>0&&C[0].originalIndex===E.length),be(({items:C})=>C[0].index),Pt())),j=Vn(ce(y,Oe(({items:C})=>C.length>0),be(({items:C})=>{let E=0,O=C.length-1;for(;C[E].type==="group"&&E<O;)E++;for(;C[O].type==="group"&&O>E;)O--;return{startIndex:C[E].index,endIndex:C[O].index}}),Pt(fx)));return{listState:y,topItemsIndexes:b,endReached:w,startReached:S,rangeChanged:j,itemsRendered:x,initialItemCount:v,...f}},Ot(er,px,Rg,Sl,xl,wl,po,Lg),{singleton:!0}),C$=ut(([{sizes:e,firstItemIndex:t,data:n,gap:s},{initialTopMostItemIndex:r},{initialItemCount:o,listState:i},{didMount:a}])=>(Ce(ce(a,Fe(o),Oe(([,l])=>l!==0),Fe(r,e,t,s,n),be(([[,l],u,d,p,f,h=[]])=>gx(l,u,d,p,f,h))),i),{}),Ot(er,Sl,Ko,po),{singleton:!0}),hx=ut(([{scrollVelocity:e}])=>{const t=fe(!1),n=Ze(),s=fe(!1);return Ce(ce(e,Fe(s,t,n),Oe(([r,o])=>!!o),be(([r,o,i,a])=>{const{exit:l,enter:u}=o;if(i){if(l(r,a))return!1}else if(u(r,a))return!0;return i}),Pt()),t),ct(ce(Gt(t,e,n),Fe(s)),([[r,o,i],a])=>r&&a&&a.change&&a.change(o,i)),{isSeeking:t,scrollSeekConfiguration:s,scrollVelocity:e,scrollSeekRangeChanged:n}},Ot(wl),{singleton:!0}),j$=ut(([{topItemsIndexes:e}])=>{const t=fe(0);return Ce(ce(t,Oe(n=>n>0),be(n=>Array.from({length:n}).map((s,r)=>r))),e),{topItemCount:t}},Ot(Ko)),mx=ut(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:s},{listState:r}])=>{const o=Ze(),i=pn(ce(Gt(e,s,t,n,r),be(([a,l,u,d,p])=>a+l+u+d+p.offsetBottom+p.bottom)),0);return Ce(Te(i),o),{totalListHeight:i,totalListHeightChanged:o}},Ot(hn,Ko),{singleton:!0});function bx(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const E$=bx(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),P$=ut(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:s},{isScrolling:r,isAtBottom:o,scrollDirection:i,lastJumpDueToItemResize:a},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:p,gap:f},{log:h},{recalcInProgress:m}])=>{const b=Vn(ce(l,Fe(a),Bs(([,x,y,w],[{items:S,totalCount:j,bottom:C,offsetBottom:E},O])=>{const P=C+E;let T=0;return y===j&&x.length>0&&S.length>0&&(S[0].originalIndex===0&&x[0].originalIndex===0||(T=P-w,T!==0&&(T+=O))),[T,S,j,P]},[0,[],0,0]),Oe(([x])=>x!==0),Fe(t,i,s,o,h,m),Oe(([,x,y,w,,,S])=>!S&&!w&&x!==0&&y===Va),be(([[x],,,,,y])=>(y("Upward scrolling compensation",{amount:x},Hn.DEBUG),x))));function v(x){x>0?(Ve(e,{top:-x,behavior:"auto"}),Ve(n,0)):(Ve(n,0),Ve(e,{top:-x,behavior:"auto"}))}return ct(ce(b,Fe(n,r)),([x,y,w])=>{w&&E$()?Ve(n,y-x):v(-x)}),ct(ce(Gt(pn(r,!1),n,m),Oe(([x,y,w])=>!x&&!w&&y!==0),be(([x,y])=>y),Hr(1)),v),Ce(ce(d,be(x=>({top:-x}))),e),ct(ce(u,Fe(p,f),be(([x,{lastSize:y,groupIndices:w,sizeTree:S},j])=>{function C(E){return E*(y+j)}if(w.length===0)return C(x);{let E=0;const O=Ra(S,0);let P=0,T=0;for(;P<x;){P++,E+=O;let A=w.length===T+1?1/0:w[T+1]-w[T]-1;P+A>x&&(E-=O,A=x-P+1),P+=A,E+=C(A),T++}return E}})),x=>{Ve(n,x),requestAnimationFrame(()=>{Ve(e,{top:x}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Ot(hn,wl,Ko,er,uo,Lg)),T$=ut(([{didMount:e},{scrollTo:t},{listState:n}])=>{const s=fe(0);return ct(ce(e,Fe(s),Oe(([,r])=>r!==0),be(([,r])=>({top:r}))),r=>{Ys(ce(n,Oi(1),Oe(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,r)})})}),{initialScrollTop:s}},Ot(po,hn,Ko),{singleton:!0}),O$=ut(([{viewportHeight:e},{totalListHeight:t}])=>{const n=fe(!1),s=pn(ce(Gt(n,e,t),Oe(([r])=>r),be(([,r,o])=>Math.max(0,r-o)),Hr(0),Pt()),0);return{alignToBottom:n,paddingTopAddition:s}},Ot(hn,mx),{singleton:!0}),Ig=ut(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ze(),s=Ze(),r=Ze(),o=fe(!1),i=fe(void 0);return Ce(ce(Gt(n,s),be(([{viewportHeight:a,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:a}))),t),Ce(ce(e,Fe(s),be(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{useWindowScroll:o,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:s,windowScrollTo:r}},Ot(hn)),_$=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:s,locationParams:{behavior:r,align:o,...i}})=>e<n?{...i,behavior:r,align:o??"start"}:t>s?{...i,behavior:r,align:o??"end"}:null,A$=ut(([{sizes:e,totalCount:t,gap:n},{scrollTop:s,viewportHeight:r,headerHeight:o,fixedHeaderHeight:i,fixedFooterHeight:a,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=Ze();return Ce(ce(d,Fe(e,r,t,o,i,a,s),Fe(n),be(([[p,f,h,m,b,v,x,y],w])=>{const{done:S,behavior:j,align:C,calculateViewLocation:E=_$,...O}=p,P=cx(p,f,m-1),T=Ia(P,f.offsetTree,w)+b+v,A=T+js(f.sizeTree,P)[1],_=y+v,N=y+h-x,V=E({itemTop:T,itemBottom:A,viewportTop:_,viewportBottom:N,locationParams:{behavior:j,align:C,...O}});return V?S&&Ys(ce(l,Oe(M=>M===!1),Oi(sn(l)?1:2)),S):S&&S(),V}),Oe(p=>p!==null)),u),{scrollIntoView:d}},Ot(er,hn,xl,Ko,uo),{singleton:!0}),M$=ut(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:s},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=Ze(),d=fe(void 0),p=fe(null),f=fe(null);return Ce(a,p),Ce(l,f),ct(ce(u,Fe(e,n,i,p,f,s)),([h,m,b,v,x,y,w])=>{const S=p$(m.sizeTree);v&&x!==null&&y!==null&&(b=x.scrollTop-y.offsetTop),b-=w,h({ranges:S,scrollTop:b})}),Ce(ce(d,Oe(_g),be(L$)),r),Ce(ce(o,Fe(d),Oe(([,h])=>h!==void 0),Pt(),be(([,h])=>h.ranges)),t),{getState:u,restoreStateFrom:d}},Ot(er,hn,Sl,po,Ig));function L$(e){return{offset:e.scrollTop,index:0,align:"start"}}const N$=ut(([e,t,n,s,r,o,i,a,l,u])=>({...e,...t,...n,...s,...r,...o,...i,...a,...l,...u}),Ot(Rg,C$,po,hx,mx,T$,O$,Ig,A$,uo)),$$=ut(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:s,trackItemSizes:r,itemSize:o,data:i,firstItemIndex:a,groupIndices:l,statefulTotalCount:u,gap:d,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:h,initialItemFinalLocationReached:m},b,v,x,{listState:y,topItemsIndexes:w,...S},{scrollToIndex:j},C,{topItemCount:E},{groupCounts:O},P])=>(Ce(S.rangeChanged,P.scrollSeekRangeChanged),Ce(ce(P.windowViewportRect,be(T=>T.visibleHeight)),b.viewportHeight),{totalCount:e,data:i,firstItemIndex:a,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:h,initialItemFinalLocationReached:m,topItemsIndexes:w,topItemCount:E,groupCounts:O,fixedItemHeight:n,defaultItemHeight:s,gap:d,...x,statefulTotalCount:u,listState:y,scrollToIndex:j,trackItemSizes:r,itemSize:o,groupIndices:l,...S,...P,...b,sizes:p,...v}),Ot(er,Sl,hn,M$,x$,Ko,xl,P$,j$,px,N$)),Vd="-webkit-sticky",l1="sticky",vx=bx(()=>{if(typeof document>"u")return l1;const e=document.createElement("div");return e.style.position=Vd,e.style.position===Vd?Vd:l1});function yx(e,t,n){const s=g.useRef(null),r=g.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let p,f;if(t){const h=t.getBoundingClientRect(),m=u.top-h.top;p=h.height-Math.max(0,m),f=m+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),f=u.top+window.pageYOffset;s.current={offsetTop:f,visibleHeight:p,visibleWidth:d},e(s.current)},[e,t]),{callbackRef:o,ref:i}=Mg(r,!0,n),a=g.useCallback(()=>{r(i.current)},[r,i]);return g.useEffect(()=>{if(t){t.addEventListener("scroll",a);const l=new ResizeObserver(()=>{requestAnimationFrame(a)});return l.observe(t),()=>{t.removeEventListener("scroll",a),l.unobserve(t)}}else return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,t]),o}const xx=g.createContext(void 0),wx=g.createContext(void 0);function Sx(e){return e}const k$=ut(()=>{const e=fe(l=>`Item ${l}`),t=fe(null),n=fe(l=>`Group ${l}`),s=fe({}),r=fe(Sx),o=fe("div"),i=fe(Hi),a=(l,u=null)=>pn(ce(s,be(d=>d[l]),Pt()),u);return{context:t,itemContent:e,groupContent:n,components:s,computeItemKey:r,HeaderFooterTag:o,scrollerRef:i,FooterComponent:a("Footer"),HeaderComponent:a("Header"),TopItemListComponent:a("TopItemList"),ListComponent:a("List","div"),ItemComponent:a("Item","div"),GroupComponent:a("Group","div"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder")}}),R$=ut(([e,t])=>({...e,...t}),Ot($$,k$)),I$=({height:e})=>c.jsx("div",{style:{height:e}}),V$={position:vx(),zIndex:1,overflowAnchor:"none"},Cx={overflowAnchor:"none"},H$={...Cx,display:"inline-block",height:"100%"},c1=g.memo(function({showTopList:t=!1}){const n=Me("listState"),s=Qn("sizeRanges"),r=Me("useWindowScroll"),o=Me("customScrollParent"),i=Qn("windowScrollContainerState"),a=Qn("scrollContainerState"),l=o||r?i:a,u=Me("itemContent"),d=Me("context"),p=Me("groupContent"),f=Me("trackItemSizes"),h=Me("itemSize"),m=Me("log"),b=Qn("gap"),v=Me("horizontalDirection"),{callbackRef:x}=e$(s,h,f,t?Hi:l,m,b,o,v,Me("skipAnimationFrameInResizeObserver")),[y,w]=g.useState(0);Vg("deviation",M=>{y!==M&&w(M)});const S=Me("EmptyPlaceholder"),j=Me("ScrollSeekPlaceholder")||I$,C=Me("ListComponent"),E=Me("ItemComponent"),O=Me("GroupComponent"),P=Me("computeItemKey"),T=Me("isSeeking"),A=Me("groupIndices").length>0,_=Me("alignToBottom"),N=Me("initialItemFinalLocationReached"),V=t?{}:{boxSizing:"border-box",...v?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:_?"auto":0}:{marginTop:y!==0?y:_?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...N?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&S?c.jsx(S,{...dn(S,d)}):c.jsx(C,{...dn(C,d),ref:x,style:V,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(M=>{const I=M.originalIndex,U=P(I+n.firstItemIndex,M.data,d);return T?g.createElement(j,{...dn(j,d),key:U,index:M.index,height:M.size,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?g.createElement(O,{...dn(O,d),key:U,"data-index":I,"data-known-size":M.size,"data-item-index":M.index,style:V$},p(M.index,d)):g.createElement(E,{...dn(E,d),...z$(E,M.data),key:U,"data-index":I,"data-known-size":M.size,"data-item-index":M.index,"data-item-group-index":M.groupIndex,style:v?H$:Cx},A?u(M.index,M.groupIndex,M.data,d):u(M.index,M.data,d))})})}),D$={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},F$={outline:"none",overflowX:"auto",position:"relative"},Iu=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),B$={width:"100%",position:vx(),top:0,zIndex:1};function dn(e,t){if(typeof e!="string")return{context:t}}function z$(e,t){return{item:typeof e=="string"?void 0:t}}const U$=g.memo(function(){const t=Me("HeaderComponent"),n=Qn("headerHeight"),s=Me("HeaderFooterTag"),r=qo(g.useMemo(()=>i=>n(Xr(i,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),o=Me("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),W$=g.memo(function(){const t=Me("FooterComponent"),n=Qn("footerHeight"),s=Me("HeaderFooterTag"),r=qo(g.useMemo(()=>i=>n(Xr(i,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),o=Me("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null});function jx({usePublisher:e,useEmitter:t,useEmitterValue:n}){return g.memo(function({style:o,children:i,...a}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("scrollerRef"),f=n("context"),h=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:b,scrollToCallback:v}=nx(l,d,u,p,void 0,h);t("scrollTo",v),t("scrollBy",b);const x=h?F$:D$;return c.jsx(u,{ref:m,style:{...x,...o},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...a,...dn(u,f),children:i})})}function Ex({usePublisher:e,useEmitter:t,useEmitterValue:n}){return g.memo(function({style:o,children:i,...a}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("totalListHeight"),f=n("deviation"),h=n("customScrollParent"),m=n("context"),{scrollerRef:b,scrollByCallback:v,scrollToCallback:x}=nx(l,d,u,Hi,h);return ex(()=>(b.current=h||window,()=>{b.current=null}),[b,h]),t("windowScrollTo",x),t("scrollBy",v),c.jsx(u,{style:{position:"relative",...o,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...a,...dn(u,m),children:i})})}const G$=({children:e})=>{const t=g.useContext(xx),n=Qn("viewportHeight"),s=Qn("fixedItemHeight"),r=Me("alignToBottom"),o=Me("horizontalDirection"),i=g.useMemo(()=>Yy(n,l=>Xr(l,o?"width":"height")),[n,o]),a=qo(i,!0,Me("skipAnimationFrameInResizeObserver"));return g.useEffect(()=>{t&&(n(t.viewportHeight),s(t.itemHeight))},[t,n,s]),c.jsx("div",{style:Iu(r),ref:a,"data-viewport-type":"element",children:e})},q$=({children:e})=>{const t=g.useContext(xx),n=Qn("windowViewportRect"),s=Qn("fixedItemHeight"),r=Me("customScrollParent"),o=yx(n,r,Me("skipAnimationFrameInResizeObserver")),i=Me("alignToBottom");return g.useEffect(()=>{t&&(s(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,s]),c.jsx("div",{ref:o,style:Iu(i),"data-viewport-type":"window",children:e})},K$=({children:e})=>{const t=Me("TopItemListComponent")||"div",n=Me("headerHeight"),s={...B$,marginTop:`${n}px`},r=Me("context");return c.jsx(t,{style:s,...dn(t,r),children:e})},Z$=g.memo(function(t){const n=Me("useWindowScroll"),s=Me("topItemsIndexes").length>0,r=Me("customScrollParent"),o=r||n?J$:X$,i=r||n?q$:G$;return c.jsxs(o,{...t,children:[s&&c.jsx(K$,{children:c.jsx(c1,{showTopList:!0})}),c.jsxs(i,{children:[c.jsx(U$,{}),c.jsx(c1,{}),c.jsx(W$,{})]})]})}),{Component:Y$,usePublisher:Qn,useEmitterValue:Me,useEmitter:Vg}=Qy(R$,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Z$),X$=jx({usePublisher:Qn,useEmitterValue:Me,useEmitter:Vg}),J$=Ex({usePublisher:Qn,useEmitterValue:Me,useEmitter:Vg}),Q$=Y$,u1={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},ek={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:d1,ceil:p1,floor:Gc,min:Hd,max:ga}=Math;function tk(e){return{...ek,items:e}}function f1(e,t,n){return Array.from({length:t-e+1}).map((s,r)=>{const o=n===null?null:n[r+e];return{index:r+e,data:o}})}function nk(e,t){return e&&e.column===t.column&&e.row===t.row}function Gl(e,t){return e&&e.width===t.width&&e.height===t.height}const sk=ut(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:s},{scrollTop:r,viewportHeight:o,scrollBy:i,scrollTo:a,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:p},f,h,{propsReady:m,didMount:b},{windowViewportRect:v,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,windowScrollTo:S},j])=>{const C=fe(0),E=fe(0),O=fe(u1),P=fe({height:0,width:0}),T=fe({height:0,width:0}),A=Ze(),_=Ze(),N=fe(0),V=fe(null),M=fe({row:0,column:0}),I=Ze(),U=Ze(),F=fe(!1),W=fe(0),H=fe(!0),R=fe(!1),$=fe(!1);ct(ce(b,Fe(W),Oe(([G,Q])=>!!Q)),()=>{Ve(H,!1)}),ct(ce(Gt(b,H,T,P,W,R),Oe(([G,Q,ie,ae,,me])=>G&&!Q&&ie.height!==0&&ae.height!==0&&!me)),([,,,,G])=>{Ve(R,!0),$g(1,()=>{Ve(A,G)}),Ys(ce(r),()=>{Ve(n,[0,0]),Ve(H,!0)})}),Ce(ce(U,Oe(G=>G!=null&&G.scrollTop>0),Rs(0)),E),ct(ce(b,Fe(U),Oe(([,G])=>G!=null)),([,G])=>{G&&(Ve(P,G.viewport),Ve(T,G==null?void 0:G.item),Ve(M,G.gap),G.scrollTop>0&&(Ve(F,!0),Ys(ce(r,Oi(1)),Q=>{Ve(F,!1)}),Ve(a,{top:G.scrollTop})))}),Ce(ce(P,be(({height:G})=>G)),o),Ce(ce(Gt(Te(P,Gl),Te(T,Gl),Te(M,(G,Q)=>G&&G.column===Q.column&&G.row===Q.row),Te(r)),be(([G,Q,ie,ae])=>({viewport:G,item:Q,gap:ie,scrollTop:ae}))),I),Ce(ce(Gt(Te(C),t,Te(M,nk),Te(T,Gl),Te(P,Gl),Te(V),Te(E),Te(F),Te(H),Te(W)),Oe(([,,,,,,,G])=>!G),be(([G,[Q,ie],ae,me,ve,ke,Re,,ot,Ue])=>{const{row:we,column:ze}=ae,{height:Xe,width:vt}=me,{width:Le}=ve;if(Re===0&&(G===0||Le===0))return u1;if(vt===0){const Ft=kg(Ue,G),nr=Math.max(Ft+Re-1,0);return tk(f1(Ft,nr,ke))}const ft=Px(Le,vt,ze);let dt,We;ot?Q===0&&ie===0&&Re>0?(dt=0,We=Re-1):(dt=ft*Gc((Q+we)/(Xe+we)),We=ft*p1((ie+we)/(Xe+we))-1,We=Hd(G-1,ga(We,ft-1)),dt=Hd(We,ga(0,dt))):(dt=0,We=-1);const Xt=f1(dt,We,ke),{top:he,bottom:De}=g1(ve,ae,me,Xt),Be=p1(G/ft),_t=Be*Xe+(Be-1)*we-De;return{items:Xt,offsetTop:he,offsetBottom:_t,top:he,bottom:De,itemHeight:Xe,itemWidth:vt}})),O),Ce(ce(V,Oe(G=>G!==null),be(G=>G.length)),C),Ce(ce(Gt(P,T,O,M),Oe(([G,Q,{items:ie}])=>ie.length>0&&Q.height!==0&&G.height!==0),be(([G,Q,{items:ie},ae])=>{const{top:me,bottom:ve}=g1(G,ae,Q,ie);return[me,ve]}),Pt(Ha)),n);const B=fe(!1);Ce(ce(r,Fe(B),be(([G,Q])=>Q||G!==0)),B);const Z=Vn(ce(Te(O),Oe(({items:G})=>G.length>0),Fe(C,B),Oe(([{items:G},Q,ie])=>ie&&G[G.length-1].index===Q-1),be(([,G])=>G-1),Pt())),Y=Vn(ce(Te(O),Oe(({items:G})=>G.length>0&&G[0].index===0),Rs(0),Pt())),ee=Vn(ce(Te(O),Fe(F),Oe(([{items:G},Q])=>G.length>0&&!Q),be(([{items:G}])=>({startIndex:G[0].index,endIndex:G[G.length-1].index})),Pt(fx),Hr(0)));Ce(ee,h.scrollSeekRangeChanged),Ce(ce(A,Fe(P,T,C,M),be(([G,Q,ie,ae,me])=>{const ve=dx(G),{align:ke,behavior:Re,offset:ot}=ve;let Ue=ve.index;Ue==="LAST"&&(Ue=ae-1),Ue=ga(0,Ue,Hd(ae-1,Ue));let we=Qp(Q,me,ie,Ue);return ke==="end"?we=d1(we-Q.height+ie.height):ke==="center"&&(we=d1(we-Q.height/2+ie.height/2)),ot&&(we+=ot),{top:we,behavior:Re}})),a);const X=pn(ce(O,be(G=>G.offsetBottom+G.bottom)),0);return Ce(ce(v,be(G=>({width:G.visibleWidth,height:G.visibleHeight}))),P),{data:V,totalCount:C,viewportDimensions:P,itemDimensions:T,scrollTop:r,scrollHeight:_,overscan:e,increaseViewportBy:s,scrollBy:i,scrollTo:a,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:v,windowScrollTo:S,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,deviation:N,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:E,gap:M,restoreStateFrom:U,...h,initialTopMostItemIndex:W,horizontalDirection:$,gridState:O,totalListHeight:X,...f,startReached:Y,endReached:Z,rangeChanged:ee,stateChanged:I,propsReady:m,stateRestoreInProgress:F,...j}},Ot(Rg,hn,wl,hx,po,Ig,uo));function g1(e,t,n,s){const{height:r}=n;if(r===void 0||s.length===0)return{top:0,bottom:0};const o=Qp(e,t,n,s[0].index),i=Qp(e,t,n,s[s.length-1].index)+r;return{top:o,bottom:i}}function Qp(e,t,n,s){const r=Px(e.width,n.width,t.column),o=Gc(s/r),i=o*n.height+ga(0,o-1)*t.row;return i>0?i+t.row:i}function Px(e,t,n){return ga(1,Gc((e+n)/(Gc(t)+n)))}const rk=ut(()=>{const e=fe(p=>`Item ${p}`),t=fe({}),n=fe(null),s=fe("virtuoso-grid-item"),r=fe("virtuoso-grid-list"),o=fe(Sx),i=fe("div"),a=fe(Hi),l=(p,f=null)=>pn(ce(t,be(h=>h[p]),Pt()),f),u=fe(!1),d=fe(!1);return Ce(Te(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:s,listClassName:r,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),ok=ut(([e,t])=>({...e,...t}),Ot(sk,rk)),ik=g.memo(function(){const t=Mt("gridState"),n=Mt("listClassName"),s=Mt("itemClassName"),r=Mt("itemContent"),o=Mt("computeItemKey"),i=Mt("isSeeking"),a=es("scrollHeight"),l=Mt("ItemComponent"),u=Mt("ListComponent"),d=Mt("ScrollSeekPlaceholder"),p=Mt("context"),f=es("itemDimensions"),h=es("gap"),m=Mt("log"),b=Mt("stateRestoreInProgress"),v=es("reportReadyState"),x=qo(g.useMemo(()=>y=>{const w=y.parentElement.parentElement.scrollHeight;a(w);const S=y.firstChild;if(S){const{width:j,height:C}=S.getBoundingClientRect();f({width:j,height:C})}h({row:h1("row-gap",getComputedStyle(y).rowGap,m),column:h1("column-gap",getComputedStyle(y).columnGap,m)})},[a,f,h,m]),!0,!1);return ex(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),b?null:c.jsx(u,{ref:x,className:n,...dn(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const w=o(y.index,y.data,p);return i?c.jsx(d,{...dn(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},w):g.createElement(l,{...dn(l,p),className:s,"data-index":y.index,key:w},r(y.index,y.data,p))})})}),ak=g.memo(function(){const t=Mt("HeaderComponent"),n=es("headerHeight"),s=Mt("headerFooterTag"),r=qo(g.useMemo(()=>i=>n(Xr(i,"height")),[n]),!0,!1),o=Mt("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),lk=g.memo(function(){const t=Mt("FooterComponent"),n=es("footerHeight"),s=Mt("headerFooterTag"),r=qo(g.useMemo(()=>i=>n(Xr(i,"height")),[n]),!0,!1),o=Mt("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...dn(t,o)})}):null}),ck=({children:e})=>{const t=g.useContext(wx),n=es("itemDimensions"),s=es("viewportDimensions"),r=qo(g.useMemo(()=>o=>{s(o.getBoundingClientRect())},[s]),!0,!1);return g.useEffect(()=>{t&&(s({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,s,n]),c.jsx("div",{style:Iu(!1),ref:r,children:e})},uk=({children:e})=>{const t=g.useContext(wx),n=es("windowViewportRect"),s=es("itemDimensions"),r=Mt("customScrollParent"),o=yx(n,r,!1);return g.useEffect(()=>{t&&(s({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,s]),c.jsx("div",{ref:o,style:Iu(!1),children:e})},dk=g.memo(function({...t}){const n=Mt("useWindowScroll"),s=Mt("customScrollParent"),r=s||n?gk:fk,o=s||n?uk:ck;return c.jsx(r,{...t,children:c.jsxs(o,{children:[c.jsx(ak,{}),c.jsx(ik,{}),c.jsx(lk,{})]})})}),{Component:pk,usePublisher:es,useEmitterValue:Mt,useEmitter:Tx}=Qy(ok,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},dk),fk=jx({usePublisher:es,useEmitterValue:Mt,useEmitter:Tx}),gk=Ex({usePublisher:es,useEmitterValue:Mt,useEmitter:Tx});function h1(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Hn.WARN),t==="normal"?0:parseInt(t??"0",10)}const Vu=pk,Hg=e=>{const t="gs-utl-grid-cols-4",n=parseInt(`${e||4}`,10);return n===1?"gs-utl-grid-cols-1":n===2?"gs-utl-grid-cols-2":n===3?"gs-utl-grid-cols-3":n===4?t:n===5?"gs-utl-grid-cols-5":n===6?"gs-utl-grid-cols-6":n===7?"gs-utl-grid-cols-7":n===8?"gs-utl-grid-cols-8":n===9?"gs-utl-grid-cols-9":n===10?"gs-utl-grid-cols-10":n===11?"gs-utl-grid-cols-11":n===12?"gs-utl-grid-cols-12":t},hk=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function mk(e){const t=e.map(({id:i,src:a})=>({id:i,src:a})),n=e.reduce((i,a)=>(i[a.id]=a,i),{}),s=[],r=[];return(await zb(t)).forEach(i=>{i.status==="fulfilled"?s.push(n[i.value]):r.push(n[i.reason])}),{loaded:s,failed:r}}const bk=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{hk(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await mk(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},vk=(e,t,n,s={})=>{const{skipReplace:r}=s;e.loadData(t);const o=e.getCss()||"",i=r?o:o.replace(/:root\s*{/gi,"[data-body]{");let a=`${e.getHtml()}<style>${i}</style>`;if(n===Et.email)try{a=e.runCommand(Tu).html}catch(l){console.error(l)}return s.removeScripts&&(a=a.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),r?a:a.replace("<body","<div data-body").replace("</body>","</div>")},yk=async(e,t,n)=>{const s=sS(t,{appStore:n}),r=await bk(s);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...r.plugins,o=>{o.Storage.setCurrent("")}],pluginsOpts:r.pluginOptions,protectedCss:`
304
304
  * { box-sizing: border-box; }
305
305
  [data-body] {
306
306
  margin: 0;
@@ -318,43 +318,43 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
318
318
  height: 0px;
319
319
  overflow: hidden;
320
320
  }
321
- `})};function ku({children:e,text:t,onConfirm:n,onCancel:s,className:r="w-[200px]",confirmButtonProps:o={},...i}){const a=Ie();return c.jsx(Es,{...i,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs($,{className:Y(r),space:"m",col:!0,children:[c.jsx(F,{grow:!0,className:Y("text-center"),children:t||a.t("confirmAction")}),c.jsxs($,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Ke,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...o,children:o.children||a.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),s==null||s()},children:a.t("cancel")})]})]})})}const d1=new Map,p1=new Map,ok=async({html:e="",el:t})=>{const n=e,s={};if(document.body.attachShadow){const r=t.shadowRoot||t.attachShadow({mode:"open"});r.innerHTML=n}return s},ik=ce(function({template:t,projectType:n,skipProjectNamePopover:s,className:r,onSelect:o,onRemove:i}){var E;const a=Ie(),l=xe(),u=l.editor,[d,p]=h.useState(""),f=h.useRef(null),g=a.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((E=t.data.custom)==null?void 0:E.id),v=n===jt.web,b=!t.isTemplate||s,x=()=>{b&&(o==null||o({editor:u,template:t,loadTemplate:y}))},y=l.setProject,w=O=>{O.preventDefault(),o({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const P=setTimeout(async()=>{if(!f.current||!u)return;const T=`${t.isTemplate?"t-":""}${t.id}`;let A=d1.get(T);if(!A){let N=p1.get(n);if(!N){const D=new SV({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});N=await rk(u.config.grapesjs,n,D.appEditorStore),p1.set(n,N)}A=N?sk(N,t.data,n):"",d1.set(T,A)}const _=f.current;ok({el:_,html:A})});return()=>clearTimeout(P)},[f,u,n,t.data]);const{media:S,author:C}=t,j=c.jsx(Ke,{className:ie("text-sm"),size:"m2",variant:"pr",onClick:x,disabled:m,children:a.t("select")});return c.jsx(rs,{padding:!1,className:ie("overflow-hidden max-w-full group",r),children:c.jsxs($,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ie("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:S?c.jsx("img",{src:S,alt:t.name,className:ie("max-w-full")}):c.jsx("div",{className:ie("gs-utl-w-[1200px]","gs-utl-flex-shrink-0","gs-utl-flex-grow-0","gs-utl-origin-top","gs-utl-bg-white","gs-utl-scale-[0.232]","gs-utl-h-[431.034%]"),ref:f})}),m&&c.jsx(Br,{className:ie("absolute top-2 right-2",z.bgA2),label:a.t("current"),s:"s",pill:!0}),c.jsx($,{justify:"center",items:"center",className:ie(_e.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?j:c.jsx(Es,{overlay:!0,title:!1,buttonAs:"span",handler:j,children:()=>c.jsx("form",{onSubmit:w,children:c.jsxs($,{space:"m",col:!0,children:[c.jsx(F,{children:c.jsx(ot,{size:"s",value:d,onChange:p,placeholder:g,required:!0})}),c.jsx(F,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:a.t("load")})})]})})})})]}),c.jsxs($,{className:ie("gjs-p-2 max-w-full",te.bt,z.br),col:!0,space:"s",children:[c.jsxs($,{className:ie("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(F,{className:ie(_e.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!C&&c.jsxs(F,{children:["by"," ",c.jsx("a",{className:ie(zr.link),href:C.link,rel:"noreferrer",target:"_blank",children:C.name})]})]}),c.jsxs($,{items:"center",children:[v&&c.jsxs(F,{className:ie("gjs-mr-auto"),children:[a.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&i&&c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(ku,{onConfirm:()=>i(t),className:"",children:c.jsx(St,{title:a.t("delete"),children:c.jsx(se,{icon:K.delete,size:oe.sx})})})})]})]})]})})}),bx=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:s,onSelect:r,onRemove:o}){const[i]=mh(),l=Ie().tScoped("templates"),d=xe().editor,p=$h(n==null?void 0:n.itemsPerRow),f=r??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx($,{justify:"center",children:l("notFound")}):c.jsx($u,{data:e,listClassName:ie("grid gap-2 gjs-pr-2",p),itemContent:(g,m)=>c.jsx(ik,{template:m,projectType:t,onSelect:f,onRemove:o,skipProjectNamePopover:s},m.id)},i):c.jsx(Ur,{})})}),ak=ce(function(){var v;const t=xe(),n=X0(),{filteredTemplates:s,projectSourceFilter:r,projectTypeFilter:o}=n,i=Ie(),a=Mi(),{sdkOptions:l}=t,u=i.tScoped("projectManager"),d=async({loadTemplate:b,template:x})=>{b(x),a.close()},p=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},f=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:Pa.Existing,label:u("existentProjects")},{id:Pa.Templates,label:u("templates")}],[i]),m=((v=l.project)==null?void 0:v.types)&&vf();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs($,{col:!0,full:!0,space:"m",children:[m&&c.jsx($,{items:"center",space:"m",children:c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(Ae,{value:o,onChange:p,options:ON(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(F,{children:c.jsx(io,{tabs:g,value:r,onChange:n.setProjectSourceFilter})}),c.jsx(F,{grow:!0,children:c.jsx(bx,{templates:s,projectType:jt[o],onSelect:d,onRemove:f,content:{itemsPerRow:3}})})]})}),lk=({items:e,editor:t,customItems:n})=>n===!1?[]:tt(n)?n({items:e,editor:t}):n||e,f1=e=>({icon:K.plus,size:oe.s,className:Y("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),yx=e=>!e.type||e.type==="button",ck="gs-cmp-topbar-left",uk=ce(function({buttons:t,className:n,style:s}){const r=xe(),o=Ie(),{isOpen:i,toggleOpen:a}=G3(),l=r.editor,d=o.tScoped("blockManager")("blocks"),p=lk({items:[{id:`blocks-${d}`,tooltip:d,size:yy.s,icon:f1(i),variant:by.primary,editorEvents:{[Hn.toggleBlocksPanel]:({fromEvent:f,setState:g})=>{g({icon:f1(f.isOpen)})}},onClick:()=>a()}],customItems:t,editor:l});return c.jsx($,{gap:"s",items:"center",justify:"start",className:Y(ck,Pe.xS,n),style:s,nowrap:!0,children:p.map(({id:f,...g})=>yx(g)?c.jsx(Eu,{...g},f):$t({id:f,...g}))})}),dk=[{id:Hr.auto,label:"Auto"},{id:Hr.dark,label:"Dark"},{id:Hr.light,label:"Light"}],pk={size:"s"},Rd=".grapesjs",fk=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},hk=({actions:e,editor:t,buttons:n,sdkOptions:s})=>{const r=s.actions;return r===!1?[]:tt(r)?r({actions:e,editor:t}):r||(n?tt(n)?n({items:e,editor:t}):n:e)},gk="gs-cmp-topbar-right",mk=ce(function({editor:t,className:n,buttons:s,...r}){const o=xe(),{theme:i,setTheme:a}=Ys(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:f,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=o,b=Mi(),x=Ie(),y=_=>x.t(`actions.${_}`),w=t.Storage.events,S=l.events,C="change:changesCount",j=(_,N)=>()=>{tt(_)?_({editor:t}):l.isActive(_)?l.stop(_):l.run(_,N)},E=_=>({[`${S.runCommand}${_}`]:({setState:N})=>N({active:!0}),[`${S.stopCommand}${_}`]:({setState:N})=>N({active:!1})}),O=[{id:cs.componentOutline,icon:K.borderRadius,tooltip:y("componentOutline.title"),onClick:j("core:component-outline"),editorEvents:E("core:component-outline")},{id:cs.preview,icon:K.eye,tooltip:y("preview.title"),onClick:j("core:preview"),editorEvents:E("core:preview")},{id:cs.fullscreen,icon:K.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:j("core:fullscreen",{target:"body"}),editorEvents:E("core:fullscreen")},{id:cs.showCode,icon:K.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(ne.dialogExportCode)},{id:cs.showImportCode,icon:K.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(ne.dialogImportCode)},{id:cs.clearCanvas,icon:K.delete,tooltip:y("clearCanvas.title"),onClick:()=>b.confirm({title:y("clearCanvas.title"),content:y("clearCanvas.content"),confirmButton:{variant:"danger",children:y("clearCanvas.title")},onConfirm:()=>{v?t.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):t.Components.clear()}})},{id:cs.store,tooltip:y("store.title"),onClick:async()=>{try{if(o.isSaving)return;await t.store()}catch(_){t.getModel()._isStoring=!1,console.error(_)}},editorEvents:{"change:changesCount":({setState:_})=>_({}),[w.startStore]:({setState:_})=>_({disabled:!0}),[w.endStore]:({setState:_})=>_({disabled:!1})},label:()=>c.jsxs("div",{className:Y("relative"),children:[c.jsx(se,{icon:K.floppy,size:oe.s}),!!t.getDirtyCount()&&!o.isSaving&&c.jsx("div",{className:Y("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:Y(_e.dot,z.bgW)})}),o.isSaving&&c.jsx("div",{className:Y("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(se,{icon:K.refresh,size:"11px",className:Y(_e.spin)})})]})},{id:cs.undo,icon:K.arrowULeftTop,disabled:!0,onClick:j("core:undo"),editorEvents:{[C]:({setState:_})=>_({disabled:!u.hasUndo()})}},{id:cs.redo,icon:K.arrowURightTop,disabled:!0,onClick:j("core:redo"),editorEvents:{[C]:({setState:_})=>_({disabled:!u.hasRedo()})}}],P=hk({actions:O,sdkOptions:m,editor:t,buttons:s}),T=[{id:"about",label:y("about.title"),icon:K.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(PN,{})})},{id:"embed",label:y("embed.title"),icon:K.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(TN,{})})},{id:"openProject",label:y("open.title"),icon:K.folder,action:async()=>{let _="";try{_=await(await cN({extensions:[Rd]})).text()}catch(N){return console.error(N)}o.loadProjectData(JSON.parse(_))}},{id:"saveProject",label:y("save.title"),icon:K.contentSave,action:async()=>{const _=t.getProjectData(),N=new Blob([JSON.stringify(_)]),D=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await dN(N,{fileName:`${D}${Rd}`,extensions:[Rd]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:K.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(ak,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:K.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const _=await(d==null?void 0:d.userChoice);(_==null?void 0:_.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs($,{items:"center",space:"m",children:[c.jsx(F,{children:"Theme"}),c.jsx(F,{children:c.jsx(io,{tabs:dk,onChange:_=>a(_),value:i,variant:"pills"})})]})}]].filter(({id:_})=>!((!f||!d)&&_==="installApp"||!fk(m,_))),A=(_,N)=>D=>{tt(_)&&(_(D),N())};return c.jsxs($,{space:"s",items:"center",justify:"end",className:Y(gk,Pe.xS,n),nowrap:!0,...r,children:[P.map(({id:_,...N})=>yx(N)?c.jsx(Eu,{size:"s",...N},_):$t({id:_,...N})),c.jsx(F,{children:m.settingsMenu!==!1&&T.length>0&&c.jsx(Es,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(se,{icon:K.cog,size:oe.s}),buttonProps:pk,overlay:!0,children:({close:_})=>c.jsx(c.Fragment,{children:T.map(N=>c.jsx(ki,{action:A(N.action,_),icon:N.icon,label:N.label},N.id))})})})]})});function vk({devices:e,selected:t,className:n,style:s,select:r}){const o=e.map(i=>({id:i.id,label:i.getName(),icon:i.attributes.icon}));return o.length?c.jsx(Ae,{size:"xs",className:n,style:s,value:t,options:o,onChange:r}):null}const bk="gs-devices",xx=h.memo(function({className:t,style:n}){return c.jsx(UM,{children:s=>c.jsx(vk,{className:M(bk,t),style:n,...s})})}),Yi="gs-cmp-editor-topbar",yk=ce(function({className:t,height:n,style:s,children:r,leftContainer:o,rightContainer:i,devices:a}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:p}=xe(),f=n??l,g=h.useMemo(()=>({...s,minHeight:f,marginTop:u||!p?`-${f}px`:0}),[u,p,s]);return c.jsxs(c.Fragment,{children:[c.jsx(F,{className:M(Yi,"gs-utl-transition-spacing gs-utl-w-full",te.bb,z.br,t),style:g,children:r??c.jsxs($,{className:M(`${Yi}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(F,{className:M(`${Yi}__wrp-left`),grow:!0,children:o!==!1&&c.jsx(uk,{...o})}),c.jsx(F,{className:M(`${Yi}__wrp-center`),children:a!==!1&&c.jsx(xx,{...a})}),c.jsx(F,{className:M(`${Yi}__wrp-right`),grow:!0,children:i!==!1&&d&&c.jsx(mk,{editor:d,...i})})]})}),c.jsx(F,{className:M("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:c.jsx(Ke,{className:M("gs-cmp-close-preview gs-utl-m-4",z.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(se,{icon:K.eyeOff,size:oe.s})})})]})}),xk="gs-sidebar-top",wx=h.memo(ce(function({height:t,children:n,...s}){return c.jsx(yk,{height:t,...s,style:Tu(s),className:M(xk,"gs-utl-flex",Pu(s)),children:n?$t(n):void 0})})),wk="gs-canvas-sidebar-top",Sk=h.memo(ce(function({className:t,sidebarTop:n,...s}){return c.jsxs(jn,{className:M(wk,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...s,children:[c.jsx(wx,{...n}),c.jsx(Iy,{grow:!0})]})})),Ck="gs-code-field",jk=ce(function(e){const{editor:t}=xe(),{isDarkTheme:n}=Ys(),{editorEvents:s,onChange:r}=e,[o,i]=h.useState(()=>e),a=u=>({value:u,editor:t,state:o,setState:d=>i(p=>({...p,...d}))}),l=u=>r==null?void 0:r(a(u||""));return xr({editor:t,editorEvents:s,localState:o,setLocalState:i}),c.jsx(mr,{className:M(Ck,o.className),language:o.language,style:o.style,label:o.label,name:o.name,defaultValue:o.value,size:o.size,required:o.required,disabled:o.disabled,readOnly:o.readOnly,minHeight:o.minHeight,row:o.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});function Ru(){return(Ru=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function Sx(e,t){if(e==null)return{};var n,s,r={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(r[n]=e[n]);return r}function Zp(e){var t=h.useRef(e),n=h.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var Ti=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},fa=function(e){return"touches"in e},Yp=function(e){return e&&e.ownerDocument.defaultView||self},h1=function(e,t,n){var s=e.getBoundingClientRect(),r=fa(t)?function(o,i){for(var a=0;a<o.length;a++)if(o[a].identifier===i)return o[a];return o[0]}(t.touches,n):t;return{left:Ti((r.pageX-(s.left+Yp(e).pageXOffset))/s.width),top:Ti((r.pageY-(s.top+Yp(e).pageYOffset))/s.height)}},g1=function(e){!fa(e)&&e.preventDefault()},kh=h.memo(function(e){var t=e.onMove,n=e.onKey,s=Sx(e,["onMove","onKey"]),r=h.useRef(null),o=Zp(t),i=Zp(n),a=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){g1(b),(fa(b)?b.touches.length>0:b.buttons>0)&&r.current?o(h1(r.current,b,a.current)):v(!1)},m=function(){return v(!1)};function v(b){var x=l.current,y=Yp(r.current),w=b?y.addEventListener:y.removeEventListener;w(x?"touchmove":"mousemove",g),w(x?"touchend":"mouseup",m)}return[function(b){var x=b.nativeEvent,y=r.current;if(y&&(g1(x),!function(S,C){return C&&!fa(S)}(x,l.current)&&y)){if(fa(x)){l.current=!0;var w=x.changedTouches||[];w.length&&(a.current=w[0].identifier)}y.focus(),o(h1(y,x,a.current)),v(!0)}},function(b){var x=b.which||b.keyCode;x<37||x>40||(b.preventDefault(),i({left:x===39?.05:x===37?-.05:0,top:x===40?.05:x===38?-.05:0}))},v]},[i,o]),d=u[0],p=u[1],f=u[2];return h.useEffect(function(){return f},[f]),h.createElement("div",Ru({},s,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:r,onKeyDown:p,tabIndex:0,role:"slider"}))}),Iu=function(e){return e.filter(Boolean).join(" ")},Rh=function(e){var t=e.color,n=e.left,s=e.top,r=s===void 0?.5:s,o=Iu(["react-colorful__pointer",e.className]);return h.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},fn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Cx=function(e){var t=e.s,n=e.v,s=e.a,r=(200-t)*n/100;return{h:fn(e.h),s:fn(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:fn(r/2),a:fn(s,2)}},Xp=function(e){var t=Cx(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Id=function(e){var t=Cx(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Ek=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:fn(255*[s,a,i,i,l,s][u]),g:fn(255*[l,s,s,a,i,i][u]),b:fn(255*[i,i,l,s,s,a][u]),a:fn(r,2)}},Pk=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?Tk({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Tk=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:fn(60*(a<0?a+6:a)),s:fn(o?i/o*100:0),v:fn(o/255*100),a:r}},Ok=h.memo(function(e){var t=e.hue,n=e.onChange,s=Iu(["react-colorful__hue",e.className]);return h.createElement("div",{className:s},h.createElement(kh,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:Ti(t+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":fn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Rh,{className:"react-colorful__hue-pointer",left:t/360,color:Xp({h:t,s:100,v:100,a:1})})))}),_k=h.memo(function(e){var t=e.hsva,n=e.onChange,s={backgroundColor:Xp({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:s},h.createElement(kh,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:Ti(t.s+100*r.left,0,100),v:Ti(t.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+fn(t.s)+"%, Brightness "+fn(t.v)+"%"},h.createElement(Rh,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Xp(t)})))}),Ak=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},Lk=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function Mk(e,t,n){var s=Zp(n),r=h.useState(function(){return e.toHsva(t)}),o=r[0],i=r[1],a=h.useRef({color:t,hsva:o});h.useEffect(function(){if(!e.equal(t,a.current.color)){var u=e.toHsva(t);a.current={hsva:u,color:t},i(u)}},[t,e]),h.useEffect(function(){var u;Ak(o,a.current.hsva)||e.equal(u=e.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},s(u))},[o,e,s]);var l=h.useCallback(function(u){i(function(d){return Object.assign({},d,u)})},[]);return[o,l]}var Nk=typeof window<"u"?h.useLayoutEffect:h.useEffect,$k=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},m1=new Map,kk=function(e){Nk(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!m1.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,m1.set(t,n);var s=$k();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},Rk=function(e){var t=e.className,n=e.hsva,s=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Id(Object.assign({},n,{a:0}))+", "+Id(Object.assign({},n,{a:1}))+")"},o=Iu(["react-colorful__alpha",t]),i=fn(100*n.a);return h.createElement("div",{className:o},h.createElement("div",{className:"react-colorful__alpha-gradient",style:r}),h.createElement(kh,{onMove:function(a){s({a:a.left})},onKey:function(a){s({a:Ti(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Rh,{className:"react-colorful__alpha-pointer",left:n.a,color:Id(n)})))},Ik=function(e){var t=e.className,n=e.colorModel,s=e.color,r=s===void 0?n.defaultColor:s,o=e.onChange,i=Sx(e,["className","colorModel","color","onChange"]),a=h.useRef(null);kk(a);var l=Mk(n,r,o),u=l[0],d=l[1],p=Iu(["react-colorful",t]);return h.createElement("div",Ru({},i,{ref:a,className:p}),h.createElement(_k,{hsva:u,onChange:d}),h.createElement(Ok,{hue:u.h,onChange:d}),h.createElement(Rk,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},Vk={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Pk,fromHsva:function(e){var t=Ek(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Lk},Hk=function(e){return h.createElement(Ik,Ru({},e,{colorModel:Vk}))};function Dk(e){if(!os()||!document.body)return null;const{className:t,onPointerUp:n,onPointerCancel:s}=e,r=M(t,"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50");return $n.createPortal(c.jsx("div",{onPointerUp:n,onPointerCancel:s,className:r}),document.body)}var Fk={grad:.9,turn:360,rad:360/(2*Math.PI)},nr=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Bt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},es=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},jx=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},v1=function(e){return{r:es(e.r,0,255),g:es(e.g,0,255),b:es(e.b,0,255),a:es(e.a)}},Vd=function(e){return{r:Bt(e.r),g:Bt(e.g),b:Bt(e.b),a:Bt(e.a,3)}},Bk=/^#([0-9a-f]{3,8})$/i,Bl=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ex=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:60*(a<0?a+6:a),s:o?i/o*100:0,v:o/255*100,a:r}},Px=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:255*[s,a,i,i,l,s][u],g:255*[l,s,s,a,i,i][u],b:255*[i,i,l,s,s,a][u],a:r}},b1=function(e){return{h:jx(e.h),s:es(e.s,0,100),l:es(e.l,0,100),a:es(e.a)}},y1=function(e){return{h:Bt(e.h),s:Bt(e.s),l:Bt(e.l),a:Bt(e.a,3)}},x1=function(e){return Px((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},ha=function(e){return{h:(t=Ex(e)).h,s:(r=(200-(n=t.s))*(s=t.v)/100)>0&&r<200?n*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,s,r},zk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Wk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Gk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jp={string:[[function(e){var t=Bk.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Bt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Bt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Wk.exec(e)||Gk.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:v1({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=zk.exec(e)||Uk.exec(e);if(!t)return null;var n,s,r=b1({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(Fk[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return x1(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=r===void 0?1:r;return nr(t)&&nr(n)&&nr(s)?v1({r:Number(t),g:Number(n),b:Number(s),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,r=e.a,o=r===void 0?1:r;if(!nr(t)||!nr(n)||!nr(s))return null;var i=b1({h:Number(t),s:Number(n),l:Number(s),a:Number(o)});return x1(i)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,r=e.a,o=r===void 0?1:r;if(!nr(t)||!nr(n)||!nr(s))return null;var i=function(a){return{h:jx(a.h),s:es(a.s,0,100),v:es(a.v,0,100),a:es(a.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(o)});return Px(i)},"hsv"]]},w1=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},qk=function(e){return typeof e=="string"?w1(e.trim(),Jp.string):typeof e=="object"&&e!==null?w1(e,Jp.object):[null,void 0]},Hd=function(e,t){var n=ha(e);return{h:n.h,s:es(n.s+100*t,0,100),l:n.l,a:n.a}},Dd=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},S1=function(e,t){var n=ha(e);return{h:n.h,s:n.s,l:es(n.l+100*t,0,100),a:n.a}},Qp=function(){function e(t){this.parsed=qk(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Bt(Dd(this.rgba),2)},e.prototype.isDark=function(){return Dd(this.rgba)<.5},e.prototype.isLight=function(){return Dd(this.rgba)>=.5},e.prototype.toHex=function(){return t=Vd(this.rgba),n=t.r,s=t.g,r=t.b,i=(o=t.a)<1?Bl(Bt(255*o)):"","#"+Bl(n)+Bl(s)+Bl(r)+i;var t,n,s,r,o,i},e.prototype.toRgb=function(){return Vd(this.rgba)},e.prototype.toRgbString=function(){return t=Vd(this.rgba),n=t.r,s=t.g,r=t.b,(o=t.a)<1?"rgba("+n+", "+s+", "+r+", "+o+")":"rgb("+n+", "+s+", "+r+")";var t,n,s,r,o},e.prototype.toHsl=function(){return y1(ha(this.rgba))},e.prototype.toHslString=function(){return t=y1(ha(this.rgba)),n=t.h,s=t.s,r=t.l,(o=t.a)<1?"hsla("+n+", "+s+"%, "+r+"%, "+o+")":"hsl("+n+", "+s+"%, "+r+"%)";var t,n,s,r,o},e.prototype.toHsv=function(){return t=Ex(this.rgba),{h:Bt(t.h),s:Bt(t.s),v:Bt(t.v),a:Bt(t.a,3)};var t},e.prototype.invert=function(){return _n({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),_n(Hd(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),_n(Hd(this.rgba,-t))},e.prototype.grayscale=function(){return _n(Hd(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),_n(S1(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),_n(S1(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?_n({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Bt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=ha(this.rgba);return typeof t=="number"?_n({h:t,s:n.s,l:n.l,a:n.a}):Bt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===_n(t).toHex()},e}(),_n=function(e){return e instanceof Qp?e:new Qp(e)},C1=[],Kk=function(e){e.forEach(function(t){C1.indexOf(t)<0&&(t(Qp,Jp),C1.push(t))})},Zk={grad:.9,turn:360,rad:360/(2*Math.PI)},Fd=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},zl=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Bd=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},Tx=function(e){return{h:(t=e.h,(t=isFinite(t)?t%360:0)>0?t:t+360),w:Bd(e.w,0,100),b:Bd(e.b,0,100),a:Bd(e.a)};var t},j1=function(e){return{h:zl(e.h),w:zl(e.w),b:zl(e.b),a:zl(e.a,3)}},E1=function(e){return{h:function(t){var n=t.r,s=t.g,r=t.b,o=t.a,i=Math.max(n,s,r),a=i-Math.min(n,s,r),l=a?i===n?(s-r)/a:i===s?2+(r-n)/a:4+(n-s)/a:0;return{h:60*(l<0?l+6:l),s:i?a/i*100:0,v:i/255*100,a:o}}(e).h,w:Math.min(e.r,e.g,e.b)/255*100,b:100-Math.max(e.r,e.g,e.b)/255*100,a:e.a}},Ox=function(e){return function(t){var n=t.h,s=t.s,r=t.v,o=t.a;n=n/360*6,s/=100,r/=100;var i=Math.floor(n),a=r*(1-s),l=r*(1-(n-i)*s),u=r*(1-(1-n+i)*s),d=i%6;return{r:255*[r,l,a,a,u,r][d],g:255*[u,r,r,l,a,a][d],b:255*[a,a,u,r,r,l][d],a:o}}({h:e.h,s:e.b===100?0:100-e.w/(100-e.b)*100,v:100-e.b,a:e.a})},Yk=function(e){var t=e.h,n=e.w,s=e.b,r=e.a,o=r===void 0?1:r;if(!Fd(t)||!Fd(n)||!Fd(s))return null;var i=Tx({h:Number(t),w:Number(n),b:Number(s),a:Number(o)});return Ox(i)},Xk=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jk=function(e){var t=Xk.exec(e);if(!t)return null;var n,s,r=Tx({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(Zk[s]||1)),w:Number(t[3]),b:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Ox(r)};function Qk(e,t){e.prototype.toHwb=function(){return j1(E1(this.rgba))},e.prototype.toHwbString=function(){return n=j1(E1(this.rgba)),s=n.h,r=n.w,o=n.b,(i=n.a)<1?"hwb("+s+" "+r+"% "+o+"% / "+i+")":"hwb("+s+" "+r+"% "+o+"%)";var n,s,r,o,i},t.string.push([Jk,"hwb"]),t.object.push([Yk,"hwb"])}function eR(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in n)s[n[r]]=r;var o={};e.prototype.toName=function(i){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(i!=null&&i.closest){var d=this.toRgb(),p=1/0,f="black";if(!o.length)for(var g in n)o[g]=new e(n[g]).toRgb();for(var m in n){var v=(a=d,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));v<p&&(p=v,f=m)}return f}},t.string.push([function(i){var a=i.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new e(l).toRgb():null},"name"])}Kk([eR,Qk]);const tR="rgb",_x="rgba(0, 0, 0, 1)",nR=_n(_x).toRgb(),sR=[{id:"rgba",label:"RGB"},{id:"hex",label:"HEX"},{id:"hsla",label:"HSL"},{id:"hwb",label:"HWB"}],rR=[{id:"hex",label:"HEX"},{id:"rgba",label:"RGB"}],Ra=e=>e==null?"":`${e}`,P1=e=>typeof e=="string",T1=(e,t)=>e.some(n=>Ra(n.id)===t),oR=e=>{const t=(e||"").trim().toLowerCase();return t?t.startsWith("#")?"hex":t.startsWith("rgba(")||t.startsWith("rgb(")?"rgba":t.startsWith("hsla(")||t.startsWith("hsl(")?"hsla":t.startsWith("hwb(")?"hwb":"":""},zd=(e,t=[],n)=>{var i;const s=Ra(e).trim();if(s&&(!t.length||T1(t,s)))return s;const r=oR(n);return r&&(!t.length||T1(t,r))?r:Ra((i=t[0])==null?void 0:i.id).trim()||tR},iR=(e,t)=>{const n=e[t];return typeof n=="function"?n.call(e):void 0},aR=(e=[],t)=>{if(!t)return;const n=Ra(t).toLowerCase();return e.find(s=>Ra(s.id).toLowerCase()===n)},lR=(e,t)=>{if(!t)return e;const n=_n(e);if(!n.isValid())return e;switch(t.toLowerCase()){case"rgb":case"rgba":return n.toRgbString();case"hex":return n.toHex();case"hsl":case"hsla":return n.toHslString();case"hwb":return n.toHwbString();case"name":return iR(n,"toName")||e;default:return e}},O1=({value:e,format:t,prevFormat:n,formats:s,onFormatChange:r,callOnFormatChange:o})=>{var u;const i=t||"",a=aR(s,i);if(!!(a!=null&&a.onFormat)||!!(o&&r)){const d=_n(e),p={value:e,format:i,prevFormat:n||i,valueRgb:d.isValid()?d.toRgb():nR},f=(u=a==null?void 0:a.onFormat)==null?void 0:u.call(a,p);if(P1(f))return f;if(o){const g=r==null?void 0:r(p);if(P1(g))return g}}return lR(e,i)||e},cR=e=>{const t=(e||"").trim();if(t.toLowerCase().startsWith("rgba("))return t;const n=_n(t);if(!n.isValid())return _x;const{r:s,g:r,b:o,a:i}=n.toRgb();return`rgba(${s}, ${r}, ${o}, ${i})`},uR=e=>!!(e!=null&&e.Components.getType("mjml")),Ax=e=>({formats:uR(e)?rR:sR}),Bc=e=>e==null?"":`${e}`,dR=(e=[],t)=>!t||!e.length||e.some(n=>Bc(n.id).trim().toLowerCase()===Bc(t).trim().toLowerCase());function Lx({value:e,format:t,formats:n=[],onChange:s,onFormatChange:r,disabled:o}){const[i,a]=h.useState(()=>zd(t,n,e||"")),l=h.useMemo(()=>cR(e||""),[e]),u=h.useMemo(()=>O1({value:e||"",format:i,prevFormat:i,formats:n}),[e,i,n]),d=h.useRef(e||""),[p,f]=h.useState(!1),g=os()&&!!window.EyeDropper,m=!!n.length;h.useEffect(()=>{a(j=>{if(t){const E=zd(t,n);return j===E?j:E}return dR(n,j)?j:zd(void 0,n)})},[t,n]),h.useEffect(()=>{d.current=e||""},[e]);const v=(j,E=i,O={})=>O1({value:j,format:E,prevFormat:O.prevFormat||i,formats:n,onFormatChange:r,callOnFormatChange:O.callOnFormatChange}),b=j=>{d.current=j,s==null||s(j)},x=j=>{const E=v(j);d.current=E,s==null||s(E,!0)},y=j=>{const E=Bc(j).trim();if(!E)return;const O=i,P=e||"";a(E);const T=v(P,E,{prevFormat:O,callOnFormatChange:!0});d.current=T,s==null||s(T,!1)},w=()=>{g&&new window.EyeDropper().open().then(E=>{const O=v(E.sRGBHex);d.current=O,s==null||s(O)}).catch(console.warn)},S=()=>{f(!0)},C=()=>{const j=v(d.current);d.current=j,s==null||s(j,!1),f(!1)};return c.jsxs(c.Fragment,{children:[p&&c.jsx(Dk,{className:"gs-utl-cursor-grabbing",onPointerUp:C,onPointerCancel:C}),c.jsx(Hk,{className:"color-picker",color:l,onChange:x,onPointerDown:S,onPointerUp:C}),m&&c.jsx(Ae,{classNameContainer:"gs-utl-mt-3",value:i,options:n,size:"s",onChange:j=>y(Bc(j)),disabled:o}),c.jsxs($,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(ot,{size:"s",value:u,onChange:b,disabled:o})}),g&&c.jsx(Ke,{type:"button",onClick:w,children:c.jsx(se,{icon:K.eyedropperVariant,size:oe.s})})]})]})}const pR="gs-cmp-color-picker",fR={backgroundSize:"10px"},hR=[0,15];function Mx({className:e,value:t,format:n,formats:s,onChange:r,onFormatChange:o,disabled:i}){const[a,l]=h.useState(!1),u=M(`${pR}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,z.br),d=()=>{l(!1)},p=c.jsxs("div",{style:fR,className:u,children:[a&&c.jsx("div",{onPointerUp:d,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx("div",{className:"gs-utl-w-4 gs-utl-h-4",style:{backgroundColor:t}})]});return c.jsx(Es,{handler:p,title:"Color",size:"s",placement:"left-end",offset:hR,clickAway:!0,disabled:i,children:c.jsx(Lx,{value:t,format:n,formats:s,onChange:r,onFormatChange:o,disabled:i})})}const gR="gs-cmp-color-field";function mR(e){const{className:t,value:n,placeholder:s,preventSubmitOnEnter:r=!1,onChange:o,labelAs:i,disabled:a,colorPickerProps:l,name:u,required:d,readOnly:p}=e,[f,g]=h.useState(Ic(n)),m=fl(e);h.useEffect(()=>{g(Ic(n))},[n]);const v=(w,S)=>{o==null||o(w,S)},b=w=>{switch(w.key){case"Escape":return g(n);case"Enter":v(f),r&&(w.preventDefault(),w.stopPropagation())}},x=()=>{v(f)},y=ro({...e,className:M(gR,t)});return c.jsxs("div",{...y,children:[c.jsx(js,{...e,as:i}),c.jsxs($,{className:xh(e),items:"center",space:"s",children:[c.jsx(F,{children:c.jsx(Mx,{...l,value:n,onChange:o,disabled:a})}),c.jsx(F,{grow:!0,children:c.jsx("input",{name:u,required:d,readOnly:p,disabled:a,placeholder:s,className:M(m,a&&"gs-utl-pointer-events-none"),value:f,onChange:w=>g(w.target.value),onBlur:x,onKeyDown:b})})]})]})}const Ks=ce(function(t){const{editor:n}=xe(),s=wu(),r={...Ax(n),...t.colorPickerProps},o=s.getOverrideProps("colorField",{props:{...t,colorPickerProps:r},editor:n});return c.jsx(mR,{...o})}),vR="gs-cmp-studio-color-field",bR=h.memo(ce(function(t){const{editor:n}=xe(),{onChange:s,editorEvents:r}=t,[o,i]=h.useState(()=>({...t})),a=(u,d)=>{s==null||s({value:u||"",partial:d,editor:n,state:o,setState:p=>i(f=>({...f,...p}))})},l={className:M(vR,o.className),style:o.style,value:o.value||"",size:o.size,label:o.label,name:o.name,required:o.required,readOnly:o.readOnly,placeholder:o.placeholder,disabled:o.disabled,preventSubmitOnEnter:o.preventSubmitOnEnter,colorPickerProps:o.colorPickerProps,onChange:a};return xr({editor:n,editorEvents:r,localState:o,setLocalState:i}),c.jsx(Ks,{...l})})),yR="gs-cmp-studio-color-picker",xR=h.memo(ce(function(t){const{editor:n}=xe(),r=wu().getOverrideProps("colorPicker",{props:{...Ax(n),...t},editor:n}),{className:o,style:i,value:a="",format:l,formats:u,disabled:d,onChange:p,onFormatChange:f,editorEvents:g}=r,[m,v]=h.useState(()=>({className:o,style:i,value:a,format:l,formats:u,disabled:d})),b=(y,w)=>{const S=y||"";p==null||p({value:S,partial:w,editor:n,state:m,setState:C=>v(j=>({...j,...C}))})},x=y=>f==null?void 0:f({...y,editor:n,state:m,setState:w=>v(S=>({...S,...w}))});return xr({editor:n,editorEvents:g,localState:m,setLocalState:v}),c.jsx("div",{className:M(yR,m.className,Pe.m),style:m.style,children:c.jsx(Lx,{value:m.value||"",format:m.format,formats:m.formats,onChange:b,onFormatChange:x,disabled:m.disabled})})})),wR="gs-cmp-column",SR=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(jn,{className:M(wR,z.bg,"gs-utl-flex gs-utl-flex-col",s&&"gs-utl-h-full",t),...r,children:$t(n)})}),Ih=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
322
- <path fill="currentColor" d="M20 6c0-2.168-3.663-4-8-4S4 3.832 4 6v2c0 2.168 3.663 4 8 4s8-1.832 8-4zm-8 13c-4.337 0-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4v-3c0 2.168-3.663 4-8 4"/><path fill="currentColor" d="M20 10c0 2.168-3.663 4-8 4s-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4z"/></svg>`,Co="--before-content",Vh={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},Nx={stylable:!1,traits:[]};function CR(e){return typeof e=="object"&&e.type===Ut.variable}function _1(e){if(CR(e)){const{path:t}=e;return $x(t||"")}return e}function $x(e){return`{{ ${e} }}`}function jR(e){const t={};return e.DataSources.getAll().forEach(n=>{const s=n.get("id");if(!s)return;const r=n.getRecords();if(!r){t[s]={};return}t[s]=r.reduce((o,i)=>{if(!i)return o;let a={...i.attributes};return delete a.__p,delete a.id,s===Wo.globalStyles&&(a={value:a.value}),{...o,[i.id]:a}},{})}),t}function kx(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Hh=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags)??t?{...Nx}:{}},ef=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e,s=(i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags;return t||s===!0?{...Nx}:{}},ER=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,PR=e=>Array.isArray(e)?"array":e===null?"default":typeof e,TR=ce(({name:e,value:t,isActive:n,isCollection:s,onClick:r,className:o})=>{const i=Ie().tScoped("dataSources"),a=typeof t=="object"&&t!==null,l={array:K.codeBrackets,object:K.codeBraces,string:K.codeString,number:K.number,boolean:K.toggleSwitchOffOutline,default:K.null},u=PR(t),d=M(o,"gs-utl-text-left",z.hBgH,te.b,te.rnd,Pe.xy,n?[te.bA,z.tA]:[z.br,z.txtHighEmphasisH]),p=f=>typeof f=="object"?Array.isArray(f)?i("items",{params:{length:f.length}}):f?i("properties",{params:{length:Object.keys(f).length}}):"null":String(f);return c.jsx(Ke,{onClick:r,border:!1,className:d,full:!0,children:c.jsxs($,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs($,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs($,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(se,{icon:l[u],size:oe.s}),c.jsx(F,{className:M(_e.txtEllips,s&&"gs-utl-font-bold"),children:e})]}),c.jsx(F,{className:M("gs-utl-w-full",_e.txtEllips,_e.disabled),children:p(t)})]}),a&&c.jsx(F,{children:c.jsx(se,{size:oe.sx,icon:K.arrowRight,className:M(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),OR="gs-cmp-data-path-explorer",A1=ce(function({additionalSources:t,onChange:n,path:s=""}){const{editor:r}=xe(),o=h.useRef({}),[i,a]=h.useState(()=>s.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...r?jR(r):{},...t}),[r,t]),p=(v,b)=>{let x=o.current;for(let y=0;y<b&&y<v.length;y++){const w=v[y];if(x&&typeof x=="object"&&w in x)x=x[w];else{x=void 0;break}}return!x||typeof x!="object"?[]:Object.entries(x).map(([y,w])=>{const S=v.slice(0,b).concat(y),C=i[b]===y,j=b===0&&yr(w)&&w.collectionId===y,E=()=>{const O=C?S.slice(0,-1):S;n==null||n(O.join("."),{paths:O}),a(O)};return c.jsx(TR,{className:M(j&&"-gs-utl-order-1"),isCollection:j,name:y,value:w,isActive:C,onClick:E},y)})};h.useEffect(()=>{o.current=d;const v=[];for(let b=0;b<=i.length;b++){const x=p(i,b);x.length>0&&v.push(x)}u(v)},[d,i]);const f=M(OR,z.bg,z.br,te.b,te.rnd,_e.scrollX,"gs-utl-h-full"),g=M("gs-utl-min-w-[220px]",z.br),m=M("gs-utl-h-full gs-utl-max-h-[60vh]",_e.scrollY,Pe.xyS);return c.jsx($,{className:f,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(F,{className:M(g,b!==l.length-1&&te.br),children:c.jsx($,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function Rx(e){const{collectionId:t,variableType:n,path:s=""}=e;return t?[t,n,s].filter(Boolean).join("."):s}function Dh(e,t){const[n="",s="",...r]=e.split(".");return n&&t[n]?{collectionId:n,variableType:s,path:r.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const _R=e=>{const{path:t,collectionId:n,variableType:s}=e.dataResolver||{};return n?[n,s,t].filter(Boolean).join("."):e.value||t||""},AR=e=>{const{dataResolver:t,editor:n,value:s,defaultValue:r,additionalSources:o}=e,{path:i="",collectionId:a,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(a){const d=o==null?void 0:o[a],p=l&&d?d[l]:d;return(u==null?void 0:u.getValue(i,r,{context:p}))||""}else return(u==null?void 0:u.getValue(s,r))||""},LR="gs-cmp-data-path-field",yl=ce(e=>{const{size:t="m",value:n="",label:s,open:r,defaultValue:o,additionalSources:i,dataResolver:a,readOnly:l,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:f}=e,{editor:g}=xe(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!r),[x,y]=h.useState(!1),w=!!l||v||x,S=()=>y(!x),C=H=>{const B=H??!v;b(B),f==null||f(B)},j=()=>C(!1),E=(...H)=>{p==null||p(...H)},O=H=>{w||p==null||p(H,{paths:H.split(".")})},P=_R({dataResolver:a,value:n}),T=x&&g?`"${AR({editor:g,dataResolver:a,additionalSources:i,value:n,defaultValue:o})}"`:P,A=t==="m",_=A?"lg":t,N=A?oe.l:oe.s,D=m(v?"closePathExplorer":"openPathExplorer"),L={icon:v?K.close:K.databaseOutline,size:oe.l},V={icon:x?K.eyeOff:K.eye,size:A?oe.m:N},U=c.jsx(St,{block:!0,variant:"pr",size:_,title:D,onClick:()=>C(),icon:L});return c.jsxs($,{className:LR,gap:t,col:!0,children:[c.jsxs($,{gap:t,items:"end",nowrap:!0,children:[c.jsx(ot,{readOnly:w,label:s,value:x?T:P,size:t,disabled:u,onChange:O,placeholder:m("selectVariablePath"),className:M("gs-utl-flex-grow",z.txt,_e.txtEllips),afterInput:!!n&&c.jsx(St,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:S,className:_e.hover,icon:V})}),d?c.jsx(Es,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:U,onClose:j,overlay:!0,children:c.jsx(A1,{path:P,onChange:E,additionalSources:i})}):U]}),!!v&&!d&&c.jsx(A1,{path:P,onChange:E,additionalSources:i})]})}),MR=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},Ix=({value:e,step:t})=>{const n=parseFloat(`${e}`);let s=0;if(Math.floor(n)!==n&&t){const r=`${t}`.split(".")[1];s=(r==null?void 0:r.length)||0}return s?parseFloat(n.toFixed(s)):n},NR=({value:e,key:t,shiftKey:n,min:s,max:r,step:o=1})=>{const i=t==="ArrowUp",a=t==="ArrowDown";let l=null;if(i||a){l=Number(e);const u=parseFloat(`${o}`);i&&(l+=(n?10:1)*u),a&&(l-=(n?10:1)*u),l=`${Vu({min:s,max:r,value:l})}`,l=Ix({value:l,step:o})}return l},Vu=({min:e,max:t,value:n})=>{const s=parseFloat(`${n}`);let r=s||0;return Dt(e)&&(r=Math.max(r,parseFloat(`${e}`)||0)),Dt(t)&&(r=Math.min(r,parseFloat(`${t}`)||0)),`${`${s}`!=`${n}`?n:r}`},$R=(e,t,n,s={})=>{const r=parseInt(`${e}`,10)||0,{min:o,max:i,step:a=1}=s;let l=r;const u=p=>{const f=p.clientY-t,g=r-f*parseFloat(`${a}`);l=Ix({value:Vu({min:o,max:i,value:g}),step:a}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},kR=(e,t,n={})=>{const{partial:s}=n,r=(o,i)=>o===i||s&&o.startsWith(i);return t.some(o=>r(typeof o=="string"?o:o.id,e))},L1=e=>Dt(e)?e:"",RR="gs-cmp-number-field";function Ne(e){const{className:t,value:n,units:s,valueUnit:r,size:o="m",pan:i=!0,min:a,max:l,step:u,placeholder:d,disabled:p,onChange:f,onChangeUnit:g}=e,[m,v]=h.useState(L1(n)),[b,x]=h.useState(!1),y=(s==null?void 0:s.map(P=>({id:P,label:P})))||[],w={min:a,max:l,step:u};h.useEffect(()=>{v(L1(n))},[n,r]);const S=(P,T)=>{f==null||f(Vu({min:a,max:l,value:P}),T)},C=P=>{if(p)return;x(!0);const T=(A,_)=>{S(A,!!_),!_&&x(!1)};$R(m,P.clientY,T,w)},j=P=>{const{key:T,shiftKey:A}=P;switch(T){case"Escape":return v(n);case"Enter":return S(m)}const _=NR({step:u,value:n,key:T,shiftKey:A});_!==null&&(P.preventDefault(),S(_))},E=()=>{S(m)},O=ro({...e,className:M(RR,t)});return c.jsxs("div",{...O,children:[b&&c.jsx("div",{className:M("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(js,{as:e.labelAs,...e}),c.jsxs($,{className:xh(e),items:"center",space:"x2s",children:[!!i&&c.jsx(F,{onMouseDown:C,className:M("gs-utl-opacity-50 gs-utl-cursor-ns",o==="m"&&"-gs-utl-ml-3",o==="s"&&"-gs-utl-ml-2",i!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:i===!0?c.jsx(se,{icon:K.panVertical,size:oe.s2x}):i}),c.jsx(F,{grow:!0,children:c.jsx("input",{className:fl(e),value:m,disabled:p,onChange:P=>v(P.target.value),placeholder:d,onBlur:E,onKeyDown:j})}),!!y.length&&c.jsx(F,{className:M(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Ae,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:r,disabled:p,onChange:P=>g==null?void 0:g(P),options:y})})]})]})}const IR="gs-cmp-switch-field";function Ia(e){const{className:t,value:n,label:s,labelAs:r,border:o,disabled:i,onChange:a}=e,l=!!n,u=M("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",l?z.bgA:z.bgH,Ca.focus,o&&`${z.br} ${te.b}`);return c.jsx(hd.Group,{children:c.jsxs($,{items:"center",className:M(IR,t),full:!0,children:[!!s&&c.jsx(hd.Label,{as:r,className:M("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(js,{...e,as:"span"})}),c.jsx(hd,{checked:l,onChange:a,className:u,disabled:i,children:c.jsx("span",{className:M(z.bg,"gs-utl-inline-block gs-utl-w-4 gs-utl-h-4 gs-utl-transform gs-utl-rounded-full gs-utl-transition-transform",l?"gs-utl-translate-x-6":"gs-utl-translate-x-1")})})]})})}function Fh(e){var i;const[t,n]=h.useState(((i=e.getDataResolver)==null?void 0:i.call(e))??{}),s=h.useRef(t),r=a=>{const l={...s.current,...a};s.current=l,n(l)},o=()=>{e.setDataResolver(s.current)};return h.useEffect(()=>{const a="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(a,l),()=>{e.off(a,l)}},[e]),{localData:t,updateLocalData:r,syncToComponent:o}}const VR="gs-cmp-data-collection-picker",HR=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Fh(e),{collectionId:o="",dataSource:i={},startIndex:a=0,endIndex:l=10}=n,u=Rx(i),d=l===Number.MAX_VALUE,p=Ie().tScoped("dataSources"),f=d?"":l,g=()=>{r(),t==null||t({value:n})},m=y=>s({dataSource:{...i,path:y}}),v=y=>s({startIndex:y}),b=y=>s({endIndex:y}),x=y=>s({endIndex:y?Number.MAX_VALUE:4});return c.jsxs($,{className:VR,gap:"s",col:!0,nowrap:!0,children:[c.jsxs($,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(ot,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:o,readOnly:!0,disabled:!0}),c.jsx(jy,{size:"s",value:o,block:!0})]}),c.jsx(yl,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs($,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Ne,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:a==null?void 0:a.toString(),onChange:v}),c.jsx(Ne,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:f==null?void 0:f.toString(),onChange:b,className:M("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(F,{children:c.jsx(Ia,{label:p("collectionUpToEndIndex"),value:d,onChange:x})})]}),c.jsx($,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:p("confirm")})})]})}),DR="gs-data-collection-picker",FR=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:M(DR,t),...r,children:c.jsx(HR,{component:n,onConfirm:s})})});var kn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(kn||{}),On=(e=>(e.equals="equals",e.isTruthy="isTruthy",e.isFalsy="isFalsy",e.isDefined="isDefined",e.isNull="isNull",e.isUndefined="isUndefined",e.isArray="isArray",e.isObject="isObject",e.isString="isString",e.isNumber="isNumber",e.isBoolean="isBoolean",e.isDefaultValue="isDefaultValue",e))(On||{}),Bh=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Bh||{}),zh=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(zh||{});const BR=[...Object.values(zh),...Object.values(Bh),...Object.values(On)],tf={string:Object.values(zh),number:Object.values(Bh),dataSource:BR},zR=h.memo(function(t){const{additionalSources:n,side:s,type:r,value:o,onChange:i}=t;switch(r){case kn.DATA_SOURCE:return c.jsx(yl,{size:"s",pickerInPopover:!0,value:Rx(o),onChange:a=>i(s,a,r),additionalSources:n});case kn.NUMBER:return c.jsx(Ne,{size:"s",value:o,onChange:a=>i(s,a,r)});default:return c.jsx(ot,{size:"s",value:o,onChange:a=>i(s,a,r)})}}),UR="gs-cmp-statement-side",M1=h.memo(function({side:t,type:n,value:s,label:r,onChange:o,onTypeChange:i,additionalSources:a,typeOptions:l}){return c.jsxs($,{className:M(UR,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Kr,{size:"s",children:r}),c.jsxs($,{items:"center",gap:"xs",children:[c.jsx(F,{children:c.jsx(Ae,{size:"s",value:n,options:l,onChange:u=>i(t,u)})}),c.jsx(F,{grow:!0,children:c.jsx(zR,{additionalSources:a,side:t,type:n,value:s,onChange:o})})]})]})}),Ul=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?kn.DATA_SOURCE:typeof e=="string"?kn.STRING:typeof e=="number"?kn.NUMBER:kn.STRING,WR=(e,t,n)=>{switch(t){case kn.STRING:return e||"";case kn.NUMBER:return e?Number(e):0;case kn.DATA_SOURCE:{const s=n||{};return{type:"data-variable",...(dt(e)?Dh(e,s):e)??{path:"",defaultValue:""}}}default:return e}},GR=e=>tf[e][0],qR=e=>![On.isTruthy,On.isFalsy,On.isDefined,On.isNull,On.isUndefined,On.isArray,On.isObject,On.isString,On.isNumber,On.isBoolean,On.isDefaultValue].includes(e),KR="gs-cmp-statement",ZR=ce(e=>{const{statement:t,onChange:n,className:s,additionalSources:r}=e,o=Ie().tScoped("dataSources"),[i,a]=h.useState(()=>Ul(t.left)),[l,u]=h.useState(()=>Ul(t.right)),d=tf[i]||tf[kn.STRING],p=h.useMemo(()=>Object.values(kn).map(S=>({id:S,label:Is(S)})),[]),f=h.useMemo(()=>d.map(S=>({id:S,label:o(`operators.${S}`)})),[d,o]);h.useEffect(()=>{a(Ul(t.left)),u(Ul(t.right))},[t.left,t.right]);const g=S=>{n({...t,...S})},m=(S,C,j)=>{const E=WR(C,j,r),O=S==="left",P=O&&j!==kn.DATA_SOURCE;O?a(j):u(j),g({[S]:E,...P&&{operator:GR(j)}})},v=(S,C)=>m(S,null,C),b=S=>g({operator:S}),x=M(KR,s,z.br,te.b,te.rnd,Pe.xy),y=qR(t.operator),w={additionalSources:r,onChange:m,onTypeChange:v,typeOptions:p};return c.jsx($,{className:M(x,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs($,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(M1,{side:"left",type:i,value:t.left,label:o("leftValue"),...w}),c.jsx(F,{children:c.jsx(Ae,{size:"s",label:o("operator"),value:t.operator,options:f,onChange:b})}),y&&c.jsx(M1,{side:"right",type:l,value:t.right,label:o("rightValue"),...w})]})})}),Ud="gs-cmp-statements-group",YR=e=>e==="and"||e==="or",zc=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),Vx=ce(e=>{const{className:t,condition:n,onUpdate:s,additionalSources:r,skipAddCondition:o}=e,i=Ie().tScoped("dataSources"),a=n.statements??[],l=n.logicalOperator||"and",u=m=>{YR(m)&&s({...n,logicalOperator:m})},d=()=>{zc(n),s(zc(n))},p=m=>{const v=a.filter((b,x)=>x!==m);s({...n,statements:v})},f=(m,v)=>{if(m>=0&&m<a.length){const b=[...a];b[m]=v,s({...n,statements:b})}},g=[{id:"and",label:i("conditionAnd")},{id:"or",label:i("conditionOr")}];return c.jsxs($,{className:M(Ud,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[a.length>1&&c.jsx(io,{value:l,onChange:u,tabs:g}),c.jsx($,{className:`${Ud}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:a.map((m,v)=>c.jsxs($,{className:M(`${Ud}__item`),gap:"s",col:!0,children:[c.jsx(ZR,{additionalSources:r,statement:m,onChange:b=>f(v,b)}),v<a.length-1&&c.jsxs($,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:M(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(St,{block:!0,variant:"out-clear",title:i("deleteCondition"),onClick:()=>p(v+1),icon:{icon:K.delete,size:oe.s}})]})]},`stmt-${v}`))}),!o&&c.jsx($,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:K.plus,size:oe.s},children:i("addCondition")})})]})}),XR="gs-cmp-data-condition-picker",JR=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Fh(e),o=Ie().tScoped("dataSources"),i=n.condition,a=d=>s({condition:d}),l=()=>{r(),t==null||t({value:n})},u=()=>{s({condition:zc(i)})};return c.jsxs($,{className:XR,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(Vx,{additionalSources:e.collectionsStateMap??{},condition:i,onUpdate:a,skipAddCondition:!0}),c.jsxs($,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:K.plus,size:oe.s},children:o("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:o("confirm")})]})]})}),QR="gs-data-condition-picker",e6=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:M(QR,t),...r,children:c.jsx(JR,{component:n,onConfirm:s})})}),t6="gs-data-path-field",n6=ce(({className:e,value:t="",onChange:n,...s})=>c.jsx(jn,{className:M(t6,e),...s,children:c.jsx(yl,{onChange:r=>n({value:r}),value:t})})),Wl={type:"data-variable",path:"",defaultValue:""},N1={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function Yr(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const $1="gs-cmp-dynamic-value-picker",s6=ce(({value:e,onChange:t,onConfirm:n,additionalSources:s})=>{const[r,o]=h.useState(()=>Yr(e)?e:Wl),[i,a]=h.useState(r.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const w=Yr(e)?e:Wl;(w.type!==r.type||JSON.stringify(w)!==JSON.stringify(r))&&(o(w),a(w.type))},[e]);const u=w=>{o(w),t==null||t({value:w})},d=w=>{const S=w;a(S);const C=r.type===S?r:S==="data-variable"?Wl:N1;u(C)},p=w=>{u({type:"data-variable",defaultValue:r.defaultValue,...Dh(w,s)})},f=w=>{o(S=>{const C={...S,defaultValue:w};return t==null||t({value:C}),C})},g=w=>{u({...r,condition:w})},m=(w,S)=>{u({...r,[w]:S})},v=()=>{const w=r.condition;g(zc(w))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],x=(r==null?void 0:r.type)==="data-variable"?r:Wl,y=(r==null?void 0:r.type)==="data-condition"?r:N1;return c.jsxs($,{className:$1,gap:"s",col:!0,nowrap:!0,children:[c.jsxs($,{className:$1,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(io,{value:i,onChange:d,tabs:b}),c.jsx(F,{grow:!0,className:Pe.y,style:{overflowY:"auto",overflowX:"hidden"},children:i==="data-variable"?c.jsxs($,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(yl,{value:x.path,label:l("variablePath"),additionalSources:s,defaultValue:x.defaultValue,onChange:p}),c.jsx(ot,{label:l("defaultValue"),value:x.defaultValue||"",onChange:f})]}):c.jsxs($,{gap:"m",col:!0,children:[c.jsx(Vx,{additionalSources:s,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs($,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(ot,{label:l("ifTrue"),value:y.ifTrue,onChange:w=>m("ifTrue",w)}),c.jsx(ot,{label:l("ifFalse"),value:y.ifFalse,onChange:w=>m("ifFalse",w)})]})]})}),i==="data-condition"&&c.jsx($,{full:!0,justify:"end",className:Pe.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:K.plus,size:oe.s},children:l("addCondition")})})]}),c.jsx($,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:r})},variant:"pr",size:"m",children:l("confirm")})})]})}),r6="gs-data-value-picker",o6=ce(({className:e,value:t={},onChange:n,onConfirm:s,additionalSources:r={},...o})=>c.jsx(jn,{className:M(r6,e),...o,children:c.jsx(s6,{value:t,onConfirm:i=>s==null?void 0:s(i),onChange:i=>n==null?void 0:n(i),additionalSources:r})})),i6="gs-cmp-data-variable-picker",a6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Fh(e),o=Ie().tScoped("dataSources"),{path:i="",defaultValue:a=""}=n,l=e.collectionsStateMap,u=f=>{s(Dh(f,l))},d=()=>{r(),t==null||t({value:n})},p=f=>s({defaultValue:f});return c.jsxs($,{className:i6,gap:"s",col:!0,nowrap:!0,children:[c.jsx(yl,{value:i,label:o("variablePath"),dataResolver:n,additionalSources:l,defaultValue:a,onChange:u}),c.jsx(ot,{label:o("defaultValue"),value:a,onChange:p}),c.jsx($,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:o("confirm")})})]})}),l6="gs-data-variable-picker",c6=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:M(l6,t),...r,children:c.jsx(a6,{component:n,onConfirm:s})})}),u6="gs-cmp-input-field",d6=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,size:i,disabled:a,inputType:l,readOnly:u,required:d,placeholder:p,onChange:f,onInput:g,editorEvents:m}){const{editor:v}=xe(),[b,x]=h.useState(()=>({className:t,style:n,label:s,name:r,value:o,size:i,readOnly:u,disabled:a,required:d,placeholder:p})),y=C=>({value:C,editor:v,state:b,setState:j=>x(E=>({...E,...j}))}),w=C=>f==null?void 0:f(y(C)),S=C=>g==null?void 0:g(y(C));return xr({editor:v,editorEvents:m,localState:b,setLocalState:x}),c.jsx(ot,{type:l,className:M(u6,b.className),style:b.style,label:b.label,name:b.name,value:b.value,size:b.size,required:b.required,disabled:b.disabled,readOnly:b.readOnly,placeholder:b.placeholder,onChange:w,onInput:S})})),p6="gs-menu-list",f6=ce(function({className:e,items:t,onItemClick:n,...s}){const{editor:r}=xe(),[o,i]=h.useState(),a=u=>{const{onClick:d}=u;if(d&&r)return p=>d({item:u,editor:r,...p})},l=()=>{if(n&&r)return u=>n({...u,editor:r})};return c.jsx(jn,{className:M(p6,z.bg,"gs-utl-flex gs-utl-flex-col",e),...s,children:(t||[]).map((u,d)=>h.createElement(ki,{...u,label:u.layout?$t(u.layout):u.label,key:u.id??d,className:u.className,action:a(u),onActive:()=>i(u),onItemClick:l(),active:o===u,items:u.items}))})});function h6({children:e,accept:t,onChange:n,multiple:s=!0,...r}){const o=Ie(),i=h.useRef(null),a=()=>{const{current:l}=i;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:Y("hidden"),ref:i,type:"file",multiple:s,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...r,onClick:a,children:e||o.t("upload")})]})}const g6=ce(h6),m6=ce(function({editor:t,assetProps:n,itemLayout:s,onSelect:r,onRemove:o}){const i=ul();return $t(s({asset:us(i.toAsset(n)),assetProps:us(n),onSelect:a=>r(i.toAssetProps(a)),onDelete:o&&(a=>o(i.toAssetProps(a))),editor:t}))}),v6="gs-cmp-asset-card",b6=ce(function(t){var p;const{assetProps:n,onSelect:s,onRemove:r,className:o,itemLayout:i}=t,a=Ie(),{editor:l}=xe();if(i)return l?c.jsx(m6,{...t,editor:l,itemLayout:i}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return c.jsx(rs,{padding:!1,className:ie(v6,"overflow-hidden max-w-full group",o),children:c.jsxs($,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-24 cursor-pointer bg-checker"),onClick:()=>s(n),children:[c.jsx("div",{className:ie("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx($,{justify:"center",items:"center",className:ie(_e.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ie("text-sm"),size:"m2",variant:"pr",children:a.t("select")})})]}),c.jsxs($,{className:ie("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(F,{className:ie(_e.txtEllips,"text-sm gjs-mr-auto"),children:d}),r&&c.jsx(ku,{onConfirm:()=>r==null?void 0:r(n),text:c.jsxs($,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ie("text-center",z.txtHighEmphasis),children:a.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ie("text-center"),children:a.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(St,{title:a.t("delete"),children:c.jsx(se,{icon:K.delete,size:oe.sx})})})]})]})})}),Un="gs-asset-manager",y6={search:!0,addUrl:!0,upload:!0},x6=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:s,typeFilter:r,providerFilter:o,searchValue:i,isLoading:a,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:f,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:x,onAddUrl:y,onRemove:w,onEndReached:S,layoutAfterHeader:C}){const j=xe(),{editor:E}=j,O=Ie(),[P]=mh(),T=$h(f==null?void 0:f.itemsPerRow),[A,_]=h.useState(""),N=(f==null?void 0:f.header)===!1?!1:{...y6,...yr(f==null?void 0:f.header)?f.header:{}};if(!E)return;const D=d?t.filter(L=>!(i&&!pi(L.src,i)&&!pi(L.name??"",i))):t;return c.jsxs($,{className:Y(Un,"relative gs-utl-h-full",a&&_e.disabled),nowrap:!0,col:!0,space:"m",children:[N!==!1&&c.jsxs($,{className:`${Un}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs($,{className:`${Un}__header-filters`,items:"center",gap:"m",children:[N.search&&c.jsx(F,{children:c.jsx(ot,{className:`${Un}__search-filter`,size:"m",type:"search",value:i,onInput:b,placeholder:`${O.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(F,{children:c.jsx(Ae,{className:Y(`${Un}__type-filter`,"items-center"),size:"m",options:n,value:r,onChange:m,emptyState:O.t("assetManager.assetTypes.all"),includeEmpty:l})}),s.length>(u?0:1)&&c.jsx(F,{children:c.jsx(Ae,{classNameContainer:Y(`${Un}__provider-filter`,"items-center"),size:"m",options:s.map(L=>({...L,label:tt(L.label)?L.label({editor:E}):L.label,icon:L.icon})),value:o,onChange:v,emptyState:O.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs($,{className:`${Un}__header-buttons`,items:"center",gap:"m",children:[N.upload&&c.jsx(F,{className:`${Un}__upload`,children:c.jsx(g6,{className:`${Un}__upload-field`,onChange:x})}),N.addUrl&&!!y&&c.jsx(F,{className:`${Un}__add-url`,children:c.jsx(Es,{className:`${Un}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Ke,{variant:"pr",size:"m2",children:O.t("assetManager.addUrl")}),children:({close:L})=>c.jsx("form",{onSubmit:V=>{V.preventDefault(),y(A),_(""),L()},children:c.jsxs($,{gap:"m",children:[c.jsx(F,{children:c.jsx(ot,{type:"url",size:"s",pattern:"https?://.+",value:A,onChange:_,placeholder:O.t("assetManager.inputPlh"),required:!0})}),c.jsx(F,{children:c.jsx(Ke,{variant:"pr",size:"m2",type:"submit",children:O.t("add")})})]})})})})]}),C&&c.jsx(c.Fragment,{children:$t(C({editor:E}))})]}),c.jsx($,{className:Y(`${Un}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!a&&!D.length?c.jsx($,{justify:"center",children:O.t("noItems")}):!!P&&c.jsx($u,{data:D,listClassName:Y("gs-utl-grid gs-utl-gap-2",T),endReached:S,itemContent:(L,V)=>c.jsx(b6,{assetProps:V,onSelect:g,onRemove:w,itemLayout:p},V.id),components:{Footer:S?w6:void 0}})}),a&&c.jsx(Ur,{abs:!0})]})}),w6=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),S6=ce(function({panelId:t,content:n,assets:s,types:r,providers:o,typeId:i,providerId:a,optionalType:l,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:f}){const{appEditorStore:g,i18nStore:m}=En(),{editor:v}=g,b=ul(),{customOnLoad:x}=b,y=Y0(t);h.useEffect(()=>{const E=P=>dt(P)?{id:P,label:m.t(`assetManager.assetTypes.${P}`)||P}:P;y.setCustomTypes(r==null?void 0:r.map(E)),y.setCustomProviders(dt(o)?[o]:o),i?y.setTypeFilter(i):y.initTypeFilter(),a?y.setProviderFilter(a):y.initProviderFilter(),Dt(l)?y.setOptionalType(l):y.initOptionalType(),Dt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const O=setTimeout(()=>y.loadAssets());return()=>clearTimeout(O)},[r,o,i,a,l,u]);const w=E=>{b.addToProjectAssets([{id:E,src:E,type:y.typeFilter??To.image}])},S=E=>{v&&(d==null||d({asset:b.toAsset(E),assetProps:E,editor:v}),p==null||p())},C=s==null?void 0:s.map(b.toAssetProps),j=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(x6,{assetProps:C??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:E=>{y.setTypeFilter(E),y.loadAssets()},onChangeProviderFilter:E=>{y.setProviderFilter(E),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:S,onAddUrl:x?void 0:w,onChangeUpload:E=>b.uploadFile(E.nativeEvent),onRemove:C?void 0:y.handleDelete,onEndReached:j,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:f})});var C6=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Rt=function(){return Rt=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Rt.apply(this,arguments)},k1={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},R1={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Gl={width:"20px",height:"20px",position:"absolute"},j6={top:Rt(Rt({},k1),{top:"-5px"}),right:Rt(Rt({},R1),{left:void 0,right:"-5px"}),bottom:Rt(Rt({},k1),{top:void 0,bottom:"-5px"}),left:Rt(Rt({},R1),{left:"-5px"}),topRight:Rt(Rt({},Gl),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Rt(Rt({},Gl),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Rt(Rt({},Gl),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Rt(Rt({},Gl),{left:"-10px",top:"-10px",cursor:"nw-resize"})},E6=function(e){C6(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(s){n.props.onResizeStart(s,n.props.direction)},n.onTouchStart=function(s){n.props.onResizeStart(s,n.props.direction)},n}return t.prototype.render=function(){return rt.createElement("div",{className:this.props.className||"",style:Rt(Rt({position:"absolute",userSelect:"none"},j6[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(rt.PureComponent),P6=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),As=function(){return As=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},As.apply(this,arguments)},T6={width:"auto",height:"auto"},ql=function(e,t,n){return Math.max(Math.min(e,n),t)},I1=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},ei=function(e,t){return new RegExp(e,"i").test(t)},Kl=function(e){return!!(e.touches&&e.touches.length)},O6=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},V1=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(o,i,a){return Math.abs(i-e)<Math.abs(t[o]-e)?a:o},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},Wd=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},Zl=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},_6=function(e,t,n,s,r,o,i){return s=Zl(s,e.width,t,n),r=Zl(r,e.height,t,n),o=Zl(o,e.width,t,n),i=Zl(i,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof i>"u"?void 0:Number(i)}},A6=function(e){return Array.isArray(e)?e:[e,e]},L6=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],H1="__resizable_base__",M6=function(e){P6(t,e);function t(n){var s,r,o,i,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var u=a.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(H1):u.className+=H1,l.appendChild(u),u},a.removeBase=function(l){var u=a.parentNode;u&&u.removeChild(l)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(i=(o=a.propsSize)===null||o===void 0?void 0:o.height)!==null&&i!==void 0?i:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||T6},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,o=this.resizable.offsetHeight,i=this.resizable.style.position;i!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,this.resizable.style.position=i}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var l;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((l=n.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),p=d/u[a]*100;return p+"%"}return Wd(n.state[a])},o=s&&typeof s.width<"u"&&!this.state.isResizing?Wd(s.width):r("width"),i=s&&typeof s.height<"u"&&!this.state.isResizing?Wd(s.height):r("height");return{width:o,height:i}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return s&&(this.parentNode.style.flexWrap=r),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,o=this.state.direction,i=r&&ei("left",o),a=r&&ei("top",o),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=i?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,o=A6(this.props.resizeRatio||1),i=o[0],a=o[1],l=this.state,u=l.direction,d=l.original,p=this.props,f=p.lockAspectRatio,g=p.lockAspectRatioExtraHeight,m=p.lockAspectRatioExtraWidth,v=d.width,b=d.height,x=g||0,y=m||0;return ei("right",u)&&(v=d.width+(n-d.x)*i/r,f&&(b=(v-y)/this.ratio+x)),ei("left",u)&&(v=d.width-(n-d.x)*i/r,f&&(b=(v-y)/this.ratio+x)),ei("bottom",u)&&(b=d.height+(s-d.y)*a/r,f&&(v=(b-x)*this.ratio+y)),ei("top",u)&&(b=d.height-(s-d.y)*a/r,f&&(v=(b-x)*this.ratio+y)),{newWidth:v,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,o){var i=this.props,a=i.lockAspectRatio,l=i.lockAspectRatioExtraHeight,u=i.lockAspectRatioExtraWidth,d=typeof o.width>"u"?10:o.width,p=typeof r.width>"u"||r.width<0?n:r.width,f=typeof o.height>"u"?10:o.height,g=typeof r.height>"u"||r.height<0?s:r.height,m=l||0,v=u||0;if(a){var b=(f-m)*this.ratio+v,x=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,w=(p-v)/this.ratio+m,S=Math.max(d,b),C=Math.min(p,x),j=Math.max(f,y),E=Math.min(g,w);n=ql(n,S,C),s=ql(s,j,E)}else n=ql(n,d,p),s=ql(s,f,g);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*n,this.targetTop=o.top*n}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,l=i.top,u=i.right,d=i.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,o=0;if(n.nativeEvent&&O6(n.nativeEvent)?(r=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&Kl(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,o=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var i=this.props.onResizeStart(n,s,this.resizable);if(i===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:r,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:As(As({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(p)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Kl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,o=r.maxWidth,i=r.maxHeight,a=r.minWidth,l=r.minHeight,u=Kl(n)?n.touches[0].clientX:n.clientX,d=Kl(n)?n.touches[0].clientY:n.clientY,p=this.state,f=p.direction,g=p.original,m=p.width,v=p.height,b=this.getParentSize(),x=_6(b,this.window.innerWidth,this.window.innerHeight,o,i,a,l);o=x.maxWidth,i=x.maxHeight,a=x.minWidth,l=x.minHeight;var y=this.calculateNewSizeFromDirection(u,d),w=y.newHeight,S=y.newWidth,C=this.calculateNewMaxFromBoundary(o,i);this.props.snap&&this.props.snap.x&&(S=V1(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=V1(w,this.props.snap.y,this.props.snapGap));var j=this.calculateNewSizeFromAspectRatio(S,w,{width:C.maxWidth,height:C.maxHeight},{width:a,height:l});if(S=j.newWidth,w=j.newHeight,this.props.grid){var E=I1(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),O=I1(w,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),P=this.props.snapGap||0,T=P===0||Math.abs(E-S)<=P?E:S,A=P===0||Math.abs(O-w)<=P?O:w;S=T,w=A}var _={width:S-g.width,height:w-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var N=S/b.width*100;S=N+"%"}else if(m.endsWith("vw")){var D=S/this.window.innerWidth*100;S=D+"vw"}else if(m.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}if(v&&typeof v=="string"){if(v.endsWith("%")){var N=w/b.height*100;w=N+"%"}else if(v.endsWith("vw")){var D=w/this.window.innerWidth*100;w=D+"vw"}else if(v.endsWith("vh")){var L=w/this.window.innerHeight*100;w=L+"vh"}}var V={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(w,"height")};this.flexDir==="row"?V.flexBasis=V.width:this.flexDir==="column"&&(V.flexBasis=V.height);var U=this.state.width!==V.width,H=this.state.height!==V.height,B=this.state.flexBasis!==V.flexBasis,k=U||H||B;k&&$n.flushSync(function(){s.setState(V)}),this.props.onResize&&k&&this.props.onResize(n,f,this.resizable,_)}},t.prototype.onMouseUp=function(n){var s,r,o=this.state,i=o.isResizing,a=o.direction,l=o.original;if(!(!i||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,u),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:As(As({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(n){var s=this,r=this.props,o=r.enable,i=r.handleStyles,a=r.handleClasses,l=r.handleWrapperStyle,u=r.handleWrapperClass,d=r.handleComponent;if(!o)return null;var p=n.filter(function(f){return o[f]!==!1}).map(function(f){return o[f]!==!1?rt.createElement(E6,{key:f,direction:f,onResizeStart:s.onResizeStart,replaceStyles:i&&i[f],className:a&&a[f]},d&&d[f]?d[f]:null):null});return rt.createElement("div",{className:u,style:l},p)},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(i,a){return L6.indexOf(a)!==-1||(i[a]=n.props[a]),i},{}),r=As(As(As({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return rt.createElement(o,As({style:r,className:this.props.className},s,{ref:function(i){i&&(n.resizable=i)}}),this.state.isResizing&&rt.createElement("div",{style:this.state.backgroundStyle}),this.renderResizer(["topLeft","top","topRight","left"]),this.props.children,this.renderResizer(["right","bottomLeft","bottom","bottomRight"]))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(rt.PureComponent);function Hu({className:e,children:t,top:n,bottom:s,right:r,left:o,width:i,height:a,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,onResize:g,onResizeStop:m,...v}){const b={top:n||!1,right:r||!1,bottom:s||!1,left:o||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},x={width:i||"auto",height:a||"auto"},y=M("gs-utl-z-10",z.hBgAct),w={top:y,bottom:y,right:y,left:y},S={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(M6,{className:e,enable:v.enable??b,defaultSize:x,handleStyles:S,handleClasses:w,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,children:t})}const Uh="gs-cmp-accordion",nf=`${Uh}-handler`,Yl=`${nf}__content`,N6=`${Uh}-content`;function vr({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:s,style:r,handler:o,handlerIcon:i,children:a,inverted:l,disabled:u,sticky:d,onChange:p,open:f}){return c.jsx(dd,{as:"div",defaultOpen:f,className:Y(Uh,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(dd.Button,{as:u?"div":"button",disabled:u,style:r,onClick:m=>p==null?void 0:p({event:m,open:!g}),className:({open:m})=>M(nf,tt(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs($,{items:"center",className:Y("gap-2"),full:!0,children:[c.jsx(F,{className:Y(Yl,s,"text-left"),grow:!0,children:tt(o)?o(m):c.jsxs($,{items:"center",className:Y(`${Yl}-wrp`,"gap-3"),nowrap:!0,children:[!!i&&c.jsx(se,{className:Y(`${Yl}-icon`),icon:i,size:oe.s2x}),c.jsx(F,{className:Y(`${Yl}-label gs-utl-w-full`),children:o})]})}),c.jsx(F,{className:Y(`${nf}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(se,{icon:K.chevronDown,className:Y("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(dd.Panel,{className:Y(N6,n),children:a})]})})}const Xi="gs-studio-panel",Hx=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Ps=h.memo(function({children:t,header:n,resizable:s,className:r,classNameAccordion:o,classNameAccordionContent:i,...a}){const l=c.jsx(jn,{className:M(Xi,r),...a,children:t}),u=s?s===!0?{top:!0,right:!0,bottom:!0,left:!0}:s:void 0,d=u?c.jsx(Hu,{className:M([`${Xi}__resizer`]),...u,children:l}):l,p=n===!0?{collapsible:!0}:n||void 0;return p?c.jsx(vr,{classNameWrap:M(`${Xi}__accordion`,o),className:M(`${Xi}__accordion-header`,Pe.xy,p.className),classNameContent:M(`${Xi}__accordion-content`,i),disabled:p.collapsible===!1,style:p.style,handler:c.jsxs($,{space:"s",items:"center",children:[!!p.icon&&c.jsx(se,{icon:p.icon,size:oe.s}),c.jsx(F,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),$6="gs-panel-assets",k6=h.memo(ce(function({className:t,onSelect:n,content:s,assets:r,types:o,providers:i,typeId:a,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:f,...g}){var C;const m=xe(),v=ul(),b=m.editor,x=(C=m.sdkOptions.assets)==null?void 0:C.layoutAfterHeader,y=f||x,[w]=h.useState(()=>g.id||L0());return h.useEffect(()=>(v.createAssetManager(w),()=>{v.removeAssetManager(w)}),[w]),Y0(w)?c.jsx(Ps,{className:M($6,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:b&&c.jsx(S6,{panelId:w,assets:r,types:o,providers:i,onSelect:n,typeId:a,providerId:l,content:s,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null}));var oa=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(oa||{}),ks=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(ks||{});const Ji="gs-block-item",R6=e=>{const{block:t,className:n,itemLayout:s,onClick:r,variant:o}=e,{editor:i}=xe(),a=Ie(),[,l]=h.useState(0),u=a.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),f=r||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),v=t.getMedia(),b=t.get("attributes")||{},x=u(d)||t.getLabel(),y=o==="compact",w=M(Ji,`${Ji}--${d}`,y&&`${Ji}-compact`,n,"gs-utl-px-2 gs-utl-transition-colors",te.b,te.rnd,z.br,p&&"gs-utl-col-span-full",y?"gs-utl-py-1":"gs-utl-py-2",y?"gs-utl-flex-row gs-utl-nowrap gs-utl-gap-3 gs-utl-justify-start":"gs-utl-flex-col",g?_e.disabledM:M("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),S=Dt(b.class)&&!y?b.class:M("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),C=M(`${Ji}__label`,"gs-utl-text-center",_e.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!i)return;const{Blocks:A}=i,_=A.events.update,N=D=>D===t&&l(L=>++L);return i.on(_,N),()=>{i.off(_,N)}},[t,i]),!i)return null;const{Blocks:j}=i,P={className:w,...!g&&{onDragStart:()=>j.startDrag(t),onDragEnd:()=>j.endDrag(!1),draggable:!r},...!!f&&{onClick:()=>f(t,i)}},T=s==null?void 0:s({editor:i,block:t,attributes:P});return T&&$t(T)||c.jsxs($,{items:"center",...P,children:[m||c.jsx("div",{className:M(`${Ji}__media`,S),dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:C,title:x,children:x})]})},D1=ce(R6);function Wh({className:e,value:t,onChange:n}){const[s,r]=h.useState(t),o=h.useRef(null),i=u=>{const{value:d}=u.target;r(d)},a=()=>{n(s||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(s||t);break}};return h.useEffect(()=>{o.current&&o.current.select()},[]),c.jsx("input",{autoFocus:!0,className:Y([e,"w-full",z.bgTr]),value:s,onChange:i,onBlur:a,onKeyDown:l,onPointerDown:Oo,ref:o})}function Dx({className:e,value:t,active:n,unstyled:s,activable:r,onChange:o,onActive:i,...a}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=f=>{i==null||i(f),u(f)},p=f=>{o(f),d(!1)};return c.jsx("div",{className:Y("truncate",e),...a,onDoubleClick:()=>r&&d(!0),children:l?c.jsx(Wh,{className:Y(s&&_e.noFocusOut),value:t,onChange:p}):c.jsx(c.Fragment,{children:t})})}const F1=ie("text-sm w-full",_e.txtEllips),I6=({symbol:e,className:t})=>{const n=hl(),{Components:s}=n,r=Ie(),o=Mi(),i=r.tScoped("blockManager.symbols"),a=()=>{const{draggable:x,droppable:y,attributes:w,type:S,tagName:C}=e.attributes;n.Canvas.startDrag({content:()=>s.addSymbol(e),model:e,dragDef:{type:S,tagName:C,draggable:x,droppable:y,attributes:w}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=s.getSymbolInfo(e).instances.length,f=ie("h-10 w-10 block-media",z.grouphTAo),g=ie("gjs-pt-1 gjs-mt-2",te.bt,z.br),m=ie("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,z.br,z.hBgH,t),v=()=>{o.confirm({title:i("delete"),content:i("deleteConfirm"),onConfirm:()=>e.remove()})},b=x=>{e.set("custom-name",x)};return c.jsxs($,{className:m,onDragStart:a,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:u}}),c.jsxs($,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(F,{children:c.jsx($,{className:ie(F1,"gjs-mr-auto"),children:c.jsx(zt,{title:`${p} ${i("instancesProject")}`,children:c.jsx(Br,{label:`${p}`,className:ie(z.bgH75)})})})}),c.jsx(F,{className:ie("truncate"),grow:!0,title:d,children:c.jsx(Dx,{activable:!0,value:d,className:F1,onChange:b})}),c.jsx(F,{className:ie(_e.hoverGroup),children:c.jsx($,{justify:"end",full:!0,children:c.jsx(St,{onClick:v,title:i("delete"),border:!1,size:"",block:!0,children:c.jsx(se,{icon:K.delete,size:oe.s})})})})]})]})},V6=ce(I6),Or="gs-block-manager",B1={id:ks.before,title:"Add before",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <path d="M4 5v14"/> <rect fill="none" x="8" y="5" width="12" height="14" rx="2" ry="2"/> </svg>'},H6={id:ks.beforeInside,title:"Add inside first",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M8 8v8"/> </svg>'},D6={id:ks.afterInside,title:"Add inside last",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M16 8v8"/> </svg>'},z1={id:ks.after,title:"Add after",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="12" height="14" rx="2" ry="2"/> <path d="M20 5v14"/> </svg>'},U1=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Fx=e=>{const t=e.getContent();return tt(t)?e.getDragDef():t},F6=e=>{const t=Fx(e);return Array.isArray(t)?t[0]:t},B6=ce(function({isOpen:t,className:n,hideCategories:s,target:r,variant:o,itemLayout:i,...a}){var Fe,Yt;const{editor:l}=xe(),u=Ie(),[d,p]=h.useState(0),[f,g]=h.useState(oa.REGULAR),[m,v]=h.useState(""),[b,x]=h.useState(""),y=h.useRef(new Set),[w,S]=h.useState((r==null?void 0:r.position)||ks.after),[C,j]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),E=f===oa.SYMBOLS,O=h.useRef(null),P=u.tScoped("blockManager"),T=r==null?void 0:r.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:he,Components:Ve}=l,De=he.events.custom,$e=Ve.events.symbol,Ot=()=>{j(Ve.getSymbols()),p(Ft=>++Ft)};return l.on($e,Ot),l.on(De,Ot),()=>{l.off($e,Ot),l.off(De,Ot)}},[l]),h.useEffect(()=>{if(O.current&&t){const he=O.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),_f)}},[O.current,t]),!l)return null;const{Blocks:A,Components:_}=l,N=he=>P(`labels.${he.getId()}`)||he.getLabel(),D=C.filter(he=>pi(he.getName(),m)),L=A.getAll().map(he=>he),V=((Fe=a.blocks)==null?void 0:Fe.call(a,{blocks:L}))||L,U=w===ks.before,H=w===ks.beforeInside,B=w===ks.afterInside,k=w===ks.after,I=!!(T!=null&&T.attributes.droppable),R=V.filter(he=>{const Ve=U1(l,he.category);if(m&&!pi(Ve,m)&&!pi(N(he),m))return!1;if(T){const De=F6(he);if(I&&(H||B)){const $e=H?0:void 0;return _.canMove(T,De,$e).result}else if(U||k){const $e=T.index(),Ot=T.parent(),Ft=U?$e:$e+1;return Ot&&_.canMove(Ot,De,Ft).result}}return!0}),W=A.getBlocksByCategory(R),Z=s?R:(Yt=W.find(he=>!he.category))==null?void 0:Yt.items,X=s?[]:W.filter(he=>he.category),J=a.symbols!==!1,Q=a.search!==!1,G=!J&&!Q,ee=o==="compact",ae=P("search")||u.t("search"),ge=M(Or,n,"gap-2"),je=M(`${Or}__header`,"gs-utl-pt-2",Pe.xS,G&&"gs-utl-hidden"),Se=M(`${Or}__content`,_e.scrollY,z.br,te.bt),et=M(`${Or}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Ye=M(`${Or}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ct=M(`${Or}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",ee?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),ct=M(`${Or}__no-category`,Ct,z.br,X.length&&te.bb),we=M(z.tAo,z.bgH75,te.bA),nt=`${Or}__category`,st=[{id:oa.REGULAR,label:P("types.regular")},{id:oa.SYMBOLS,label:P("types.symbols")}],vt=I?[B1,H6,D6,z1]:[B1,z1],Me=T?he=>{const Ve=Fx(he);if(!Ve)return;let De;if(H||B){const $e=H?0:void 0;De=T.append(Ve,{at:$e})[0]}else if(U||k){const $e=T.index(),Ot=T.parent(),Ft=U?$e:$e+1;De=Ot==null?void 0:Ot.append(Ve,{at:Ft})[0]}if(De){const{activate:$e,select:Ot}=he.attributes;Ot||$e&&Ot!==!1?requestAnimationFrame(()=>l.em.setSelected(De,{activate:$e})):$e&&De.trigger("active")}}:void 0,pt=he=>{if(!T)return;const Ve=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),x(De=>{const $e=Ve.indexOf(De);return Ve.at(Math.min($e+1,Ve.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),x(De=>{const $e=Ve.indexOf(De);return Ve.at(Math.max($e-1,0))||""});else if(he.key==="Enter"&&b){const De=A.get(b);De&&(Me==null||Me(De))}},ut=he=>{y.current.clear(),v(he)};return c.jsxs($,{className:ge,col:!0,full:!0,children:[c.jsxs($,{className:je,gap:"s",col:!0,children:[J&&c.jsx(io,{tabs:st,onChange:g,value:f,variant:"pills"}),T&&c.jsx(tn,{size:"s",options:vt,value:w,onChange:he=>S(he)}),Q&&c.jsx(ot,{ref:O,size:"s",value:m,onInput:ut,onKeyDown:pt,placeholder:ae,type:"search"})]}),c.jsxs(F,{className:Se,grow:!0,children:[E&&(D.length?c.jsx($,{className:et,children:D.map(he=>c.jsx(V6,{symbol:he},`${d}_${he.getId()}`))}):c.jsx($,{className:Ye,justify:"center",children:P("symbols.notFound")})),!E&&(R.length?c.jsxs(c.Fragment,{children:[!!(Z!=null&&Z.length)&&c.jsx($,{className:ct,children:Z==null?void 0:Z.map(he=>(y.current.add(`${he.id}`),c.jsx(D1,{block:he,itemLayout:i,onClick:Me,variant:o,className:M(b===he.id&&we)},he.id)))}),X.map(({category:he,items:Ve},De)=>c.jsx(vr,{sticky:!0,className:$e=>Lf.itemList({index:De,open:$e,length:X.length}),open:!!(he!=null&&he.get("open")),onChange:({open:$e})=>he==null?void 0:he.set({open:$e}),handler:U1(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:M(nt,`${nt}--${he==null?void 0:he.id}`),children:c.jsx($,{className:Ct,children:Ve.map($e=>(y.current.add(`${$e.id}`),c.jsx(D1,{block:$e,itemLayout:i,onClick:Me,variant:o,className:M(b===$e.id&&we)},$e.id)))})},he==null?void 0:he.id))]}):c.jsx($,{className:Ye,justify:"center",children:P("notFound")}))]})]})}),z6=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-block-manager-after"),n),ref:r,...s,children:t})}),U6=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-block-manager-before"),n),ref:r,...s,children:t})}),W6="gs-panel-blocks",G6=h.memo(ce(function({className:t,symbols:n,search:s,hideCategories:r,target:o,variant:i,blocks:a,itemLayout:l,...u}){const d=xe().sdkProps.children,p={search:s,symbols:n,hideCategories:r,isOpen:!0,target:o,variant:i,blocks:a,itemLayout:l};return c.jsx(Ps,{className:M(W6,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(gl,{children:[Xn(d,U6),c.jsx(B6,{className:M("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),Xn(d,z6)]})})})),q6=(e,t)=>{t.runCommand(ne.fontAdd,{font:e})},Gh=(e,{onSelect:t,...n}={})=>{const s="font",i=e.runCommand(ne.assetProviderGet).filter(a=>dt(a.types)?a.types===s:a.types.includes(s))[0];if(!i){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:s,providerId:i.id,onSelect:a=>{const l=a.assetProps;q6(l.customData.font,e),t==null||t(a)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Du=ce(e=>{const{buttonClassName:t,value:n,...s}=e,{editor:r}=xe(),o=Ie(),i=ul(),a=dl(),l=[...s.options||[],...a.fontFamilyOptions].map(u=>{const d=a.getFont(u.id),p=d?hh(d):u.id;return{...u,content:c.jsx($,{col:!0,children:c.jsx(F,{style:{fontFamily:p},children:u.label})})}});return c.jsx(Ae,{...s,value:Ro(n),options:l,afterLabel:a.sdkAddFonts&&i.hasType("font")&&c.jsx(St,{className:t,title:o.t("fontManager.addFontToProject"),icon:K.plus,size:"xs",border:!1,block:!0,onClick:()=>r&&Gh(r,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;s.onChange(Ro(d.family))}})})})}),K6=(e,{t,id:n})=>t(`fields.${n}.label`)||Is(`${e}`.replace(/-/g," ")),Bx=(e,{t,id:n})=>{const s=dt(e)?{id:e,label:e}:e;return{...s,label:t(`fields.${n}.options.${s.id}`)||s.label}},zx=e=>e.get("defaultValue")||"",xl=e=>e.get("field"),Ux=e=>{const t=xl(e);return dt(t)?{type:t}:t},Wx=e=>`${e.get("value")||zx(e)||Ux(e).defaultValue||""}`,Z6=(e,t)=>e||zx(t)||"",Va=({record:e,value:t,partial:n})=>{e.set({value:Z6(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},Ha=(e,t)=>{const{className:n,defaultValue:s,size:r,...o}=Ux(e),i=s??e.get("defaultValue");return{...o,hasClear:()=>{const a=e.get("value");return!!a&&Dt(i)&&a!==i},className:M(n,"gs-utl-w-full"),size:r||"s",value:Wx(e),label:K6(e.get("label")||e.id||"",t),onChange:(a,l)=>Va({record:e,value:a,partial:l})}},Y6=(e,t)=>{const n=xl(e),s=yr(n)?n:void 0,r=(s==null?void 0:s.units)||[],o=MR(Wx(e)),i=o.number,a=o.unit||r[0]||"";return{...Ha(e,t),value:i,valueUnit:a,min:s==null?void 0:s.min,max:s==null?void 0:s.max,step:s==null?void 0:s.step,units:s==null?void 0:s.units,onChange:(l,u)=>{Va({value:l?`${l}${a}`:"",record:e,partial:u})},onChangeUnit:l=>{Va({value:i?`${i}${l}`:"",record:e})}}},Gx=(e,t)=>{var o;const n=xl(e),s=yr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Bx(i,t)))||[];return{...Ha(e,t),options:r,onChange:i=>Va({value:i,record:e})}},X6=(e,t)=>({...Ha(e,t),onChange:n=>Va({value:n,record:e})}),J6=(e,t)=>{var o;const n=xl(e),s=yr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Bx(i,t)))||[];return{...Gx(e,t),size:"s",options:r}};function Q6(e,t){const n=xl(e);switch(dt(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(tn,{...J6(e,t)});case"select":return c.jsx(Ae,{...Gx(e,t)});case"selectFont":{const r=X6(e,t);return c.jsx(Du,{...r,labelAs:"div"})}case"number":return c.jsx(Ne,{...Y6(e,t)});case"color":return c.jsx(Ks,{...Ha(e,t)});default:return c.jsx(ot,{...Ha(e,t)})}}const W1="gs-cmp-global-style-field",e8=ce(function({record:t}){const n=xe(),r=Ie().tScoped("globalStyleManager"),[,o]=h.useState(0),i=n.editor,a=t.id,l={t:r,id:a};return h.useEffect(()=>{if(!i)return;const u=`data:path:${t.getPath("value")}`,d=()=>o(p=>++p);return i.on(u,d),()=>{i.off(u,d)}},[i]),c.jsx($,{className:M(W1,`${W1}__${a}`),children:Q6(t,l)})}),ga="gs-cmp-global-style-manager",G1=({items:e,category:t,className:n})=>{const s=M(t?`${ga}__cat-fields--${t.id}`:`${ga}__uncat-fields`,"gs-utl-gap-2",Pe.xy,n);return c.jsx($,{className:s,nowrap:!0,col:!0,children:e.map(r=>c.jsx(e8,{record:r},r.id))})},t8=ce(function(){const t=q4(),{recordsByCategory:n,openCategories:s}=t,o=Ie().tScoped("globalStyleManager");return c.jsx($,{col:!0,full:!0,nowrap:!0,className:M(ga,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx($,{col:!0,nowrap:!0,className:M(`${ga}__fields`,_e.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:i,items:a},l)=>i?c.jsx(vr,{sticky:!0,open:s.get(i.id)??i.open,handler:o(`categories.${i.id}.label`)||i.label||i.id,onChange:({open:u})=>t.setCategoryOpen(i.id,u),className:u=>M(`${ga}__cat-fields`,Lf.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(G1,{category:i,items:a})},i.id):c.jsx(G1,{items:a,className:M(n.length!==1&&[te.bt,z.br])},l)):c.jsx($,{className:M("gs-utl-text-center"),justify:"center",children:o("notFound")})})})}),n8="gs-panel-global-styles",s8=h.memo(ce(function({className:t,...n}){return c.jsx(Ps,{className:M(n8,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(gl,{children:c.jsx(t8,{})})})})),r8={maxWidth:`${xS}px`},o8="gs-cmp-layer-item";function qx({component:e,draggingCmp:t,dragParent:n,...s}){const r=hl(),{Layers:o}=r,i=h.useRef(null),[a,l]=h.useState(!1),[u,d]=h.useState(o.getLayerData(e)),{open:p,selected:f,hovered:g,components:m,visible:v,locked:b,name:x}=u,y=m.map(H=>H.cid),w=t===e,S=y.join("-"),C=s.level+1,j=g||n===e;h.useEffect(()=>{C===0&&d(o.getLayerData(e)),i.current&&(i.current.__cmp=e)},[e]),h.useEffect(()=>{const H=i.current;if(!H)return;const{select:B}=r.Components.events,k=I=>I===e&&H.scrollIntoView({block:"nearest"});return r.on(B,k),()=>{r.off(B,k)}},[e,i.current]),h.useEffect(()=>{const H=k=>{k===e&&d(o.getLayerData(k))},B=o.events.component;return r.on(B,H),()=>{r.off(B,H)}},[r,o,e]);const E=h.useMemo(()=>m.map(H=>c.jsx(qx,{component:H,level:C,draggingCmp:t,dragParent:n},H.cid)),[S,t,n]),O=H=>{o.setLayerData(e,{name:H}),l(!1)},P=H=>{H.stopPropagation(),o.setLayerData(e,{open:!p})},T=H=>{H.stopPropagation(),o.setLayerData(e,{visible:!v})},A=H=>{H.stopPropagation(),o.setLayerData(e,{locked:!b})},_=H=>{H.stopPropagation(),o.setLayerData(e,{selected:!0},{event:H})},N=H=>{H.preventDefault(),r.runCommand(ne.contextMenuComponent,{source:fh.layers,component:e,event:H.nativeEvent,x:H.clientX,y:H.clientY})},D=H=>{(!H||!t)&&o.setLayerData(e,{hovered:H})},L=Ib(e),V=Y("layer-item",(f||L.isSymbol)&&L.bgSoftX,(!v||w)&&"opacity-50"),U=Y(Pe.xyS,te.b,j?L.border:te.bT,f&&L.bgSoft);return c.jsx("div",{className:o8,children:c.jsxs($,{col:!0,className:V,children:[c.jsx(F,{onClick:_,onContextMenu:N,onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),className:Y("group max-w-full"),"data-layer-item":!0,ref:i,children:c.jsxs($,{items:"center",space:"xs",className:U,children:[c.jsx(F,{style:{marginLeft:`${C*10}px`},className:Y("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:P,children:c.jsx(se,{icon:K.menuDown,size:oe.sx,rotate:p?0:-90})}),c.jsx(F,{children:z0(e)}),c.jsx(F,{className:Y("truncate"),onDoubleClick:()=>l(!0),style:r8,grow:!0,children:a?c.jsx(Wh,{value:x,onChange:O}):c.jsx(c.Fragment,{children:x})}),!a&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:Y("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(se,{icon:b?K.lock:K.lockOpenVariant,size:oe.s3x})}),c.jsx(F,{className:Y("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:T,children:c.jsx(se,{icon:v?K.eyeOutline:K.eyeOffOutline,size:oe.sx})})]})]})}),!!(p&&m.length)&&c.jsx(F,{className:Y("max-w-full",!p&&"hidden"),children:E})]})})}const i8={touchAction:"none"},q1=5,a8=e=>{var o,i;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),s=n==null?void 0:n.__cmp,r=((i=(o=s==null?void 0:s.delegate)==null?void 0:o.move)==null?void 0:i.call(o,s))||s;return{el:n,cmp:r}},Kx=ce(function({root:t,header:n}){const{editor:s}=xe(),[r,o]=h.useState(!1),[i,a]=h.useState({}),[l,u]=h.useState(),[d,p]=h.useState(),[f,g]=h.useState(),[m,v]=h.useState(),b=h.useRef(null);if(h.useEffect(()=>{const P=window.document,T=A=>{A.key==="Escape"&&(a({...i,result:!1}),S())};return P.addEventListener("keydown",T),()=>{P.removeEventListener("keydown",T)}},[]),!s)return null;const{Components:x}=s,y=P=>{P.button===0&&o(!0)},w=P=>{if(!r)return;const{cmp:T,el:A}=a8(P);if(!A||!T)return;const _=A.getBoundingClientRect(),N=A.offsetHeight,D=A.offsetTop,L=P.clientY,V=L<_.y+N/2,U=d||T,H=T.parent(),B=T.index()+(V?0:1);!d&&p(T),u(T);const k=x.canMove(H,U,B),I=x.canMove(T,U),R={...k,canMoveInside:I,index:B};let W=!1;I.result&&L>_.y+q1&&L<_.y+N-q1&&(W=!0,R.target=T,delete R.index),g(W?T:void 0),a(R),v({pointerInside:W,y:D+(V?0:N),h:N})},S=()=>{var P;i!=null&&i.result&&((P=i.source)==null||P.move(i.target,{at:i.index})),a({}),o(!1),p(void 0),u(void 0),g(void 0),v(void 0)},C=(l?l.parents():[]).length,j=!!(d&&m&&(i!=null&&i.result)&&!m.pointerInside),E=j?{top:m.y,left:0,marginLeft:C*10+20}:{},O=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs($,{col:!0,full:!0,nowrap:!0,className:Y("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(F,{children:c.jsxs($,{space:"s",items:"center",className:Y([Pe.xy,te.bb,z.br]),children:[c.jsx(F,{children:c.jsx(se,{icon:K.layers,size:oe.s})}),c.jsx(F,{grow:!0,children:O})]})}),c.jsxs(F,{className:Y("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:i8,onPointerDown:y,onPointerMove:w,onPointerUp:S,grow:!0,children:[!!t&&c.jsx(qx,{component:t,level:-1,draggingCmp:d,dragParent:f}),j&&c.jsx("div",{ref:b,className:Y("absolute w-full gs-utl-h-0.5",z.cmp),style:E})]})]})}),Zx=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-layer-manager-after"),n),ref:r,...s,children:t})}),Yx=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-layer-manager-before"),n),ref:r,...s,children:t})}),l8="gs-panel-layers",Xx=h.memo(ce(function({className:t,...n}){const s=xe().sdkProps.children;return c.jsx(Ps,{className:M(l8,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(Ly,{children:r=>c.jsxs(c.Fragment,{children:[Xn(s,Yx),c.jsx(Kx,{...r,header:!1}),Xn(s,Zx)]})})})})),go="gs-cmp-file-field";function Da(e){var C;const{className:t,value:n,btnLabel:s,nameLabel:r,size:o,isContain:i,clear:a,inputField:l,placeholder:u,preview:d=50,disabled:p,hideButton:f,labelAs:g,onChange:m,onOpen:v}=e,b=(n||"").replace(/^"|"$/gi,""),x=((C=b.split("/").pop())==null?void 0:C.split("?")[0])||"",y={minWidth:d,minHeight:d},w=b?{...y,backgroundImage:`url("${b}")`}:y,S=M(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",i?"gs-utl-bg-contain":"gs-utl-bg-cover",te.b,te.rnd,z.br);return c.jsxs($,{className:M(go,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(js,{...e,as:g}),c.jsxs($,{className:M(`${go}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(F,{className:M(`${go}-preview`),children:c.jsx("div",{className:S,style:w})}),c.jsxs(F,{className:M(`${go}-fields gs-utl-overflow-hidden`),grow:!0,children:[x&&r!==!1&&c.jsx(Kr,{className:M(`${go}-name`,"gs-utl-mb-2",_e.txtEllips),as:"div",size:o,capitalize:!1,children:x}),c.jsxs($,{className:M(`${go}-buttons`),space:"s",nowrap:!0,children:[!f&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:o,type:"button",block:!0,full:!0,disabled:p,children:s||"Select image"}),!!n&&a&&c.jsx(St,{onClick:()=>m==null?void 0:m(""),title:a.tooltip,size:o,icon:{icon:K.close,size:oe.s},type:"button",block:!0})]})]})]}),l&&c.jsx(ot,{className:M(`${go}-input`),value:b,onChange:m,size:o,placeholder:u})]})}function c8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>s=>{t.forEach(r=>r(s))},t)}const Fu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function qh(e){return"nodeType"in e}function uo(e){var t,n;return e?Vi(e)?e:qh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Kh(e){const{Document:t}=uo(e);return e instanceof t}function Hi(e){return Vi(e)?!1:e instanceof uo(e).HTMLElement}function Jx(e){return e instanceof uo(e).SVGElement}function Di(e){return e?Vi(e)?e.document:qh(e)?Kh(e)?e:Hi(e)||Jx(e)?e.ownerDocument:document:document:document}const Io=Fu?h.useLayoutEffect:h.useEffect;function u8(e){const t=h.useRef(e);return Io(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function d8(){const e=h.useRef(null),t=h.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function wl(e,t){const n=h.useRef();return h.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Zh(e){const t=u8(e),n=h.useRef(null),s=h.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}let Gd={};function Sl(e,t){return h.useMemo(()=>{if(t)return t;const n=Gd[e]==null?0:Gd[e]+1;return Gd[e]=n,e+"-"+n},[e,t])}function Qx(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((o,i)=>{const a=Object.entries(i);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...t})}}const Fa=Qx(1),ew=Qx(-1);function p8(e){return"clientX"in e&&"clientY"in e}function f8(e){if(!e)return!1;const{KeyboardEvent:t}=uo(e.target);return t&&e instanceof t}function h8(e){if(!e)return!1;const{TouchEvent:t}=uo(e.target);return t&&e instanceof t}function sf(e){if(h8(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return p8(e)?{x:e.clientX,y:e.clientY}:null}const Ba=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ba.Translate.toString(e),Ba.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),g8={display:"none"};function m8(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:g8},n)}function v8(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function b8(){const[e,t]=h.useState("");return{announce:h.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const y8={draggable:`
321
+ `})};function Hu({children:e,text:t,onConfirm:n,onCancel:s,className:r="w-[200px]",confirmButtonProps:o={},...i}){const a=$e();return c.jsx(Os,{...i,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(k,{className:J(r),space:"m",col:!0,children:[c.jsx(D,{grow:!0,className:J("text-center"),children:t||a.t("confirmAction")}),c.jsxs(k,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Qe,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...o,children:o.children||a.t("confirm")}),c.jsx(Qe,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),s==null||s()},children:a.t("cancel")})]})]})})}const m1=new Map,b1=new Map,xk=async({html:e="",el:t})=>{const n=e,s={};if(document.body.attachShadow){const r=t.shadowRoot||t.attachShadow({mode:"open"});r.innerHTML=n}return s},wk=ue(function({template:t,projectType:n,skipProjectNamePopover:s,className:r,onSelect:o,onRemove:i}){var E;const a=$e(),l=Se(),u=l.editor,[d,p]=g.useState(""),f=g.useRef(null),h=a.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((E=t.data.custom)==null?void 0:E.id),b=n===Et.web,v=!t.isTemplate||s,x=()=>{v&&(o==null||o({editor:u,template:t,loadTemplate:y}))},y=l.setProject,w=O=>{O.preventDefault(),o({editor:u,template:t,loadTemplate:y})};g.useEffect(()=>{const P=setTimeout(async()=>{if(!f.current||!u)return;const T=`${t.isTemplate?"t-":""}${t.id}`;let A=m1.get(T);if(!A){let N=b1.get(n);if(!N){const V=new qV({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});N=await yk(u.config.grapesjs,n,V.appEditorStore),b1.set(n,N)}A=N?vk(N,t.data,n):"",m1.set(T,A)}const _=f.current;xk({el:_,html:A})});return()=>clearTimeout(P)},[f,u,n,t.data]);const{media:S,author:j}=t,C=c.jsx(Qe,{className:le("text-sm"),size:"m2",variant:"pr",onClick:x,disabled:m,children:a.t("select")});return c.jsx(os,{padding:!1,className:le("overflow-hidden max-w-full group",r),children:c.jsxs(k,{col:!0,children:[c.jsxs(D,{className:le("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:le("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:S?c.jsx("img",{src:S,alt:t.name,className:le("max-w-full")}):c.jsx("div",{className:le("gs-utl-w-[1200px]","gs-utl-flex-shrink-0","gs-utl-flex-grow-0","gs-utl-origin-top","gs-utl-bg-white","gs-utl-scale-[0.232]","gs-utl-h-[431.034%]"),ref:f})}),m&&c.jsx(Ur,{className:le("absolute top-2 right-2",z.bgA2),label:a.t("current"),s:"s",pill:!0}),c.jsx(k,{justify:"center",items:"center",className:le(Ae.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:v?C:c.jsx(Os,{overlay:!0,title:!1,buttonAs:"span",handler:C,children:()=>c.jsx("form",{onSubmit:w,children:c.jsxs(k,{space:"m",col:!0,children:[c.jsx(D,{children:c.jsx(at,{size:"s",value:d,onChange:p,placeholder:h,required:!0})}),c.jsx(D,{children:c.jsx(Qe,{type:"submit",variant:"pr",size:"m2",full:!0,children:a.t("load")})})]})})})})]}),c.jsxs(k,{className:le("gjs-p-2 max-w-full",se.bt,z.br),col:!0,space:"s",children:[c.jsxs(k,{className:le("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(D,{className:le(Ae.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!j&&c.jsxs(D,{children:["by"," ",c.jsx("a",{className:le(Wr.link),href:j.link,rel:"noreferrer",target:"_blank",children:j.name})]})]}),c.jsxs(k,{items:"center",children:[b&&c.jsxs(D,{className:le("gjs-mr-auto"),children:[a.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&i&&c.jsx(D,{className:le("gjs-ml-auto"),children:c.jsx(Hu,{onConfirm:()=>i(t),className:"",children:c.jsx(St,{title:a.t("delete"),children:c.jsx(ne,{icon:K.delete,size:oe.sx})})})})]})]})]})})}),Ox=ue(function({templates:e,projectType:t,content:n,skipProjectNamePopover:s,onSelect:r,onRemove:o}){const[i]=wg(),l=$e().tScoped("templates"),d=Se().editor,p=Hg(n==null?void 0:n.itemsPerRow),f=r??(({template:h,loadTemplate:m})=>m(h));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(k,{justify:"center",children:l("notFound")}):c.jsx(Vu,{data:e,listClassName:le("grid gap-2 gjs-pr-2",p),itemContent:(h,m)=>c.jsx(wk,{template:m,projectType:t,onSelect:f,onRemove:o,skipProjectNamePopover:s},m.id)},i):c.jsx(Gr,{})})}),Sk=ue(function(){var b;const t=Se(),n=ay(),{filteredTemplates:s,projectSourceFilter:r,projectTypeFilter:o}=n,i=$e(),a=$i(),{sdkOptions:l}=t,u=i.tScoped("projectManager"),d=async({loadTemplate:v,template:x})=>{v(x),a.close()},p=async v=>{n.setProjectTypeFilter(v),await n.loadAllTemplates()},f=v=>{n.removeProject(v.id),n.loadProjects()},h=g.useMemo(()=>[{id:Aa.Existing,label:u("existentProjects")},{id:Aa.Templates,label:u("templates")}],[i]),m=((b=l.project)==null?void 0:b.types)&&Sf();return g.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(k,{col:!0,full:!0,space:"m",children:[m&&c.jsx(k,{items:"center",space:"m",children:c.jsx(D,{className:le("gjs-ml-auto"),children:c.jsx(_e,{value:o,onChange:p,options:zN(),handlerSelected:v=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",v.label]})})})}),c.jsx(D,{children:c.jsx(lo,{tabs:h,value:r,onChange:n.setProjectSourceFilter})}),c.jsx(D,{grow:!0,children:c.jsx(Ox,{templates:s,projectType:Et[o],onSelect:d,onRemove:f,content:{itemsPerRow:3}})})]})}),Ck=({items:e,editor:t,customItems:n})=>n===!1?[]:rt(n)?n({items:e,editor:t}):n||e,v1=e=>({icon:K.plus,size:oe.s,className:J("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),_x=e=>!e.type||e.type==="button",jk="gs-cmp-topbar-left",Ek=ue(function({buttons:t,className:n,style:s}){const r=Se(),o=$e(),{isOpen:i,toggleOpen:a}=a4(),l=r.editor,d=o.tScoped("blockManager")("blocks"),p=Ck({items:[{id:`blocks-${d}`,tooltip:d,size:_y.s,icon:v1(i),variant:Oy.primary,editorEvents:{[Dn.toggleBlocksPanel]:({fromEvent:f,setState:h})=>{h({icon:v1(f.isOpen)})}},onClick:()=>a()}],customItems:t,editor:l});return c.jsx(k,{gap:"s",items:"center",justify:"start",className:J(jk,Pe.xS,n),style:s,nowrap:!0,children:p.map(({id:f,...h})=>_x(h)?c.jsx(_u,{...h},f):Nt({id:f,...h}))})}),Pk=[{id:Fr.auto,label:"Auto"},{id:Fr.dark,label:"Dark"},{id:Fr.light,label:"Light"}],Tk={size:"s"},Dd=".grapesjs",Ok=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},_k=({actions:e,editor:t,buttons:n,sdkOptions:s})=>{const r=s.actions;return r===!1?[]:rt(r)?r({actions:e,editor:t}):r||(n?rt(n)?n({items:e,editor:t}):n:e)},Ak="gs-cmp-topbar-right",Mk=ue(function({editor:t,className:n,buttons:s,...r}){const o=Se(),{theme:i,setTheme:a}=Ps(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:f,setInstallEvent:h,sdkOptions:m,isProjectTypeEmail:b}=o,v=$i(),x=$e(),y=_=>x.t(`actions.${_}`),w=t.Storage.events,S=l.events,j="change:changesCount",C=(_,N)=>()=>{rt(_)?_({editor:t}):l.isActive(_)?l.stop(_):l.run(_,N)},E=_=>({[`${S.runCommand}${_}`]:({setState:N})=>N({active:!0}),[`${S.stopCommand}${_}`]:({setState:N})=>N({active:!1})}),O=[{id:us.componentOutline,icon:K.borderRadius,tooltip:y("componentOutline.title"),onClick:C("core:component-outline"),editorEvents:E("core:component-outline")},{id:us.preview,icon:K.eye,tooltip:y("preview.title"),onClick:C("core:preview"),editorEvents:E("core:preview")},{id:us.fullscreen,icon:K.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:C("core:fullscreen",{target:"body"}),editorEvents:E("core:fullscreen")},{id:us.showCode,icon:K.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(te.dialogExportCode)},{id:us.showImportCode,icon:K.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(te.dialogImportCode)},{id:us.clearCanvas,icon:K.delete,tooltip:y("clearCanvas.title"),onClick:()=>v.confirm({title:y("clearCanvas.title"),content:y("clearCanvas.content"),confirmButton:{variant:"danger",children:y("clearCanvas.title")},onConfirm:()=>{b?t.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):t.Components.clear()}})},{id:us.store,tooltip:y("store.title"),onClick:async()=>{try{if(o.isSaving)return;await t.store()}catch(_){t.getModel()._isStoring=!1,console.error(_)}},editorEvents:{"change:changesCount":({setState:_})=>_({}),[w.startStore]:({setState:_})=>_({disabled:!0}),[w.endStore]:({setState:_})=>_({disabled:!1})},label:()=>c.jsxs("div",{className:J("relative"),children:[c.jsx(ne,{icon:K.floppy,size:oe.s}),!!t.getDirtyCount()&&!o.isSaving&&c.jsx("div",{className:J("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:J(Ae.dot,z.bgW)})}),o.isSaving&&c.jsx("div",{className:J("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(ne,{icon:K.refresh,size:"11px",className:J(Ae.spin)})})]})},{id:us.undo,icon:K.arrowULeftTop,disabled:!0,onClick:C("core:undo"),editorEvents:{[j]:({setState:_})=>_({disabled:!u.hasUndo()})}},{id:us.redo,icon:K.arrowURightTop,disabled:!0,onClick:C("core:redo"),editorEvents:{[j]:({setState:_})=>_({disabled:!u.hasRedo()})}}],P=_k({actions:O,sdkOptions:m,editor:t,buttons:s}),T=[{id:"about",label:y("about.title"),icon:K.helpCircle,action:()=>v.open({size:"m",title:y("about.title"),content:()=>c.jsx(FN,{})})},{id:"embed",label:y("embed.title"),icon:K.powerPlug,action:()=>v.open({size:"m",title:y("embed.title"),content:()=>c.jsx(BN,{})})},{id:"openProject",label:y("open.title"),icon:K.folder,action:async()=>{let _="";try{_=await(await jN({extensions:[Dd]})).text()}catch(N){return console.error(N)}o.loadProjectData(JSON.parse(_))}},{id:"saveProject",label:y("save.title"),icon:K.contentSave,action:async()=>{const _=t.getProjectData(),N=new Blob([JSON.stringify(_)]),V=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await PN(N,{fileName:`${V}${Dd}`,extensions:[Dd]})}catch(M){return console.error(M)}}},{id:"loadProject",label:y("newProject.title"),icon:K.newspaperVariantOutline,action:()=>v.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(Sk,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:K.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const _=await(d==null?void 0:d.userChoice);(_==null?void 0:_.outcome)==="accepted"&&h()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(k,{items:"center",space:"m",children:[c.jsx(D,{children:"Theme"}),c.jsx(D,{children:c.jsx(lo,{tabs:Pk,onChange:_=>a(_),value:i,variant:"pills"})})]})}]].filter(({id:_})=>!((!f||!d)&&_==="installApp"||!Ok(m,_))),A=(_,N)=>V=>{rt(_)&&(_(V),N())};return c.jsxs(k,{space:"s",items:"center",justify:"end",className:J(Ak,Pe.xS,n),nowrap:!0,...r,children:[P.map(({id:_,...N})=>_x(N)?c.jsx(_u,{size:"s",...N},_):Nt({id:_,...N})),c.jsx(D,{children:m.settingsMenu!==!1&&T.length>0&&c.jsx(Os,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(ne,{icon:K.cog,size:oe.s}),buttonProps:Tk,overlay:!0,children:({close:_})=>c.jsx(c.Fragment,{children:T.map(N=>c.jsx(Ii,{action:A(N.action,_),icon:N.icon,label:N.label},N.id))})})})]})});function Lk({devices:e,selected:t,className:n,style:s,select:r}){const o=e.map(i=>({id:i.id,label:i.getName(),icon:i.attributes.icon}));return o.length?c.jsx(_e,{size:"xs",className:n,style:s,value:t,options:o,onChange:r}):null}const Nk="gs-devices",Ax=g.memo(function({className:t,style:n}){return c.jsx(oN,{children:s=>c.jsx(Lk,{className:L(Nk,t),style:n,...s})})}),Ji="gs-cmp-editor-topbar",$k=ue(function({className:t,height:n,style:s,children:r,leftContainer:o,rightContainer:i,devices:a}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:p}=Se(),f=n??l,h=g.useMemo(()=>({...s,minHeight:f,marginTop:u||!p?`-${f}px`:0}),[u,p,s]);return c.jsxs(c.Fragment,{children:[c.jsx(D,{className:L(Ji,"gs-utl-transition-spacing gs-utl-w-full",se.bb,z.br,t),style:h,children:r??c.jsxs(k,{className:L(`${Ji}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(D,{className:L(`${Ji}__wrp-left`),grow:!0,children:o!==!1&&c.jsx(Ek,{...o})}),c.jsx(D,{className:L(`${Ji}__wrp-center`),children:a!==!1&&c.jsx(Ax,{...a})}),c.jsx(D,{className:L(`${Ji}__wrp-right`),grow:!0,children:i!==!1&&d&&c.jsx(Mk,{editor:d,...i})})]})}),c.jsx(D,{className:L("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:c.jsx(Qe,{className:L("gs-cmp-close-preview gs-utl-m-4",z.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(ne,{icon:K.eyeOff,size:oe.s})})})]})}),kk="gs-sidebar-top",Mx=g.memo(ue(function({height:t,children:n,...s}){return c.jsx($k,{height:t,...s,style:Mu(s),className:L(kk,"gs-utl-flex",Au(s)),children:n?Nt(n):void 0})})),Rk="gs-canvas-sidebar-top",Ik=g.memo(ue(function({className:t,sidebarTop:n,...s}){return c.jsxs(jn,{className:L(Rk,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...s,children:[c.jsx(Mx,{...n}),c.jsx(qy,{grow:!0})]})})),Vk="gs-code-field",Hk=ue(function(e){const{editor:t}=Se(),{isDarkTheme:n}=Ps(),{editorEvents:s,onChange:r}=e,[o,i]=g.useState(()=>e),a=u=>({value:u,editor:t,state:o,setState:d=>i(p=>({...p,...d}))}),l=u=>r==null?void 0:r(a(u||""));return Sr({editor:t,editorEvents:s,localState:o,setLocalState:i}),c.jsx(Cs,{className:L(Vk,o.className),language:o.language,style:o.style,label:o.label,name:o.name,defaultValue:o.value,size:o.size,required:o.required,disabled:o.disabled,readOnly:o.readOnly,minHeight:o.minHeight,row:o.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});function Du(){return(Du=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function Lx(e,t){if(e==null)return{};var n,s,r={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(r[n]=e[n]);return r}function ef(e){var t=g.useRef(e),n=g.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var _i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},ha=function(e){return"touches"in e},tf=function(e){return e&&e.ownerDocument.defaultView||self},y1=function(e,t,n){var s=e.getBoundingClientRect(),r=ha(t)?function(o,i){for(var a=0;a<o.length;a++)if(o[a].identifier===i)return o[a];return o[0]}(t.touches,n):t;return{left:_i((r.pageX-(s.left+tf(e).pageXOffset))/s.width),top:_i((r.pageY-(s.top+tf(e).pageYOffset))/s.height)}},x1=function(e){!ha(e)&&e.preventDefault()},Dg=g.memo(function(e){var t=e.onMove,n=e.onKey,s=Lx(e,["onMove","onKey"]),r=g.useRef(null),o=ef(t),i=ef(n),a=g.useRef(null),l=g.useRef(!1),u=g.useMemo(function(){var h=function(v){x1(v),(ha(v)?v.touches.length>0:v.buttons>0)&&r.current?o(y1(r.current,v,a.current)):b(!1)},m=function(){return b(!1)};function b(v){var x=l.current,y=tf(r.current),w=v?y.addEventListener:y.removeEventListener;w(x?"touchmove":"mousemove",h),w(x?"touchend":"mouseup",m)}return[function(v){var x=v.nativeEvent,y=r.current;if(y&&(x1(x),!function(S,j){return j&&!ha(S)}(x,l.current)&&y)){if(ha(x)){l.current=!0;var w=x.changedTouches||[];w.length&&(a.current=w[0].identifier)}y.focus(),o(y1(y,x,a.current)),b(!0)}},function(v){var x=v.which||v.keyCode;x<37||x>40||(v.preventDefault(),i({left:x===39?.05:x===37?-.05:0,top:x===40?.05:x===38?-.05:0}))},b]},[i,o]),d=u[0],p=u[1],f=u[2];return g.useEffect(function(){return f},[f]),g.createElement("div",Du({},s,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:r,onKeyDown:p,tabIndex:0,role:"slider"}))}),Fu=function(e){return e.filter(Boolean).join(" ")},Fg=function(e){var t=e.color,n=e.left,s=e.top,r=s===void 0?.5:s,o=Fu(["react-colorful__pointer",e.className]);return g.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},g.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},fn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Nx=function(e){var t=e.s,n=e.v,s=e.a,r=(200-t)*n/100;return{h:fn(e.h),s:fn(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:fn(r/2),a:fn(s,2)}},nf=function(e){var t=Nx(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Fd=function(e){var t=Nx(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Dk=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:fn(255*[s,a,i,i,l,s][u]),g:fn(255*[l,s,s,a,i,i][u]),b:fn(255*[i,i,l,s,s,a][u]),a:fn(r,2)}},Fk=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?Bk({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Bk=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:fn(60*(a<0?a+6:a)),s:fn(o?i/o*100:0),v:fn(o/255*100),a:r}},zk=g.memo(function(e){var t=e.hue,n=e.onChange,s=Fu(["react-colorful__hue",e.className]);return g.createElement("div",{className:s},g.createElement(Dg,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:_i(t+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":fn(t),"aria-valuemax":"360","aria-valuemin":"0"},g.createElement(Fg,{className:"react-colorful__hue-pointer",left:t/360,color:nf({h:t,s:100,v:100,a:1})})))}),Uk=g.memo(function(e){var t=e.hsva,n=e.onChange,s={backgroundColor:nf({h:t.h,s:100,v:100,a:1})};return g.createElement("div",{className:"react-colorful__saturation",style:s},g.createElement(Dg,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:_i(t.s+100*r.left,0,100),v:_i(t.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+fn(t.s)+"%, Brightness "+fn(t.v)+"%"},g.createElement(Fg,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:nf(t)})))}),Wk=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},Gk=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function qk(e,t,n){var s=ef(n),r=g.useState(function(){return e.toHsva(t)}),o=r[0],i=r[1],a=g.useRef({color:t,hsva:o});g.useEffect(function(){if(!e.equal(t,a.current.color)){var u=e.toHsva(t);a.current={hsva:u,color:t},i(u)}},[t,e]),g.useEffect(function(){var u;Wk(o,a.current.hsva)||e.equal(u=e.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},s(u))},[o,e,s]);var l=g.useCallback(function(u){i(function(d){return Object.assign({},d,u)})},[]);return[o,l]}var Kk=typeof window<"u"?g.useLayoutEffect:g.useEffect,Zk=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},w1=new Map,Yk=function(e){Kk(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!w1.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,w1.set(t,n);var s=Zk();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},Xk=function(e){var t=e.className,n=e.hsva,s=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Fd(Object.assign({},n,{a:0}))+", "+Fd(Object.assign({},n,{a:1}))+")"},o=Fu(["react-colorful__alpha",t]),i=fn(100*n.a);return g.createElement("div",{className:o},g.createElement("div",{className:"react-colorful__alpha-gradient",style:r}),g.createElement(Dg,{onMove:function(a){s({a:a.left})},onKey:function(a){s({a:_i(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},g.createElement(Fg,{className:"react-colorful__alpha-pointer",left:n.a,color:Fd(n)})))},Jk=function(e){var t=e.className,n=e.colorModel,s=e.color,r=s===void 0?n.defaultColor:s,o=e.onChange,i=Lx(e,["className","colorModel","color","onChange"]),a=g.useRef(null);Yk(a);var l=qk(n,r,o),u=l[0],d=l[1],p=Fu(["react-colorful",t]);return g.createElement("div",Du({},i,{ref:a,className:p}),g.createElement(Uk,{hsva:u,onChange:d}),g.createElement(zk,{hue:u.h,onChange:d}),g.createElement(Xk,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},Qk={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Fk,fromHsva:function(e){var t=Dk(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Gk},eR=function(e){return g.createElement(Jk,Du({},e,{colorModel:Qk}))};function $x(e){if(!is()||!document.body)return null;const{className:t,onPointerUp:n,onPointerCancel:s}=e,r=L(t,"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50");return kn.createPortal(c.jsx("div",{onPointerUp:n,onPointerCancel:s,className:r}),document.body)}var tR={grad:.9,turn:360,rad:360/(2*Math.PI)},rr=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},zt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},ts=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},kx=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},S1=function(e){return{r:ts(e.r,0,255),g:ts(e.g,0,255),b:ts(e.b,0,255),a:ts(e.a)}},Bd=function(e){return{r:zt(e.r),g:zt(e.g),b:zt(e.b),a:zt(e.a,3)}},nR=/^#([0-9a-f]{3,8})$/i,ql=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Rx=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:60*(a<0?a+6:a),s:o?i/o*100:0,v:o/255*100,a:r}},Ix=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:255*[s,a,i,i,l,s][u],g:255*[l,s,s,a,i,i][u],b:255*[i,i,l,s,s,a][u],a:r}},C1=function(e){return{h:kx(e.h),s:ts(e.s,0,100),l:ts(e.l,0,100),a:ts(e.a)}},j1=function(e){return{h:zt(e.h),s:zt(e.s),l:zt(e.l),a:zt(e.a,3)}},E1=function(e){return Ix((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},ma=function(e){return{h:(t=Rx(e)).h,s:(r=(200-(n=t.s))*(s=t.v)/100)>0&&r<200?n*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,s,r},sR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rR=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,oR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,iR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sf={string:[[function(e){var t=nR.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?zt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?zt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=oR.exec(e)||iR.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:S1({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=sR.exec(e)||rR.exec(e);if(!t)return null;var n,s,r=C1({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(tR[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return E1(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=r===void 0?1:r;return rr(t)&&rr(n)&&rr(s)?S1({r:Number(t),g:Number(n),b:Number(s),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,r=e.a,o=r===void 0?1:r;if(!rr(t)||!rr(n)||!rr(s))return null;var i=C1({h:Number(t),s:Number(n),l:Number(s),a:Number(o)});return E1(i)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,r=e.a,o=r===void 0?1:r;if(!rr(t)||!rr(n)||!rr(s))return null;var i=function(a){return{h:kx(a.h),s:ts(a.s,0,100),v:ts(a.v,0,100),a:ts(a.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(o)});return Ix(i)},"hsv"]]},P1=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},aR=function(e){return typeof e=="string"?P1(e.trim(),sf.string):typeof e=="object"&&e!==null?P1(e,sf.object):[null,void 0]},zd=function(e,t){var n=ma(e);return{h:n.h,s:ts(n.s+100*t,0,100),l:n.l,a:n.a}},Ud=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},T1=function(e,t){var n=ma(e);return{h:n.h,s:n.s,l:ts(n.l+100*t,0,100),a:n.a}},rf=function(){function e(t){this.parsed=aR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return zt(Ud(this.rgba),2)},e.prototype.isDark=function(){return Ud(this.rgba)<.5},e.prototype.isLight=function(){return Ud(this.rgba)>=.5},e.prototype.toHex=function(){return t=Bd(this.rgba),n=t.r,s=t.g,r=t.b,i=(o=t.a)<1?ql(zt(255*o)):"","#"+ql(n)+ql(s)+ql(r)+i;var t,n,s,r,o,i},e.prototype.toRgb=function(){return Bd(this.rgba)},e.prototype.toRgbString=function(){return t=Bd(this.rgba),n=t.r,s=t.g,r=t.b,(o=t.a)<1?"rgba("+n+", "+s+", "+r+", "+o+")":"rgb("+n+", "+s+", "+r+")";var t,n,s,r,o},e.prototype.toHsl=function(){return j1(ma(this.rgba))},e.prototype.toHslString=function(){return t=j1(ma(this.rgba)),n=t.h,s=t.s,r=t.l,(o=t.a)<1?"hsla("+n+", "+s+"%, "+r+"%, "+o+")":"hsl("+n+", "+s+"%, "+r+"%)";var t,n,s,r,o},e.prototype.toHsv=function(){return t=Rx(this.rgba),{h:zt(t.h),s:zt(t.s),v:zt(t.v),a:zt(t.a,3)};var t},e.prototype.invert=function(){return An({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},e.prototype.saturate=function(t){return t===void 0&&(t=.1),An(zd(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),An(zd(this.rgba,-t))},e.prototype.grayscale=function(){return An(zd(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),An(T1(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),An(T1(this.rgba,-t))},e.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},e.prototype.alpha=function(t){return typeof t=="number"?An({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):zt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=ma(this.rgba);return typeof t=="number"?An({h:t,s:n.s,l:n.l,a:n.a}):zt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===An(t).toHex()},e}(),An=function(e){return e instanceof rf?e:new rf(e)},O1=[],lR=function(e){e.forEach(function(t){O1.indexOf(t)<0&&(t(rf,sf),O1.push(t))})},cR={grad:.9,turn:360,rad:360/(2*Math.PI)},Wd=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Kl=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Gd=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},Vx=function(e){return{h:(t=e.h,(t=isFinite(t)?t%360:0)>0?t:t+360),w:Gd(e.w,0,100),b:Gd(e.b,0,100),a:Gd(e.a)};var t},_1=function(e){return{h:Kl(e.h),w:Kl(e.w),b:Kl(e.b),a:Kl(e.a,3)}},A1=function(e){return{h:function(t){var n=t.r,s=t.g,r=t.b,o=t.a,i=Math.max(n,s,r),a=i-Math.min(n,s,r),l=a?i===n?(s-r)/a:i===s?2+(r-n)/a:4+(n-s)/a:0;return{h:60*(l<0?l+6:l),s:i?a/i*100:0,v:i/255*100,a:o}}(e).h,w:Math.min(e.r,e.g,e.b)/255*100,b:100-Math.max(e.r,e.g,e.b)/255*100,a:e.a}},Hx=function(e){return function(t){var n=t.h,s=t.s,r=t.v,o=t.a;n=n/360*6,s/=100,r/=100;var i=Math.floor(n),a=r*(1-s),l=r*(1-(n-i)*s),u=r*(1-(1-n+i)*s),d=i%6;return{r:255*[r,l,a,a,u,r][d],g:255*[u,r,r,l,a,a][d],b:255*[a,a,u,r,r,l][d],a:o}}({h:e.h,s:e.b===100?0:100-e.w/(100-e.b)*100,v:100-e.b,a:e.a})},uR=function(e){var t=e.h,n=e.w,s=e.b,r=e.a,o=r===void 0?1:r;if(!Wd(t)||!Wd(n)||!Wd(s))return null;var i=Vx({h:Number(t),w:Number(n),b:Number(s),a:Number(o)});return Hx(i)},dR=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pR=function(e){var t=dR.exec(e);if(!t)return null;var n,s,r=Vx({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(cR[s]||1)),w:Number(t[3]),b:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Hx(r)};function fR(e,t){e.prototype.toHwb=function(){return _1(A1(this.rgba))},e.prototype.toHwbString=function(){return n=_1(A1(this.rgba)),s=n.h,r=n.w,o=n.b,(i=n.a)<1?"hwb("+s+" "+r+"% "+o+"% / "+i+")":"hwb("+s+" "+r+"% "+o+"%)";var n,s,r,o,i},t.string.push([pR,"hwb"]),t.object.push([uR,"hwb"])}function gR(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in n)s[n[r]]=r;var o={};e.prototype.toName=function(i){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(i!=null&&i.closest){var d=this.toRgb(),p=1/0,f="black";if(!o.length)for(var h in n)o[h]=new e(n[h]).toRgb();for(var m in n){var b=(a=d,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));b<p&&(p=b,f=m)}return f}},t.string.push([function(i){var a=i.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new e(l).toRgb():null},"name"])}lR([gR,fR]);const hR="rgb",Dx="rgba(0, 0, 0, 1)",mR=An(Dx).toRgb(),bR=[{id:"rgba",label:"RGB"},{id:"hex",label:"HEX"},{id:"hsla",label:"HSL"},{id:"hwb",label:"HWB"}],vR=[{id:"hex",label:"HEX"},{id:"rgba",label:"RGB"}],Da=e=>e==null?"":`${e}`,M1=e=>typeof e=="string",L1=(e,t)=>e.some(n=>Da(n.id)===t),yR=e=>{const t=(e||"").trim().toLowerCase();return t?t.startsWith("#")?"hex":t.startsWith("rgba(")||t.startsWith("rgb(")?"rgba":t.startsWith("hsla(")||t.startsWith("hsl(")?"hsla":t.startsWith("hwb(")?"hwb":"":""},qd=(e,t=[],n)=>{var i;const s=Da(e).trim();if(s&&(!t.length||L1(t,s)))return s;const r=yR(n);return r&&(!t.length||L1(t,r))?r:Da((i=t[0])==null?void 0:i.id).trim()||hR},xR=(e,t)=>{const n=e[t];return typeof n=="function"?n.call(e):void 0},wR=(e=[],t)=>{if(!t)return;const n=Da(t).toLowerCase();return e.find(s=>Da(s.id).toLowerCase()===n)},SR=(e,t)=>{if(!t)return e;const n=An(e);if(!n.isValid())return e;switch(t.toLowerCase()){case"rgb":case"rgba":return n.toRgbString();case"hex":return n.toHex();case"hsl":case"hsla":return n.toHslString();case"hwb":return n.toHwbString();case"name":return xR(n,"toName")||e;default:return e}},N1=({value:e,format:t,prevFormat:n,formats:s,onFormatChange:r,callOnFormatChange:o})=>{var u;const i=t||"",a=wR(s,i);if(!!(a!=null&&a.onFormat)||!!(o&&r)){const d=An(e),p={value:e,format:i,prevFormat:n||i,valueRgb:d.isValid()?d.toRgb():mR},f=(u=a==null?void 0:a.onFormat)==null?void 0:u.call(a,p);if(M1(f))return f;if(o){const h=r==null?void 0:r(p);if(M1(h))return h}}return SR(e,i)||e},CR=e=>{const t=(e||"").trim();if(t.toLowerCase().startsWith("rgba("))return t;const n=An(t);if(!n.isValid())return Dx;const{r:s,g:r,b:o,a:i}=n.toRgb();return`rgba(${s}, ${r}, ${o}, ${i})`},jR=e=>!!(e!=null&&e.Components.getType("mjml")),Fx=e=>({formats:jR(e)?vR:bR}),qc=e=>e==null?"":`${e}`,ER=(e=[],t)=>!t||!e.length||e.some(n=>qc(n.id).trim().toLowerCase()===qc(t).trim().toLowerCase());function Bx({value:e,format:t,formats:n=[],onChange:s,onFormatChange:r,disabled:o}){const[i,a]=g.useState(()=>qd(t,n,e||"")),l=g.useMemo(()=>CR(e||""),[e]),u=g.useMemo(()=>N1({value:e||"",format:i,prevFormat:i,formats:n}),[e,i,n]),d=g.useRef(e||""),[p,f]=g.useState(!1),h=is()&&!!window.EyeDropper,m=!!n.length;g.useEffect(()=>{a(C=>{if(t){const E=qd(t,n);return C===E?C:E}return ER(n,C)?C:qd(void 0,n)})},[t,n]),g.useEffect(()=>{d.current=e||""},[e]);const b=(C,E=i,O={})=>N1({value:C,format:E,prevFormat:O.prevFormat||i,formats:n,onFormatChange:r,callOnFormatChange:O.callOnFormatChange}),v=C=>{d.current=C,s==null||s(C)},x=C=>{const E=b(C);d.current=E,s==null||s(E,!0)},y=C=>{const E=qc(C).trim();if(!E)return;const O=i,P=e||"";a(E);const T=b(P,E,{prevFormat:O,callOnFormatChange:!0});d.current=T,s==null||s(T,!1)},w=()=>{h&&new window.EyeDropper().open().then(E=>{const O=b(E.sRGBHex);d.current=O,s==null||s(O)}).catch(console.warn)},S=()=>{f(!0)},j=()=>{const C=b(d.current);d.current=C,s==null||s(C,!1),f(!1)};return c.jsxs(c.Fragment,{children:[p&&c.jsx($x,{className:"gs-utl-cursor-grabbing",onPointerUp:j,onPointerCancel:j}),c.jsx(eR,{className:"color-picker",color:l,onChange:x,onPointerDown:S,onPointerUp:j}),m&&c.jsx(_e,{classNameContainer:"gs-utl-mt-3",value:i,options:n,size:"s",onChange:C=>y(qc(C)),disabled:o}),c.jsxs(k,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(at,{size:"s",value:u,onChange:v,disabled:o})}),h&&c.jsx(Qe,{type:"button",onClick:w,children:c.jsx(ne,{icon:K.eyedropperVariant,size:oe.s})})]})]})}const PR="gs-cmp-color-picker",TR={backgroundSize:"10px"},OR=[0,15];function zx({className:e,value:t,format:n,formats:s,onChange:r,onFormatChange:o,disabled:i}){const[a,l]=g.useState(!1),u=L(`${PR}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,se.b,se.rnd,z.br),d=()=>{l(!1)},p=c.jsxs("div",{style:TR,className:u,children:[a&&c.jsx("div",{onPointerUp:d,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx("div",{className:"gs-utl-w-4 gs-utl-h-4",style:{backgroundColor:t}})]});return c.jsx(Os,{handler:p,title:"Color",size:"s",placement:"left-end",offset:OR,clickAway:!0,disabled:i,children:c.jsx(Bx,{value:t,format:n,formats:s,onChange:r,onFormatChange:o,disabled:i})})}const _R="gs-cmp-color-field";function AR(e){const{className:t,value:n,placeholder:s,preventSubmitOnEnter:r=!1,onChange:o,labelAs:i,disabled:a,colorPickerProps:l,name:u,required:d,readOnly:p}=e,[f,h]=g.useState(Bc(n)),m=bl(e);g.useEffect(()=>{h(Bc(n))},[n]);const b=(w,S)=>{o==null||o(w,S)},v=w=>{switch(w.key){case"Escape":return h(n);case"Enter":b(f),r&&(w.preventDefault(),w.stopPropagation())}},x=()=>{b(f)},y=io({...e,className:L(_R,t)});return c.jsxs("div",{...y,children:[c.jsx(Ts,{...e,as:i}),c.jsxs(k,{className:Eg(e),items:"center",space:"s",children:[c.jsx(D,{children:c.jsx(zx,{...l,value:n,onChange:o,disabled:a})}),c.jsx(D,{grow:!0,children:c.jsx("input",{name:u,required:d,readOnly:p,disabled:a,placeholder:s,className:L(m,a&&"gs-utl-pointer-events-none"),value:f,onChange:w=>h(w.target.value),onBlur:x,onKeyDown:v})})]})]})}const Xs=ue(function(t){const{editor:n}=Se(),s=Eu(),r={...Fx(n),...t.colorPickerProps},o=s.getOverrideProps("colorField",{props:{...t,colorPickerProps:r},editor:n});return c.jsx(AR,{...o})}),MR="gs-cmp-studio-color-field",LR=g.memo(ue(function(t){const{editor:n}=Se(),{onChange:s,editorEvents:r}=t,[o,i]=g.useState(()=>({...t})),a=(u,d)=>{s==null||s({value:u||"",partial:d,editor:n,state:o,setState:p=>i(f=>({...f,...p}))})},l={className:L(MR,o.className),style:o.style,value:o.value||"",size:o.size,label:o.label,name:o.name,required:o.required,readOnly:o.readOnly,placeholder:o.placeholder,disabled:o.disabled,preventSubmitOnEnter:o.preventSubmitOnEnter,colorPickerProps:o.colorPickerProps,onChange:a};return Sr({editor:n,editorEvents:r,localState:o,setLocalState:i}),c.jsx(Xs,{...l})})),NR="gs-cmp-studio-color-picker",$R=g.memo(ue(function(t){const{editor:n}=Se(),r=Eu().getOverrideProps("colorPicker",{props:{...Fx(n),...t},editor:n}),{className:o,style:i,value:a="",format:l,formats:u,disabled:d,onChange:p,onFormatChange:f,editorEvents:h}=r,[m,b]=g.useState(()=>({className:o,style:i,value:a,format:l,formats:u,disabled:d})),v=(y,w)=>{const S=y||"";p==null||p({value:S,partial:w,editor:n,state:m,setState:j=>b(C=>({...C,...j}))})},x=y=>f==null?void 0:f({...y,editor:n,state:m,setState:w=>b(S=>({...S,...w}))});return Sr({editor:n,editorEvents:h,localState:m,setLocalState:b}),c.jsx("div",{className:L(NR,m.className,Pe.m),style:m.style,children:c.jsx(Bx,{value:m.value||"",format:m.format,formats:m.formats,onChange:v,onFormatChange:x,disabled:m.disabled})})})),kR="gs-cmp-column",RR=g.memo(function({className:t,children:n,full:s,...r}){return c.jsx(jn,{className:L(kR,z.bg,"gs-utl-flex gs-utl-flex-col",s&&"gs-utl-h-full",t),...r,children:Nt(n)})}),Bg=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
322
+ <path fill="currentColor" d="M20 6c0-2.168-3.663-4-8-4S4 3.832 4 6v2c0 2.168 3.663 4 8 4s8-1.832 8-4zm-8 13c-4.337 0-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4v-3c0 2.168-3.663 4-8 4"/><path fill="currentColor" d="M20 10c0 2.168-3.663 4-8 4s-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4z"/></svg>`,Co="--before-content",zg={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},Ux={stylable:!1,traits:[]};function IR(e){return typeof e=="object"&&e.type===Wt.variable}function $1(e){if(IR(e)){const{path:t}=e;return Wx(t||"")}return e}function Wx(e){return`{{ ${e} }}`}function VR(e){const t={};return e.DataSources.getAll().forEach(n=>{const s=n.get("id");if(!s)return;const r=n.getRecords();if(!r){t[s]={};return}t[s]=r.reduce((o,i)=>{if(!i)return o;let a={...i.attributes};return delete a.__p,delete a.id,s===Go.globalStyles&&(a={value:a.value}),{...o,[i.id]:a}},{})}),t}function Gx(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Ug=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags)??t?{...Ux}:{}},of=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e,s=(i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags;return t||s===!0?{...Ux}:{}},HR=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,DR=e=>Array.isArray(e)?"array":e===null?"default":typeof e,FR=ue(({name:e,value:t,isActive:n,isCollection:s,onClick:r,className:o})=>{const i=$e().tScoped("dataSources"),a=typeof t=="object"&&t!==null,l={array:K.codeBrackets,object:K.codeBraces,string:K.codeString,number:K.number,boolean:K.toggleSwitchOffOutline,default:K.null},u=DR(t),d=L(o,"gs-utl-text-left",z.hBgH,se.b,se.rnd,Pe.xy,n?[se.bA,z.tA]:[z.br,z.txtHighEmphasisH]),p=f=>typeof f=="object"?Array.isArray(f)?i("items",{params:{length:f.length}}):f?i("properties",{params:{length:Object.keys(f).length}}):"null":String(f);return c.jsx(Qe,{onClick:r,border:!1,className:d,full:!0,children:c.jsxs(k,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(k,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(k,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(ne,{icon:l[u],size:oe.s}),c.jsx(D,{className:L(Ae.txtEllips,s&&"gs-utl-font-bold"),children:e})]}),c.jsx(D,{className:L("gs-utl-w-full",Ae.txtEllips,Ae.disabled),children:p(t)})]}),a&&c.jsx(D,{children:c.jsx(ne,{size:oe.sx,icon:K.arrowRight,className:L(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),BR="gs-cmp-data-path-explorer",k1=ue(function({additionalSources:t,onChange:n,path:s=""}){const{editor:r}=Se(),o=g.useRef({}),[i,a]=g.useState(()=>s.split(".")),[l,u]=g.useState([]),d=g.useMemo(()=>({...r?VR(r):{},...t}),[r,t]),p=(b,v)=>{let x=o.current;for(let y=0;y<v&&y<b.length;y++){const w=b[y];if(x&&typeof x=="object"&&w in x)x=x[w];else{x=void 0;break}}return!x||typeof x!="object"?[]:Object.entries(x).map(([y,w])=>{const S=b.slice(0,v).concat(y),j=i[v]===y,C=v===0&&wr(w)&&w.collectionId===y,E=()=>{const O=j?S.slice(0,-1):S;n==null||n(O.join("."),{paths:O}),a(O)};return c.jsx(FR,{className:L(C&&"-gs-utl-order-1"),isCollection:C,name:y,value:w,isActive:j,onClick:E},y)})};g.useEffect(()=>{o.current=d;const b=[];for(let v=0;v<=i.length;v++){const x=p(i,v);x.length>0&&b.push(x)}u(b)},[d,i]);const f=L(BR,z.bg,z.br,se.b,se.rnd,Ae.scrollX,"gs-utl-h-full"),h=L("gs-utl-min-w-[220px]",z.br),m=L("gs-utl-h-full gs-utl-max-h-[60vh]",Ae.scrollY,Pe.xyS);return c.jsx(k,{className:f,full:!0,nowrap:!0,children:l.map((b,v)=>c.jsx(D,{className:L(h,v!==l.length-1&&se.br),children:c.jsx(k,{col:!0,nowrap:!0,gap:"m",className:m,children:b})},v))})});function qx(e){const{collectionId:t,variableType:n,path:s=""}=e;return t?[t,n,s].filter(Boolean).join("."):s}function Wg(e,t){const[n="",s="",...r]=e.split(".");return n&&t[n]?{collectionId:n,variableType:s,path:r.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const zR=e=>{const{path:t,collectionId:n,variableType:s}=e.dataResolver||{};return n?[n,s,t].filter(Boolean).join("."):e.value||t||""},UR=e=>{const{dataResolver:t,editor:n,value:s,defaultValue:r,additionalSources:o}=e,{path:i="",collectionId:a,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(a){const d=o==null?void 0:o[a],p=l&&d?d[l]:d;return(u==null?void 0:u.getValue(i,r,{context:p}))||""}else return(u==null?void 0:u.getValue(s,r))||""},WR="gs-cmp-data-path-field",Cl=ue(e=>{const{size:t="m",value:n="",label:s,open:r,defaultValue:o,additionalSources:i,dataResolver:a,readOnly:l,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:f}=e,{editor:h}=Se(),m=$e().tScoped("dataSources"),[b,v]=g.useState(!!r),[x,y]=g.useState(!1),w=!!l||b||x,S=()=>y(!x),j=F=>{const W=F??!b;v(W),f==null||f(W)},C=()=>j(!1),E=(...F)=>{p==null||p(...F)},O=F=>{w||p==null||p(F,{paths:F.split(".")})},P=zR({dataResolver:a,value:n}),T=x&&h?`"${UR({editor:h,dataResolver:a,additionalSources:i,value:n,defaultValue:o})}"`:P,A=t==="m",_=A?"lg":t,N=A?oe.l:oe.s,V=m(b?"closePathExplorer":"openPathExplorer"),M={icon:b?K.close:K.databaseOutline,size:oe.l},I={icon:x?K.eyeOff:K.eye,size:A?oe.m:N},U=c.jsx(St,{block:!0,variant:"pr",size:_,title:V,onClick:()=>j(),icon:M});return c.jsxs(k,{className:WR,gap:t,col:!0,children:[c.jsxs(k,{gap:t,items:"end",nowrap:!0,children:[c.jsx(at,{readOnly:w,label:s,value:x?T:P,size:t,disabled:u,onChange:O,placeholder:m("selectVariablePath"),className:L("gs-utl-flex-grow",z.txt,Ae.txtEllips),afterInput:!!n&&c.jsx(St,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:S,className:Ae.hover,icon:I})}),d?c.jsx(Os,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:U,onClose:C,overlay:!0,children:c.jsx(k1,{path:P,onChange:E,additionalSources:i})}):U]}),!!b&&!d&&c.jsx(k1,{path:P,onChange:E,additionalSources:i})]})}),GR=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},Kx=({value:e,step:t})=>{const n=parseFloat(`${e}`);let s=0;if(Math.floor(n)!==n&&t){const r=`${t}`.split(".")[1];s=(r==null?void 0:r.length)||0}return s?parseFloat(n.toFixed(s)):n},qR=({value:e,key:t,shiftKey:n,min:s,max:r,step:o=1})=>{const i=t==="ArrowUp",a=t==="ArrowDown";let l=null;if(i||a){l=Number(e);const u=parseFloat(`${o}`);i&&(l+=(n?10:1)*u),a&&(l-=(n?10:1)*u),l=`${Bu({min:s,max:r,value:l})}`,l=Kx({value:l,step:o})}return l},Bu=({min:e,max:t,value:n})=>{const s=parseFloat(`${n}`);let r=s||0;return Dt(e)&&e!==""&&(r=Math.max(r,parseFloat(`${e}`)||0)),Dt(t)&&t!==""&&(r=Math.min(r,parseFloat(`${t}`)||0)),`${`${s}`!=`${n}`?n:r}`},KR=(e,t,n,s={})=>{const r=parseInt(`${e}`,10)||0,{min:o,max:i,step:a=1}=s;let l=r;const u=p=>{const f=p.clientY-t,h=r-f*parseFloat(`${a}`);l=Kx({value:Bu({min:o,max:i,value:h}),step:a}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},ZR=(e,t,n={})=>{const{partial:s}=n,r=(o,i)=>o===i||s&&o.startsWith(i);return t.some(o=>r(typeof o=="string"?o:o.id,e))},R1=e=>Dt(e)?e:"",YR="gs-cmp-number-field";function Ne(e){const{className:t,value:n,units:s,valueUnit:r,size:o="m",pan:i=!0,min:a,max:l,step:u,placeholder:d,disabled:p,onChange:f,onChangeUnit:h}=e,[m,b]=g.useState(R1(n)),[v,x]=g.useState(!1),y=(s==null?void 0:s.map(P=>({id:P,label:P})))||[],w={min:a,max:l,step:u};g.useEffect(()=>{b(R1(n))},[n,r]);const S=(P,T)=>{f==null||f(Bu({min:a,max:l,value:P}),T)},j=P=>{if(p)return;x(!0);const T=(A,_)=>{S(A,!!_),!_&&x(!1)};KR(m,P.clientY,T,w)},C=P=>{const{key:T,shiftKey:A}=P;switch(T){case"Escape":return b(n);case"Enter":return S(m)}const _=qR({step:u,value:n,key:T,shiftKey:A});_!==null&&(P.preventDefault(),S(_))},E=()=>{S(m)},O=io({...e,className:L(YR,t)});return c.jsxs("div",{...O,children:[v&&c.jsx("div",{className:L("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(Ts,{as:e.labelAs,...e}),c.jsxs(k,{className:Eg(e),items:"center",space:"x2s",children:[!!i&&c.jsx(D,{onMouseDown:j,className:L("gs-utl-opacity-50 gs-utl-cursor-ns",o==="m"&&"-gs-utl-ml-3",o==="s"&&"-gs-utl-ml-2",i!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:i===!0?c.jsx(ne,{icon:K.panVertical,size:oe.s2x}):i}),c.jsx(D,{grow:!0,children:c.jsx("input",{className:bl(e),value:m,disabled:p,onChange:P=>b(P.target.value),placeholder:d,onBlur:E,onKeyDown:C})}),!!y.length&&c.jsx(D,{className:L(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(_e,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:r,disabled:p,onChange:P=>h==null?void 0:h(P),options:y})})]})]})}const XR="gs-cmp-switch-field";function Fa(e){const{className:t,value:n,label:s,labelAs:r,border:o,disabled:i,onChange:a}=e,l=!!n,u=L("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",l?z.bgA:z.bgH,Ta.focus,o&&`${z.br} ${se.b}`);return c.jsx(vd.Group,{children:c.jsxs(k,{items:"center",className:L(XR,t),full:!0,children:[!!s&&c.jsx(vd.Label,{as:r,className:L("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(Ts,{...e,as:"span"})}),c.jsx(vd,{checked:l,onChange:a,className:u,disabled:i,children:c.jsx("span",{className:L(z.bg,"gs-utl-inline-block gs-utl-w-4 gs-utl-h-4 gs-utl-transform gs-utl-rounded-full gs-utl-transition-transform",l?"gs-utl-translate-x-6":"gs-utl-translate-x-1")})})]})})}function Gg(e){var i;const[t,n]=g.useState(((i=e.getDataResolver)==null?void 0:i.call(e))??{}),s=g.useRef(t),r=a=>{const l={...s.current,...a};s.current=l,n(l)},o=()=>{e.setDataResolver(s.current)};return g.useEffect(()=>{const a="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(a,l),()=>{e.off(a,l)}},[e]),{localData:t,updateLocalData:r,syncToComponent:o}}const JR="gs-cmp-data-collection-picker",QR=ue(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Gg(e),{collectionId:o="",dataSource:i={},startIndex:a=0,endIndex:l=10}=n,u=qx(i),d=l===Number.MAX_VALUE,p=$e().tScoped("dataSources"),f=d?"":l,h=()=>{r(),t==null||t({value:n})},m=y=>s({dataSource:{...i,path:y}}),b=y=>s({startIndex:y}),v=y=>s({endIndex:y}),x=y=>s({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(k,{className:JR,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(at,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:o,readOnly:!0,disabled:!0}),c.jsx($y,{size:"s",value:o,block:!0})]}),c.jsx(Cl,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Ne,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:a==null?void 0:a.toString(),onChange:b}),c.jsx(Ne,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:f==null?void 0:f.toString(),onChange:v,className:L("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(D,{children:c.jsx(Fa,{label:p("collectionUpToEndIndex"),value:d,onChange:x})})]}),c.jsx(k,{full:!0,justify:"end",children:c.jsx(Qe,{onClick:h,variant:"pr",size:"m",children:p("confirm")})})]})}),eI="gs-data-collection-picker",tI=ue(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:L(eI,t),...r,children:c.jsx(QR,{component:n,onConfirm:s})})});var Rn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Rn||{}),_n=(e=>(e.equals="equals",e.isTruthy="isTruthy",e.isFalsy="isFalsy",e.isDefined="isDefined",e.isNull="isNull",e.isUndefined="isUndefined",e.isArray="isArray",e.isObject="isObject",e.isString="isString",e.isNumber="isNumber",e.isBoolean="isBoolean",e.isDefaultValue="isDefaultValue",e))(_n||{}),qg=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(qg||{}),Kg=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Kg||{});const nI=[...Object.values(Kg),...Object.values(qg),...Object.values(_n)],af={string:Object.values(Kg),number:Object.values(qg),dataSource:nI},sI=g.memo(function(t){const{additionalSources:n,side:s,type:r,value:o,onChange:i}=t;switch(r){case Rn.DATA_SOURCE:return c.jsx(Cl,{size:"s",pickerInPopover:!0,value:qx(o),onChange:a=>i(s,a,r),additionalSources:n});case Rn.NUMBER:return c.jsx(Ne,{size:"s",value:o,onChange:a=>i(s,a,r)});default:return c.jsx(at,{size:"s",value:o,onChange:a=>i(s,a,r)})}}),rI="gs-cmp-statement-side",I1=g.memo(function({side:t,type:n,value:s,label:r,onChange:o,onTypeChange:i,additionalSources:a,typeOptions:l}){return c.jsxs(k,{className:L(rI,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Yr,{size:"s",children:r}),c.jsxs(k,{items:"center",gap:"xs",children:[c.jsx(D,{children:c.jsx(_e,{size:"s",value:n,options:l,onChange:u=>i(t,u)})}),c.jsx(D,{grow:!0,children:c.jsx(sI,{additionalSources:a,side:t,type:n,value:s,onChange:o})})]})]})}),Zl=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Rn.DATA_SOURCE:typeof e=="string"?Rn.STRING:typeof e=="number"?Rn.NUMBER:Rn.STRING,oI=(e,t,n)=>{switch(t){case Rn.STRING:return e||"";case Rn.NUMBER:return e?Number(e):0;case Rn.DATA_SOURCE:{const s=n||{};return{type:"data-variable",...(pt(e)?Wg(e,s):e)??{path:"",defaultValue:""}}}default:return e}},iI=e=>af[e][0],aI=e=>![_n.isTruthy,_n.isFalsy,_n.isDefined,_n.isNull,_n.isUndefined,_n.isArray,_n.isObject,_n.isString,_n.isNumber,_n.isBoolean,_n.isDefaultValue].includes(e),lI="gs-cmp-statement",cI=ue(e=>{const{statement:t,onChange:n,className:s,additionalSources:r}=e,o=$e().tScoped("dataSources"),[i,a]=g.useState(()=>Zl(t.left)),[l,u]=g.useState(()=>Zl(t.right)),d=af[i]||af[Rn.STRING],p=g.useMemo(()=>Object.values(Rn).map(S=>({id:S,label:Ds(S)})),[]),f=g.useMemo(()=>d.map(S=>({id:S,label:o(`operators.${S}`)})),[d,o]);g.useEffect(()=>{a(Zl(t.left)),u(Zl(t.right))},[t.left,t.right]);const h=S=>{n({...t,...S})},m=(S,j,C)=>{const E=oI(j,C,r),O=S==="left",P=O&&C!==Rn.DATA_SOURCE;O?a(C):u(C),h({[S]:E,...P&&{operator:iI(C)}})},b=(S,j)=>m(S,null,j),v=S=>h({operator:S}),x=L(lI,s,z.br,se.b,se.rnd,Pe.xy),y=aI(t.operator),w={additionalSources:r,onChange:m,onTypeChange:b,typeOptions:p};return c.jsx(k,{className:L(x,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(k,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(I1,{side:"left",type:i,value:t.left,label:o("leftValue"),...w}),c.jsx(D,{children:c.jsx(_e,{size:"s",label:o("operator"),value:t.operator,options:f,onChange:v})}),y&&c.jsx(I1,{side:"right",type:l,value:t.right,label:o("rightValue"),...w})]})})}),Kd="gs-cmp-statements-group",uI=e=>e==="and"||e==="or",Kc=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),Zx=ue(e=>{const{className:t,condition:n,onUpdate:s,additionalSources:r,skipAddCondition:o}=e,i=$e().tScoped("dataSources"),a=n.statements??[],l=n.logicalOperator||"and",u=m=>{uI(m)&&s({...n,logicalOperator:m})},d=()=>{Kc(n),s(Kc(n))},p=m=>{const b=a.filter((v,x)=>x!==m);s({...n,statements:b})},f=(m,b)=>{if(m>=0&&m<a.length){const v=[...a];v[m]=b,s({...n,statements:v})}},h=[{id:"and",label:i("conditionAnd")},{id:"or",label:i("conditionOr")}];return c.jsxs(k,{className:L(Kd,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[a.length>1&&c.jsx(lo,{value:l,onChange:u,tabs:h}),c.jsx(k,{className:`${Kd}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:a.map((m,b)=>c.jsxs(k,{className:L(`${Kd}__item`),gap:"s",col:!0,children:[c.jsx(cI,{additionalSources:r,statement:m,onChange:v=>f(b,v)}),b<a.length-1&&c.jsxs(k,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:L(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(St,{block:!0,variant:"out-clear",title:i("deleteCondition"),onClick:()=>p(b+1),icon:{icon:K.delete,size:oe.s}})]})]},`stmt-${b}`))}),!o&&c.jsx(k,{justify:"end",children:c.jsx(Qe,{variant:"pr",onClick:d,icon:{icon:K.plus,size:oe.s},children:i("addCondition")})})]})}),dI="gs-cmp-data-condition-picker",pI=ue(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Gg(e),o=$e().tScoped("dataSources"),i=n.condition,a=d=>s({condition:d}),l=()=>{r(),t==null||t({value:n})},u=()=>{s({condition:Kc(i)})};return c.jsxs(k,{className:dI,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(Zx,{additionalSources:e.collectionsStateMap??{},condition:i,onUpdate:a,skipAddCondition:!0}),c.jsxs(k,{gap:"m",justify:"end",full:!0,children:[c.jsx(Qe,{variant:"out",onClick:u,icon:{icon:K.plus,size:oe.s},children:o("addCondition")}),c.jsx(Qe,{onClick:l,variant:"pr",size:"m",children:o("confirm")})]})]})}),fI="gs-data-condition-picker",gI=ue(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:L(fI,t),...r,children:c.jsx(pI,{component:n,onConfirm:s})})}),hI="gs-data-path-field",mI=ue(({className:e,value:t="",onChange:n,...s})=>c.jsx(jn,{className:L(hI,e),...s,children:c.jsx(Cl,{onChange:r=>n({value:r}),value:t})})),Yl={type:"data-variable",path:"",defaultValue:""},V1={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function Jr(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const H1="gs-cmp-dynamic-value-picker",bI=ue(({value:e,onChange:t,onConfirm:n,additionalSources:s})=>{const[r,o]=g.useState(()=>Jr(e)?e:Yl),[i,a]=g.useState(r.type),l=$e().tScoped("dataSources");g.useEffect(()=>{const w=Jr(e)?e:Yl;(w.type!==r.type||JSON.stringify(w)!==JSON.stringify(r))&&(o(w),a(w.type))},[e]);const u=w=>{o(w),t==null||t({value:w})},d=w=>{const S=w;a(S);const j=r.type===S?r:S==="data-variable"?Yl:V1;u(j)},p=w=>{u({type:"data-variable",defaultValue:r.defaultValue,...Wg(w,s)})},f=w=>{o(S=>{const j={...S,defaultValue:w};return t==null||t({value:j}),j})},h=w=>{u({...r,condition:w})},m=(w,S)=>{u({...r,[w]:S})},b=()=>{const w=r.condition;h(Kc(w))},v=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],x=(r==null?void 0:r.type)==="data-variable"?r:Yl,y=(r==null?void 0:r.type)==="data-condition"?r:V1;return c.jsxs(k,{className:H1,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{className:H1,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(lo,{value:i,onChange:d,tabs:v}),c.jsx(D,{grow:!0,className:Pe.y,style:{overflowY:"auto",overflowX:"hidden"},children:i==="data-variable"?c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(Cl,{value:x.path,label:l("variablePath"),additionalSources:s,defaultValue:x.defaultValue,onChange:p}),c.jsx(at,{label:l("defaultValue"),value:x.defaultValue||"",onChange:f})]}):c.jsxs(k,{gap:"m",col:!0,children:[c.jsx(Zx,{additionalSources:s,condition:y.condition,onUpdate:h,skipAddCondition:!0}),c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(at,{label:l("ifTrue"),value:y.ifTrue,onChange:w=>m("ifTrue",w)}),c.jsx(at,{label:l("ifFalse"),value:y.ifFalse,onChange:w=>m("ifFalse",w)})]})]})}),i==="data-condition"&&c.jsx(k,{full:!0,justify:"end",className:Pe.x,children:c.jsx(Qe,{variant:"out",onClick:b,icon:{icon:K.plus,size:oe.s},children:l("addCondition")})})]}),c.jsx(k,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Qe,{onClick:()=>{n==null||n({value:r})},variant:"pr",size:"m",children:l("confirm")})})]})}),vI="gs-data-value-picker",yI=ue(({className:e,value:t={},onChange:n,onConfirm:s,additionalSources:r={},...o})=>c.jsx(jn,{className:L(vI,e),...o,children:c.jsx(bI,{value:t,onConfirm:i=>s==null?void 0:s(i),onChange:i=>n==null?void 0:n(i),additionalSources:r})})),xI="gs-cmp-data-variable-picker",wI=ue(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=Gg(e),o=$e().tScoped("dataSources"),{path:i="",defaultValue:a=""}=n,l=e.collectionsStateMap,u=f=>{s(Wg(f,l))},d=()=>{r(),t==null||t({value:n})},p=f=>s({defaultValue:f});return c.jsxs(k,{className:xI,gap:"s",col:!0,nowrap:!0,children:[c.jsx(Cl,{value:i,label:o("variablePath"),dataResolver:n,additionalSources:l,defaultValue:a,onChange:u}),c.jsx(at,{label:o("defaultValue"),value:a,onChange:p}),c.jsx(k,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Qe,{onClick:d,variant:"pr",size:"m",children:o("confirm")})})]})}),SI="gs-data-variable-picker",CI=ue(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(jn,{className:L(SI,t),...r,children:c.jsx(wI,{component:n,onConfirm:s})})}),jI="gs-cmp-input-field",EI=g.memo(ue(function({className:t,style:n,label:s,name:r,value:o,size:i,disabled:a,inputType:l,readOnly:u,required:d,placeholder:p,onChange:f,onInput:h,editorEvents:m}){const{editor:b}=Se(),[v,x]=g.useState(()=>({className:t,style:n,label:s,name:r,value:o,size:i,readOnly:u,disabled:a,required:d,placeholder:p})),y=j=>({value:j,editor:b,state:v,setState:C=>x(E=>({...E,...C}))}),w=j=>f==null?void 0:f(y(j)),S=j=>h==null?void 0:h(y(j));return Sr({editor:b,editorEvents:m,localState:v,setLocalState:x}),c.jsx(at,{type:l,className:L(jI,v.className),style:v.style,label:v.label,name:v.name,value:v.value,size:v.size,required:v.required,disabled:v.disabled,readOnly:v.readOnly,placeholder:v.placeholder,onChange:w,onInput:S})})),PI="gs-menu-list",TI=ue(function({className:e,items:t,onItemClick:n,...s}){const{editor:r}=Se(),[o,i]=g.useState(),a=u=>{const{onClick:d}=u;if(d&&r)return p=>d({item:u,editor:r,...p})},l=()=>{if(n&&r)return u=>n({...u,editor:r})};return c.jsx(jn,{className:L(PI,z.bg,"gs-utl-flex gs-utl-flex-col",e),...s,children:(t||[]).map((u,d)=>g.createElement(Ii,{...u,label:u.layout?Nt(u.layout):u.label,key:u.id??d,className:u.className,action:a(u),onActive:()=>i(u),onItemClick:l(),active:o===u,items:u.items}))})});function OI({children:e,accept:t,onChange:n,multiple:s=!0,...r}){const o=$e(),i=g.useRef(null),a=()=>{const{current:l}=i;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:J("hidden"),ref:i,type:"file",multiple:s,accept:t,onChange:n}),c.jsx(Qe,{variant:"pr",size:"m2",...r,onClick:a,children:e||o.t("upload")})]})}const _I=ue(OI),AI=ue(function({editor:t,assetProps:n,itemLayout:s,onSelect:r,onRemove:o}){const i=gl();return Nt(s({asset:ds(i.toAsset(n)),assetProps:ds(n),onSelect:a=>r(i.toAssetProps(a)),onDelete:o&&(a=>o(i.toAssetProps(a))),editor:t}))}),MI="gs-cmp-asset-card",LI=ue(function(t){var p;const{assetProps:n,onSelect:s,onRemove:r,className:o,itemLayout:i}=t,a=$e(),{editor:l}=Se();if(i)return l?c.jsx(AI,{...t,editor:l,itemLayout:i}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return c.jsx(os,{padding:!1,className:le(MI,"overflow-hidden max-w-full group",o),children:c.jsxs(k,{col:!0,children:[c.jsxs(D,{className:le("relative group h-24 cursor-pointer bg-checker"),onClick:()=>s(n),children:[c.jsx("div",{className:le("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(k,{justify:"center",items:"center",className:le(Ae.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Qe,{className:le("text-sm"),size:"m2",variant:"pr",children:a.t("select")})})]}),c.jsxs(k,{className:le("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(D,{className:le(Ae.txtEllips,"text-sm gjs-mr-auto"),children:d}),r&&c.jsx(Hu,{onConfirm:()=>r==null?void 0:r(n),text:c.jsxs(k,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:le("text-center",z.txtHighEmphasis),children:a.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:le("text-center"),children:a.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(St,{title:a.t("delete"),children:c.jsx(ne,{icon:K.delete,size:oe.sx})})})]})]})})}),Wn="gs-asset-manager",NI={search:!0,addUrl:!0,upload:!0},$I=ue(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:s,typeFilter:r,providerFilter:o,searchValue:i,isLoading:a,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:f,onSelect:h,onChangeTypeFilter:m,onChangeProviderFilter:b,onChangeSearchValue:v,onChangeUpload:x,onAddUrl:y,onRemove:w,onEndReached:S,layoutAfterHeader:j}){const C=Se(),{editor:E}=C,O=$e(),[P]=wg(),T=Hg(f==null?void 0:f.itemsPerRow),[A,_]=g.useState(""),N=(f==null?void 0:f.header)===!1?!1:{...NI,...wr(f==null?void 0:f.header)?f.header:{}};if(!E)return;const V=d?t.filter(M=>!(i&&!gi(M.src,i)&&!gi(M.name??"",i))):t;return c.jsxs(k,{className:J(Wn,"relative gs-utl-h-full",a&&Ae.disabled),nowrap:!0,col:!0,space:"m",children:[N!==!1&&c.jsxs(k,{className:`${Wn}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(k,{className:`${Wn}__header-filters`,items:"center",gap:"m",children:[N.search&&c.jsx(D,{children:c.jsx(at,{className:`${Wn}__search-filter`,size:"m",type:"search",value:i,onInput:v,placeholder:`${O.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(D,{children:c.jsx(_e,{className:J(`${Wn}__type-filter`,"items-center"),size:"m",options:n,value:r,onChange:m,emptyState:O.t("assetManager.assetTypes.all"),includeEmpty:l})}),s.length>(u?0:1)&&c.jsx(D,{children:c.jsx(_e,{classNameContainer:J(`${Wn}__provider-filter`,"items-center"),size:"m",options:s.map(M=>({...M,label:rt(M.label)?M.label({editor:E}):M.label,icon:M.icon})),value:o,onChange:b,emptyState:O.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(k,{className:`${Wn}__header-buttons`,items:"center",gap:"m",children:[N.upload&&c.jsx(D,{className:`${Wn}__upload`,children:c.jsx(_I,{className:`${Wn}__upload-field`,onChange:x})}),N.addUrl&&!!y&&c.jsx(D,{className:`${Wn}__add-url`,children:c.jsx(Os,{className:`${Wn}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Qe,{variant:"pr",size:"m2",children:O.t("assetManager.addUrl")}),children:({close:M})=>c.jsx("form",{onSubmit:I=>{I.preventDefault(),y(A),_(""),M()},children:c.jsxs(k,{gap:"m",children:[c.jsx(D,{children:c.jsx(at,{type:"url",size:"s",pattern:"https?://.+",value:A,onChange:_,placeholder:O.t("assetManager.inputPlh"),required:!0})}),c.jsx(D,{children:c.jsx(Qe,{variant:"pr",size:"m2",type:"submit",children:O.t("add")})})]})})})})]}),j&&c.jsx(c.Fragment,{children:Nt(j({editor:E}))})]}),c.jsx(k,{className:J(`${Wn}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!a&&!V.length?c.jsx(k,{justify:"center",children:O.t("noItems")}):!!P&&c.jsx(Vu,{data:V,listClassName:J("gs-utl-grid gs-utl-gap-2",T),endReached:S,itemContent:(M,I)=>c.jsx(LI,{assetProps:I,onSelect:h,onRemove:w,itemLayout:p},I.id),components:{Footer:S?kI:void 0}})}),a&&c.jsx(Gr,{abs:!0})]})}),kI=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),RI=ue(function({panelId:t,content:n,assets:s,types:r,providers:o,typeId:i,providerId:a,optionalType:l,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:f}){const{appEditorStore:h,i18nStore:m}=En(),{editor:b}=h,v=gl(),{customOnLoad:x}=v,y=iy(t);g.useEffect(()=>{const E=P=>pt(P)?{id:P,label:m.t(`assetManager.assetTypes.${P}`)||P}:P;y.setCustomTypes(r==null?void 0:r.map(E)),y.setCustomProviders(pt(o)?[o]:o),i?y.setTypeFilter(i):y.initTypeFilter(),a?y.setProviderFilter(a):y.initProviderFilter(),Dt(l)?y.setOptionalType(l):y.initOptionalType(),Dt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const O=setTimeout(()=>y.loadAssets());return()=>clearTimeout(O)},[r,o,i,a,l,u]);const w=E=>{v.addToProjectAssets([{id:E,src:E,type:y.typeFilter??Oo.image}])},S=E=>{b&&(d==null||d({asset:v.toAsset(E),assetProps:E,editor:b}),p==null||p())},j=s==null?void 0:s.map(v.toAssetProps),C=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx($I,{assetProps:j??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:E=>{y.setTypeFilter(E),y.loadAssets()},onChangeProviderFilter:E=>{y.setProviderFilter(E),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:S,onAddUrl:x?void 0:w,onChangeUpload:E=>v.uploadFile(E.nativeEvent),onRemove:j?void 0:y.handleDelete,onEndReached:C,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:f})});var II=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Rt=function(){return Rt=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Rt.apply(this,arguments)},D1={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},F1={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Xl={width:"20px",height:"20px",position:"absolute"},VI={top:Rt(Rt({},D1),{top:"-5px"}),right:Rt(Rt({},F1),{left:void 0,right:"-5px"}),bottom:Rt(Rt({},D1),{top:void 0,bottom:"-5px"}),left:Rt(Rt({},F1),{left:"-5px"}),topRight:Rt(Rt({},Xl),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Rt(Rt({},Xl),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Rt(Rt({},Xl),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Rt(Rt({},Xl),{left:"-10px",top:"-10px",cursor:"nw-resize"})},HI=function(e){II(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(s){n.props.onResizeStart(s,n.props.direction)},n.onTouchStart=function(s){n.props.onResizeStart(s,n.props.direction)},n}return t.prototype.render=function(){return it.createElement("div",{className:this.props.className||"",style:Rt(Rt({position:"absolute",userSelect:"none"},VI[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(it.PureComponent),DI=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Ns=function(){return Ns=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Ns.apply(this,arguments)},FI={width:"auto",height:"auto"},Jl=function(e,t,n){return Math.max(Math.min(e,n),t)},B1=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},ti=function(e,t){return new RegExp(e,"i").test(t)},Ql=function(e){return!!(e.touches&&e.touches.length)},BI=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},z1=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(o,i,a){return Math.abs(i-e)<Math.abs(t[o]-e)?a:o},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},Zd=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:e+"px"},ec=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},zI=function(e,t,n,s,r,o,i){return s=ec(s,e.width,t,n),r=ec(r,e.height,t,n),o=ec(o,e.width,t,n),i=ec(i,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof i>"u"?void 0:Number(i)}},UI=function(e){return Array.isArray(e)?e:[e,e]},WI=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],U1="__resizable_base__",GI=function(e){DI(t,e);function t(n){var s,r,o,i,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var u=a.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(U1):u.className+=U1,l.appendChild(u),u},a.removeBase=function(l){var u=a.parentNode;u&&u.removeChild(l)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(i=(o=a.propsSize)===null||o===void 0?void 0:o.height)!==null&&i!==void 0?i:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||FI},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,o=this.resizable.offsetHeight,i=this.resizable.style.position;i!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,this.resizable.style.position=i}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var l;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((l=n.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),p=d/u[a]*100;return p+"%"}return Zd(n.state[a])},o=s&&typeof s.width<"u"&&!this.state.isResizing?Zd(s.width):r("width"),i=s&&typeof s.height<"u"&&!this.state.isResizing?Zd(s.height):r("height");return{width:o,height:i}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return s&&(this.parentNode.style.flexWrap=r),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,o=this.state.direction,i=r&&ti("left",o),a=r&&ti("top",o),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=i?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,o=UI(this.props.resizeRatio||1),i=o[0],a=o[1],l=this.state,u=l.direction,d=l.original,p=this.props,f=p.lockAspectRatio,h=p.lockAspectRatioExtraHeight,m=p.lockAspectRatioExtraWidth,b=d.width,v=d.height,x=h||0,y=m||0;return ti("right",u)&&(b=d.width+(n-d.x)*i/r,f&&(v=(b-y)/this.ratio+x)),ti("left",u)&&(b=d.width-(n-d.x)*i/r,f&&(v=(b-y)/this.ratio+x)),ti("bottom",u)&&(v=d.height+(s-d.y)*a/r,f&&(b=(v-x)*this.ratio+y)),ti("top",u)&&(v=d.height-(s-d.y)*a/r,f&&(b=(v-x)*this.ratio+y)),{newWidth:b,newHeight:v}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,o){var i=this.props,a=i.lockAspectRatio,l=i.lockAspectRatioExtraHeight,u=i.lockAspectRatioExtraWidth,d=typeof o.width>"u"?10:o.width,p=typeof r.width>"u"||r.width<0?n:r.width,f=typeof o.height>"u"?10:o.height,h=typeof r.height>"u"||r.height<0?s:r.height,m=l||0,b=u||0;if(a){var v=(f-m)*this.ratio+b,x=(h-m)*this.ratio+b,y=(d-b)/this.ratio+m,w=(p-b)/this.ratio+m,S=Math.max(d,v),j=Math.min(p,x),C=Math.max(f,y),E=Math.min(h,w);n=Jl(n,S,j),s=Jl(s,C,E)}else n=Jl(n,d,p),s=Jl(s,f,h);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*n,this.targetTop=o.top*n}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,l=i.top,u=i.right,d=i.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,o=0;if(n.nativeEvent&&BI(n.nativeEvent)?(r=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&Ql(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,o=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var i=this.props.onResizeStart(n,s,this.resizable);if(i===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:r,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ns(Ns({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(p)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Ql(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,o=r.maxWidth,i=r.maxHeight,a=r.minWidth,l=r.minHeight,u=Ql(n)?n.touches[0].clientX:n.clientX,d=Ql(n)?n.touches[0].clientY:n.clientY,p=this.state,f=p.direction,h=p.original,m=p.width,b=p.height,v=this.getParentSize(),x=zI(v,this.window.innerWidth,this.window.innerHeight,o,i,a,l);o=x.maxWidth,i=x.maxHeight,a=x.minWidth,l=x.minHeight;var y=this.calculateNewSizeFromDirection(u,d),w=y.newHeight,S=y.newWidth,j=this.calculateNewMaxFromBoundary(o,i);this.props.snap&&this.props.snap.x&&(S=z1(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=z1(w,this.props.snap.y,this.props.snapGap));var C=this.calculateNewSizeFromAspectRatio(S,w,{width:j.maxWidth,height:j.maxHeight},{width:a,height:l});if(S=C.newWidth,w=C.newHeight,this.props.grid){var E=B1(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),O=B1(w,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),P=this.props.snapGap||0,T=P===0||Math.abs(E-S)<=P?E:S,A=P===0||Math.abs(O-w)<=P?O:w;S=T,w=A}var _={width:S-h.width,height:w-h.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var N=S/v.width*100;S=N+"%"}else if(m.endsWith("vw")){var V=S/this.window.innerWidth*100;S=V+"vw"}else if(m.endsWith("vh")){var M=S/this.window.innerHeight*100;S=M+"vh"}}if(b&&typeof b=="string"){if(b.endsWith("%")){var N=w/v.height*100;w=N+"%"}else if(b.endsWith("vw")){var V=w/this.window.innerWidth*100;w=V+"vw"}else if(b.endsWith("vh")){var M=w/this.window.innerHeight*100;w=M+"vh"}}var I={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(w,"height")};this.flexDir==="row"?I.flexBasis=I.width:this.flexDir==="column"&&(I.flexBasis=I.height);var U=this.state.width!==I.width,F=this.state.height!==I.height,W=this.state.flexBasis!==I.flexBasis,H=U||F||W;H&&kn.flushSync(function(){s.setState(I)}),this.props.onResize&&H&&this.props.onResize(n,f,this.resizable,_)}},t.prototype.onMouseUp=function(n){var s,r,o=this.state,i=o.isResizing,a=o.direction,l=o.original;if(!(!i||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,u),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ns(Ns({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(n){var s=this,r=this.props,o=r.enable,i=r.handleStyles,a=r.handleClasses,l=r.handleWrapperStyle,u=r.handleWrapperClass,d=r.handleComponent;if(!o)return null;var p=n.filter(function(f){return o[f]!==!1}).map(function(f){return o[f]!==!1?it.createElement(HI,{key:f,direction:f,onResizeStart:s.onResizeStart,replaceStyles:i&&i[f],className:a&&a[f]},d&&d[f]?d[f]:null):null});return it.createElement("div",{className:u,style:l},p)},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(i,a){return WI.indexOf(a)!==-1||(i[a]=n.props[a]),i},{}),r=Ns(Ns(Ns({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return it.createElement(o,Ns({style:r,className:this.props.className},s,{ref:function(i){i&&(n.resizable=i)}}),this.state.isResizing&&it.createElement("div",{style:this.state.backgroundStyle}),this.renderResizer(["topLeft","top","topRight","left"]),this.props.children,this.renderResizer(["right","bottomLeft","bottom","bottomRight"]))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(it.PureComponent);function zu({className:e,children:t,top:n,bottom:s,right:r,left:o,width:i,height:a,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,onResize:h,onResizeStop:m,...b}){const v={top:n||!1,right:r||!1,bottom:s||!1,left:o||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},x={width:i||"auto",height:a||"auto"},y=L("gs-utl-z-10",z.hBgAct),w={top:y,bottom:y,right:y,left:y},S={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(GI,{className:e,enable:b.enable??v,defaultSize:x,handleStyles:S,handleClasses:w,onResize:h,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,children:t})}const Zg="gs-cmp-accordion",lf=`${Zg}-handler`,tc=`${lf}__content`,qI=`${Zg}-content`;function yr({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:s,style:r,handler:o,handlerIcon:i,children:a,inverted:l,disabled:u,sticky:d,onChange:p,open:f}){return c.jsx(hd,{as:"div",defaultOpen:f,className:J(Zg,t,"relative"),children:({open:h})=>c.jsxs(c.Fragment,{children:[c.jsx(hd.Button,{as:u?"div":"button",disabled:u,style:r,onClick:m=>p==null?void 0:p({event:m,open:!h}),className:({open:m})=>L(lf,rt(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs(k,{items:"center",className:J("gap-2"),full:!0,children:[c.jsx(D,{className:J(tc,s,"text-left"),grow:!0,children:rt(o)?o(m):c.jsxs(k,{items:"center",className:J(`${tc}-wrp`,"gap-3"),nowrap:!0,children:[!!i&&c.jsx(ne,{className:J(`${tc}-icon`),icon:i,size:oe.s2x}),c.jsx(D,{className:J(`${tc}-label gs-utl-w-full`),children:o})]})}),c.jsx(D,{className:J(`${lf}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(ne,{icon:K.chevronDown,className:J("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(hd.Panel,{className:J(qI,n),children:a})]})})}const Qi="gs-studio-panel",Yx=(e,t={})=>({...t,...e===!0?{}:e||void 0}),_s=g.memo(function({children:t,header:n,resizable:s,className:r,classNameAccordion:o,classNameAccordionContent:i,...a}){const l=c.jsx(jn,{className:L(Qi,r),...a,children:t}),u=s?s===!0?{top:!0,right:!0,bottom:!0,left:!0}:s:void 0,d=u?c.jsx(zu,{className:L([`${Qi}__resizer`]),...u,children:l}):l,p=n===!0?{collapsible:!0}:n||void 0;return p?c.jsx(yr,{classNameWrap:L(`${Qi}__accordion`,o),className:L(`${Qi}__accordion-header`,Pe.xy,p.className),classNameContent:L(`${Qi}__accordion-content`,i),disabled:p.collapsible===!1,style:p.style,handler:c.jsxs(k,{space:"s",items:"center",children:[!!p.icon&&c.jsx(ne,{icon:p.icon,size:oe.s}),c.jsx(D,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),KI="gs-panel-assets",ZI=g.memo(ue(function({className:t,onSelect:n,content:s,assets:r,types:o,providers:i,typeId:a,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:f,...h}){var j;const m=Se(),b=gl(),v=m.editor,x=(j=m.sdkOptions.assets)==null?void 0:j.layoutAfterHeader,y=f||x,[w]=g.useState(()=>h.id||D0());return g.useEffect(()=>(b.createAssetManager(w),()=>{b.removeAssetManager(w)}),[w]),iy(w)?c.jsx(_s,{className:L(KI,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...h,children:v&&c.jsx(RI,{panelId:w,assets:r,types:o,providers:i,onSelect:n,typeId:a,providerId:l,content:s,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null})),Xx={indent_size:2},YI=async()=>await ES([{id:"js_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify.min.js"},{id:"css_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify-css.min.js"},{id:"html_beautify",src:"https://cdn.jsdelivr.net/npm/js-beautify@1.15.4/js/lib/beautify-html.min.js"}]),XI=(e,t={})=>{const n=window.html_beautify;return n?n(e,{...Xx,indent_inner_html:!0,preserve_newlines:!0,inline:[],...t.isEmail&&{inline_custom_elements:!1,unformatted:[],content_unformatted:[]}}):e},JI=e=>{const t=window.css_beautify;return t?t(e,Xx):e};function Jx(e,t){if(e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const r of n)if(!s.includes(r)||!Jx(e[r],t[r]))return!1;return!0}function QI(e){return e.Css.getAll().filter(n=>{var r;const s=(r=n.get("__data_values"))==null?void 0:r.style;return!s||Gb(s)})}function Qx(e,t){return{avoidProtected:!0,keepUnusedStyles:!1,component:t,rules:QI(e)}}function e6({editor:e,page:t,component:n,includeComponentIds:s=!0}){return{page:t,optionsHtml:{attributes:(r,o)=>{var l;if(!s)return o;const i=r.tagName;return o&&!["body","html","head"].includes(i)&&((l=r.parent())==null?void 0:l.tagName)!=="head"&&(o.id=r.getId()),o}},optionsCss:Qx(e,n),skipProject:!0,skipGlobalCode:!0,skipCustomCodeBody:!0,styles:"skipInPage",scriptComponents:"skip"}}function t6({projectFiles:e,isEmail:t}){var o,i,a;const n=(o=e.find(l=>l.mimeType==="text/html"))==null?void 0:o.content,s=(i=e.find(l=>l.mimeType==="text/mjml"))==null?void 0:i.content,r=(a=e.find(l=>l.mimeType==="text/css"))==null?void 0:a.content;return{code:t?s||"":n||"",codeStyle:r||""}}function n6(e){const t={};return e.forEach(n=>{const s=n.getAtRule(),r=n.selectorsToString(),o=`${s}__${r}`;t[o]=n}),t}function s6({editor:e,css:t,component:n}){const{Css:s,Parser:r}=e,o=new Set,i={},a={added:[],updated:[],removed:[]},l=e.getCss({...Qx(e,n),json:!0}),u=n6(l);return r.parseCss(t).forEach(p=>{const{atRuleType:f="",mediaText:h="",state:m="",selectorsAdd:b="",selectors:v=[]}=p,x=v.map(E=>E.startsWith("#")?E:`.${E}`).join(""),y=[];x&&y.push(`${x}${m?`:${m}`:""}`),b&&y.push(b);const w=y.join(", "),S=f?`@${f}`:h?"@media":"",C=`${S+(h&&S?` ${h}`:"")}__${w}`;i[C]=p}),Object.keys(i).forEach(p=>{const f=u[p],h=i[p];if(f)f.setStyle(h.style),a.updated.push({rule:f,parsedRule:h});else{const m=s.rules.add(h);a.added.push({rule:m,parsedRule:h})}o.add(p)}),Object.keys(u).forEach(p=>{if(!o.has(p)){const f=u[p];s.remove(f),a.removed.push({rule:f})}}),a}const On="gs-panel-edit-code",r6=ue(function({className:t,style:n,htmlAttrs:s,id:r,as:o,state:i,layoutBefore:a,layoutAfter:l,...u}){const{editor:d}=Se(),{isDarkTheme:p}=Ps(),f=g.useRef(),h=g.useRef(!0),[m,b]=g.useState(!1),[v,x]=g.useState(0),[y,w]=g.useState(""),[S,j]=g.useState(""),[C,E]=g.useState(""),[O,P]=g.useState(""),[T,A]=g.useState(),[_,N]=g.useState(),V=ae=>d==null?void 0:d.t(`actions.editCode.${ae}`),M=f.current??(i==null?void 0:i({editor:d}))??{};f.current=M;const[I,U]=g.useState(()=>M.page??(d==null?void 0:d.Pages.getSelected())??null),[F]=g.useState(()=>X0(d)),{className:W,style:H,...R}=s||{},$=I==null?void 0:I.getMainComponent(),B=S!==y,Z=C!==O,Y=B||Z,ee={editor:d,state:{page:I,code:S,codeStyle:C,isEmail:F,isCodeChanged:B,isCodeStyleChanged:Z,hasChanges:Y},setState:ae=>{if("page"in ae&&U(ae.page??null),"code"in ae){const me=ae.code??"";j(me),T&&Bl(T,me)}if("codeStyle"in ae){const me=ae.codeStyle??"";E(me),_&&Bl(_,me)}},update:()=>{if(!(!$||!S||!d)){if(B){const{output:ae,error:me}=d.runCommand(te.validateCode,{code:S,showToastError:!0});if(me)return;if(F)return d.loadProjectData({pages:[{component:ae}]});$.components().resetFromString(ae,{updateOptions:{onAttributes:({component:ve,attributes:ke,options:Re,item:ot})=>{var Xe;const Ue=((Xe=ot.classes)==null?void 0:Xe.join(" "))||ke.class,we={id:ve.getId(),...ve.getAttributes()},ze={id:ot.attributes.id,...ke,...Ue!==void 0?{class:Ue}:{}};Jx(we,ze)||ve.setAttributes({...ke,class:Ue||[]},Re)}}})}if(Z){if(C.trim()&&!d.Parser.parseCss(C).length)return;s6({editor:d,css:C,component:$}),P(C)}}}};g.useEffect(()=>{const ae=setTimeout(async()=>{await YI(),b(!0)});return()=>clearTimeout(ae)},[]),g.useEffect(()=>{if(!$||!d)return;const ae=d.Components.events.updateInside,me=()=>x(ve=>ve+1);return $.on(ae,me),()=>{$.off(ae,me)}},[$,d]),g.useEffect(()=>{if(!d)return;const{Pages:ae}=d,me=ae.events.select,ve=()=>U(ae.getSelected()??null);return d.on(me,ve),()=>{d.off(me,ve)}},[d]),g.useEffect(()=>{if(!d)return;let ae=!1;const me=async()=>{if(!I||!T||!m)return;const ke=I.getMainComponent(),Re=await d.runCommand(te.projectFiles,e6({editor:d,page:I,component:ke,includeComponentIds:!F}));if(ae)return;const ot=t6({projectFiles:Re,isEmail:F}),Ue=h.current?f.current||{}:{},we=XI(Ue.code??ot.code,{isEmail:F}),ze=JI(Ue.codeStyle??ot.codeStyle);h.current=!1,j(we),w(we),Bl(T,we),E(ze),P(ze),_&&Bl(_,ze)},ve=setTimeout(()=>me());return()=>{ae=!0,clearTimeout(ve)}},[I,T,_,m,v,d,F]);const X=a==null?void 0:a(ee),G=l==null?void 0:l(ee),Q=Y?"":V("noChanges"),ie={formatOnMount:!1,padding:5,isDarkTheme:p,clean:!0};return c.jsxs(k,{id:r,as:o,style:n??H,className:L(On,t??W),gap:"s",nowrap:!0,col:!0,full:!0,...R,...u,children:[X?c.jsx(c.Fragment,{children:Nt(X)}):null,c.jsx(k,{className:L(`${On}__fields`,"gs-utl-flex-grow gs-utl-min-h-[300px] md:gs-utl-flex-row"),gap:"s",nowrap:!0,col:!0,children:m&&c.jsxs(c.Fragment,{children:[c.jsx(D,{className:`${On}__field ${On}__field-html`,grow:!0,children:c.jsx(Cs,{...ie,containerClassName:`${On}__code-field ${On}__code-field-html`,language:"html",defaultValue:S,onMount:A,onChange:ae=>j(ae||"")})}),!F&&c.jsx(D,{className:L(`${On}__field ${On}__field-css`,"md:gs-utl-max-w-[25%]"),grow:!0,children:c.jsx(Cs,{...ie,containerClassName:`${On}__code-field ${On}__code-field-css`,language:"css",defaultValue:C,onMount:N,onChange:ae=>E(ae||"")})})]})}),l?G?c.jsx(c.Fragment,{children:Nt(G)}):null:c.jsx(k,{className:`${On}__row-after`,justify:"end",children:c.jsx(St,{classNameWrp:`${On}__update`,className:`${On}__update-btn`,title:Q,size:"m2",variant:Y?"pr":void 0,disabled:!Y,onClick:ee.update,children:V("button")})})]})});var aa=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(aa||{}),Vs=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Vs||{});const ea="gs-block-item",o6=e=>{const{block:t,className:n,itemLayout:s,onClick:r,variant:o}=e,{editor:i}=Se(),a=$e(),[,l]=g.useState(0),u=a.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),f=r||t.get("onClick"),h=t.get("disable"),m=t.get("mediaReact"),b=t.getMedia(),v=t.get("attributes")||{},x=u(d)||t.getLabel(),y=o==="compact",w=L(ea,`${ea}--${d}`,y&&`${ea}-compact`,n,"gs-utl-px-2 gs-utl-transition-colors",se.b,se.rnd,z.br,p&&"gs-utl-col-span-full",y?"gs-utl-py-1":"gs-utl-py-2",y?"gs-utl-flex-row gs-utl-nowrap gs-utl-gap-3 gs-utl-justify-start":"gs-utl-flex-col",h?Ae.disabledM:L("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),S=Dt(v.class)&&!y?v.class:L("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),j=L(`${ea}__label`,"gs-utl-text-center",Ae.txtEllips,!y&&"gs-utl-w-full");if(g.useEffect(()=>{if(!i)return;const{Blocks:A}=i,_=A.events.update,N=V=>V===t&&l(M=>++M);return i.on(_,N),()=>{i.off(_,N)}},[t,i]),!i)return null;const{Blocks:C}=i,P={className:w,...!h&&{onDragStart:()=>C.startDrag(t),onDragEnd:()=>C.endDrag(!1),draggable:!r},...!!f&&{onClick:()=>f(t,i)}},T=s==null?void 0:s({editor:i,block:t,attributes:P});return T&&Nt(T)||c.jsxs(k,{items:"center",...P,children:[m||c.jsx("div",{className:L(`${ea}__media`,S),dangerouslySetInnerHTML:{__html:b}}),c.jsx("div",{className:j,title:x,children:x})]})},W1=ue(o6);function Yg({className:e,value:t,onChange:n}){const[s,r]=g.useState(t),o=g.useRef(null),i=u=>{const{value:d}=u.target;r(d)},a=()=>{n(s||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(s||t);break}};return g.useEffect(()=>{o.current&&o.current.select()},[]),c.jsx("input",{autoFocus:!0,className:J([e,"w-full",z.bgTr]),value:s,onChange:i,onBlur:a,onKeyDown:l,onPointerDown:_o,ref:o})}function ew({className:e,value:t,active:n,unstyled:s,activable:r,onChange:o,onActive:i,...a}){const[l,u]=g.useState(n);g.useEffect(()=>{u(n)},[n]);const d=f=>{i==null||i(f),u(f)},p=f=>{o(f),d(!1)};return c.jsx("div",{className:J("truncate",e),...a,onDoubleClick:()=>r&&d(!0),children:l?c.jsx(Yg,{className:J(s&&Ae.noFocusOut),value:t,onChange:p}):c.jsx(c.Fragment,{children:t})})}const G1=le("text-sm w-full",Ae.txtEllips),i6=({symbol:e,className:t})=>{const n=vl(),{Components:s}=n,r=$e(),o=$i(),i=r.tScoped("blockManager.symbols"),a=()=>{const{draggable:x,droppable:y,attributes:w,type:S,tagName:j}=e.attributes;n.Canvas.startDrag({content:()=>s.addSymbol(e),model:e,dragDef:{type:S,tagName:j,draggable:x,droppable:y,attributes:w}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=s.getSymbolInfo(e).instances.length,f=le("h-10 w-10 block-media",z.grouphTAo),h=le("gjs-pt-1 gjs-mt-2",se.bt,z.br),m=le("cursor-pointer gjs-p-2 transition-colors group",se.b,se.rnd,z.br,z.hBgH,t),b=()=>{o.confirm({title:i("delete"),content:i("deleteConfirm"),onConfirm:()=>e.remove()})},v=x=>{e.set("custom-name",x)};return c.jsxs(k,{className:m,onDragStart:a,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(k,{items:"center",justify:"between",className:h,space:"m",full:!0,children:[c.jsx(D,{children:c.jsx(k,{className:le(G1,"gjs-mr-auto"),children:c.jsx(Ut,{title:`${p} ${i("instancesProject")}`,children:c.jsx(Ur,{label:`${p}`,className:le(z.bgH75)})})})}),c.jsx(D,{className:le("truncate"),grow:!0,title:d,children:c.jsx(ew,{activable:!0,value:d,className:G1,onChange:v})}),c.jsx(D,{className:le(Ae.hoverGroup),children:c.jsx(k,{justify:"end",full:!0,children:c.jsx(St,{onClick:b,title:i("delete"),border:!1,size:"",block:!0,children:c.jsx(ne,{icon:K.delete,size:oe.s})})})})]})]})},a6=ue(i6),Ar="gs-block-manager",q1={id:Vs.before,title:"Add before",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <path d="M4 5v14"/> <rect fill="none" x="8" y="5" width="12" height="14" rx="2" ry="2"/> </svg>'},l6={id:Vs.beforeInside,title:"Add inside first",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M8 8v8"/> </svg>'},c6={id:Vs.afterInside,title:"Add inside last",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="16" height="14" rx="2" ry="2"/> <path d="M16 8v8"/> </svg>'},K1={id:Vs.after,title:"Add after",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="12" height="14" rx="2" ry="2"/> <path d="M20 5v14"/> </svg>'},Z1=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},tw=e=>{const t=e.getContent();return rt(t)?e.getDragDef():t},u6=e=>{const t=tw(e);return Array.isArray(t)?t[0]:t},d6=ue(function({isOpen:t,className:n,hideCategories:s,target:r,variant:o,itemLayout:i,...a}){var We,Xt;const{editor:l}=Se(),u=$e(),[d,p]=g.useState(0),[f,h]=g.useState(aa.REGULAR),[m,b]=g.useState(""),[v,x]=g.useState(""),y=g.useRef(new Set),[w,S]=g.useState((r==null?void 0:r.position)||Vs.after),[j,C]=g.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),E=f===aa.SYMBOLS,O=g.useRef(null),P=u.tScoped("blockManager"),T=r==null?void 0:r.component;if(g.useEffect(()=>{if(!l)return;const{Blocks:he,Components:De}=l,Be=he.events.custom,Ie=De.events.symbol,_t=()=>{C(De.getSymbols()),p(Ft=>++Ft)};return l.on(Ie,_t),l.on(Be,_t),()=>{l.off(Ie,_t),l.off(Be,_t)}},[l]),g.useEffect(()=>{if(O.current&&t){const he=O.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),$f)}},[O.current,t]),!l)return null;const{Blocks:A,Components:_}=l,N=he=>P(`labels.${he.getId()}`)||he.getLabel(),V=j.filter(he=>gi(he.getName(),m)),M=A.getAll().map(he=>he),I=((We=a.blocks)==null?void 0:We.call(a,{blocks:M}))||M,U=w===Vs.before,F=w===Vs.beforeInside,W=w===Vs.afterInside,H=w===Vs.after,R=!!(T!=null&&T.attributes.droppable),$=I.filter(he=>{const De=Z1(l,he.category);if(m&&!gi(De,m)&&!gi(N(he),m))return!1;if(T){const Be=u6(he);if(R&&(F||W)){const Ie=F?0:void 0;return _.canMove(T,Be,Ie).result}else if(U||H){const Ie=T.index(),_t=T.parent(),Ft=U?Ie:Ie+1;return _t&&_.canMove(_t,Be,Ft).result}}return!0}),B=A.getBlocksByCategory($),Z=s?$:(Xt=B.find(he=>!he.category))==null?void 0:Xt.items,Y=s?[]:B.filter(he=>he.category),ee=a.symbols!==!1,X=a.search!==!1,G=!ee&&!X,Q=o==="compact",ie=P("search")||u.t("search"),ae=L(Ar,n,"gap-2"),me=L(`${Ar}__header`,"gs-utl-pt-2",Pe.xS,G&&"gs-utl-hidden"),ve=L(`${Ar}__content`,Ae.scrollY,z.br,se.bt),ke=L(`${Ar}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Re=L(`${Ar}__not-found`,"gs-utl-text-center gs-utl-p-4"),ot=L(`${Ar}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",Q?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),Ue=L(`${Ar}__no-category`,ot,z.br,Y.length&&se.bb),we=L(z.tAo,z.bgH75,se.bA),ze=`${Ar}__category`,Xe=[{id:aa.REGULAR,label:P("types.regular")},{id:aa.SYMBOLS,label:P("types.symbols")}],vt=R?[q1,l6,c6,K1]:[q1,K1],Le=T?he=>{const De=tw(he);if(!De)return;let Be;if(F||W){const Ie=F?0:void 0;Be=T.append(De,{at:Ie})[0]}else if(U||H){const Ie=T.index(),_t=T.parent(),Ft=U?Ie:Ie+1;Be=_t==null?void 0:_t.append(De,{at:Ft})[0]}if(Be){const{activate:Ie,select:_t}=he.attributes;_t||Ie&&_t!==!1?requestAnimationFrame(()=>l.em.setSelected(Be,{activate:Ie})):Ie&&Be.trigger("active")}}:void 0,ft=he=>{if(!T)return;const De=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),x(Be=>{const Ie=De.indexOf(Be);return De.at(Math.min(Ie+1,De.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),x(Be=>{const Ie=De.indexOf(Be);return De.at(Math.max(Ie-1,0))||""});else if(he.key==="Enter"&&v){const Be=A.get(v);Be&&(Le==null||Le(Be))}},dt=he=>{y.current.clear(),b(he)};return c.jsxs(k,{className:ae,col:!0,full:!0,children:[c.jsxs(k,{className:me,gap:"s",col:!0,children:[ee&&c.jsx(lo,{tabs:Xe,onChange:h,value:f,variant:"pills"}),T&&c.jsx(tn,{size:"s",options:vt,value:w,onChange:he=>S(he)}),X&&c.jsx(at,{ref:O,size:"s",value:m,onInput:dt,onKeyDown:ft,placeholder:ie,type:"search"})]}),c.jsxs(D,{className:ve,grow:!0,children:[E&&(V.length?c.jsx(k,{className:ke,children:V.map(he=>c.jsx(a6,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(k,{className:Re,justify:"center",children:P("symbols.notFound")})),!E&&($.length?c.jsxs(c.Fragment,{children:[!!(Z!=null&&Z.length)&&c.jsx(k,{className:Ue,children:Z==null?void 0:Z.map(he=>(y.current.add(`${he.id}`),c.jsx(W1,{block:he,itemLayout:i,onClick:Le,variant:o,className:L(v===he.id&&we)},he.id)))}),Y.map(({category:he,items:De},Be)=>c.jsx(yr,{sticky:!0,className:Ie=>Rf.itemList({index:Be,open:Ie,length:Y.length}),open:!!(he!=null&&he.get("open")),onChange:({open:Ie})=>he==null?void 0:he.set({open:Ie}),handler:Z1(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:L(ze,`${ze}--${he==null?void 0:he.id}`),children:c.jsx(k,{className:ot,children:De.map(Ie=>(y.current.add(`${Ie.id}`),c.jsx(W1,{block:Ie,itemLayout:i,onClick:Le,variant:o,className:L(v===Ie.id&&we)},Ie.id)))})},he==null?void 0:he.id))]}):c.jsx(k,{className:Re,justify:"center",children:P("notFound")}))]})]})}),p6=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-block-manager-after"),n),ref:r,...s,children:t})}),f6=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-block-manager-before"),n),ref:r,...s,children:t})}),g6="gs-panel-blocks",h6=g.memo(ue(function({className:t,symbols:n,search:s,hideCategories:r,target:o,variant:i,blocks:a,itemLayout:l,...u}){const d=Se().sdkProps.children,p={search:s,symbols:n,hideCategories:r,isOpen:!0,target:o,variant:i,blocks:a,itemLayout:l};return c.jsx(_s,{className:L(g6,"gs-utl-overflow-hidden",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(yl,{children:[Jn(d,f6),c.jsx(d6,{className:L("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),Jn(d,p6)]})})})),m6=(e,t)=>{t.runCommand(te.fontAdd,{font:e})},Xg=(e,{onSelect:t,...n}={})=>{const s="font",i=e.runCommand(te.assetProviderGet).filter(a=>pt(a.types)?a.types===s:a.types.includes(s))[0];if(!i){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:s,providerId:i.id,onSelect:a=>{const l=a.assetProps;m6(l.customData.font,e),t==null||t(a)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Uu=ue(e=>{const{buttonClassName:t,value:n,...s}=e,{editor:r}=Se(),o=$e(),i=gl(),a=hl(),l=[...s.options||[],...a.fontFamilyOptions].map(u=>{const d=a.getFont(u.id),p=d?yg(d):u.id;return{...u,content:c.jsx(k,{col:!0,children:c.jsx(D,{style:{fontFamily:p},children:u.label})})}});return c.jsx(_e,{...s,value:Io(n),options:l,afterLabel:a.sdkAddFonts&&i.hasType("font")&&c.jsx(St,{className:t,title:o.t("fontManager.addFontToProject"),icon:K.plus,size:"xs",border:!1,block:!0,onClick:()=>r&&Xg(r,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;s.onChange(Io(d.family))}})})})}),b6=(e,{t,id:n})=>t(`fields.${n}.label`)||Ds(`${e}`.replace(/-/g," ")),nw=(e,{t,id:n})=>{const s=pt(e)?{id:e,label:e}:e;return{...s,label:t(`fields.${n}.options.${s.id}`)||s.label}},sw=e=>e.get("defaultValue")||"",jl=e=>e.get("field"),rw=e=>{const t=jl(e);return pt(t)?{type:t}:t},ow=e=>`${e.get("value")||sw(e)||rw(e).defaultValue||""}`,v6=(e,t)=>e||sw(t)||"",Ba=({record:e,value:t,partial:n})=>{e.set({value:v6(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},za=(e,t)=>{const{className:n,defaultValue:s,size:r,...o}=rw(e),i=s??e.get("defaultValue");return{...o,hasClear:()=>{const a=e.get("value");return!!a&&Dt(i)&&a!==i},className:L(n,"gs-utl-w-full"),size:r||"s",value:ow(e),label:b6(e.get("label")||e.id||"",t),onChange:(a,l)=>Ba({record:e,value:a,partial:l})}},y6=(e,t)=>{const n=jl(e),s=wr(n)?n:void 0,r=(s==null?void 0:s.units)||[],o=GR(ow(e)),i=o.number,a=o.unit||r[0]||"";return{...za(e,t),value:i,valueUnit:a,min:s==null?void 0:s.min,max:s==null?void 0:s.max,step:s==null?void 0:s.step,units:s==null?void 0:s.units,onChange:(l,u)=>{Ba({value:l?`${l}${a}`:"",record:e,partial:u})},onChangeUnit:l=>{Ba({value:i?`${i}${l}`:"",record:e})}}},iw=(e,t)=>{var o;const n=jl(e),s=wr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>nw(i,t)))||[];return{...za(e,t),options:r,onChange:i=>Ba({value:i,record:e})}},x6=(e,t)=>({...za(e,t),onChange:n=>Ba({value:n,record:e})}),w6=(e,t)=>{var o;const n=jl(e),s=wr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>nw(i,t)))||[];return{...iw(e,t),size:"s",options:r}};function S6(e,t){const n=jl(e);switch(pt(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(tn,{...w6(e,t)});case"select":return c.jsx(_e,{...iw(e,t)});case"selectFont":{const r=x6(e,t);return c.jsx(Uu,{...r,labelAs:"div"})}case"number":return c.jsx(Ne,{...y6(e,t)});case"color":return c.jsx(Xs,{...za(e,t)});default:return c.jsx(at,{...za(e,t)})}}const Y1="gs-cmp-global-style-field",C6=ue(function({record:t}){const n=Se(),r=$e().tScoped("globalStyleManager"),[,o]=g.useState(0),i=n.editor,a=t.id,l={t:r,id:a};return g.useEffect(()=>{if(!i)return;const u=`data:path:${t.getPath("value")}`,d=()=>o(p=>++p);return i.on(u,d),()=>{i.off(u,d)}},[i]),c.jsx(k,{className:L(Y1,`${Y1}__${a}`),children:S6(t,l)})}),ba="gs-cmp-global-style-manager",X1=({items:e,category:t,className:n})=>{const s=L(t?`${ba}__cat-fields--${t.id}`:`${ba}__uncat-fields`,"gs-utl-gap-2",Pe.xy,n);return c.jsx(k,{className:s,nowrap:!0,col:!0,children:e.map(r=>c.jsx(C6,{record:r},r.id))})},j6=ue(function(){const t=lM(),{recordsByCategory:n,openCategories:s}=t,o=$e().tScoped("globalStyleManager");return c.jsx(k,{col:!0,full:!0,nowrap:!0,className:L(ba,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(k,{col:!0,nowrap:!0,className:L(`${ba}__fields`,Ae.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:i,items:a},l)=>i?c.jsx(yr,{sticky:!0,open:s.get(i.id)??i.open,handler:o(`categories.${i.id}.label`)||i.label||i.id,onChange:({open:u})=>t.setCategoryOpen(i.id,u),className:u=>L(`${ba}__cat-fields`,Rf.itemList({index:l,open:u,length:n.length}),l===0&&se.bt),children:c.jsx(X1,{category:i,items:a})},i.id):c.jsx(X1,{items:a,className:L(n.length!==1&&[se.bt,z.br])},l)):c.jsx(k,{className:L("gs-utl-text-center"),justify:"center",children:o("notFound")})})})}),E6="gs-panel-global-styles",P6=g.memo(ue(function({className:t,...n}){return c.jsx(_s,{className:L(E6,"gs-utl-overflow-auto",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-auto"),...n,children:c.jsx(yl,{children:c.jsx(j6,{})})})})),T6={maxWidth:`${kS}px`},O6="gs-cmp-layer-item";function aw({component:e,draggingCmp:t,dragParent:n,...s}){const r=vl(),{Layers:o}=r,i=g.useRef(null),[a,l]=g.useState(!1),[u,d]=g.useState(o.getLayerData(e)),{open:p,selected:f,hovered:h,components:m,visible:b,locked:v,name:x}=u,y=m.map(F=>F.cid),w=t===e,S=y.join("-"),j=s.level+1,C=h||n===e;g.useEffect(()=>{j===0&&d(o.getLayerData(e)),i.current&&(i.current.__cmp=e)},[e]),g.useEffect(()=>{const F=i.current;if(!F)return;const{select:W}=r.Components.events,H=R=>R===e&&F.scrollIntoView({block:"nearest"});return r.on(W,H),()=>{r.off(W,H)}},[e,i.current]),g.useEffect(()=>{const F=H=>{H===e&&d(o.getLayerData(H))},W=o.events.component;return r.on(W,F),()=>{r.off(W,F)}},[r,o,e]);const E=g.useMemo(()=>m.map(F=>c.jsx(aw,{component:F,level:j,draggingCmp:t,dragParent:n},F.cid)),[S,t,n]),O=F=>{o.setLayerData(e,{name:F}),l(!1)},P=F=>{F.stopPropagation(),o.setLayerData(e,{open:!p})},T=F=>{F.stopPropagation(),o.setLayerData(e,{visible:!b})},A=F=>{F.stopPropagation(),o.setLayerData(e,{locked:!v})},_=F=>{F.stopPropagation(),o.setLayerData(e,{selected:!0},{event:F})},N=F=>{F.preventDefault(),r.runCommand(te.contextMenuComponent,{source:vg.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},V=F=>{(!F||!t)&&o.setLayerData(e,{hovered:F})},M=Gv(e),I=J("layer-item",(f||M.isSymbol)&&M.bgSoftX,(!b||w)&&"opacity-50"),U=J(Pe.xyS,se.b,C?M.border:se.bT,f&&M.bgSoft);return c.jsx("div",{className:O6,children:c.jsxs(k,{col:!0,className:I,children:[c.jsx(D,{onClick:_,onContextMenu:N,onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),className:J("group max-w-full"),"data-layer-item":!0,ref:i,children:c.jsxs(k,{items:"center",space:"xs",className:U,children:[c.jsx(D,{style:{marginLeft:`${j*10}px`},className:J("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:P,children:c.jsx(ne,{icon:K.menuDown,size:oe.sx,rotate:p?0:-90})}),c.jsx(D,{children:Q0(e)}),c.jsx(D,{className:J("truncate"),onDoubleClick:()=>l(!0),style:T6,grow:!0,children:a?c.jsx(Yg,{value:x,onChange:O}):c.jsx(c.Fragment,{children:x})}),!a&&c.jsxs(c.Fragment,{children:[c.jsx(D,{className:J("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(ne,{icon:v?K.lock:K.lockOpenVariant,size:oe.s3x})}),c.jsx(D,{className:J("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-0":"opacity-100"),onClick:T,children:c.jsx(ne,{icon:b?K.eyeOutline:K.eyeOffOutline,size:oe.sx})})]})]})}),!!(p&&m.length)&&c.jsx(D,{className:J("max-w-full",!p&&"hidden"),children:E})]})})}const _6={touchAction:"none"},J1=5,A6=e=>{var o,i;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),s=n==null?void 0:n.__cmp,r=((i=(o=s==null?void 0:s.delegate)==null?void 0:o.move)==null?void 0:i.call(o,s))||s;return{el:n,cmp:r}},lw=ue(function({root:t,header:n}){const{editor:s}=Se(),[r,o]=g.useState(!1),[i,a]=g.useState({}),[l,u]=g.useState(),[d,p]=g.useState(),[f,h]=g.useState(),[m,b]=g.useState(),v=g.useRef(null);if(g.useEffect(()=>{const P=window.document,T=A=>{A.key==="Escape"&&(a({...i,result:!1}),S())};return P.addEventListener("keydown",T),()=>{P.removeEventListener("keydown",T)}},[]),!s)return null;const{Components:x}=s,y=P=>{P.button===0&&o(!0)},w=P=>{if(!r)return;const{cmp:T,el:A}=A6(P);if(!A||!T)return;const _=A.getBoundingClientRect(),N=A.offsetHeight,V=A.offsetTop,M=P.clientY,I=M<_.y+N/2,U=d||T,F=T.parent(),W=T.index()+(I?0:1);!d&&p(T),u(T);const H=x.canMove(F,U,W),R=x.canMove(T,U),$={...H,canMoveInside:R,index:W};let B=!1;R.result&&M>_.y+J1&&M<_.y+N-J1&&(B=!0,$.target=T,delete $.index),h(B?T:void 0),a($),b({pointerInside:B,y:V+(I?0:N),h:N})},S=()=>{var P;i!=null&&i.result&&((P=i.source)==null||P.move(i.target,{at:i.index})),a({}),o(!1),p(void 0),u(void 0),h(void 0),b(void 0)},j=(l?l.parents():[]).length,C=!!(d&&m&&(i!=null&&i.result)&&!m.pointerInside),E=C?{top:m.y,left:0,marginLeft:j*10+20}:{},O=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(k,{col:!0,full:!0,nowrap:!0,className:J("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(D,{children:c.jsxs(k,{space:"s",items:"center",className:J([Pe.xy,se.bb,z.br]),children:[c.jsx(D,{children:c.jsx(ne,{icon:K.layers,size:oe.s})}),c.jsx(D,{grow:!0,children:O})]})}),c.jsxs(D,{className:J("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:_6,onPointerDown:y,onPointerMove:w,onPointerUp:S,grow:!0,children:[!!t&&c.jsx(aw,{component:t,level:-1,draggingCmp:d,dragParent:f}),C&&c.jsx("div",{ref:v,className:J("absolute w-full gs-utl-h-0.5",z.cmp),style:E})]})]})}),cw=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-layer-manager-after"),n),ref:r,...s,children:t})}),uw=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-layer-manager-before"),n),ref:r,...s,children:t})}),M6="gs-panel-layers",dw=g.memo(ue(function({className:t,...n}){const s=Se().sdkProps.children;return c.jsx(_s,{className:L(M6,"gs-utl-overflow-auto",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-auto"),...n,children:c.jsx(Fy,{children:r=>c.jsxs(c.Fragment,{children:[Jn(s,uw),c.jsx(lw,{...r,header:!1}),Jn(s,cw)]})})})})),bo="gs-cmp-file-field";function Ua(e){var j;const{className:t,value:n,btnLabel:s,nameLabel:r,size:o,isContain:i,clear:a,inputField:l,placeholder:u,preview:d=50,disabled:p,hideButton:f,labelAs:h,onChange:m,onOpen:b}=e,v=(n||"").replace(/^"|"$/gi,""),x=((j=v.split("/").pop())==null?void 0:j.split("?")[0])||"",y={minWidth:d,minHeight:d},w=v?{...y,backgroundImage:`url("${v}")`}:y,S=L(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",i?"gs-utl-bg-contain":"gs-utl-bg-cover",se.b,se.rnd,z.br);return c.jsxs(k,{className:L(bo,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(Ts,{...e,as:h}),c.jsxs(k,{className:L(`${bo}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(D,{className:L(`${bo}-preview`),children:c.jsx("div",{className:S,style:w})}),c.jsxs(D,{className:L(`${bo}-fields gs-utl-overflow-hidden`),grow:!0,children:[x&&r!==!1&&c.jsx(Yr,{className:L(`${bo}-name`,"gs-utl-mb-2",Ae.txtEllips),as:"div",size:o,capitalize:!1,children:x}),c.jsxs(k,{className:L(`${bo}-buttons`),space:"s",nowrap:!0,children:[!f&&c.jsx(Qe,{onClick:()=>b==null?void 0:b(n),size:o,type:"button",block:!0,full:!0,disabled:p,children:s||"Select image"}),!!n&&a&&c.jsx(St,{onClick:()=>m==null?void 0:m(""),title:a.tooltip,size:o,icon:{icon:K.close,size:oe.s},type:"button",block:!0})]})]})]}),l&&c.jsx(at,{className:L(`${bo}-input`),value:v,onChange:m,size:o,placeholder:u})]})}function L6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>s=>{t.forEach(r=>r(s))},t)}const Wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Di(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Jg(e){return"nodeType"in e}function fo(e){var t,n;return e?Di(e)?e:Jg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Qg(e){const{Document:t}=fo(e);return e instanceof t}function Fi(e){return Di(e)?!1:e instanceof fo(e).HTMLElement}function pw(e){return e instanceof fo(e).SVGElement}function Bi(e){return e?Di(e)?e.document:Jg(e)?Qg(e)?e:Fi(e)||pw(e)?e.ownerDocument:document:document:document}const Vo=Wu?g.useLayoutEffect:g.useEffect;function N6(e){const t=g.useRef(e);return Vo(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function $6(){const e=g.useRef(null),t=g.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function El(e,t){const n=g.useRef();return g.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function eh(e){const t=N6(e),n=g.useRef(null),s=g.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}let Yd={};function Pl(e,t){return g.useMemo(()=>{if(t)return t;const n=Yd[e]==null?0:Yd[e]+1;return Yd[e]=n,e+"-"+n},[e,t])}function fw(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((o,i)=>{const a=Object.entries(i);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...t})}}const Wa=fw(1),gw=fw(-1);function k6(e){return"clientX"in e&&"clientY"in e}function R6(e){if(!e)return!1;const{KeyboardEvent:t}=fo(e.target);return t&&e instanceof t}function I6(e){if(!e)return!1;const{TouchEvent:t}=fo(e.target);return t&&e instanceof t}function cf(e){if(I6(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return k6(e)?{x:e.clientX,y:e.clientY}:null}const Ga=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ga.Translate.toString(e),Ga.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),V6={display:"none"};function H6(e){let{id:t,value:n}=e;return g.createElement("div",{id:t,style:V6},n)}function D6(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return g.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function F6(){const[e,t]=g.useState("");return{announce:g.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const B6={draggable:`
323
323
  To pick up a draggable item, press the space bar.
324
324
  While dragging, use the arrow keys to move the item.
325
325
  Press space again to drop the item in its new position, or press escape to cancel.
326
- `},x8={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}};var ht;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ht||(ht={}));function qd(...e){}class ma extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Bu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:qd,draggableNodes:{},droppableRects:new Map,droppableContainers:new ma,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:qd},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:qd,windowRect:null,willRecomputeLayouts:!1});function w8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new ma}}}function S8(e,t){switch(t.type){case ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ht.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case ht.DragEnd:case ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ht.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new ma(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case ht.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new ma(e.droppable.containers);return i.set(n,{...o,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case ht.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const o=new ma(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}const tw=h.createContext({type:null,event:null});function C8({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:s,onDragCancel:r}){const o=h.useContext(tw),i=h.useRef(o);h.useEffect(()=>{if(o!==i.current){const{type:a,event:l}=o;switch(a){case ht.DragStart:e==null||e(l);break;case ht.DragMove:t==null||t(l);break;case ht.DragOver:n==null||n(l);break;case ht.DragCancel:r==null||r(l);break;case ht.DragEnd:s==null||s(l);break}i.current=o}},[o,e,t,n,s,r])}function j8({announcements:e=x8,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:s,announcement:r}=b8(),o=Sl("DndLiveRegion"),[i,a]=h.useState(!1);return h.useEffect(()=>{a(!0)},[]),C8(h.useMemo(()=>({onDragStart({active:l}){s(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&s(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){s(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){s(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){s(e.onDragCancel(l.id))}}),[s,e])),i?$n.createPortal(h.createElement(h.Fragment,null,h.createElement(m8,{id:t,value:n.draggable}),h.createElement(v8,{id:o,announcement:r})),document.body):null}const br=Object.freeze({x:0,y:0});function nw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K1(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const E8=({collisionRect:e,droppableContainers:t})=>{const n=K1(e,e.left,e.top);let s=1/0,r=null;for(const o of t){const{rect:{current:i}}=o;if(i){const a=nw(K1(i),n);a<s&&(s=a,r=o.id)}}return r};function P8(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function T8(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:br}function O8(e){return function(n,...s){return s.reduce((r,o)=>({...r,top:r.top+e*o.y,bottom:r.bottom+e*o.y,left:r.left+e*o.x,right:r.right+e*o.x,offsetLeft:r.offsetLeft+e*o.x,offsetTop:r.offsetTop+e*o.y}),{...n})}}const Z1=O8(1);function _8(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function A8(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(r=>{const o=t[r];return typeof o=="string"?n.test(o):!1})!=null}function Yh(e){const t=[];function n(s){if(!s)return t;if(Kh(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Hi(s)||Jx(s)||t.includes(s))return t;const r=window.getComputedStyle(s);return A8(s,r)&&t.push(s),_8(s,r)?t:n(s.parentNode)}return e?n(e.parentNode):t}function Kd(e){return!Fu||!e?null:Vi(e)?e:qh(e)?Kh(e)||e===Di(e).scrollingElement?window:Hi(e)?e:null:null}function rf(e){return Vi(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var di;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(di||(di={}));function sw(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},s=e.scrollTop<=t.y,r=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:r,isBottom:o,isRight:i,maxScroll:n,minScroll:t}}function L8(e){return!Fu||!e?!1:e===document.scrollingElement}const M8={x:.2,y:.2};function N8(e,t,{top:n,left:s,right:r,bottom:o},i=10,a=M8){const{clientHeight:l,clientWidth:u}=e,d=L8(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:p,isBottom:f,isLeft:g,isRight:m}=sw(e),v={x:0,y:0},b={x:0,y:0},x={height:d.height*a.y,width:d.width*a.x};return!p&&n<=d.top+x.height?(v.y=di.Backward,b.y=i*Math.abs((d.top+x.height-n)/x.height)):!f&&o>=d.bottom-x.height&&(v.y=di.Forward,b.y=i*Math.abs((d.bottom-x.height-o)/x.height)),!m&&r>=d.right-x.width?(v.x=di.Forward,b.x=i*Math.abs((d.right-x.width-r)/x.width)):!g&&s<=d.left+x.width&&(v.x=di.Backward,b.x=i*Math.abs((d.left+x.width-s)/x.width)),{direction:v,speed:b}}function $8(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function rw(e){return e.reduce((t,n)=>Fa(t,rf(n)),br)}function ow(e,t,n=br){if(!e||!Hi(e))return n;const s={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?s:ow(e.offsetParent,t,s)}function zu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:s,y:r}=ow(e,null);return{width:t,height:n,offsetTop:r,offsetLeft:s}}function Uu(e){if(Vi(e)){const u=window.innerWidth,d=window.innerHeight;return{top:0,left:0,right:u,bottom:d,width:u,height:d,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=zu(e),{width:s,height:r,top:o,bottom:i,left:a,right:l}=e.getBoundingClientRect();return{width:s,height:r,top:o,bottom:i,right:l,left:a,offsetTop:t,offsetLeft:n}}function of(e){const{width:t,height:n,offsetTop:s,offsetLeft:r}=zu(e),o=Yh(e),i=rw(o),a=s-i.y,l=r-i.x;return{width:t,height:n,top:a,bottom:a+n,right:l+t,left:l,offsetTop:s,offsetLeft:r}}function Y1(e){return"top"in e}function X1(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const k8=({collisionRect:e,droppableContainers:t})=>{let n=1/0,s=null;const r=X1(e,e.left,e.top);for(const o of t){const{rect:{current:i}}=o;if(i){const a=X1(i,Y1(i)?i.left:void 0,Y1(i)?i.top:void 0),l=r.reduce((d,p,f)=>d+nw(a[f],p),0),u=Number((l/4).toFixed(4));u<n&&(n=u,s=o.id)}}return s};function R8(e,t){const n=Math.max(t.top,e.offsetTop),s=Math.max(t.left,e.offsetLeft),r=Math.min(t.left+t.width,e.offsetLeft+e.width),o=Math.min(t.top+t.height,e.offsetTop+e.height),i=r-s,a=o-n;if(s<r&&n<o){const l=t.width*t.height,u=e.width*e.height,d=i*a,p=d/(l+u-d);return Number(p.toFixed(4))}return 0}const I8=({collisionRect:e,droppableContainers:t})=>{let n=0,s=null;for(const r of t){const{rect:{current:o}}=r;if(o){const i=R8(o,e);i>n&&(n=i,s=r.id)}}return s};var va;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(va||(va={}));var Uc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Uc||(Uc={}));function V8({acceleration:e,activator:t=va.Pointer,canScroll:n,draggingRect:s,enabled:r,interval:o=5,order:i=Uc.TreeOrder,pointerCoordinates:a,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[p,f]=d8(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case va.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case va.DraggableRect:return s}return null},[t,s,a]),v=h.useRef(br),b=h.useRef(null),x=h.useCallback(()=>{const w=b.current;if(!w)return;const S=g.current.x*v.current.x,C=g.current.y*v.current.y;w.scrollBy(S,C)},[]),y=h.useMemo(()=>i===Uc.TreeOrder?[...l].reverse():l,[i,l]);h.useEffect(()=>{if(!r||!l.length||!m){f();return}for(const w of y){if((n==null?void 0:n(w))===!1)continue;const S=l.indexOf(w),C=u[S];if(!C)continue;const{direction:j,speed:E}=N8(w,C,m,e,d);if(E.x>0||E.y>0){f(),b.current=w,p(x,o),g.current=E,v.current=j;return}}g.current={x:0,y:0},v.current={x:0,y:0},f()},[e,x,n,f,r,o,JSON.stringify(m),p,l,y,u,JSON.stringify(d)])}function H8(e,t){const n=t!==null?e[t]:void 0,s=n?n.node.current:null;return wl(r=>{var o;return t===null?null:(o=s??r)!=null?o:null},[s,t])}function D8(e,t){return h.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,o=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...n,...o]},[]),[e,t])}function iw(e){const t=h.useRef(e);return Io(()=>{t.current!==e&&(t.current=e)},[e]),t}var za;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(za||(za={}));var af;(function(e){e.Optimized="optimized"})(af||(af={}));const J1=new Map,F8={measure:zu,strategy:za.WhileDragging,frequency:af.Optimized};function B8(e,{dragging:t,dependencies:n,config:s}){const[r,o]=h.useState(!1),{frequency:i,measure:a,strategy:l}={...F8,...s},u=h.useRef(e),d=h.useCallback(()=>o(!0),[]),p=h.useRef(null),f=m(),g=wl(v=>{if(f&&!t)return J1;if(!v||v===J1||u.current!==e||r){for(let b of e)b&&(b.rect.current=b.node.current?a(b.node.current):null);return z8(e)}return v},[e,t,f,a,r]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{r&&o(!1)},[r]),h.useEffect(function(){f||requestAnimationFrame(d)},[t,f]),h.useEffect(function(){f||typeof i!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},i))},[i,f,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:r};function m(){switch(l){case za.Always:return!1;case za.BeforeDragging:return t;default:return!t}}}function z8(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:s,rect:r}=n;r.current!=null&&t.set(s,r.current)}return t}function U8(e){const[t,n]=h.useState(null),s=h.useRef(e),r=h.useCallback(o=>{const i=Kd(o.target);i&&n(a=>a?(a.set(i,rf(i)),new Map(a)):null)},[]);return h.useEffect(()=>{const o=s.current;if(e!==o){i(o);const a=e.map(l=>{const u=Kd(l);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,rf(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),s.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const u=Kd(l);u==null||u.removeEventListener("scroll",r)})}},[r,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Fa(o,i),br):rw(e):br,[e,t])}const W8=[];function G8(e){const t=h.useRef(e),n=wl(s=>e?s&&e&&t.current&&e.parentNode===t.current.parentNode?s:Yh(e):W8,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function q8(e){h.useEffect(()=>{if(!Fu)return;const t=e.map(({sensor:n})=>n.setup==null?void 0:n.setup());return()=>{for(const n of t)n==null||n()}},e.map(({sensor:t})=>t))}function K8(e,t){return h.useMemo(()=>e.reduce((n,{eventName:s,handler:r})=>(n[s]=o=>{r(o,t)},n),{}),[e,t])}const Zd=lw(Uu),Z8=Y8(Uu);function aw(e,t,n){const s=h.useRef(e);return wl(r=>e?n||!r&&e||e!==s.current?Hi(e)&&e.parentNode==null?null:t(e):r??null:null,[e,n,t])}function lw(e){return(t,n)=>aw(t,e,n)}function Y8(e){const t=[];return function(s,r){const o=h.useRef(s);return wl(i=>s.length?r||!i&&s.length||s!==o.current?s.map(a=>e(a)):i??t:t,[s,r])}}function X8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Hi(t)?t:e}function J8(e){const{width:t,height:n,offsetLeft:s,offsetTop:r}=zu(e);return{top:r,bottom:r+n,left:s,right:s+t,width:t,height:n,offsetTop:r,offsetLeft:s}}const Q8=lw(J8);function eI({disabled:e,forceRecompute:t}){const[n,s]=Zh(),r=Q8(e?null:X8(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:r,setRef:s}),[r,n,s])}function Q1(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function tI(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class ba{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})}}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function nI(e){const{EventTarget:t}=uo(e);return e instanceof t?e:Di(e)}function Yd(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Gn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Gn||(Gn={}));function ev(e){e.preventDefault()}function sI(e){e.stopPropagation()}var Ue;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Ue||(Ue={}));const cw={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter]},rI=(e,{currentCoordinates:t})=>{switch(e.code){case Ue.Right:return{...t,x:t.x+25};case Ue.Left:return{...t,x:t.x-25};case Ue.Down:return{...t,y:t.y+25};case Ue.Up:return{...t,y:t.y-25}}};class Xh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=br;const{event:{target:n}}=t;this.props=t,this.listeners=new ba(Di(n)),this.windowListeners=new ba(uo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const s=Uu(t.node.current),r={x:s.left,y:s.top};this.coordinates=r,n(r)}handleKeyDown(t){if(f8(t)){const{coordinates:n}=this,{active:s,context:r,options:o}=this.props,{keyboardCodes:i=cw,coordinateGetter:a=rI,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const d=a(t,{active:s,context:r.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:f}=r.current;for(const g of f){const m=t.code,v=ew(d,n),{isTop:b,isRight:x,isLeft:y,isBottom:w,maxScroll:S,minScroll:C}=sw(g),j=$8(g),E={x:Math.min(m===Ue.Right?j.right-j.width/2:j.right,Math.max(m===Ue.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(m===Ue.Down?j.bottom-j.height/2:j.bottom,Math.max(m===Ue.Down?j.top:j.top+j.height/2,d.y))},O=m===Ue.Right&&!x||m===Ue.Left&&!y,P=m===Ue.Down&&!w||m===Ue.Up&&!b;if(O&&E.x!==d.x){if(m===Ue.Right&&g.scrollLeft+v.x<=S.x||m===Ue.Left&&g.scrollLeft+v.x>=C.x){g.scrollBy({left:v.x,behavior:l});return}p.x=m===Ue.Right?g.scrollLeft-S.x:g.scrollLeft-C.x,g.scrollBy({left:-p.x,behavior:l});break}else if(P&&E.y!==d.y){if(m===Ue.Down&&g.scrollTop+v.y<=S.y||m===Ue.Up&&g.scrollTop+v.y>=C.y){g.scrollBy({top:v.y,behavior:l});return}p.y=m===Ue.Down?g.scrollTop-S.y:g.scrollTop-C.y,g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Fa(d,p))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Xh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=cw,onActivation:n})=>{const{code:s}=e.nativeEvent;return t.start.includes(s)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function tv(e){return!!(e&&"distance"in e)}function nv(e){return!!(e&&"delay"in e)}class Jh{constructor(t,n,s=nI(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=t,{target:o}=r;this.props=t,this.events=n,this.document=Di(o),this.documentListeners=new ba(this.document),this.listeners=new ba(s),this.windowListeners=new ba(uo(o)),this.initialCoordinates=sf(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Gn.Resize,this.handleCancel),this.windowListeners.add(Gn.DragStart,ev),this.windowListeners.add(Gn.VisibilityChange,this.handleCancel),this.windowListeners.add(Gn.ContextMenu,ev),this.documentListeners.add(Gn.Keydown,this.handleKeydown),n){if(tv(n))return;if(nv(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Gn.Click,sI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:s,props:r}=this,{onMove:o,options:{activationConstraint:i}}=r;if(!s)return;const a=sf(t),l=ew(s,a);if(!n&&i){if(nv(i))return Yd(l,i.tolerance)?this.handleCancel():void 0;if(tv(i))return i.tolerance!=null&&Yd(l,i.tolerance)?this.handleCancel():Yd(l,i.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),o(a)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const oI={move:{name:"pointermove"},end:{name:"pointerup"}};class Qh extends Jh{constructor(t){const{event:n}=t,s=Di(n.target);super(t,oI,s)}}Qh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const iI={move:{name:"mousemove"},end:{name:"mouseup"}};var lf;(function(e){e[e.RightClick=2]="RightClick"})(lf||(lf={}));class aI extends Jh{constructor(t){super(t,iI,Di(t.event.target))}}aI.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===lf.RightClick?!1:(t==null||t({event:e}),!0)}];const Xd={move:{name:"touchmove"},end:{name:"touchend"}};class lI extends Jh{constructor(t){super(t,Xd)}static setup(){return window.addEventListener(Xd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Xd.move.name,t)};function t(){}}}lI.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function cI(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((s,r)=>r({transform:s,...n}),t):t}const uI=[{sensor:Qh,options:{}},{sensor:Xh,options:{}}],dI={current:{}},uw=h.createContext({...br,scaleX:1,scaleY:1}),pI=h.memo(function({id:t,autoScroll:n=!0,announcements:s,children:r,sensors:o=uI,collisionDetection:i=I8,measuring:a,modifiers:l,screenReaderInstructions:u=y8,...d}){var p,f,g,m,v;const b=h.useReducer(S8,void 0,w8),[x,y]=b,[w,S]=h.useState(()=>({type:null,event:null})),[C,j]=h.useState(!1),{draggable:{active:E,nodes:O,translate:P},droppable:{containers:T}}=x,A=E?O[E]:null,_=h.useRef({initial:null,translated:null}),N=h.useMemo(()=>{var Xe;return E!=null?{id:E,data:(Xe=A==null?void 0:A.data)!=null?Xe:dI,rect:_}:null},[E,A]),D=h.useRef(null),[L,V]=h.useState(null),[U,H]=h.useState(null),B=h.useRef(d),k=Sl("DndDescribedBy",t),I=h.useMemo(()=>T.getEnabled(),[T]),{layoutRectMap:R,recomputeLayouts:W,willRecomputeLayouts:Z}=B8(I,{dragging:C,dependencies:[P.x,P.y],config:a==null?void 0:a.droppable}),X=H8(O,E),J=U?sf(U):null,Q=aw(X,(p=a==null||(f=a.draggable)==null?void 0:f.measure)!=null?p:of),G=Zd(X),ee=h.useRef(null),ae=ee.current,ge=h.useRef({active:null,activeNode:X,collisionRect:null,droppableRects:R,draggableNodes:O,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),je=T.getNodeFor((g=ge.current.over)==null?void 0:g.id),Se=Zd(X?X.ownerDocument.defaultView:null),et=Zd(X?X.parentElement:null),Ye=G8(E?je??X:null),Ct=Z8(Ye),ct=eI({disabled:E==null,forceRecompute:Z}),we=(m=ct.rect)!=null?m:Q,nt=we===Q?T8(Q,ae):br,st=cI(l,{transform:{x:P.x-nt.x,y:P.y-nt.y,scaleX:1,scaleY:1},activatorEvent:U,active:N,activeNodeRect:G,containerNodeRect:et,draggingNodeRect:we,over:ge.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Ye,scrollableAncestorRects:Ct,windowRect:Se}),vt=J?Fa(J,P):null,Me=U8(Ye),pt=Fa(st,Me),ut=we?Z1(we,st):null,Fe=ut?Z1(ut,Me):null,Yt=N&&Fe?i({active:N,collisionRect:Fe,droppableContainers:I}):null,[he,Ve]=h.useState(null),De=P8(st,(v=he==null?void 0:he.rect)!=null?v:null,Q),$e=h.useCallback((Xe,{sensor:bt,options:Xt})=>{if(!D.current)return;const Pn=O[D.current];if(!Pn)return;const Gt=new bt({active:D.current,activeNode:Pn,event:Xe.nativeEvent,options:Xt,context:ge,onStart(mn){const wr=D.current;if(!wr)return;const Sr=O[wr];if(!Sr)return;const{onDragStart:Cr}=B.current,jr={active:{id:wr,data:Sr.data,rect:_}};$n.unstable_batchedUpdates(()=>{y({type:ht.DragStart,initialCoordinates:mn,active:wr}),S({type:ht.DragStart,event:jr})}),Cr==null||Cr(jr)},onMove(mn){y({type:ht.DragMove,coordinates:mn})},onEnd:fo(ht.DragEnd),onCancel:fo(ht.DragCancel)});$n.unstable_batchedUpdates(()=>{V(Gt),H(Xe.nativeEvent)});function fo(mn){return async function(){const{active:Sr,over:Cr,scrollAdjustedTranslate:jr}=ge.current;let Er=null;if(Sr&&jr){const{cancelDrop:rn}=B.current;Er={active:Sr,delta:jr,over:Cr},mn===ht.DragEnd&&typeof rn=="function"&&await Promise.resolve(rn(Er))&&(mn=ht.DragCancel)}if(D.current=null,$n.unstable_batchedUpdates(()=>{y({type:mn}),Ve(null),j(!1),V(null),H(null),Er&&S({type:mn,event:Er})}),Er){const{onDragCancel:rn,onDragEnd:as}=B.current,jl=mn===ht.DragEnd?as:rn;jl==null||jl(Er)}}}},[y,O]),Ot=h.useCallback((Xe,bt)=>(Xt,Pn)=>{const Gt=Xt.nativeEvent;D.current!==null||Gt.dndKit||Gt.defaultPrevented||Xe(Xt,bt.options)===!0&&(Gt.dndKit={capturedBy:bt.sensor},D.current=Pn,$e(Xt,bt))},[$e]),Ft=D8(o,Ot);q8(o),Io(()=>{B.current=d},Object.values(d)),h.useEffect(()=>{E!=null&&j(!0)},[E]),h.useEffect(()=>{N||(ee.current=null),N&&Q&&!ee.current&&(ee.current=Q)},[Q,N]),h.useEffect(()=>{const{onDragMove:Xe}=B.current,{active:bt,over:Xt}=ge.current;if(!bt)return;const Pn={active:bt,delta:{x:pt.x,y:pt.y},over:Xt};S({type:ht.DragMove,event:Pn}),Xe==null||Xe(Pn)},[pt.x,pt.y]),h.useEffect(()=>{const{active:Xe,droppableContainers:bt,scrollAdjustedTranslate:Xt}=ge.current;if(!Xe||!D.current||!Xt)return;const{onDragOver:Pn}=B.current,Gt=bt.get(Yt),fo=Gt&&Gt.rect.current?{id:Gt.id,rect:Gt.rect.current,data:Gt.data,disabled:Gt.disabled}:null,mn={active:Xe,delta:{x:Xt.x,y:Xt.y},over:fo};$n.unstable_batchedUpdates(()=>{Ve(fo),S({type:ht.DragOver,event:mn}),Pn==null||Pn(mn)})},[Yt]),Io(()=>{ge.current={active:N,activeNode:X,collisionRect:Fe,droppableRects:R,draggableNodes:O,draggingNodeRect:we,droppableContainers:T,over:he,scrollableAncestors:Ye,scrollAdjustedTranslate:pt,translatedRect:ut},_.current={initial:we,translated:ut}},[N,X,Fe,O,we,R,T,he,Ye,pt,ut]),V8({...po(),draggingRect:ut,pointerCoordinates:vt,scrollableAncestors:Ye,scrollableAncestorRects:Ct});const er=h.useMemo(()=>({active:N,activeNode:X,activeNodeRect:Q,activeNodeClientRect:G,activatorEvent:U,activators:Ft,ariaDescribedById:{draggable:k},containerNodeRect:et,dispatch:y,dragOverlay:ct,draggableNodes:O,droppableContainers:T,droppableRects:R,over:he,recomputeLayouts:W,scrollableAncestors:Ye,scrollableAncestorRects:Ct,willRecomputeLayouts:Z,windowRect:Se}),[N,X,G,Q,U,Ft,et,ct,y,O,k,T,R,he,W,Ye,Ct,Z,Se]);return h.createElement(tw.Provider,{value:w},h.createElement(Bu.Provider,{value:er},h.createElement(uw.Provider,{value:De},r)),h.createElement(j8,{announcements:s,hiddenTextDescribedById:k,screenReaderInstructions:u}));function po(){const Xe=(L==null?void 0:L.autoScrollEnabled)===!1,bt=typeof n=="object"?n.enabled===!1:n===!1,Xt=!Xe&&!bt;return typeof n=="object"?{...n,enabled:Xt}:{enabled:Xt}}}),fI=h.createContext(null),sv="button",hI="Droppable";function gI({id:e,data:t,disabled:n=!1,attributes:s}){const r=Sl(hI),{active:o,activeNodeRect:i,activatorEvent:a,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:p,over:f}=h.useContext(Bu),{role:g=sv,roleDescription:m="draggable",tabIndex:v=0}=s??{},b=(o==null?void 0:o.id)===e,x=h.useContext(b?uw:fI),[y,w]=Zh(),S=K8(p,e),C=iw(t);h.useEffect(()=>(u[e]={id:e,key:r,node:y,data:C},()=>{const E=u[e];E&&E.key===r&&delete u[e]}),[u,e]);const j=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===sv?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,v,b,m,l.draggable]);return{active:o,activeNodeRect:i,activatorEvent:a,attributes:j,droppableRects:d,isDragging:b,listeners:n?void 0:S,node:y,over:f,setNodeRef:w,transform:x}}function mI(){return h.useContext(Bu)}const vI="Droppable";function bI({data:e,disabled:t=!1,id:n}){const s=Sl(vI),{active:r,dispatch:o,over:i}=h.useContext(Bu),a=h.useRef(null),[l,u]=Zh(),d=iw(e);return Io(()=>(o({type:ht.RegisterDroppable,element:{id:n,key:s,disabled:t,node:l,rect:a,data:d}}),()=>o({type:ht.UnregisterDroppable,key:s,id:n})),[n]),h.useEffect(()=>{o({type:ht.SetDroppableDisabled,id:n,key:s,disabled:t})},[t]),{active:r,rect:a,isOver:(i==null?void 0:i.id)===n,node:l,over:i,setNodeRef:u}}function yI(e,t,n){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(s.x=n.left+n.width-t.right),s}const xI=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const s=n[0];return!e||!s?t:yI(t,e,s)},wI=({transform:e})=>({...e,x:0});function dw(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function SI(e,t){return e.reduce((n,s,r)=>{const o=t.get(s);return o&&(n[r]=o),n},Array(e.length))}function Xl(e){return e!==null&&e>=0}const pw=({layoutRects:e,activeIndex:t,overIndex:n,index:s})=>{const r=dw(e,n,t),o=e[s],i=r[s];return!i||!o?null:{x:i.offsetLeft-o.offsetLeft,y:i.offsetTop-o.offsetTop,scaleX:i.width/o.width,scaleY:i.height/o.height}},Jl={scaleX:1,scaleY:1},CI=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:s,overIndex:r})=>{var o;const i=(o=s[e])!=null?o:t;if(!i)return null;if(n===e){const l=s[r];return l?{x:0,y:e<r?l.offsetTop+l.height-(i.offsetTop+i.height):l.offsetTop-i.offsetTop,...Jl}:null}const a=jI(s,n,e);return n>e&&n<=r?{x:0,y:-i.height-a,...Jl}:n<e&&n>=r?{x:0,y:i.height+a,...Jl}:{x:0,y:0,...Jl}};function jI(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return s?n<t?r?s.offsetTop-(r.offsetTop+r.height):o?o.offsetTop-(s.offsetTop+s.height):0:o?o.offsetTop-(s.offsetTop+s.height):r?s.offsetTop-(r.offsetTop+r.height):0:0}const fw="Sortable",hw=h.createContext({activeIndex:-1,containerId:fw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pw,wasDragging:{current:!1}});function EI({children:e,id:t,items:n,strategy:s=pw}){const{active:r,dragOverlay:o,droppableRects:i,over:a,recomputeLayouts:l,willRecomputeLayouts:u}=mI(),d=Sl(fw,t),p=o.rect!==null,f=h.useMemo(()=>n.map(E=>typeof E=="string"?E:E.id),[n]),g=r!=null,m=h.useRef(!1),v=r?f.indexOf(r.id):-1,b=v!==-1,x=a?f.indexOf(a.id):-1,y=h.useRef(f),w=SI(f,i),S=!PI(f,y.current),C=x!==-1&&v===-1||S;Io(()=>{S&&b&&!u&&l()},[S,b,l,u]),h.useEffect(()=>{y.current=f},[f]),h.useEffect(()=>{const E=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(E)},[g]);const j=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:C,items:f,overIndex:x,useDragOverlay:p,sortedRects:w,strategy:s,wasDragging:m}),[v,d,C,f,x,w,p,s,m]);return h.createElement(hw.Provider,{value:j},e)}function PI(e,t){return e.join()===t.join()}const TI=({id:e,items:t,activeIndex:n,overIndex:s})=>dw(t,n,s).indexOf(e),OI=({containerId:e,isSorting:t,wasDragging:n,index:s,items:r,newIndex:o,previousItems:i,previousContainerId:a,transition:l})=>!l||!n||i!==r&&s===o?!1:t?!0:o!==s&&e===a,_I={duration:200,easing:"ease"},gw="transform",AI=Ba.Transition.toString({property:gw,duration:0,easing:"linear"}),LI={roleDescription:"sortable"};function MI({disabled:e,index:t,node:n,rect:s}){const[r,o]=h.useState(null),i=h.useRef(t);return Io(()=>{if(!e&&t!==i.current&&n.current){const a=s.current;if(a){const l=Uu(n.current),u={x:a.offsetLeft-l.offsetLeft,y:a.offsetTop-l.offsetTop,scaleX:a.width/l.width,scaleY:a.height/l.height};(u.x||u.y)&&o(u)}}t!==i.current&&(i.current=t)},[e,t,n,s]),h.useEffect(()=>{r&&requestAnimationFrame(()=>{o(null)})},[r]),r}function NI({animateLayoutChanges:e=OI,attributes:t,disabled:n,data:s,getNewIndex:r=TI,id:o,strategy:i,transition:a=_I}){const{items:l,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:f,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(hw),x=l.indexOf(o),y=h.useMemo(()=>({sortable:{containerId:u,index:x,items:l},...s}),[u,s,x,l]),{rect:w,node:S,setNodeRef:C}=bI({id:o,data:y}),{active:j,activeNodeRect:E,activatorEvent:O,attributes:P,setNodeRef:T,listeners:A,isDragging:_,over:N,transform:D}=gI({id:o,data:y,attributes:{...LI,...t},disabled:n}),L=c8(C,T),V=!!j,U=V&&b.current&&!p&&Xl(d)&&Xl(g),H=!m&&_,B=H&&U?D:null,I=U?B??(i??v)({layoutRects:f,activeNodeRect:E,activeIndex:d,overIndex:g,index:x}):null,R=Xl(d)&&Xl(g)?r({id:o,items:l,activeIndex:d,overIndex:g}):x,W=h.useRef(l),Z=l!==W.current,X=h.useRef(R),J=h.useRef(u),Q=e({active:j,containerId:u,isDragging:_,isSorting:V,id:o,index:x,items:l,newIndex:X.current,previousItems:W.current,previousContainerId:J.current,transition:a,wasDragging:b.current}),G=MI({disabled:!Q,index:x,node:S,rect:w});return h.useEffect(()=>{V&&X.current!==R&&(X.current=R),u!==J.current&&(J.current=u),l!==W.current&&(W.current=l)},[V,R,u,l]),{active:j,attributes:P,activatorEvent:O,rect:w,index:x,isSorting:V,isDragging:_,listeners:A,node:S,overIndex:g,over:N,setNodeRef:L,setDroppableNodeRef:C,setDraggableNodeRef:T,transform:G??I,transition:ee()};function ee(){if(G||Z&&X.current===x)return AI;if(!(H||!a)&&(V||Q))return Ba.Transition.toString({...a,property:gw})}}const $I=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],kI=(e,{context:{active:t,droppableContainers:n,translatedRect:s,scrollableAncestors:r}})=>{if($I.includes(e.code)){if(e.preventDefault(),!t||!s)return;const i=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=of(u),p={...l,rect:{current:d}};switch(e.code){case Ue.Down:s.top+s.height<=d.top&&i.push(p);break;case Ue.Up:s.top>=d.top+d.height&&i.push(p);break;case Ue.Left:s.left>=d.left+d.width&&i.push(p);break;case Ue.Right:s.left+s.width<=d.left&&i.push(p);break}});const a=k8({active:t,collisionRect:s,droppableContainers:i});if(a){var o;const l=(o=n.get(a))==null?void 0:o.node.current;if(l){const d=Yh(l).some((m,v)=>r[v]!==m),p=of(l),f=d?{x:0,y:0}:{x:s.width-p.width,y:s.height-p.height};return{x:p.left-f.x,y:p.top-f.y}}}}};function RI(e){const{id:t,item:n,className:s,select:r,remove:o,renderItem:i,previewStyle:a,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:f,setNodeRef:g,transform:m,transition:v}=NI({id:t,disabled:u}),b={transform:Ba.Transform.toString(m),transition:v},x=()=>!u&&(r==null?void 0:r(n));return c.jsx("div",{...l?{ref:g,style:b,...p}:{},children:c.jsxs($,{space:"s",onClick:x,className:s,items:"center",nowrap:!0,children:[l&&c.jsx(F,{className:Y(!u&&_e.hover,!u&&"cursor-grab"),...f,children:c.jsx(se,{icon:K.dotsVertical,size:oe.sx})}),c.jsx(F,{grow:!0,className:Y("overflow-hidden"),children:c.jsxs($,{children:[c.jsx(F,{grow:!0,className:Y("overflow-ellipsis overflow-hidden"),children:i(n)}),!!a&&c.jsx(F,{children:c.jsx("div",{className:Y("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:a(n)})})]})}),o&&d?c.jsx(ku,{disabled:u,onConfirm:()=>{o==null||o(n)},children:c.jsx(F,{className:Y(!u&&_e.click),children:c.jsx(se,{icon:K.close,size:oe.sx})})}):c.jsx(F,{className:Y(!u&&_e.click),onClick:y=>{Oo(y),!u&&(o==null||o(n))},children:c.jsx(se,{icon:K.close,size:oe.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function $s(e){const{className:t,items:n,selected:s,renderItem:r,select:o,add:i,remove:a,move:l,previewStyle:u,getItemId:d=T=>T.id||T.name||T.title||T.label||"",label:p,labelAs:f,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:x=!1,hidePopover:y,popoverPlacement:w="left",confirmRemove:S}=e,C=tI(Q1(Qh),Q1(Xh,{coordinateGetter:kI}));function j(T){const{active:A,over:_}=T;if(A.id!==(_==null?void 0:_.id)){const N=n.find(L=>d(L)===A.id),D=n.findIndex(L=>d(L)===(_==null?void 0:_.id));N&&(l==null||l(N,D))}}const E=Y(te.rnd,z.br,n.length&&te.b,n.length&&"gjs-mt-1");let O=c.jsxs("div",{className:E,children:[n.length===0&&b&&c.jsx($,{className:M("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((T,A)=>{const _=d(T),N=T===s,D=Y("gjs-px-2 gjs-py-2 text-xs",z.br,A&&te.bt,!!o&&!N&&!x&&z.hBgH2,N&&z.bgH,x&&"opacity-75");return c.jsx(RI,{id:_,item:T,className:D,select:o,remove:a,renderItem:r,previewStyle:u,sortable:!!l,disabled:x,confirmRemove:S},_||A)})]});l&&(O=c.jsx(pI,{sensors:C,collisionDetection:E8,onDragEnd:j,modifiers:[wI,xI],children:c.jsx(EI,{items:n.map(d),strategy:CI,children:O})})),o&&!y&&(O=c.jsx(Es,{placement:w,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!s&&!x,onClose:()=>o==null?void 0:o(null),handler:O,children:g}));const P=i?[{type:"button",icon:K.plus,tooltip:v,variant:"outline",size:"xs",disabled:x,onClick:i}]:[];return c.jsxs("div",{className:Y(t,"w-full"),children:[!!(p||i)&&c.jsx(js,{...e,as:f,afterLabelButtons:P}),O]})}const II=ce(function(){const t=Ie(),{editor:n}=xe(),s=ul(),r=dl(),o=r.sortedFonts;return n?c.jsx($s,{items:o,selected:null,renderItem:i=>{const a=hh(i);return c.jsxs($,{col:!0,children:[c.jsx(F,{className:"gs-utl-text-lg",style:{fontFamily:a},children:i.familyLabel}),c.jsx(F,{children:i.familyLabel})]})},remove:i=>r.removeFont(i.family),add:r.sdkAddFonts&&s.hasType("font")?()=>Gh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:i=>i.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),mw=Zt(function({size:t="m",className:n,classNameContent:s,border:r=!0,children:o,...i},a){const l=ie(z.bg,z.br,r&&`${te.b} ${te.rnd}`,t==="m"&&Pe.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx($,{className:l,items:"center",space:"x2s",...i,ref:a,children:c.jsx(F,{grow:!0,className:s,children:o})})}),vw=Zt(({autoResize:e,style:t={},...n},s)=>{const r=h.useRef(null),o=s||r;return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[n.value,e,o]),c.jsx("textarea",{ref:o,style:{...t,...e?{resize:"none"}:{}},...n})});vw.displayName="TextAreaWithAutoResize";const VI="gs-field-textarea";function rv(e){const{className:t,value:n,label:s,size:r,description:o,placeholder:i,readOnly:a,disabled:l,name:u,required:d,minLength:p,maxLength:f,onChange:g,onKeyDown:m,afterInput:v,minHeight:b,maxHeight:x,autoResize:y,classNameField:w,classNameFieldContent:S,classNameInput:C}=e,j=fl(e);return c.jsxs("div",{className:Y(VI,t),children:[!!s&&c.jsx(Kr,{size:r,children:s}),!!o&&c.jsx(Kr,{size:r,as:"span",className:Y(z.txtLowEmphasis),capitalize:!1,children:o}),c.jsxs(mw,{size:r,className:w,classNameContent:S,children:[c.jsx(vw,{className:Y(j,C),autoResize:y,value:n,name:u,placeholder:i,readOnly:a,disabled:l,required:d,minLength:p,maxLength:f,onChange:E=>g==null?void 0:g(E.target.value),onKeyDown:m,style:{minHeight:b,maxHeight:x}}),v]})]})}const Wu="gs-page-settings",HI=`${Wu}-header`,DI=`${Wu}-content`,FI=`${Wu}-footer`,ov="",BI=ce(function({className:t,classNameHeader:n,classNameContent:s,classNameFooter:r,page:o,size:i=yh.m}){const a=xe(),{isDarkTheme:l}=Ys(),u=dl(),d=Ie(),[p,f]=h.useState(o),[g,m]=h.useState(()=>pm(p,a)),[v,b]=h.useState(()=>d.t("update")),x=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:w}=a,S={containerClassName:"gs-utl-min-h-80",size:i,padding:5,isDarkTheme:l,clean:!0};if(!w)return null;const C=N=>m(D=>({...D,...N})),j=N=>{N.preventDefault();const{name:D,...L}=g;L.customCodeHead=fS(L.customCodeHead),L.customCodeBody=pS(L.customCodeBody),p?(b3(p,L),p.setName(D)):a.setProjectDataCustom({globalPageSettings:L}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),U0(w),w.trigger(Hn.pageSettingsUpdate,{page:p,data:{name:D,...L}})},E={tooltip:d.t("clear")},O=(p==null?void 0:p.getId())??ov,P=N=>{const D=w.Pages.get(N);f(D),m(pm(D,a))},T=gh(p),A=!!p&&xu(p),_=[{id:ov,label:x("global")},...w.Pages.getAll().map(N=>({icon:B0(N),id:N.getId(),label:N.getName()}))];return c.jsx("form",{onSubmit:j,className:M(Wu,"gs-utl-h-full",t),children:c.jsxs($,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(F,{className:M(HI,n,z.br,te.bb),children:c.jsx(Ae,{value:O,onChange:P,options:_,handlerSelected:N=>c.jsxs($,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),N.icon&&dt(N.icon)&&c.jsx(se,{icon:N.icon,size:oe.s2x}),c.jsx("span",{children:N.label})]})})}),c.jsxs($,{col:!0,className:M(DI,"gs-utl-gap-5 gs-utl-overflow-y-auto",s),nowrap:!0,children:[!!O&&c.jsxs(c.Fragment,{children:[c.jsx(ot,{size:i,value:g.name,onChange:N=>C({name:N}),label:y("name.label"),description:y("name.description"),required:!0}),!T&&c.jsx(ot,{size:i,value:g.slug,onChange:N=>C({slug:A?ES(N,["id"]):Kc(N)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(ot,{size:i,value:g.title,onChange:N=>C({title:N}),label:y("title.label"),description:y("title.description")}),c.jsx(rv,{size:i,value:g.description,onChange:N=>C({description:N}),label:y("description.label"),description:y("description.description")}),c.jsx(Da,{size:i,clear:E,value:g.favicon,onChange:N=>C({favicon:N}),onOpen:()=>{w.Assets.open({select(N){C({favicon:N.getSrc()}),w.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(ot,{size:i,value:g.keywords,onChange:N=>C({keywords:N}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(ot,{size:i,value:g.socialTitle,onChange:N=>C({socialTitle:N}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(Da,{size:i,clear:E,value:g.socialImage,onChange:N=>C({socialImage:N}),onOpen:()=>{w.Assets.open({select(N){C({socialImage:N.getSrc()}),w.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(rv,{size:i,value:g.socialDescription,onChange:N=>C({socialDescription:N}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(mr,{language:"html",defaultValue:g.customCodeHead,onChange:N=>C({customCodeHead:N}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...S},`head-${O}`),c.jsx(mr,{language:"html",defaultValue:g.customCodeBody,onChange:N=>C({customCodeBody:N}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...S},`body-${O}`),u.sdkShowProjectFonts&&!O&&c.jsx(II,{})]}),c.jsx($,{className:M(FI,"gs-utl-mt-auto",r,z.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),zI="gs-panel-page-settings",UI=h.memo(ce(function({className:t,page:n,...s}){return c.jsx(Ps,{className:M(zI,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(gl,{children:c.jsx(BI,{className:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:yh.s,classNameHeader:Pe.s,classNameContent:Pe.s,classNameFooter:Pe.s})})})})),Ql="gs-page-item",iv=ce(function({page:t,rename:n,setRename:s,commandItems:r}){const o=xe(),i=Ie(),a=o.editor,{Pages:l}=a,u=o.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,f=u==null?void 0:u.layoutBefore,g=j=>i.t(`pageManager.${j}`),m=j=>l.select(j),v=j=>l.getSelected()===j,b=j=>j===n,x=v(t),y=j=>j.getName()||j.getId(),w=j=>{n==null||n.set({name:j}),s(void 0)},S=ie("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),C=()=>a.runCommand(ne.setPageSettings,{page:t,isOpen:!0});return c.jsxs($,{gap:"s",items:"center",onClick:()=>m(t),className:ie([Ql,"group cursor-default",Pe.xy,x?z.bgH:z.hBgH2]),children:[p&&gh(t)&&c.jsx(F,{className:`${Ql}__icon-home`,title:g("homePage"),children:c.jsx(se,{icon:K.home,size:oe.s3x})}),f&&$t(f({page:t,editor:a,isSelected:x})),c.jsx(F,{className:ie(`${Ql}__name truncate`),grow:!0,children:b(t)?c.jsx(Wh,{value:y(t),onChange:w}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs($,{className:`${Ql}__actions`,gap:"xs",onClick:Oo,items:"center",children:[!n&&d!==!1&&c.jsx(St,{className:S,size:"xs",border:!1,title:g("settings.label"),onClick:C,block:!0,children:c.jsx(se,{icon:K.cog,size:oe.s3x})}),x&&!!r.length&&c.jsx(Es,{placement:"right-start",handler:c.jsx(se,{icon:K.dotsVertical,size:oe.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:j})=>r.map(E=>c.jsx(ki,{icon:E.icon,label:tt(E.label)?E.label({editor:a}):E.label,action:()=>{var O;j(),(O=E.cmd)==null||O.call(E,{page:t,editor:a})}},E.id))})]})]},t.getId())});function WI({dragging:e,dragRect:t}){const n=!!(e&&t),s=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:s}}var bw=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(bw||{});const Jd="gs-cmp-sortable",av=3;function GI({items:e,direction:t,onDrop:n,renderItem:s}){const[r,o]=h.useState(null),[i,a]=h.useState(-1),[l,u]=h.useState(),[d,p]=h.useState(!1),f=h.useRef(null),{showIndicator:g,indicatorStyle:m}=WI({dragging:!!r&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const E=window.document,O=P=>P.key==="Escape"&&y(P);return E.addEventListener("keydown",O),()=>E.removeEventListener("keydown",O)},[]);const b=E=>O=>{O.button===0&&(f.current={x:O.clientX,y:O.clientY},o(E),p(!1),O.target.setPointerCapture(O.pointerId))},x=E=>{const O=f.current;if(!r||!O)return;if(!d){const N=Math.abs(E.clientX-O.x),D=Math.abs(E.clientY-O.y);(t==="vertical"?D>av:N>av)&&p(!0);return}const P=E.clientY;let T=-1;v.forEach((N,D)=>{const L=N.getBoundingClientRect();P>L.top+L.height/2&&(T=D)});const A=e.findIndex(N=>N.id===r.id);T<A&&(T+=1),T=Math.min(T,e.length-1),a(T);const _=v[T];if(_){const{height:N,top:D}=_.getBoundingClientRect(),L=P<D+N/2;u({y:_.offsetTop+(L?0:N),h:N})}},y=E=>{o(null),p(!1),f.current=null,u(void 0);const O=E.target,{pointerId:P}=E;P&&(O==null||O.releasePointerCapture(P))},w=E=>{!r||!f.current||(l&&i!==-1&&(n==null||n(r,i)),y(E))},S=M(Jd,"gs-utl-relative"),C=M(`${Jd}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),j=E=>M(`${Jd}__item`,g&&(r==null?void 0:r.id)===E.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx($,{col:t==="vertical",className:S,children:e.map((E,O)=>c.jsx(F,{ref:P=>{P&&(v[O]=P)},className:j(E),onPointerDown:b(E),onPointerMove:x,onPointerUp:w,children:s(E)},E.id))}),g&&c.jsx("div",{className:C,style:m})]})}const qI=({pages:e,commandItems:t,rename:n,setRename:s,editor:r})=>{if(!r.Pages.move)return e.map(l=>c.jsx(iv,{page:l,commandItems:t,rename:n,setRename:s},l.getId()));const o=(l,u)=>{r.Pages.move(l.entity,{at:u})},i=l=>c.jsx(iv,{page:l.entity,commandItems:t,rename:n,setRename:s},l.id),a=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(GI,{items:a,direction:bw.vertical,onDrop:o,renderItem:i})},KI=({items:e,editor:t,sdkPageConfig:n})=>{const s=n==null?void 0:n.commandItems;return s===!1?[]:tt(s)?s({items:e,editor:t}):s||e},Qd="gs-panel-page-manager",yw=ce(function({pages:t,select:n,add:s,remove:r,header:o,resizable:i={bottom:!0},height:a=200}){const l=xe(),u=Mi(),d=Ie(),{sdkPagesConfig:p}=l,f=l.editor,[g,m]=h.useState(),v=_=>d.t(`pageManager.${_}`),b=p==null?void 0:p.add,x=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,w=_=>{Oo(_);const N=L=>{const V=t.length+1;return s({name:`${v("page")} ${V}`,component:`<div>${v("newPage")} ${V}</div>`,...L},{select:!0})};if(b)return b({event:_,editor:f,rename:m,addPage:N});const D=N();D&&m(D)},S=({page:_})=>{if(y)return y({editor:f,page:_});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const N=t.indexOf(_),D=t[N+1]||t[0];n(D),r(_)}})},C=({page:_})=>{if(x)return x({editor:f,page:_,rename:m});const N=_.getMainComponent(),D=s({name:`${_.getName()} (${v("copy")})`,component:N.clone()},{select:!0});D&&m(D)},j=[{id:"rename",label:v("rename"),icon:K.pencil,cmd:({page:_})=>m(_)},x!==!1&&{id:"duplicate",label:v("duplicate"),icon:K.contentCopy,cmd:C},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:K.delete,cmd:S}].filter(Boolean),E=KI({items:j,editor:f,sdkPageConfig:p}),O=Hx(o,{collapsible:!0,label:v("pages"),icon:K.textBoxMultiple}),P=i?i===!0?{top:!0,right:!0,bottom:!0,left:!0}:i:void 0,T=c.jsx(qI,{pages:t,commandItems:E,rename:g,setRename:m,editor:f}),A=P?c.jsx(Hu,{className:Y([`${Qd}__content`,"text-sm overflow-auto",te.bt,z.br]),height:a,...P,children:T}):T;return c.jsx(vr,{classNameWrap:Qd,className:Y(`${Qd}__header`,Pe.xy,o===!1&&"gs-utl-hidden"),disabled:O&&O.collapsible===!1,handler:c.jsxs($,{space:"s",items:"center",children:[!!O.icon&&c.jsx(F,{children:c.jsx(se,{icon:O.icon,size:oe.s})}),c.jsx(F,{grow:!0,children:O.label}),b!==!1&&c.jsx(zt,{title:v("add"),children:c.jsx($,{onClick:w,className:Y("cursor-pointer"),children:c.jsx(se,{icon:K.plus,size:oe.s})})})]}),open:O?O.collapsed!==!0:!0,children:A})}),xw=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-page-manager-after"),n),ref:r,...s,children:t})}),ww=Zt(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-page-manager-before"),n),ref:r,...s,children:t})}),ZI="gs-panel-pages",Sw=h.memo(ce(function({className:t,header:n,height:s,resizable:r,...o}){const i=xe().sdkProps.children;return c.jsx(jn,{className:M(ZI,t),...o,children:c.jsx(My,{children:a=>c.jsxs(c.Fragment,{children:[Xn(i,ww),c.jsx(yw,{header:n,height:s,resizable:r,...a}),Xn(i,xw)]})})})})),YI="gs-panel-pages-layers",XI=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:s,...r}){const{showPages:o}=xe(),i=Ie(),{className:a,...l}=n||{},u=Hx(s==null?void 0:s.header,{icon:K.layers,collapsible:!1,label:i.t("layerManager.layers"),className:M(te.bb,z.br)});return c.jsxs(Ps,{className:M(YI,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...r,children:[o&&c.jsx(Sw,{className:M(a,te.bb,z.br),...l}),c.jsx(Xx,{...s,header:u})]})})),JI="gs-trait-custom",QI=ce(function(t){const{trait:n,editor:s,value:r,disabled:o,labelAs:i,className:a}=t,[,l]=h.useState(0),u=h.useRef(null),d=n.get("component"),p=n.get("render"),f=n.target,g=u.current;if(h.useEffect(()=>{if(f){let b=()=>{},x=()=>{};const y=()=>{x(),l(w=>++w)};if(f.on("change",y),!d&&p&&g){const w=j=>g.appendChild(j),S=j=>g.removeChild(j),C=p({editor:s,component:f,trait:n,addEl:w,removeEl:S,onUpdate:j=>{x=j}});C instanceof HTMLElement?(w(C),b=()=>S(C)):tt(C)&&(b=()=>C())}return()=>{f.off("change",y),b()}}},[f,g,r]),!f)return null;const m=ro({...t,className:M(JI,a)}),v={trait:n,component:f,editor:s,value:r,disabled:o};return c.jsxs("div",{...m,children:[c.jsx(js,{...t,as:i}),c.jsx("div",{className:M(o&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):p?c.jsx("div",{ref:u}):null})]})});function Cw({className:e,options:t,value:n,name:s,label:r,border:o,hideCaret:i,size:a="s",autoFocus:l,open:u,allowNew:d,onChange:p,onBlur:f,placeholder:g}){const[m,v]=h.useState(null),[b,x]=h.useState(null),{styles:y,attributes:w}=al(m,b,wh),[S,C]=h.useState(""),j=fl(),E=S===""?t:t.filter(D=>D.label.toLowerCase().includes(S.toLowerCase())),O=D=>C(D.target.value),P=D=>D==null?void 0:D.label,T=d&&S.length>0&&!E.some(D=>D.label===S),A=tt(d)?d(S):d,_={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},N=()=>f==null?void 0:f();return c.jsxs("div",{className:Y("w-full",e),children:[!!r&&c.jsx(Kr,{size:a,children:r}),c.jsxs(Jo,{value:n,onChange:p,name:s,nullable:!0,children:[c.jsx(mw,{size:a,ref:v,border:o,children:c.jsxs($,{nowrap:!0,children:[c.jsx(Jo.Input,{autoFocus:l,className:j,displayValue:P,onChange:O,onBlur:N,placeholder:g}),!i&&c.jsx(Jo.Button,{children:c.jsx(se,{icon:K.chevronDown,size:oe.sx})})]})}),c.jsx(Jo.Options,{static:u,className:Py,ref:x,style:y.popper,...w.popper,children:c.jsxs(rs,{className:Y("h-full"),padding:!1,style:_,children:[T&&c.jsx(Jo.Option,{value:{id:null,label:S},children:({active:D})=>c.jsx(Vm,{option:{id:null,label:A},active:D,selected:n})}),!T&&E.length===0&&c.jsx("div",{className:Y(Pe.xy),children:"No items found"}),E.map(D=>c.jsx(Jo.Option,{value:D,children:({active:L})=>c.jsx(Vm,{option:D,active:L,selected:n})},D.id))]})})]})]})}const e9=(e,t)=>{const n=`${bu}${t}`,s=e.get(n,{skipResolve:!0});return s?jw(s):e.get(n)||""};function jw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const t9=({page:e,component:t})=>{const{DataSources:n,I18n:s}=e.em,r=["prevItem","currentItem","nextItem"],o=yu(e)||"",i=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return r.map(p=>{if(d!=null&&d[p]){const{collectionId:f}=d,g=s.t(`dataSources.collections.${f}`)||f,m=s.t(`dataSources.variableTypes.${p}`)||p,v={collectionId:f,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:jw(v),label:`${g} > ${m}`,dataVariable:v}}}).filter(Boolean)}).flat().filter(Boolean),a=n.get(o),l=a==null?void 0:a.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...i,...l]},Ew="#",bc="mailto:",ep="subject=",cf="tel:",Pw="hrefType",lv="showIdList",cv=(e,t)=>{const n=t==null?void 0:t.get(Pw);return n||(e.startsWith(cf)?"phone":e.startsWith(bc)?"email":e.startsWith(Oa)?"pages":e.startsWith(Ew)?"elements":"url")},uv=e=>`${e.getName()} - #${e.getId()}`,n9="gs-trait-href",s9=ce(function(t){const{trait:n,value:s,disabled:r,labelAs:o,className:i}=t,a=n.component,l=xe(),{isSelectingTarget:u,editor:d}=l,[,p]=h.useState(0),[f,g]=h.useState(""),[m,v]=h.useState(""),[b,x]=h.useState(""),[y,w]=h.useState([]),S=Ie(),C=d==null?void 0:d.Pages.getAll(),j=S.tScoped("traitManager.traits.labels"),E=()=>p(J=>++J),O=a.get(lv)??!1,P=cv(s,a),T=P==="pages"?s==null?void 0:s.replace(Oa,""):"",A=!!T&&(d==null?void 0:d.Pages.get(T)),_=A?xu(A):!1,N=h.useMemo(()=>!_||!A||!d?[]:t9({page:A,component:a}),[d,A,_,a]),D=J=>{n.setValue(J)},L=J=>{a.set({[lv]:J}),E()},V=J=>{g(""),v(""),x(""),D(""),a.set({[Pw]:J}),E()},U=J=>{D(J),E()},H=(J,Q)=>{w3(a,"id",(Q==null?void 0:Q.dataVariable)||J),E()},B=J=>{J&&(D(J.id),E())},k=J=>{D(`${cf}${J}`),x(J)},I=J=>{D(`${bc}${J}${m?`?${ep}${m}`:""}`),g(J)},R=J=>{D(`${bc}${f}${J?`?${ep}${J}`:""}`),v(J)},W=()=>{l.setSelectingTarget(!u)},Z=J=>{const Q=J.replace(Ew,""),G=d==null?void 0:d.Components.componentsById[Q];return{id:J,label:G?uv(G):J}};h.useEffect(()=>{var Q;const J=[];if(O){const G=["path","br","b","u","i","strike"],ee=(Q=d==null?void 0:d.Pages.getSelected())==null?void 0:Q.getMainComponent();ee==null||ee.forEachChild(ae=>{!ae.is("comment")&&!ae.is("textnode")&&!G.includes(ae.get("tagName"))&&J.push({id:`#${ae.getId()}`,label:uv(ae)})})}w(J)},[d,O]),h.useEffect(()=>{let J=()=>{};const Q=()=>{J(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(Gc))};return u&&(J=lS(Q),d==null||d.runCommand(Gc,{onSelect:G=>D(`#${G.getId()}`)})),Q},[d,u]),h.useEffect(()=>{if(!s)return;switch(cv(s,a)){case"phone":x(s.replace(cf,""));break;case"email":{const[Q,G=""]=s.replace(bc,"").split("?");g(Q),v(G.replace(ep,""));break}}},[s]);const X=ro({className:M(n9,i)});return c.jsxs("div",{...X,children:[c.jsx(js,{...t,as:o}),c.jsx("div",{className:M(r&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(io,{onChange:V,classNamePanel:"gs-utl-p-1",value:P,tabs:[{id:"url",label:c.jsx(se,{icon:K.link,size:oe.s}),content:c.jsx(ot,{placeholder:"eg. https://google.com",value:s,label:"URL",onChange:D,size:"s",type:"url"})},{id:"pages",label:c.jsx(se,{icon:K.textBoxMultiple,size:oe.s}),content:c.jsxs($,{gap:"s",col:!0,children:[c.jsx(Ae,{size:"s",options:(C||[]).map(J=>({id:`${Oa}${J.getId()}`,icon:B0(J),label:J.getName()})),value:s,onChange:U,label:"Page"}),_&&c.jsx(Ae,{size:"s",options:N,value:e9(a,"id"),onChange:H,label:S.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(se,{icon:K.viewDayOutline,size:oe.s}),content:c.jsxs($,{gap:"s",col:!0,children:[c.jsx(Kr,{size:"s",children:"Element ID"}),c.jsxs($,{gap:"xs",nowrap:!0,children:[O?c.jsx(Cw,{options:y,onChange:B,value:Z(s),placeholder:S.t("selectList")}):c.jsx(ot,{size:"s",placeholder:"eg. #my-element-in-page",value:s,onChange:D,className:"gs-utl-flex-1"}),c.jsx(St,{title:S.t("selectTarget"),size:"m2",active:u,onClick:W,className:"gs-utl-h-[30px]",children:c.jsx(se,{icon:K.target,size:oe.sx})})]}),c.jsx(Ia,{value:O,onChange:L,label:j("showList")})]})},{id:"email",label:c.jsx(se,{icon:K.email,size:oe.s}),content:c.jsxs($,{gap:"s",col:!0,children:[c.jsx(ot,{placeholder:"eg. mail@gmail.com",value:f,onChange:I,size:"s",label:"Email",type:"email"}),c.jsx(ot,{placeholder:"eg. My subject",value:m,onChange:R,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(se,{icon:K.phone,size:oe.s}),content:c.jsx(ot,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:k})}]})})]})});function r9({trait:e,value:t,disabled:n,label:s,labelAs:r}){const[o,i]=h.useState(),a=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(f=>f.id===(o==null?void 0:o.id));return c.jsx($s,{items:d,selected:p>-1?o:null,select:i,disabled:n,label:s,labelAs:r,add:()=>{const f=d.length+1,g=l?l(f):{id:`opt${f}`,label:`New option ${f}`};e.setValue([...d,g])},move:(f,g)=>{const m=e.getValue().filter(v=>v.id!==f.id);m.splice(g,0,f),e.setValue(m)},remove:f=>{const g=e.getValue().filter(m=>m.id!==f.id);e.setValue(g,{removed:f})},renderItem:f=>u?u(f):f.label,children:c.jsx($,{space:"m",col:!0,children:!!o&&a.map(f=>{const{name:g,getValue:m}=f,v=f.setValue,b=f.label||g,x=d[p];if(!x)return null;const y=x[g],w=m?m(y):y,S=j=>{const E={...x};x[g]=v?v(j,w):j,e.setValue([...d],{item:x,previous:E}),g==="id"&&i(x)};let C=c.jsx(ot,{label:b,value:w,onChange:S});switch(f.type){case"select":C=c.jsx(Ae,{label:b,options:f.options,value:w,onChange:S})}return c.jsx(h.Fragment,{children:C},g)})})})}const o9="gs-trait-custom-type",i9=ce(function({trait:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=t.target,{Traits:i}=n,a=i.getType(r),l=!!(o&&a);return h.useEffect(()=>{const u=s.current;if(a&&u&&o){const d=new a({model:t,config:i.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(o,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[o,a,t]),l&&c.jsx("div",{className:o9,ref:s})}),a9=e=>{const{value:t={},onConfirm:n,additionalSources:s,editor:r}=e;if(!r)return;const o="DataValuePicker",i={id:o,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:a})=>{n==null||n(a),r.runCommand(ne.layoutRemove,{id:o})},additionalSources:s},placer:{type:"dialog",size:"l"}};r.runCommand(ne.layoutToggle,{...i})};function Tw(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:s,editor:r,additionalSources:o,enableDataValue:i,hasDataResolverValue:a}=e;if(!r||!i)return[];const l={type:"button",className:a?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:r.I18n.t("dataSources.connectDataValue"),icon:{icon:K.databaseOutline,size:oe.s2x},onClick:()=>a9({value:t,onConfirm:n,additionalSources:o,editor:r})}];return a&&u.push({...l,title:r.I18n.t("dataSources.clearDataValue"),icon:{icon:K.close,size:oe.s2x},onClick:s}),u}function l9(e,t){const n=e.em.getEditor(),s=e.target;let r=!1;t===!0?r=!0:yr(t)&&tt(t.enable)&&(r=t.enable({trait:e,component:s,editor:n}));const o=e.getValue({skipResolve:!0}),i=s.collectionsStateMap,a=Yr(o);return{hasDataResolverValue:a,dataResolverValue:a?e.getValue():void 0,enableDataValue:r,initialDataValue:o,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:i}}const c9=({label:e,buttons:t})=>c.jsxs($,{items:"center",nowrap:!0,full:!0,children:[c.jsx(F,{grow:!0,children:e}),c.jsx($,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,s)=>c.jsx(St,{...n},s))})]}),Ow=e=>Is((e||"").replace(/-/g," ")),u9=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&Ow(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,s)=>e.setValue(n,{partial:s})}),Ts=(e,t,n)=>{const s=l9(e,n.traitManagerDataConfig),r=Tw(s),{hasDataResolverValue:o,dataResolverValue:i}=s,a=u9(e,t);return{...a,value:i??a.value,disabled:o,labelAs:r.length?"span":void 0,label:c.jsx(c9,{label:a.label,buttons:r})}},dv=(e,t,n)=>Ts(e,t,n),d9=(e,t,n)=>Ts(e,t,n),p9=(e,t,n)=>{const s=Yr(e.getValue({skipResolve:!0})),r=Ts(e,t,n),o={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!s,units:s?[]:e.get("units"),onChange:(i,a)=>{const l=a||isNaN(parseFloat(i))?i:parseFloat(i);e.setValue(l,{partial:a})}};return{...r,...o}},_w=(e,t,n)=>{const s=e.get("labelToTitle"),r=Yr(e.getValue({skipResolve:!0})),o=Ts(e,t,n),i={options:e.getOptions().map(a=>{const l=a.labelReact||a.name||a.label||a.value;return dt(a)?{id:a,label:a}:{id:a.id||a.value,title:s?l:a.title,icon:a.icon,label:s?"":l}}),onChange:a=>e.setValue(a),emptyState:r&&e.getValue()||void 0,hideCaret:r};return{...o,...i}},f9=(e,t,n)=>{const{options:s,onChange:r}=_w(e,t,n),o={options:s,onChange:r};return{...Ts(e,t,n),...o}},h9=(e,t,n)=>{const s=e.get("typeProps")||{},r=Yr(e.getValue({skipResolve:!0}));return{...Ts(e,t,n),isContain:!0,hideButton:r,btnLabel:e.get("text"),onOpen(){if(r)return;const i=t==null?void 0:t.Assets;i==null||i.open({select(a){e.setValue(a.getSrc()),i.close()}})},...s}},g9=e=>({children:Ow(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");dt(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),m9=(e,t,n)=>{const s=Ts(e,t,n),o={value:!!(s.disabled?s.value:e.getValue({useType:!0})),onChange:i=>e.setValue(i)};return{...s,...o}},v9=(e,t,n)=>{const s=Ts(e,t,n),r=e.get("typeProps")||{},o=Yr(e.getValue({skipResolve:!0}));return{language:"css",...r,...s,formatOnMount:!o,onChange:i=>e.setValue(i)}},b9=(e,t,n)=>({...Ts(e,t,n),trait:e}),y9=(e,t,n)=>({...Ts(e,t,n),trait:e}),x9=(e,t,n)=>({...Ts(e,t,n),trait:e,editor:t});function w9(e,t,n={}){var i;const s=e.get("visible"),r=e.getType(),o={traitManagerDataConfig:n.traitManagerDataConfig};if(tt(s)&&s({component:e.target,trait:e})===!1)return null;switch(r){case"text":return c.jsx(ot,{...dv(e,t,o)});case"select":return c.jsx(Ae,{..._w(e,t,o)});case"number":return c.jsx(Ne,{...p9(e,t,o)});case"color":return c.jsx(Ks,{...d9(e,t,o)});case"checkbox":return c.jsx(Ia,{...m9(e,t,o)});case"button":return c.jsx(Ke,{...g9(e)});case"radio":return c.jsx(tn,{...f9(e,t,o)});case"code":return c.jsx(mr,{...v9(e,t,o),...n},((i=t==null?void 0:t.getSelected())==null?void 0:i.getId())||"");case"image":case"file":return c.jsx(Da,{...h9(e,t,o)});case"stack":return c.jsx(r9,{...b9(e,t,o)});case"href":return c.jsx(s9,{...y9(e,t,o)});case"custom":return c.jsx(QI,{...x9(e,t,o)});default:return!!t.Traits.getType(r)?c.jsx(i9,{editor:t,trait:e}):c.jsx(ot,{...dv(e,t,o)})}}const yc="gs-trait-manager",pv=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(F,{className:`${yc}-field gs-utl-mb-2 gs-utl-w-full`,children:w9(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function S9({traits:e,className:t}){var p,f;const n=hl(),{isDarkTheme:s}=Ys(),o=(p=xe().sdkOptions.dataSources)==null?void 0:p.traitManager,i=n.Traits.getTraitsByCategory(e),a=(f=i.find(g=>!g.category))==null?void 0:f.items,l=i.filter(g=>g.category),u=`${yc}__empty-state gs-utl-text-center`,d=g=>n.t(`traitManager.${g}`);return c.jsx($,{className:Y(yc,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[a==null?void 0:a.map(g=>c.jsx(pv,{trait:g,isDarkTheme:s,traitManagerDataConfig:o},g.id)),l.map(({category:g,items:m},v)=>c.jsx(vr,{open:!!(g!=null&&g.get("open")),onChange:({open:b})=>g==null?void 0:g.set({open:b}),handler:g==null?void 0:g.getLabel(),handlerIcon:g==null?void 0:g.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${yc}-category -gs-utl-mx-2`,className:b=>Y(Lf.itemList({index:v+(a?1:0),open:b,length:l.length})),children:m.map(b=>c.jsx(pv,{trait:b,isDarkTheme:s,traitManagerDataConfig:o},b.id))},g==null?void 0:g.id))]}):c.jsx(F,{className:u,children:d("notFound")}):c.jsx(F,{className:u,children:d("empty")})})}const uf=ce(S9),C9="gs-panel-properties",j9=h.memo(ce(function({className:t,...n}){return c.jsx(Ps,{className:M(C9,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(zp,{children:s=>c.jsx(uf,{...s})})})})),E9=async({html:e="",css:t="",el:n})=>{const s=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,r={};if(document.body.attachShadow){const o=n.shadowRoot||n.attachShadow({mode:"open"});o.innerHTML=s}return r},P9=ce(function({rule:t,onSelect:n,onRemove:s,className:r}){const o=h.useRef(null),a=xe().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=Ys(),[f,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(f),b=t.selectorsToString(),x=()=>{a.select(),setTimeout(()=>a.Selectors.select(t)),n==null||n()},y=()=>{a.Css.remove(t),s==null||s()},w=()=>{if(m){const S=a.Parser.parseCss(m)[0];S&&(t.setStyle(S.style),g(m))}};return h.useEffect(()=>{if(o.current){const S=o.current;E9({el:S,html:'<div class="prv-rule">Preview</div>',css:`
326
+ `},z6={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}};var ht;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ht||(ht={}));function Xd(...e){}class va extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Gu=g.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:Xd,draggableNodes:{},droppableRects:new Map,droppableContainers:new va,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xd},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:Xd,windowRect:null,willRecomputeLayouts:!1});function U6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new va}}}function W6(e,t){switch(t.type){case ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ht.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case ht.DragEnd:case ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ht.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new va(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case ht.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new va(e.droppable.containers);return i.set(n,{...o,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case ht.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const o=new va(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}const hw=g.createContext({type:null,event:null});function G6({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:s,onDragCancel:r}){const o=g.useContext(hw),i=g.useRef(o);g.useEffect(()=>{if(o!==i.current){const{type:a,event:l}=o;switch(a){case ht.DragStart:e==null||e(l);break;case ht.DragMove:t==null||t(l);break;case ht.DragOver:n==null||n(l);break;case ht.DragCancel:r==null||r(l);break;case ht.DragEnd:s==null||s(l);break}i.current=o}},[o,e,t,n,s,r])}function q6({announcements:e=z6,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:s,announcement:r}=F6(),o=Pl("DndLiveRegion"),[i,a]=g.useState(!1);return g.useEffect(()=>{a(!0)},[]),G6(g.useMemo(()=>({onDragStart({active:l}){s(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&s(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){s(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){s(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){s(e.onDragCancel(l.id))}}),[s,e])),i?kn.createPortal(g.createElement(g.Fragment,null,g.createElement(H6,{id:t,value:n.draggable}),g.createElement(D6,{id:o,announcement:r})),document.body):null}const xr=Object.freeze({x:0,y:0});function mw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Q1(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const K6=({collisionRect:e,droppableContainers:t})=>{const n=Q1(e,e.left,e.top);let s=1/0,r=null;for(const o of t){const{rect:{current:i}}=o;if(i){const a=mw(Q1(i),n);a<s&&(s=a,r=o.id)}}return r};function Z6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Y6(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xr}function X6(e){return function(n,...s){return s.reduce((r,o)=>({...r,top:r.top+e*o.y,bottom:r.bottom+e*o.y,left:r.left+e*o.x,right:r.right+e*o.x,offsetLeft:r.offsetLeft+e*o.x,offsetTop:r.offsetTop+e*o.y}),{...n})}}const eb=X6(1);function J6(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function Q6(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(r=>{const o=t[r];return typeof o=="string"?n.test(o):!1})!=null}function th(e){const t=[];function n(s){if(!s)return t;if(Qg(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Fi(s)||pw(s)||t.includes(s))return t;const r=window.getComputedStyle(s);return Q6(s,r)&&t.push(s),J6(s,r)?t:n(s.parentNode)}return e?n(e.parentNode):t}function Jd(e){return!Wu||!e?null:Di(e)?e:Jg(e)?Qg(e)||e===Bi(e).scrollingElement?window:Fi(e)?e:null:null}function uf(e){return Di(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var fi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(fi||(fi={}));function bw(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},s=e.scrollTop<=t.y,r=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:r,isBottom:o,isRight:i,maxScroll:n,minScroll:t}}function e8(e){return!Wu||!e?!1:e===document.scrollingElement}const t8={x:.2,y:.2};function n8(e,t,{top:n,left:s,right:r,bottom:o},i=10,a=t8){const{clientHeight:l,clientWidth:u}=e,d=e8(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:p,isBottom:f,isLeft:h,isRight:m}=bw(e),b={x:0,y:0},v={x:0,y:0},x={height:d.height*a.y,width:d.width*a.x};return!p&&n<=d.top+x.height?(b.y=fi.Backward,v.y=i*Math.abs((d.top+x.height-n)/x.height)):!f&&o>=d.bottom-x.height&&(b.y=fi.Forward,v.y=i*Math.abs((d.bottom-x.height-o)/x.height)),!m&&r>=d.right-x.width?(b.x=fi.Forward,v.x=i*Math.abs((d.right-x.width-r)/x.width)):!h&&s<=d.left+x.width&&(b.x=fi.Backward,v.x=i*Math.abs((d.left+x.width-s)/x.width)),{direction:b,speed:v}}function s8(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function vw(e){return e.reduce((t,n)=>Wa(t,uf(n)),xr)}function yw(e,t,n=xr){if(!e||!Fi(e))return n;const s={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?s:yw(e.offsetParent,t,s)}function qu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:s,y:r}=yw(e,null);return{width:t,height:n,offsetTop:r,offsetLeft:s}}function Ku(e){if(Di(e)){const u=window.innerWidth,d=window.innerHeight;return{top:0,left:0,right:u,bottom:d,width:u,height:d,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=qu(e),{width:s,height:r,top:o,bottom:i,left:a,right:l}=e.getBoundingClientRect();return{width:s,height:r,top:o,bottom:i,right:l,left:a,offsetTop:t,offsetLeft:n}}function df(e){const{width:t,height:n,offsetTop:s,offsetLeft:r}=qu(e),o=th(e),i=vw(o),a=s-i.y,l=r-i.x;return{width:t,height:n,top:a,bottom:a+n,right:l+t,left:l,offsetTop:s,offsetLeft:r}}function tb(e){return"top"in e}function nb(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const r8=({collisionRect:e,droppableContainers:t})=>{let n=1/0,s=null;const r=nb(e,e.left,e.top);for(const o of t){const{rect:{current:i}}=o;if(i){const a=nb(i,tb(i)?i.left:void 0,tb(i)?i.top:void 0),l=r.reduce((d,p,f)=>d+mw(a[f],p),0),u=Number((l/4).toFixed(4));u<n&&(n=u,s=o.id)}}return s};function o8(e,t){const n=Math.max(t.top,e.offsetTop),s=Math.max(t.left,e.offsetLeft),r=Math.min(t.left+t.width,e.offsetLeft+e.width),o=Math.min(t.top+t.height,e.offsetTop+e.height),i=r-s,a=o-n;if(s<r&&n<o){const l=t.width*t.height,u=e.width*e.height,d=i*a,p=d/(l+u-d);return Number(p.toFixed(4))}return 0}const i8=({collisionRect:e,droppableContainers:t})=>{let n=0,s=null;for(const r of t){const{rect:{current:o}}=r;if(o){const i=o8(o,e);i>n&&(n=i,s=r.id)}}return s};var ya;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ya||(ya={}));var Zc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Zc||(Zc={}));function a8({acceleration:e,activator:t=ya.Pointer,canScroll:n,draggingRect:s,enabled:r,interval:o=5,order:i=Zc.TreeOrder,pointerCoordinates:a,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[p,f]=$6(),h=g.useRef({x:1,y:1}),m=g.useMemo(()=>{switch(t){case ya.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case ya.DraggableRect:return s}return null},[t,s,a]),b=g.useRef(xr),v=g.useRef(null),x=g.useCallback(()=>{const w=v.current;if(!w)return;const S=h.current.x*b.current.x,j=h.current.y*b.current.y;w.scrollBy(S,j)},[]),y=g.useMemo(()=>i===Zc.TreeOrder?[...l].reverse():l,[i,l]);g.useEffect(()=>{if(!r||!l.length||!m){f();return}for(const w of y){if((n==null?void 0:n(w))===!1)continue;const S=l.indexOf(w),j=u[S];if(!j)continue;const{direction:C,speed:E}=n8(w,j,m,e,d);if(E.x>0||E.y>0){f(),v.current=w,p(x,o),h.current=E,b.current=C;return}}h.current={x:0,y:0},b.current={x:0,y:0},f()},[e,x,n,f,r,o,JSON.stringify(m),p,l,y,u,JSON.stringify(d)])}function l8(e,t){const n=t!==null?e[t]:void 0,s=n?n.node.current:null;return El(r=>{var o;return t===null?null:(o=s??r)!=null?o:null},[s,t])}function c8(e,t){return g.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,o=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...n,...o]},[]),[e,t])}function xw(e){const t=g.useRef(e);return Vo(()=>{t.current!==e&&(t.current=e)},[e]),t}var qa;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qa||(qa={}));var pf;(function(e){e.Optimized="optimized"})(pf||(pf={}));const sb=new Map,u8={measure:qu,strategy:qa.WhileDragging,frequency:pf.Optimized};function d8(e,{dragging:t,dependencies:n,config:s}){const[r,o]=g.useState(!1),{frequency:i,measure:a,strategy:l}={...u8,...s},u=g.useRef(e),d=g.useCallback(()=>o(!0),[]),p=g.useRef(null),f=m(),h=El(b=>{if(f&&!t)return sb;if(!b||b===sb||u.current!==e||r){for(let v of e)v&&(v.rect.current=v.node.current?a(v.node.current):null);return p8(e)}return b},[e,t,f,a,r]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{r&&o(!1)},[r]),g.useEffect(function(){f||requestAnimationFrame(d)},[t,f]),g.useEffect(function(){f||typeof i!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},i))},[i,f,d,...n]),{layoutRectMap:h,recomputeLayouts:d,willRecomputeLayouts:r};function m(){switch(l){case qa.Always:return!1;case qa.BeforeDragging:return t;default:return!t}}}function p8(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:s,rect:r}=n;r.current!=null&&t.set(s,r.current)}return t}function f8(e){const[t,n]=g.useState(null),s=g.useRef(e),r=g.useCallback(o=>{const i=Jd(o.target);i&&n(a=>a?(a.set(i,uf(i)),new Map(a)):null)},[]);return g.useEffect(()=>{const o=s.current;if(e!==o){i(o);const a=e.map(l=>{const u=Jd(l);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,uf(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),s.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const u=Jd(l);u==null||u.removeEventListener("scroll",r)})}},[r,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Wa(o,i),xr):vw(e):xr,[e,t])}const g8=[];function h8(e){const t=g.useRef(e),n=El(s=>e?s&&e&&t.current&&e.parentNode===t.current.parentNode?s:th(e):g8,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function m8(e){g.useEffect(()=>{if(!Wu)return;const t=e.map(({sensor:n})=>n.setup==null?void 0:n.setup());return()=>{for(const n of t)n==null||n()}},e.map(({sensor:t})=>t))}function b8(e,t){return g.useMemo(()=>e.reduce((n,{eventName:s,handler:r})=>(n[s]=o=>{r(o,t)},n),{}),[e,t])}const Qd=Sw(Ku),v8=y8(Ku);function ww(e,t,n){const s=g.useRef(e);return El(r=>e?n||!r&&e||e!==s.current?Fi(e)&&e.parentNode==null?null:t(e):r??null:null,[e,n,t])}function Sw(e){return(t,n)=>ww(t,e,n)}function y8(e){const t=[];return function(s,r){const o=g.useRef(s);return El(i=>s.length?r||!i&&s.length||s!==o.current?s.map(a=>e(a)):i??t:t,[s,r])}}function x8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Fi(t)?t:e}function w8(e){const{width:t,height:n,offsetLeft:s,offsetTop:r}=qu(e);return{top:r,bottom:r+n,left:s,right:s+t,width:t,height:n,offsetTop:r,offsetLeft:s}}const S8=Sw(w8);function C8({disabled:e,forceRecompute:t}){const[n,s]=eh(),r=S8(e?null:x8(n.current),t);return g.useMemo(()=>({nodeRef:n,rect:r,setRef:s}),[r,n,s])}function rb(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function j8(...e){return g.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class xa{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})}}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function E8(e){const{EventTarget:t}=fo(e);return e instanceof t?e:Bi(e)}function ep(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var qn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(qn||(qn={}));function ob(e){e.preventDefault()}function P8(e){e.stopPropagation()}var Ke;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Ke||(Ke={}));const Cw={start:[Ke.Space,Ke.Enter],cancel:[Ke.Esc],end:[Ke.Space,Ke.Enter]},T8=(e,{currentCoordinates:t})=>{switch(e.code){case Ke.Right:return{...t,x:t.x+25};case Ke.Left:return{...t,x:t.x-25};case Ke.Down:return{...t,y:t.y+25};case Ke.Up:return{...t,y:t.y-25}}};class nh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=xr;const{event:{target:n}}=t;this.props=t,this.listeners=new xa(Bi(n)),this.windowListeners=new xa(fo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(qn.Resize,this.handleCancel),this.windowListeners.add(qn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(qn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const s=Ku(t.node.current),r={x:s.left,y:s.top};this.coordinates=r,n(r)}handleKeyDown(t){if(R6(t)){const{coordinates:n}=this,{active:s,context:r,options:o}=this.props,{keyboardCodes:i=Cw,coordinateGetter:a=T8,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const d=a(t,{active:s,context:r.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:f}=r.current;for(const h of f){const m=t.code,b=gw(d,n),{isTop:v,isRight:x,isLeft:y,isBottom:w,maxScroll:S,minScroll:j}=bw(h),C=s8(h),E={x:Math.min(m===Ke.Right?C.right-C.width/2:C.right,Math.max(m===Ke.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(m===Ke.Down?C.bottom-C.height/2:C.bottom,Math.max(m===Ke.Down?C.top:C.top+C.height/2,d.y))},O=m===Ke.Right&&!x||m===Ke.Left&&!y,P=m===Ke.Down&&!w||m===Ke.Up&&!v;if(O&&E.x!==d.x){if(m===Ke.Right&&h.scrollLeft+b.x<=S.x||m===Ke.Left&&h.scrollLeft+b.x>=j.x){h.scrollBy({left:b.x,behavior:l});return}p.x=m===Ke.Right?h.scrollLeft-S.x:h.scrollLeft-j.x,h.scrollBy({left:-p.x,behavior:l});break}else if(P&&E.y!==d.y){if(m===Ke.Down&&h.scrollTop+b.y<=S.y||m===Ke.Up&&h.scrollTop+b.y>=j.y){h.scrollBy({top:b.y,behavior:l});return}p.y=m===Ke.Down?h.scrollTop-S.y:h.scrollTop-j.y,h.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Wa(d,p))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}nh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=Cw,onActivation:n})=>{const{code:s}=e.nativeEvent;return t.start.includes(s)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function ib(e){return!!(e&&"distance"in e)}function ab(e){return!!(e&&"delay"in e)}class sh{constructor(t,n,s=E8(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=t,{target:o}=r;this.props=t,this.events=n,this.document=Bi(o),this.documentListeners=new xa(this.document),this.listeners=new xa(s),this.windowListeners=new xa(fo(o)),this.initialCoordinates=cf(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(qn.Resize,this.handleCancel),this.windowListeners.add(qn.DragStart,ob),this.windowListeners.add(qn.VisibilityChange,this.handleCancel),this.windowListeners.add(qn.ContextMenu,ob),this.documentListeners.add(qn.Keydown,this.handleKeydown),n){if(ib(n))return;if(ab(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(qn.Click,P8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(qn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:s,props:r}=this,{onMove:o,options:{activationConstraint:i}}=r;if(!s)return;const a=cf(t),l=gw(s,a);if(!n&&i){if(ab(i))return ep(l,i.tolerance)?this.handleCancel():void 0;if(ib(i))return i.tolerance!=null&&ep(l,i.tolerance)?this.handleCancel():ep(l,i.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),o(a)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Ke.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const O8={move:{name:"pointermove"},end:{name:"pointerup"}};class rh extends sh{constructor(t){const{event:n}=t,s=Bi(n.target);super(t,O8,s)}}rh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const _8={move:{name:"mousemove"},end:{name:"mouseup"}};var ff;(function(e){e[e.RightClick=2]="RightClick"})(ff||(ff={}));class A8 extends sh{constructor(t){super(t,_8,Bi(t.event.target))}}A8.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===ff.RightClick?!1:(t==null||t({event:e}),!0)}];const tp={move:{name:"touchmove"},end:{name:"touchend"}};class M8 extends sh{constructor(t){super(t,tp)}static setup(){return window.addEventListener(tp.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tp.move.name,t)};function t(){}}}M8.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function L8(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((s,r)=>r({transform:s,...n}),t):t}const N8=[{sensor:rh,options:{}},{sensor:nh,options:{}}],$8={current:{}},jw=g.createContext({...xr,scaleX:1,scaleY:1}),k8=g.memo(function({id:t,autoScroll:n=!0,announcements:s,children:r,sensors:o=N8,collisionDetection:i=i8,measuring:a,modifiers:l,screenReaderInstructions:u=B6,...d}){var p,f,h,m,b;const v=g.useReducer(W6,void 0,U6),[x,y]=v,[w,S]=g.useState(()=>({type:null,event:null})),[j,C]=g.useState(!1),{draggable:{active:E,nodes:O,translate:P},droppable:{containers:T}}=x,A=E?O[E]:null,_=g.useRef({initial:null,translated:null}),N=g.useMemo(()=>{var tt;return E!=null?{id:E,data:(tt=A==null?void 0:A.data)!=null?tt:$8,rect:_}:null},[E,A]),V=g.useRef(null),[M,I]=g.useState(null),[U,F]=g.useState(null),W=g.useRef(d),H=Pl("DndDescribedBy",t),R=g.useMemo(()=>T.getEnabled(),[T]),{layoutRectMap:$,recomputeLayouts:B,willRecomputeLayouts:Z}=d8(R,{dragging:j,dependencies:[P.x,P.y],config:a==null?void 0:a.droppable}),Y=l8(O,E),ee=U?cf(U):null,X=ww(Y,(p=a==null||(f=a.draggable)==null?void 0:f.measure)!=null?p:df),G=Qd(Y),Q=g.useRef(null),ie=Q.current,ae=g.useRef({active:null,activeNode:Y,collisionRect:null,droppableRects:$,draggableNodes:O,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),me=T.getNodeFor((h=ae.current.over)==null?void 0:h.id),ve=Qd(Y?Y.ownerDocument.defaultView:null),ke=Qd(Y?Y.parentElement:null),Re=h8(E?me??Y:null),ot=v8(Re),Ue=C8({disabled:E==null,forceRecompute:Z}),we=(m=Ue.rect)!=null?m:X,ze=we===X?Y6(X,ie):xr,Xe=L8(l,{transform:{x:P.x-ze.x,y:P.y-ze.y,scaleX:1,scaleY:1},activatorEvent:U,active:N,activeNodeRect:G,containerNodeRect:ke,draggingNodeRect:we,over:ae.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:Re,scrollableAncestorRects:ot,windowRect:ve}),vt=ee?Wa(ee,P):null,Le=f8(Re),ft=Wa(Xe,Le),dt=we?eb(we,Xe):null,We=dt?eb(dt,Le):null,Xt=N&&We?i({active:N,collisionRect:We,droppableContainers:R}):null,[he,De]=g.useState(null),Be=Z6(Xe,(b=he==null?void 0:he.rect)!=null?b:null,X),Ie=g.useCallback((tt,{sensor:yt,options:Jt})=>{if(!V.current)return;const Pn=O[V.current];if(!Pn)return;const qt=new yt({active:V.current,activeNode:Pn,event:tt.nativeEvent,options:Jt,context:ae,onStart(mn){const Cr=V.current;if(!Cr)return;const jr=O[Cr];if(!jr)return;const{onDragStart:Er}=W.current,Pr={active:{id:Cr,data:jr.data,rect:_}};kn.unstable_batchedUpdates(()=>{y({type:ht.DragStart,initialCoordinates:mn,active:Cr}),S({type:ht.DragStart,event:Pr})}),Er==null||Er(Pr)},onMove(mn){y({type:ht.DragMove,coordinates:mn})},onEnd:ho(ht.DragEnd),onCancel:ho(ht.DragCancel)});kn.unstable_batchedUpdates(()=>{I(qt),F(tt.nativeEvent)});function ho(mn){return async function(){const{active:jr,over:Er,scrollAdjustedTranslate:Pr}=ae.current;let Tr=null;if(jr&&Pr){const{cancelDrop:rn}=W.current;Tr={active:jr,delta:Pr,over:Er},mn===ht.DragEnd&&typeof rn=="function"&&await Promise.resolve(rn(Tr))&&(mn=ht.DragCancel)}if(V.current=null,kn.unstable_batchedUpdates(()=>{y({type:mn}),De(null),C(!1),I(null),F(null),Tr&&S({type:mn,event:Tr})}),Tr){const{onDragCancel:rn,onDragEnd:ls}=W.current,Ol=mn===ht.DragEnd?ls:rn;Ol==null||Ol(Tr)}}}},[y,O]),_t=g.useCallback((tt,yt)=>(Jt,Pn)=>{const qt=Jt.nativeEvent;V.current!==null||qt.dndKit||qt.defaultPrevented||tt(Jt,yt.options)===!0&&(qt.dndKit={capturedBy:yt.sensor},V.current=Pn,Ie(Jt,yt))},[Ie]),Ft=c8(o,_t);m8(o),Vo(()=>{W.current=d},Object.values(d)),g.useEffect(()=>{E!=null&&C(!0)},[E]),g.useEffect(()=>{N||(Q.current=null),N&&X&&!Q.current&&(Q.current=X)},[X,N]),g.useEffect(()=>{const{onDragMove:tt}=W.current,{active:yt,over:Jt}=ae.current;if(!yt)return;const Pn={active:yt,delta:{x:ft.x,y:ft.y},over:Jt};S({type:ht.DragMove,event:Pn}),tt==null||tt(Pn)},[ft.x,ft.y]),g.useEffect(()=>{const{active:tt,droppableContainers:yt,scrollAdjustedTranslate:Jt}=ae.current;if(!tt||!V.current||!Jt)return;const{onDragOver:Pn}=W.current,qt=yt.get(Xt),ho=qt&&qt.rect.current?{id:qt.id,rect:qt.rect.current,data:qt.data,disabled:qt.disabled}:null,mn={active:tt,delta:{x:Jt.x,y:Jt.y},over:ho};kn.unstable_batchedUpdates(()=>{De(ho),S({type:ht.DragOver,event:mn}),Pn==null||Pn(mn)})},[Xt]),Vo(()=>{ae.current={active:N,activeNode:Y,collisionRect:We,droppableRects:$,draggableNodes:O,draggingNodeRect:we,droppableContainers:T,over:he,scrollableAncestors:Re,scrollAdjustedTranslate:ft,translatedRect:dt},_.current={initial:we,translated:dt}},[N,Y,We,O,we,$,T,he,Re,ft,dt]),a8({...go(),draggingRect:dt,pointerCoordinates:vt,scrollableAncestors:Re,scrollableAncestorRects:ot});const nr=g.useMemo(()=>({active:N,activeNode:Y,activeNodeRect:X,activeNodeClientRect:G,activatorEvent:U,activators:Ft,ariaDescribedById:{draggable:H},containerNodeRect:ke,dispatch:y,dragOverlay:Ue,draggableNodes:O,droppableContainers:T,droppableRects:$,over:he,recomputeLayouts:B,scrollableAncestors:Re,scrollableAncestorRects:ot,willRecomputeLayouts:Z,windowRect:ve}),[N,Y,G,X,U,Ft,ke,Ue,y,O,H,T,$,he,B,Re,ot,Z,ve]);return g.createElement(hw.Provider,{value:w},g.createElement(Gu.Provider,{value:nr},g.createElement(jw.Provider,{value:Be},r)),g.createElement(q6,{announcements:s,hiddenTextDescribedById:H,screenReaderInstructions:u}));function go(){const tt=(M==null?void 0:M.autoScrollEnabled)===!1,yt=typeof n=="object"?n.enabled===!1:n===!1,Jt=!tt&&!yt;return typeof n=="object"?{...n,enabled:Jt}:{enabled:Jt}}}),R8=g.createContext(null),lb="button",I8="Droppable";function V8({id:e,data:t,disabled:n=!1,attributes:s}){const r=Pl(I8),{active:o,activeNodeRect:i,activatorEvent:a,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:p,over:f}=g.useContext(Gu),{role:h=lb,roleDescription:m="draggable",tabIndex:b=0}=s??{},v=(o==null?void 0:o.id)===e,x=g.useContext(v?jw:R8),[y,w]=eh(),S=b8(p,e),j=xw(t);g.useEffect(()=>(u[e]={id:e,key:r,node:y,data:j},()=>{const E=u[e];E&&E.key===r&&delete u[e]}),[u,e]);const C=g.useMemo(()=>({role:h,tabIndex:b,"aria-pressed":v&&h===lb?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[h,b,v,m,l.draggable]);return{active:o,activeNodeRect:i,activatorEvent:a,attributes:C,droppableRects:d,isDragging:v,listeners:n?void 0:S,node:y,over:f,setNodeRef:w,transform:x}}function H8(){return g.useContext(Gu)}const D8="Droppable";function F8({data:e,disabled:t=!1,id:n}){const s=Pl(D8),{active:r,dispatch:o,over:i}=g.useContext(Gu),a=g.useRef(null),[l,u]=eh(),d=xw(e);return Vo(()=>(o({type:ht.RegisterDroppable,element:{id:n,key:s,disabled:t,node:l,rect:a,data:d}}),()=>o({type:ht.UnregisterDroppable,key:s,id:n})),[n]),g.useEffect(()=>{o({type:ht.SetDroppableDisabled,id:n,key:s,disabled:t})},[t]),{active:r,rect:a,isOver:(i==null?void 0:i.id)===n,node:l,over:i,setNodeRef:u}}function Ew(e,t,n){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(s.x=n.left+n.width-t.right),s}const B8=({containerNodeRect:e,draggingNodeRect:t,transform:n})=>!t||!e?n:Ew(n,t,e),z8=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const s=n[0];return!e||!s?t:Ew(t,e,s)},U8=({transform:e})=>({...e,x:0});function Pw(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function W8(e,t){return e.reduce((n,s,r)=>{const o=t.get(s);return o&&(n[r]=o),n},Array(e.length))}function nc(e){return e!==null&&e>=0}const Tw=({layoutRects:e,activeIndex:t,overIndex:n,index:s})=>{const r=Pw(e,n,t),o=e[s],i=r[s];return!i||!o?null:{x:i.offsetLeft-o.offsetLeft,y:i.offsetTop-o.offsetTop,scaleX:i.width/o.width,scaleY:i.height/o.height}},sc={scaleX:1,scaleY:1},G8=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:s,overIndex:r})=>{var o;const i=(o=s[e])!=null?o:t;if(!i)return null;if(n===e){const l=s[r];return l?{x:0,y:e<r?l.offsetTop+l.height-(i.offsetTop+i.height):l.offsetTop-i.offsetTop,...sc}:null}const a=q8(s,n,e);return n>e&&n<=r?{x:0,y:-i.height-a,...sc}:n<e&&n>=r?{x:0,y:i.height+a,...sc}:{x:0,y:0,...sc}};function q8(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return s?n<t?r?s.offsetTop-(r.offsetTop+r.height):o?o.offsetTop-(s.offsetTop+s.height):0:o?o.offsetTop-(s.offsetTop+s.height):r?s.offsetTop-(r.offsetTop+r.height):0:0}const Ow="Sortable",_w=g.createContext({activeIndex:-1,containerId:Ow,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Tw,wasDragging:{current:!1}});function K8({children:e,id:t,items:n,strategy:s=Tw}){const{active:r,dragOverlay:o,droppableRects:i,over:a,recomputeLayouts:l,willRecomputeLayouts:u}=H8(),d=Pl(Ow,t),p=o.rect!==null,f=g.useMemo(()=>n.map(E=>typeof E=="string"?E:E.id),[n]),h=r!=null,m=g.useRef(!1),b=r?f.indexOf(r.id):-1,v=b!==-1,x=a?f.indexOf(a.id):-1,y=g.useRef(f),w=W8(f,i),S=!Z8(f,y.current),j=x!==-1&&b===-1||S;Vo(()=>{S&&v&&!u&&l()},[S,v,l,u]),g.useEffect(()=>{y.current=f},[f]),g.useEffect(()=>{const E=setTimeout(()=>{m.current=h},100);return()=>clearTimeout(E)},[h]);const C=g.useMemo(()=>({activeIndex:b,containerId:d,disableTransforms:j,items:f,overIndex:x,useDragOverlay:p,sortedRects:w,strategy:s,wasDragging:m}),[b,d,j,f,x,w,p,s,m]);return g.createElement(_w.Provider,{value:C},e)}function Z8(e,t){return e.join()===t.join()}const Y8=({id:e,items:t,activeIndex:n,overIndex:s})=>Pw(t,n,s).indexOf(e),X8=({containerId:e,isSorting:t,wasDragging:n,index:s,items:r,newIndex:o,previousItems:i,previousContainerId:a,transition:l})=>!l||!n||i!==r&&s===o?!1:t?!0:o!==s&&e===a,J8={duration:200,easing:"ease"},Aw="transform",Q8=Ga.Transition.toString({property:Aw,duration:0,easing:"linear"}),e9={roleDescription:"sortable"};function t9({disabled:e,index:t,node:n,rect:s}){const[r,o]=g.useState(null),i=g.useRef(t);return Vo(()=>{if(!e&&t!==i.current&&n.current){const a=s.current;if(a){const l=Ku(n.current),u={x:a.offsetLeft-l.offsetLeft,y:a.offsetTop-l.offsetTop,scaleX:a.width/l.width,scaleY:a.height/l.height};(u.x||u.y)&&o(u)}}t!==i.current&&(i.current=t)},[e,t,n,s]),g.useEffect(()=>{r&&requestAnimationFrame(()=>{o(null)})},[r]),r}function n9({animateLayoutChanges:e=X8,attributes:t,disabled:n,data:s,getNewIndex:r=Y8,id:o,strategy:i,transition:a=J8}){const{items:l,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:f,overIndex:h,useDragOverlay:m,strategy:b,wasDragging:v}=g.useContext(_w),x=l.indexOf(o),y=g.useMemo(()=>({sortable:{containerId:u,index:x,items:l},...s}),[u,s,x,l]),{rect:w,node:S,setNodeRef:j}=F8({id:o,data:y}),{active:C,activeNodeRect:E,activatorEvent:O,attributes:P,setNodeRef:T,listeners:A,isDragging:_,over:N,transform:V}=V8({id:o,data:y,attributes:{...e9,...t},disabled:n}),M=L6(j,T),I=!!C,U=I&&v.current&&!p&&nc(d)&&nc(h),F=!m&&_,W=F&&U?V:null,R=U?W??(i??b)({layoutRects:f,activeNodeRect:E,activeIndex:d,overIndex:h,index:x}):null,$=nc(d)&&nc(h)?r({id:o,items:l,activeIndex:d,overIndex:h}):x,B=g.useRef(l),Z=l!==B.current,Y=g.useRef($),ee=g.useRef(u),X=e({active:C,containerId:u,isDragging:_,isSorting:I,id:o,index:x,items:l,newIndex:Y.current,previousItems:B.current,previousContainerId:ee.current,transition:a,wasDragging:v.current}),G=t9({disabled:!X,index:x,node:S,rect:w});return g.useEffect(()=>{I&&Y.current!==$&&(Y.current=$),u!==ee.current&&(ee.current=u),l!==B.current&&(B.current=l)},[I,$,u,l]),{active:C,attributes:P,activatorEvent:O,rect:w,index:x,isSorting:I,isDragging:_,listeners:A,node:S,overIndex:h,over:N,setNodeRef:M,setDroppableNodeRef:j,setDraggableNodeRef:T,transform:G??R,transition:Q()};function Q(){if(G||Z&&Y.current===x)return Q8;if(!(F||!a)&&(I||X))return Ga.Transition.toString({...a,property:Aw})}}const s9=[Ke.Down,Ke.Right,Ke.Up,Ke.Left],r9=(e,{context:{active:t,droppableContainers:n,translatedRect:s,scrollableAncestors:r}})=>{if(s9.includes(e.code)){if(e.preventDefault(),!t||!s)return;const i=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=df(u),p={...l,rect:{current:d}};switch(e.code){case Ke.Down:s.top+s.height<=d.top&&i.push(p);break;case Ke.Up:s.top>=d.top+d.height&&i.push(p);break;case Ke.Left:s.left>=d.left+d.width&&i.push(p);break;case Ke.Right:s.left+s.width<=d.left&&i.push(p);break}});const a=r8({active:t,collisionRect:s,droppableContainers:i});if(a){var o;const l=(o=n.get(a))==null?void 0:o.node.current;if(l){const d=th(l).some((m,b)=>r[b]!==m),p=df(l),f=d?{x:0,y:0}:{x:s.width-p.width,y:s.height-p.height};return{x:p.left-f.x,y:p.top-f.y}}}}};function o9(e){const{id:t,item:n,className:s,select:r,remove:o,renderItem:i,previewStyle:a,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:f,setNodeRef:h,transform:m,transition:b,isDragging:v}=n9({id:t,disabled:u}),x={transform:Ga.Transform.toString(m),transition:b,zIndex:v?1:void 0},y=()=>!u&&(r==null?void 0:r(n));return c.jsx("div",{...l?{ref:h,style:x,...p}:{},children:c.jsxs(k,{space:"s",onClick:y,className:J(s,v&&z.bgH2),items:"center",nowrap:!0,children:[l&&c.jsx(D,{className:J(!u&&Ae.hover,!u&&"cursor-grab",v&&"gs-utl-opacity-100"),...f,children:c.jsx(ne,{icon:K.dotsVertical,size:oe.sx})}),c.jsxs(k,{nowrap:!0,items:"center",gap:"s",className:"gs-utl-flex-1",children:[c.jsx(D,{grow:!0,className:J("overflow-ellipsis overflow-hidden"),children:i(n)}),!!a&&c.jsx(D,{children:c.jsx("div",{className:J("w-4 h-4 gjs-bg-white",se.b,se.rnd),style:a(n)})})]}),o&&d?c.jsx(Hu,{disabled:u,onConfirm:()=>{o==null||o(n)},children:c.jsx(D,{className:J(!u&&Ae.click),children:c.jsx(ne,{icon:K.close,size:oe.sx})})}):c.jsx(D,{className:J(!u&&Ae.click),onClick:w=>{_o(w),!u&&(o==null||o(n))},children:c.jsx(ne,{icon:K.close,size:oe.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}const i9=e=>{var t,n;return`${(e==null?void 0:e.id)||(e==null?void 0:e.cid)||((t=e==null?void 0:e.getId)==null?void 0:t.call(e))||(e==null?void 0:e.name)||(e==null?void 0:e.title)||(e==null?void 0:e.label)||((n=e==null?void 0:e.getIndex)==null?void 0:n.call(e))||""}`};function Is(e){const{className:t,items:n,selected:s,renderItem:r,select:o,add:i,remove:a,move:l,previewStyle:u,getItemId:d=i9,label:p,labelAs:f,children:h,title:m="Select",titleAdd:b="Add",emptyState:v,disabled:x=!1,hidePopover:y,popoverPlacement:w="left",confirmRemove:S}=e,j=j8(rb(rh),rb(nh,{coordinateGetter:r9}));function C(T){const{active:A,over:_}=T;if(A.id!==(_==null?void 0:_.id)){const N=n.find(M=>d(M)===A.id),V=n.findIndex(M=>d(M)===(_==null?void 0:_.id));N&&(l==null||l(N,V))}}const E=J(se.rnd,z.br,n.length&&se.b,n.length&&"gjs-mt-1");let O=c.jsxs("div",{className:E,children:[n.length===0&&v&&c.jsx(k,{className:L("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:v}),n.map((T,A)=>{const _=d(T),N=T===s,V=J("gjs-px-2 gjs-py-2 text-xs",z.br,A&&se.bt,!!o&&!N&&!x&&z.hBgH2,N&&z.bgH,x&&"opacity-75");return c.jsx(o9,{id:_,item:T,className:V,select:o,remove:a,renderItem:r,previewStyle:u,sortable:!!l,disabled:x,confirmRemove:S},_||A)})]});l&&(O=c.jsx(k8,{sensors:j,collisionDetection:K6,onDragEnd:C,modifiers:[U8,B8,z8],children:c.jsx(K8,{items:n.map(d),strategy:G8,children:O})})),o&&!y&&(O=c.jsx(Os,{placement:w,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!s&&!x,onClose:()=>o==null?void 0:o(null),handler:O,children:h}));const P=i?[{type:"button",icon:K.plus,tooltip:b,variant:"outline",size:"xs",disabled:x,onClick:i}]:[];return c.jsxs("div",{className:J(t,"w-full"),children:[!!(p||i)&&c.jsx(Ts,{...e,as:f,afterLabelButtons:P}),O]})}const a9=ue(function(){const t=$e(),{editor:n}=Se(),s=gl(),r=hl(),o=r.sortedFonts;return n?c.jsx(Is,{items:o,selected:null,renderItem:i=>{const a=yg(i);return c.jsxs(k,{col:!0,children:[c.jsx(D,{className:"gs-utl-text-lg",style:{fontFamily:a},children:i.familyLabel}),c.jsx(D,{children:i.familyLabel})]})},remove:i=>r.removeFont(i.family),add:r.sdkAddFonts&&s.hasType("font")?()=>Xg(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:i=>i.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),Mw=Yt(function({size:t="m",className:n,classNameContent:s,border:r=!0,children:o,...i},a){const l=le(z.bg,z.br,r&&`${se.b} ${se.rnd}`,t==="m"&&Pe.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(k,{className:l,items:"center",space:"x2s",...i,ref:a,children:c.jsx(D,{grow:!0,className:s,children:o})})}),Lw=Yt(({autoResize:e,style:t={},...n},s)=>{const r=g.useRef(null),o=s||r;return g.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[n.value,e,o]),c.jsx("textarea",{ref:o,style:{...t,...e?{resize:"none"}:{}},...n})});Lw.displayName="TextAreaWithAutoResize";const l9="gs-field-textarea";function cb(e){const{className:t,value:n,label:s,size:r,description:o,placeholder:i,readOnly:a,disabled:l,name:u,required:d,minLength:p,maxLength:f,onChange:h,onKeyDown:m,afterInput:b,minHeight:v,maxHeight:x,autoResize:y,classNameField:w,classNameFieldContent:S,classNameInput:j}=e,C=bl(e);return c.jsxs("div",{className:J(l9,t),children:[!!s&&c.jsx(Yr,{size:r,children:s}),!!o&&c.jsx(Yr,{size:r,as:"span",className:J(z.txtLowEmphasis),capitalize:!1,children:o}),c.jsxs(Mw,{size:r,className:w,classNameContent:S,children:[c.jsx(Lw,{className:J(C,j),autoResize:y,value:n,name:u,placeholder:i,readOnly:a,disabled:l,required:d,minLength:p,maxLength:f,onChange:E=>h==null?void 0:h(E.target.value),onKeyDown:m,style:{minHeight:v,maxHeight:x}}),b]})]})}const Zu="gs-page-settings",c9=`${Zu}-header`,u9=`${Zu}-content`,d9=`${Zu}-footer`,ub="",p9=ue(function({className:t,classNameHeader:n,classNameContent:s,classNameFooter:r,page:o,size:i=jg.m}){const a=Se(),{isDarkTheme:l}=Ps(),u=hl(),d=$e(),[p,f]=g.useState(o),[h,m]=g.useState(()=>vm(p,a)),[b,v]=g.useState(()=>d.t("update")),x=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:w}=a,S={containerClassName:"gs-utl-min-h-80",size:i,padding:5,isDarkTheme:l,clean:!0};if(!w)return null;const j=N=>m(V=>({...V,...N})),C=N=>{N.preventDefault();const{name:V,...M}=h;M.customCodeHead=OS(M.customCodeHead),M.customCodeBody=TS(M.customCodeBody),p?(N3(p,M),p.setName(V)):a.setProjectDataCustom({globalPageSettings:M}),v(d.t("updated")),setTimeout(()=>v(d.t("update")),2e3),ey(w),w.trigger(Dn.pageSettingsUpdate,{page:p,data:{name:V,...M}})},E={tooltip:d.t("clear")},O=(p==null?void 0:p.getId())??ub,P=N=>{const V=w.Pages.get(N);f(V),m(vm(V,a))},T=xg(p),A=!!p&&ju(p),_=[{id:ub,label:x("global")},...w.Pages.getAll().map(N=>({icon:J0(N),id:N.getId(),label:N.getName()}))];return c.jsx("form",{onSubmit:C,className:L(Zu,"gs-utl-h-full",t),children:c.jsxs(k,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(D,{className:L(c9,n,z.br,se.bb),children:c.jsx(_e,{value:O,onChange:P,options:_,handlerSelected:N=>c.jsxs(k,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),N.icon&&pt(N.icon)&&c.jsx(ne,{icon:N.icon,size:oe.s2x}),c.jsx("span",{children:N.label})]})})}),c.jsxs(k,{col:!0,className:L(u9,"gs-utl-gap-5 gs-utl-overflow-y-auto",s),nowrap:!0,children:[!!O&&c.jsxs(c.Fragment,{children:[c.jsx(at,{size:i,value:h.name,onChange:N=>j({name:N}),label:y("name.label"),description:y("name.description"),required:!0}),!T&&c.jsx(at,{size:i,value:h.slug,onChange:N=>j({slug:A?HS(N,["id"]):Jc(N)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(at,{size:i,value:h.title,onChange:N=>j({title:N}),label:y("title.label"),description:y("title.description")}),c.jsx(cb,{size:i,value:h.description,onChange:N=>j({description:N}),label:y("description.label"),description:y("description.description")}),c.jsx(Ua,{size:i,clear:E,value:h.favicon,onChange:N=>j({favicon:N}),onOpen:()=>{w.Assets.open({select(N){j({favicon:N.getSrc()}),w.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(at,{size:i,value:h.keywords,onChange:N=>j({keywords:N}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(at,{size:i,value:h.socialTitle,onChange:N=>j({socialTitle:N}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(Ua,{size:i,clear:E,value:h.socialImage,onChange:N=>j({socialImage:N}),onOpen:()=>{w.Assets.open({select(N){j({socialImage:N.getSrc()}),w.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(cb,{size:i,value:h.socialDescription,onChange:N=>j({socialDescription:N}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(Cs,{language:"html",defaultValue:h.customCodeHead,onChange:N=>j({customCodeHead:N}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...S},`head-${O}`),c.jsx(Cs,{language:"html",defaultValue:h.customCodeBody,onChange:N=>j({customCodeBody:N}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...S},`body-${O}`),u.sdkShowProjectFonts&&!O&&c.jsx(a9,{})]}),c.jsx(k,{className:L(d9,"gs-utl-mt-auto",r,z.br,se.bt),children:c.jsx(Qe,{type:"submit",variant:"pr",size:"m2",full:!0,children:b})})]})})}),f9="gs-panel-page-settings",g9=g.memo(ue(function({className:t,page:n,...s}){return c.jsx(_s,{className:L(f9,"gs-utl-overflow-hidden",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(yl,{children:c.jsx(p9,{className:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:jg.s,classNameHeader:Pe.s,classNameContent:Pe.s,classNameFooter:Pe.s})})})})),rc="gs-page-item",db=ue(function({page:t,rename:n,setRename:s,commandItems:r}){const o=Se(),i=$e(),a=o.editor,{Pages:l}=a,u=o.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,f=u==null?void 0:u.layoutBefore,h=C=>i.t(`pageManager.${C}`),m=C=>l.select(C),b=C=>l.getSelected()===C,v=C=>C===n,x=b(t),y=C=>C.getName()||C.getId(),w=C=>{n==null||n.set({name:C}),s(void 0)},S=le("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),j=()=>a.runCommand(te.setPageSettings,{page:t,isOpen:!0});return c.jsxs(k,{gap:"s",items:"center",onClick:()=>m(t),className:le([rc,"group cursor-default",Pe.xy,x?z.bgH:z.hBgH2]),children:[p&&xg(t)&&c.jsx(D,{className:`${rc}__icon-home`,title:h("homePage"),children:c.jsx(ne,{icon:K.home,size:oe.s3x})}),f&&Nt(f({page:t,editor:a,isSelected:x})),c.jsx(D,{className:le(`${rc}__name truncate`),grow:!0,children:v(t)?c.jsx(Yg,{value:y(t),onChange:w}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(k,{className:`${rc}__actions`,gap:"xs",onClick:_o,items:"center",children:[!n&&d!==!1&&c.jsx(St,{className:S,size:"xs",border:!1,title:h("settings.label"),onClick:j,block:!0,children:c.jsx(ne,{icon:K.cog,size:oe.s3x})}),x&&!!r.length&&c.jsx(Os,{placement:"right-start",handler:c.jsx(ne,{icon:K.dotsVertical,size:oe.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:C})=>r.map(E=>c.jsx(Ii,{icon:E.icon,label:rt(E.label)?E.label({editor:a}):E.label,action:()=>{var O;C(),(O=E.cmd)==null||O.call(E,{page:t,editor:a})}},E.id))})]})]},t.getId())});function h9({dragging:e,dragRect:t}){const n=!!(e&&t),s=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:s}}var Nw=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Nw||{});const np="gs-cmp-sortable",pb=3;function m9({items:e,direction:t,onDrop:n,renderItem:s}){const[r,o]=g.useState(null),[i,a]=g.useState(-1),[l,u]=g.useState(),[d,p]=g.useState(!1),f=g.useRef(null),{showIndicator:h,indicatorStyle:m}=h9({dragging:!!r&&d,dragRect:l}),b=g.useMemo(()=>[],[e]);g.useEffect(()=>{const E=window.document,O=P=>P.key==="Escape"&&y(P);return E.addEventListener("keydown",O),()=>E.removeEventListener("keydown",O)},[]);const v=E=>O=>{O.button===0&&(f.current={x:O.clientX,y:O.clientY},o(E),p(!1),O.target.setPointerCapture(O.pointerId))},x=E=>{const O=f.current;if(!r||!O)return;if(!d){const N=Math.abs(E.clientX-O.x),V=Math.abs(E.clientY-O.y);(t==="vertical"?V>pb:N>pb)&&p(!0);return}const P=E.clientY;let T=-1;b.forEach((N,V)=>{const M=N.getBoundingClientRect();P>M.top+M.height/2&&(T=V)});const A=e.findIndex(N=>N.id===r.id);T<A&&(T+=1),T=Math.min(T,e.length-1),a(T);const _=b[T];if(_){const{height:N,top:V}=_.getBoundingClientRect(),M=P<V+N/2;u({y:_.offsetTop+(M?0:N),h:N})}},y=E=>{o(null),p(!1),f.current=null,u(void 0);const O=E.target,{pointerId:P}=E;P&&(O==null||O.releasePointerCapture(P))},w=E=>{!r||!f.current||(l&&i!==-1&&(n==null||n(r,i)),y(E))},S=L(np,"gs-utl-relative"),j=L(`${np}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),C=E=>L(`${np}__item`,h&&(r==null?void 0:r.id)===E.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(k,{col:t==="vertical",className:S,children:e.map((E,O)=>c.jsx(D,{ref:P=>{P&&(b[O]=P)},className:C(E),onPointerDown:v(E),onPointerMove:x,onPointerUp:w,children:s(E)},E.id))}),h&&c.jsx("div",{className:j,style:m})]})}const b9=({pages:e,commandItems:t,rename:n,setRename:s,editor:r})=>{if(!r.Pages.move)return e.map(l=>c.jsx(db,{page:l,commandItems:t,rename:n,setRename:s},l.getId()));const o=(l,u)=>{r.Pages.move(l.entity,{at:u})},i=l=>c.jsx(db,{page:l.entity,commandItems:t,rename:n,setRename:s},l.id),a=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(m9,{items:a,direction:Nw.vertical,onDrop:o,renderItem:i})},v9=({items:e,editor:t,sdkPageConfig:n})=>{const s=n==null?void 0:n.commandItems;return s===!1?[]:rt(s)?s({items:e,editor:t}):s||e},sp="gs-panel-page-manager",$w=ue(function({pages:t,select:n,add:s,remove:r,header:o,resizable:i={bottom:!0},height:a=200}){const l=Se(),u=$i(),d=$e(),{sdkPagesConfig:p}=l,f=l.editor,[h,m]=g.useState(),b=_=>d.t(`pageManager.${_}`),v=p==null?void 0:p.add,x=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,w=_=>{_o(_);const N=M=>{const I=t.length+1;return s({name:`${b("page")} ${I}`,component:`<div>${b("newPage")} ${I}</div>`,...M},{select:!0})};if(v)return v({event:_,editor:f,rename:m,addPage:N});const V=N();V&&m(V)},S=({page:_})=>{if(y)return y({editor:f,page:_});u.confirm({title:b("deletePage"),content:b("confirmDelete"),confirmButton:{variant:"danger",children:b("deletePage")},onConfirm:()=>{const N=t.indexOf(_),V=t[N+1]||t[0];n(V),r(_)}})},j=({page:_})=>{if(x)return x({editor:f,page:_,rename:m});const N=_.getMainComponent(),V=s({name:`${_.getName()} (${b("copy")})`,component:N.clone()},{select:!0});V&&m(V)},C=[{id:"rename",label:b("rename"),icon:K.pencil,cmd:({page:_})=>m(_)},x!==!1&&{id:"duplicate",label:b("duplicate"),icon:K.contentCopy,cmd:j},t.length>1&&y!==!1&&{id:"remove",label:b("delete"),icon:K.delete,cmd:S}].filter(Boolean),E=v9({items:C,editor:f,sdkPageConfig:p}),O=Yx(o,{collapsible:!0,label:b("pages"),icon:K.textBoxMultiple}),P=i?i===!0?{top:!0,right:!0,bottom:!0,left:!0}:i:void 0,T=c.jsx(b9,{pages:t,commandItems:E,rename:h,setRename:m,editor:f}),A=P?c.jsx(zu,{className:J([`${sp}__content`,"text-sm overflow-auto",se.bt,z.br]),height:a,...P,children:T}):T;return c.jsx(yr,{classNameWrap:sp,className:J(`${sp}__header`,Pe.xy,o===!1&&"gs-utl-hidden"),disabled:O&&O.collapsible===!1,handler:c.jsxs(k,{space:"s",items:"center",children:[!!O.icon&&c.jsx(D,{children:c.jsx(ne,{icon:O.icon,size:oe.s})}),c.jsx(D,{grow:!0,children:O.label}),v!==!1&&c.jsx(Ut,{title:b("add"),children:c.jsx(k,{onClick:w,className:J("cursor-pointer"),children:c.jsx(ne,{icon:K.plus,size:oe.s})})})]}),open:O?O.collapsed!==!0:!0,children:A})}),kw=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-page-manager-after"),n),ref:r,...s,children:t})}),Rw=Yt(function({children:t,className:n,...s},r){return c.jsx("div",{className:L(le("gs-page-manager-before"),n),ref:r,...s,children:t})}),y9="gs-panel-pages",Iw=g.memo(ue(function({className:t,header:n,height:s,resizable:r,...o}){const i=Se().sdkProps.children;return c.jsx(jn,{className:L(y9,t),...o,children:c.jsx(By,{children:a=>c.jsxs(c.Fragment,{children:[Jn(i,Rw),c.jsx($w,{header:n,height:s,resizable:r,...a}),Jn(i,kw)]})})})})),x9="gs-panel-pages-layers",w9=g.memo(ue(function({className:t,panelPagesProps:n,panelLayersProps:s,...r}){const{showPages:o}=Se(),i=$e(),{className:a,...l}=n||{},u=Yx(s==null?void 0:s.header,{icon:K.layers,collapsible:!1,label:i.t("layerManager.layers"),className:L(se.bb,z.br)});return c.jsxs(_s,{className:L(x9,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...r,children:[o&&c.jsx(Iw,{className:L(a,se.bb,z.br),...l}),c.jsx(dw,{...s,header:u})]})})),S9="gs-trait-custom",C9=ue(function(t){const{trait:n,editor:s,value:r,disabled:o,labelAs:i,className:a}=t,[,l]=g.useState(0),u=g.useRef(null),d=n.get("component"),p=n.get("render"),f=n.target,h=u.current;if(g.useEffect(()=>{if(f){let v=()=>{},x=()=>{};const y=()=>{x(),l(w=>++w)};if(f.on("change",y),!d&&p&&h){const w=C=>h.appendChild(C),S=C=>h.removeChild(C),j=p({editor:s,component:f,trait:n,addEl:w,removeEl:S,onUpdate:C=>{x=C}});j instanceof HTMLElement?(w(j),v=()=>S(j)):rt(j)&&(v=()=>j())}return()=>{f.off("change",y),v()}}},[f,h,r]),!f)return null;const m=io({...t,className:L(S9,a)}),b={trait:n,component:f,editor:s,value:r,disabled:o};return c.jsxs("div",{...m,children:[c.jsx(Ts,{...t,as:i}),c.jsx("div",{className:L(o&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...b}):p?c.jsx("div",{ref:u}):null})]})});function Vw({className:e,options:t,value:n,name:s,label:r,border:o,hideCaret:i,size:a="s",autoFocus:l,open:u,allowNew:d,onChange:p,onBlur:f,placeholder:h}){const[m,b]=g.useState(null),[v,x]=g.useState(null),{styles:y,attributes:w}=dl(m,v,Pg),[S,j]=g.useState(""),C=bl(),E=S===""?t:t.filter(V=>V.label.toLowerCase().includes(S.toLowerCase())),O=V=>j(V.target.value),P=V=>V==null?void 0:V.label,T=d&&S.length>0&&!E.some(V=>V.label===S),A=rt(d)?d(S):d,_={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},N=()=>f==null?void 0:f();return c.jsxs("div",{className:J("w-full",e),children:[!!r&&c.jsx(Yr,{size:a,children:r}),c.jsxs(Qo,{value:n,onChange:p,name:s,nullable:!0,children:[c.jsx(Mw,{size:a,ref:b,border:o,children:c.jsxs(k,{nowrap:!0,children:[c.jsx(Qo.Input,{autoFocus:l,className:C,displayValue:P,onChange:O,onBlur:N,placeholder:h}),!i&&c.jsx(Qo.Button,{children:c.jsx(ne,{icon:K.chevronDown,size:oe.sx})})]})}),c.jsx(Qo.Options,{static:u,className:Ry,ref:x,style:y.popper,...w.popper,children:c.jsxs(os,{className:J("h-full"),padding:!1,style:_,children:[T&&c.jsx(Qo.Option,{value:{id:null,label:S},children:({active:V})=>c.jsx(zm,{option:{id:null,label:A},active:V,selected:n})}),!T&&E.length===0&&c.jsx("div",{className:J(Pe.xy),children:"No items found"}),E.map(V=>c.jsx(Qo.Option,{value:V,children:({active:M})=>c.jsx(zm,{option:V,active:M,selected:n})},V.id))]})})]})]})}const j9=(e,t)=>{const n=`${Su}${t}`,s=e.get(n,{skipResolve:!0});return s?Hw(s):e.get(n)||""};function Hw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const E9=({page:e,component:t})=>{const{DataSources:n,I18n:s}=e.em,r=["prevItem","currentItem","nextItem"],o=Cu(e)||"",i=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return r.map(p=>{if(d!=null&&d[p]){const{collectionId:f}=d,h=s.t(`dataSources.collections.${f}`)||f,m=s.t(`dataSources.variableTypes.${p}`)||p,b={collectionId:f,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:Hw(b),label:`${h} > ${m}`,dataVariable:b}}}).filter(Boolean)}).flat().filter(Boolean),a=n.get(o),l=a==null?void 0:a.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...i,...l]},Dw="#",Cc="mailto:",rp="subject=",gf="tel:",Fw="hrefType",fb="showIdList",gb=(e,t)=>{const n=t==null?void 0:t.get(Fw);return n||(e.startsWith(gf)?"phone":e.startsWith(Cc)?"email":e.startsWith(La)?"pages":e.startsWith(Dw)?"elements":"url")},hb=e=>`${e.getName()} - #${e.getId()}`,P9="gs-trait-href",T9=ue(function(t){const{trait:n,value:s,disabled:r,labelAs:o,className:i}=t,a=n.component,l=Se(),{isSelectingTarget:u,editor:d}=l,[,p]=g.useState(0),[f,h]=g.useState(""),[m,b]=g.useState(""),[v,x]=g.useState(""),[y,w]=g.useState([]),S=$e(),j=d==null?void 0:d.Pages.getAll(),C=S.tScoped("traitManager.traits.labels"),E=()=>p(ee=>++ee),O=a.get(fb)??!1,P=gb(s,a),T=P==="pages"?s==null?void 0:s.replace(La,""):"",A=!!T&&(d==null?void 0:d.Pages.get(T)),_=A?ju(A):!1,N=g.useMemo(()=>!_||!A||!d?[]:E9({page:A,component:a}),[d,A,_,a]),V=ee=>{n.setValue(ee)},M=ee=>{a.set({[fb]:ee}),E()},I=ee=>{h(""),b(""),x(""),V(""),a.set({[Fw]:ee}),E()},U=ee=>{V(ee),E()},F=(ee,X)=>{R3(a,"id",(X==null?void 0:X.dataVariable)||ee),E()},W=ee=>{ee&&(V(ee.id),E())},H=ee=>{V(`${gf}${ee}`),x(ee)},R=ee=>{V(`${Cc}${ee}${m?`?${rp}${m}`:""}`),h(ee)},$=ee=>{V(`${Cc}${f}${ee?`?${rp}${ee}`:""}`),b(ee)},B=()=>{l.setSelectingTarget(!u)},Z=ee=>{const X=ee.replace(Dw,""),G=d==null?void 0:d.Components.componentsById[X];return{id:ee,label:G?hb(G):ee}};g.useEffect(()=>{var X;const ee=[];if(O){const G=["path","br","b","u","i","strike"],Q=(X=d==null?void 0:d.Pages.getSelected())==null?void 0:X.getMainComponent();Q==null||Q.forEachChild(ie=>{!ie.is("comment")&&!ie.is("textnode")&&!G.includes(ie.get("tagName"))&&ee.push({id:`#${ie.getId()}`,label:hb(ie)})})}w(ee)},[d,O]),g.useEffect(()=>{let ee=()=>{};const X=()=>{ee(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(Xc))};return u&&(ee=CS(X),d==null||d.runCommand(Xc,{onSelect:G=>V(`#${G.getId()}`)})),X},[d,u]),g.useEffect(()=>{if(!s)return;switch(gb(s,a)){case"phone":x(s.replace(gf,""));break;case"email":{const[X,G=""]=s.replace(Cc,"").split("?");h(X),b(G.replace(rp,""));break}}},[s]);const Y=io({className:L(P9,i)});return c.jsxs("div",{...Y,children:[c.jsx(Ts,{...t,as:o}),c.jsx("div",{className:L(r&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(lo,{onChange:I,classNamePanel:"gs-utl-p-1",value:P,tabs:[{id:"url",label:c.jsx(ne,{icon:K.link,size:oe.s}),content:c.jsx(at,{placeholder:"eg. https://google.com",value:s,label:"URL",onChange:V,size:"s",type:"url"})},{id:"pages",label:c.jsx(ne,{icon:K.textBoxMultiple,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(_e,{size:"s",options:(j||[]).map(ee=>({id:`${La}${ee.getId()}`,icon:J0(ee),label:ee.getName()})),value:s,onChange:U,label:"Page"}),_&&c.jsx(_e,{size:"s",options:N,value:j9(a,"id"),onChange:F,label:S.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(ne,{icon:K.viewDayOutline,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(Yr,{size:"s",children:"Element ID"}),c.jsxs(k,{gap:"xs",nowrap:!0,children:[O?c.jsx(Vw,{options:y,onChange:W,value:Z(s),placeholder:S.t("selectList")}):c.jsx(at,{size:"s",placeholder:"eg. #my-element-in-page",value:s,onChange:V,className:"gs-utl-flex-1"}),c.jsx(St,{title:S.t("selectTarget"),size:"m2",active:u,onClick:B,className:"gs-utl-h-[30px]",children:c.jsx(ne,{icon:K.target,size:oe.sx})})]}),c.jsx(Fa,{value:O,onChange:M,label:C("showList")})]})},{id:"email",label:c.jsx(ne,{icon:K.email,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(at,{placeholder:"eg. mail@gmail.com",value:f,onChange:R,size:"s",label:"Email",type:"email"}),c.jsx(at,{placeholder:"eg. My subject",value:m,onChange:$,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(ne,{icon:K.phone,size:oe.s}),content:c.jsx(at,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:v,onChange:H})}]})})]})});function O9({trait:e,value:t,disabled:n,label:s,labelAs:r}){const[o,i]=g.useState(),a=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(f=>f.id===(o==null?void 0:o.id));return c.jsx(Is,{items:d,selected:p>-1?o:null,select:i,disabled:n,label:s,labelAs:r,add:()=>{const f=d.length+1,h=l?l(f):{id:`opt${f}`,label:`New option ${f}`};e.setValue([...d,h])},move:(f,h)=>{const m=e.getValue().filter(b=>b.id!==f.id);m.splice(h,0,f),e.setValue(m)},remove:f=>{const h=e.getValue().filter(m=>m.id!==f.id);e.setValue(h,{removed:f})},renderItem:f=>u?u(f):f.label,children:c.jsx(k,{space:"m",col:!0,children:!!o&&a.map(f=>{const{name:h,getValue:m}=f,b=f.setValue,v=f.label||h,x=d[p];if(!x)return null;const y=x[h],w=m?m(y):y,S=C=>{const E={...x};x[h]=b?b(C,w):C,e.setValue([...d],{item:x,previous:E}),h==="id"&&i(x)};let j=c.jsx(at,{label:v,value:w,onChange:S});switch(f.type){case"select":j=c.jsx(_e,{label:v,options:f.options,value:w,onChange:S})}return c.jsx(g.Fragment,{children:j},h)})})})}const _9="gs-trait-custom-type",A9=ue(function({trait:t,editor:n}){const s=g.useRef(null),r=t.getType(),o=t.target,{Traits:i}=n,a=i.getType(r),l=!!(o&&a);return g.useEffect(()=>{const u=s.current;if(a&&u&&o){const d=new a({model:t,config:i.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(o,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[o,a,t]),l&&c.jsx("div",{className:_9,ref:s})}),M9=e=>{const{value:t={},onConfirm:n,additionalSources:s,editor:r}=e;if(!r)return;const o="DataValuePicker",i={id:o,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:a})=>{n==null||n(a),r.runCommand(te.layoutRemove,{id:o})},additionalSources:s},placer:{type:"dialog",size:"l"}};r.runCommand(te.layoutToggle,{...i})};function Bw(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:s,editor:r,additionalSources:o,enableDataValue:i,hasDataResolverValue:a}=e;if(!r||!i)return[];const l={type:"button",className:a?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:r.I18n.t("dataSources.connectDataValue"),icon:{icon:K.databaseOutline,size:oe.s2x},onClick:()=>M9({value:t,onConfirm:n,additionalSources:o,editor:r})}];return a&&u.push({...l,title:r.I18n.t("dataSources.clearDataValue"),icon:{icon:K.close,size:oe.s2x},onClick:s}),u}function L9(e,t){const n=e.em.getEditor(),s=e.target;let r=!1;t===!0?r=!0:wr(t)&&rt(t.enable)&&(r=t.enable({trait:e,component:s,editor:n}));const o=e.getValue({skipResolve:!0}),i=s.collectionsStateMap,a=Jr(o);return{hasDataResolverValue:a,dataResolverValue:a?e.getValue():void 0,enableDataValue:r,initialDataValue:o,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:i}}const N9=({label:e,buttons:t})=>c.jsxs(k,{items:"center",nowrap:!0,full:!0,children:[c.jsx(D,{grow:!0,children:e}),c.jsx(k,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,s)=>c.jsx(St,{...n},s))})]}),zw=e=>Ds((e||"").replace(/-/g," ")),$9=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&zw(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,s)=>e.setValue(n,{partial:s})}),As=(e,t,n)=>{const s=L9(e,n.traitManagerDataConfig),r=Bw(s),{hasDataResolverValue:o,dataResolverValue:i}=s,a=$9(e,t);return{...a,value:i??a.value,disabled:o,labelAs:r.length?"span":void 0,label:c.jsx(N9,{label:a.label,buttons:r})}},mb=(e,t,n)=>As(e,t,n),k9=(e,t,n)=>As(e,t,n),R9=(e,t,n)=>{const s=Jr(e.getValue({skipResolve:!0})),r=As(e,t,n),o={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!s,units:s?[]:e.get("units"),onChange:(i,a)=>{const l=a||isNaN(parseFloat(i))?i:parseFloat(i);e.setValue(l,{partial:a})}};return{...r,...o}},Uw=(e,t,n)=>{const s=e.get("labelToTitle"),r=Jr(e.getValue({skipResolve:!0})),o=As(e,t,n),i={options:e.getOptions().map(a=>{const l=a.labelReact||a.name||a.label||a.value;return pt(a)?{id:a,label:a}:{id:a.id||a.value,title:s?l:a.title,icon:a.icon,label:s?"":l}}),onChange:a=>e.setValue(a),emptyState:r&&e.getValue()||void 0,hideCaret:r};return{...o,...i}},I9=(e,t,n)=>{const{options:s,onChange:r}=Uw(e,t,n),o={options:s,onChange:r};return{...As(e,t,n),...o}},V9=(e,t,n)=>{const s=e.get("typeProps")||{},r=Jr(e.getValue({skipResolve:!0}));return{...As(e,t,n),isContain:!0,hideButton:r,btnLabel:e.get("text"),onOpen(){if(r)return;const i=t==null?void 0:t.Assets;i==null||i.open({select(a){e.setValue(a.getSrc()),i.close()}})},...s}},H9=e=>({children:zw(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");pt(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),D9=(e,t,n)=>{const s=As(e,t,n),o={value:!!(s.disabled?s.value:e.getValue({useType:!0})),onChange:i=>e.setValue(i)};return{...s,...o}},F9=(e,t,n)=>{const s=As(e,t,n),r=e.get("typeProps")||{},o=Jr(e.getValue({skipResolve:!0}));return{language:"css",...r,...s,formatOnMount:!o,onChange:i=>e.setValue(i)}},B9=(e,t,n)=>({...As(e,t,n),trait:e}),z9=(e,t,n)=>({...As(e,t,n),trait:e}),U9=(e,t,n)=>({...As(e,t,n),trait:e,editor:t});function W9(e,t,n={}){var i;const s=e.get("visible"),r=e.getType(),o={traitManagerDataConfig:n.traitManagerDataConfig};if(rt(s)&&s({component:e.target,trait:e})===!1)return null;switch(r){case"text":return c.jsx(at,{...mb(e,t,o)});case"select":return c.jsx(_e,{...Uw(e,t,o)});case"number":return c.jsx(Ne,{...R9(e,t,o)});case"color":return c.jsx(Xs,{...k9(e,t,o)});case"checkbox":return c.jsx(Fa,{...D9(e,t,o)});case"button":return c.jsx(Qe,{...H9(e)});case"radio":return c.jsx(tn,{...I9(e,t,o)});case"code":return c.jsx(Cs,{...F9(e,t,o),...n},((i=t==null?void 0:t.getSelected())==null?void 0:i.getId())||"");case"image":case"file":return c.jsx(Ua,{...V9(e,t,o)});case"stack":return c.jsx(O9,{...B9(e,t,o)});case"href":return c.jsx(T9,{...z9(e,t,o)});case"custom":return c.jsx(C9,{...U9(e,t,o)});default:return!!t.Traits.getType(r)?c.jsx(A9,{editor:t,trait:e}):c.jsx(at,{...mb(e,t,o)})}}const jc="gs-trait-manager",bb=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(D,{className:`${jc}-field gs-utl-mb-2 gs-utl-w-full`,children:W9(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function G9({traits:e,className:t}){var p,f;const n=vl(),{isDarkTheme:s}=Ps(),o=(p=Se().sdkOptions.dataSources)==null?void 0:p.traitManager,i=n.Traits.getTraitsByCategory(e),a=(f=i.find(h=>!h.category))==null?void 0:f.items,l=i.filter(h=>h.category),u=`${jc}__empty-state gs-utl-text-center`,d=h=>n.t(`traitManager.${h}`);return c.jsx(k,{className:J(jc,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[a==null?void 0:a.map(h=>c.jsx(bb,{trait:h,isDarkTheme:s,traitManagerDataConfig:o},h.id)),l.map(({category:h,items:m},b)=>c.jsx(yr,{open:!!(h!=null&&h.get("open")),onChange:({open:v})=>h==null?void 0:h.set({open:v}),handler:h==null?void 0:h.getLabel(),handlerIcon:h==null?void 0:h.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${jc}-category -gs-utl-mx-2`,className:v=>J(Rf.itemList({index:b+(a?1:0),open:v,length:l.length})),children:m.map(v=>c.jsx(bb,{trait:v,isDarkTheme:s,traitManagerDataConfig:o},v.id))},h==null?void 0:h.id))]}):c.jsx(D,{className:u,children:d("notFound")}):c.jsx(D,{className:u,children:d("empty")})})}const hf=ue(G9),q9="gs-panel-properties",K9=g.memo(ue(function({className:t,...n}){return c.jsx(_s,{className:L(q9,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-auto"),...n,children:c.jsx(Kp,{children:s=>c.jsx(hf,{...s})})})})),Z9=async({html:e="",css:t="",el:n})=>{const s=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,r={};if(document.body.attachShadow){const o=n.shadowRoot||n.attachShadow({mode:"open"});o.innerHTML=s}return r},Y9=ue(function({rule:t,onSelect:n,onRemove:s,className:r}){const o=g.useRef(null),a=Se().editor,l=$e(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=Ps(),[f,h]=g.useState(t.toCSS({allowEmpty:!0})),[m,b]=g.useState(f),v=t.selectorsToString(),x=()=>{a.select(),setTimeout(()=>a.Selectors.select(t)),n==null||n()},y=()=>{a.Css.remove(t),s==null||s()},w=()=>{if(m){const S=a.Parser.parseCss(m)[0];S&&(t.setStyle(S.style),h(m))}};return g.useEffect(()=>{if(o.current){const S=o.current;Z9({el:S,html:'<div class="prv-rule">Preview</div>',css:`
327
327
  .prv-rule {
328
328
  background-color: #fff;
329
329
  padding: 5px;
330
330
  }
331
331
  .prv-rule, ${f}
332
- `})}},[o,f]),c.jsx(rs,{padding:!1,className:ie("overflow-hidden max-w-full group",r),children:c.jsxs($,{col:!0,space:"xs",children:[c.jsx($,{className:ie("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:o,className:ie("relative flex items-center justify-center")})}),c.jsxs($,{className:ie("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs($,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(F,{grow:!0,children:c.jsx("pre",{className:ie("text-xs bg-white/10",z.txt,te.rnd,Pe.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(F,{children:c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(se,{icon:K.cellphoneLink,size:oe.sx})})}),!!d&&c.jsx(F,{children:c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(se,{icon:K.flare,size:oe.sx})})})]}),c.jsxs($,{nowrap:!0,className:ie(_e.txtEllips),space:"s",children:[c.jsx(F,{className:ie("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Ke,{onClick:x,className:ie("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(Es,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(St,{title:l.t("selectorManager.showCSS"),children:c.jsx(se,{icon:K.codeBraces,size:oe.sx})}),children:({close:S})=>c.jsxs($,{className:ie("relative w-80 h-48"),col:!0,children:[c.jsx(F,{grow:!0,children:c.jsx(mr,{defaultValue:Sh(f),onChange:v,language:"css",padding:5,isDarkTheme:p,clean:!0})}),c.jsx(Ke,{className:ie("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{w(),S()},children:l.t("update")})]})}),c.jsx(ku,{onConfirm:y,className:ie("w-48"),children:c.jsx(St,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(se,{icon:K.delete,size:oe.sx})})})]})]})]},t.cid)})}),T9=ce(function(){const[t]=mh(),n=Mi(),s=Ie(),[r,o]=h.useState(""),[i,a]=h.useState(""),u=xe().editor,[d,p]=h.useState(u.Css.getRules("")),f=u.Devices.getDevices().map(v=>({id:v.id,label:v.getName()})),g=d.filter(v=>{var b;return!(r&&!pi(v.selectorsToString(),r)||i&&((b=v.getDevice())==null?void 0:b.id)!==i)}),m=()=>p(u.Css.getRules(""));return c.jsxs($,{col:!0,space:"m",children:[c.jsxs($,{items:"center",space:"m",children:[c.jsx(F,{children:c.jsx(ot,{size:"s",type:"search",value:r,onInput:o,placeholder:`${s.t("selectorManager.searchStyle")}...`})}),c.jsx(F,{children:c.jsx(Ae,{includeEmpty:!0,size:"s",value:i,options:f,onChange:a,emptyState:s.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs($,{space:"s",items:"center",children:[c.jsx(se,{icon:K.cellphoneLink,size:oe.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(F,{className:ie("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx($u,{data:g,listClassName:ie("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(P9,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx($,{justify:"center",children:s.t("modals.styleCatalog.noStyles")})})]})}),O9=ce(function({selector:t,className:n,removable:s,toggleable:r}){const o=Ie(),i=xe(),[a,l]=h.useState(),[u,d]=h.useState(t.getActive()),p=i.editor,{Selectors:f}=p,g=t.getLabel(),m=c.jsx(se,{icon:K.dotsVertical,size:oe.sx}),v=()=>{f.removeSelected(t)},b=j=>{a&&f.rename(a,j),l(void 0)},x=()=>{f.duplicateSelected(t)},y=()=>{const j=!t.getActive();d(j),t.setActive(j)},S=[{id:"rename",label:o.t("rename"),action:()=>l(t)},{id:"duplicate",label:o.t("duplicate"),action:x},s&&{id:"delete",label:o.t("delete"),action:v},r&&{id:"active",label:o.t(u?"disable":"enable"),action:y}].filter(Boolean),C=(j,E)=>O=>{j(),tt(E)&&E(O)};return c.jsx(Br,{className:ie(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",z.sel,n]),s:"s",children:c.jsxs($,{items:"center",children:[c.jsx(F,{className:ie("gjs-mr-4",!a&&!u&&"opacity-50 line-through"),children:c.jsx(Dx,{value:g,onChange:b,active:!!a,unstyled:!0})}),c.jsx($,{className:ie("absolute h-full right-0 transition-opacity",z.sel,z.selBr,te.bl),children:c.jsx(Es,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:j})=>S.map(E=>c.jsx(ki,{className:ie(z.txt),label:E.label,action:C(j,E.action)},E.id))})})]})})}),_9=e=>(e==null?void 0:e.get("groups"))||[],A9=/^\.[a-zA-Z_][\w-]*$/;function L9(e,t={}){const n=e.Css.getAll().filter(s=>_9(s).some(r=>r.startsWith(Wo.globalStyles)));return t.withSingleClass?n.filter(s=>A9.test(s.getSelectorsString())):n}const M9=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((o,i)=>{const a=o.indexOf(i);return a>=0&&o.splice(a,1),o},n).filter(o=>o.isClass())},N9=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:s}=t.store,o=(n!=null&&n.showInClassSelectors?L9(e,{withSingleClass:!0}):[]).map(a=>{const l=a.getSelectorsString().replace(".","");return{id:l,label:`${s.t("globalStyleManager.globalStyles")}: ${l}`}});return[...M9(e).map(a=>({id:a,label:a.getLabel()})),...o]},$9=e=>{var s,r;let t=(s=e==null?void 0:e.selectorsToString)==null?void 0:s.call(e);const n=(r=e==null?void 0:e.getAtRule)==null?void 0:r.call(e);return t&&n&&(t=`${n} {
332
+ `})}},[o,f]),c.jsx(os,{padding:!1,className:le("overflow-hidden max-w-full group",r),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(k,{className:le("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:o,className:le("relative flex items-center justify-center")})}),c.jsxs(k,{className:le("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(k,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(D,{grow:!0,children:c.jsx("pre",{className:le("text-xs bg-white/10",z.txt,se.rnd,Pe.xyS),children:v})}),!!u&&u.getWidthMedia()&&c.jsx(D,{children:c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(ne,{icon:K.cellphoneLink,size:oe.sx})})}),!!d&&c.jsx(D,{children:c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(ne,{icon:K.flare,size:oe.sx})})})]}),c.jsxs(k,{nowrap:!0,className:le(Ae.txtEllips),space:"s",children:[c.jsx(D,{className:le("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Qe,{onClick:x,className:le("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(Os,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(St,{title:l.t("selectorManager.showCSS"),children:c.jsx(ne,{icon:K.codeBraces,size:oe.sx})}),children:({close:S})=>c.jsxs(k,{className:le("relative w-80 h-48"),col:!0,children:[c.jsx(D,{grow:!0,children:c.jsx(Cs,{defaultValue:Tg(f),onChange:b,language:"css",padding:5,isDarkTheme:p,clean:!0})}),c.jsx(Qe,{className:le("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{w(),S()},children:l.t("update")})]})}),c.jsx(Hu,{onConfirm:y,className:le("w-48"),children:c.jsx(St,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(ne,{icon:K.delete,size:oe.sx})})})]})]})]},t.cid)})}),X9=ue(function(){const[t]=wg(),n=$i(),s=$e(),[r,o]=g.useState(""),[i,a]=g.useState(""),u=Se().editor,[d,p]=g.useState(u.Css.getRules("")),f=u.Devices.getDevices().map(b=>({id:b.id,label:b.getName()})),h=d.filter(b=>{var v;return!(r&&!gi(b.selectorsToString(),r)||i&&((v=b.getDevice())==null?void 0:v.id)!==i)}),m=()=>p(u.Css.getRules(""));return c.jsxs(k,{col:!0,space:"m",children:[c.jsxs(k,{items:"center",space:"m",children:[c.jsx(D,{children:c.jsx(at,{size:"s",type:"search",value:r,onInput:o,placeholder:`${s.t("selectorManager.searchStyle")}...`})}),c.jsx(D,{children:c.jsx(_e,{includeEmpty:!0,size:"s",value:i,options:f,onChange:a,emptyState:s.t("deviceManager.allDevices"),handlerSelected:b=>c.jsxs(k,{space:"s",items:"center",children:[c.jsx(ne,{icon:K.cellphoneLink,size:oe.sx}),c.jsx("span",{children:b.label})]})})})]}),c.jsx(D,{className:le("gs-utl-h-[75vh] w-full overflow-auto"),children:h.length?c.jsx(Vu,{data:h,listClassName:le("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(b,v)=>c.jsx(Y9,{rule:v,onRemove:m,onSelect:n.close},v.cid)},t):c.jsx(k,{justify:"center",children:s.t("modals.styleCatalog.noStyles")})})]})}),J9=ue(function({selector:t,className:n,removable:s,toggleable:r}){const o=$e(),i=Se(),[a,l]=g.useState(),[u,d]=g.useState(t.getActive()),p=i.editor,{Selectors:f}=p,h=t.getLabel(),m=c.jsx(ne,{icon:K.dotsVertical,size:oe.sx}),b=()=>{f.removeSelected(t)},v=C=>{a&&f.rename(a,C),l(void 0)},x=()=>{f.duplicateSelected(t)},y=()=>{const C=!t.getActive();d(C),t.setActive(C)},S=[{id:"rename",label:o.t("rename"),action:()=>l(t)},{id:"duplicate",label:o.t("duplicate"),action:x},s&&{id:"delete",label:o.t("delete"),action:b},r&&{id:"active",label:o.t(u?"disable":"enable"),action:y}].filter(Boolean),j=(C,E)=>O=>{C(),rt(E)&&E(O)};return c.jsx(Ur,{className:le(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",z.sel,n]),s:"s",children:c.jsxs(k,{items:"center",children:[c.jsx(D,{className:le("gjs-mr-4",!a&&!u&&"opacity-50 line-through"),children:c.jsx(ew,{value:h,onChange:v,active:!!a,unstyled:!0})}),c.jsx(k,{className:le("absolute h-full right-0 transition-opacity",z.sel,z.selBr,se.bl),children:c.jsx(Os,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:C})=>S.map(E=>c.jsx(Ii,{className:le(z.txt),label:E.label,action:j(C,E.action)},E.id))})})]})})}),Q9=e=>(e==null?void 0:e.get("groups"))||[],e7=/^\.[a-zA-Z_][\w-]*$/;function t7(e,t={}){const n=e.Css.getAll().filter(s=>Q9(s).some(r=>r.startsWith(Go.globalStyles)));return t.withSingleClass?n.filter(s=>e7.test(s.getSelectorsString())):n}const n7=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((o,i)=>{const a=o.indexOf(i);return a>=0&&o.splice(a,1),o},n).filter(o=>o.isClass())},s7=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:s}=t.store,o=(n!=null&&n.showInClassSelectors?t7(e,{withSingleClass:!0}):[]).map(a=>{const l=a.getSelectorsString().replace(".","");return{id:l,label:`${s.t("globalStyleManager.globalStyles")}: ${l}`}});return[...n7(e).map(a=>({id:a,label:a.getLabel()})),...o]},r7=e=>{var s,r;let t=(s=e==null?void 0:e.selectorsToString)==null?void 0:s.call(e);const n=(r=e==null?void 0:e.getAtRule)==null?void 0:r.call(e);return t&&n&&(t=`${n} {
333
333
  ${t}
334
- }`),t},Wn="gs-cmp-selector-manager",tp={},Aw=ce(function(t){var ae,ge,je;const{selectedState:n,states:s,setState:r,styleCatalog:o,stateSelector:i}=t,a=xe(),[l,u]=h.useState(!1),[d,p]=h.useState([]),[f,g]=h.useState(tp),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:x}=xe(),{i18nStore:y,modalStore:w}=x,S=b==null?void 0:b.getSelected(),C=b==null?void 0:b.Styles.getSelected();if(h.useEffect(()=>{if(b&&C&&a){const Se=setTimeout(()=>{let et=tp;const Ye=S==null?void 0:S.get("selectorManager");S&&tt(Ye)&&(et=Ye({editor:b,component:S})),g(et||tp),p(N9(b,a))});return()=>clearTimeout(Se)}},[S,b,C,a]),!b)return null;const{Selectors:j}=b,E=f.disableClasses,O=f.disableComponent,P=E&&O,T=j.getComponentFirst()&&!O,A=j.getSelectedAll(),_=b.getSelectedAll(),N=s.map(Se=>({id:Se.getName(),label:Se.getLabel()})),D=b.getModel(),L=(ae=C==null?void 0:C.getDevice)==null?void 0:ae.call(C),V=(ge=C==null?void 0:C.getState)==null?void 0:ge.call(C),U=M("gs-utl-overflow-hidden",te.b,te.rnd,z.br),H=M(z.bA),B=M("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,z.br),k=`${z.bgA}`,I=$9(C),R=A.length>0,W=_.length>0,Z=R||W,X=T&&W||!T&&!R,J=X?"Components":"Selectors",Q=Se=>y.t(`selectorManager.${Se}`),G=y.t("modals.styleCatalog.title"),ee=()=>w.open({title:G,content:c.jsx(T9,{})});return c.jsxs($,{className:Wn,gap:"s",col:!0,full:!0,children:[c.jsxs($,{className:M(`${Wn}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs($,{className:M(`${Wn}__head-start`),items:"center",gap:"s",children:[c.jsx(F,{className:M(`${Wn}__head-title`),children:Q("selection")}),o!==!1&&c.jsx(F,{className:M(`${Wn}__style-catalog`),children:c.jsx(zt,{className:"gs-utl-cursor-pointer",onClick:ee,title:G,children:c.jsx(se,{icon:K.paletteSwatch,size:oe.s})})})]}),!!C&&i!==!1&&!P&&c.jsx(F,{className:`${Wn}__head-end`,children:c.jsx(Ae,{size:"s",value:n,options:N,includeEmpty:!0,onChange:r,emptyState:`- ${Q("state")} -`,className:M(n&&z.bA)})})]}),Z&&!P?c.jsxs(c.Fragment,{children:[!E&&c.jsxs($,{className:M(`${Wn}__field-selectors`,U,!X&&H),items:"stretch",gap:"xs",children:[c.jsx(zt,{title:Q(R?"applyOnSelector":"noSelectors"),className:M(B,!X&&k),onClick:()=>R&&j.setComponentFirst(!1),children:c.jsx($,{className:"gs-utl-h-full",items:"center",children:c.jsx(se,{icon:K.tag,size:oe.sx})})}),c.jsx(F,{grow:!0,children:c.jsx($,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Cw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:Q("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Se=>{Se&&(j.addSelected(Se.id||Se.label),u(!1))}}):c.jsxs(c.Fragment,{children:[W&&c.jsx(St,{title:Q("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(se,{icon:K.plus,size:oe.sx})}),A.map(Se=>c.jsx(O9,{selector:Se,removable:W,toggleable:W&&A.filter(et=>et.getActive()||et===Se).length>1},Se.toString()))]})})})]}),!O&&c.jsxs($,{className:M(`${Wn}__field-components`,U,X&&H),items:"stretch",gap:"xs",children:[c.jsx(zt,{title:Q(W?"applyOnComponents":"noComponents"),onClick:()=>W&&j.setComponentFirst(!0),className:M(B,X&&k),children:c.jsx($,{className:"gs-utl-h-full",items:"center",children:c.jsx(se,{icon:K.targetVariant,size:oe.sx})})}),c.jsx(F,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx($,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:_.map(Se=>c.jsx(Br,{s:"s",className:M("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>D.setHovered(Se),onPointerOut:()=>D.setHovered(),label:Se.getName()},Se.getId()))})})]}),c.jsxs($,{className:`${Wn}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:Q("selected")}),c.jsx("pre",{className:M("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",te.rnd,Pe.xyS),children:I}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:Q("currentSelection")})]}),children:c.jsx(Br,{className:M(te.b,te.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(se,{icon:K.target,size:oe.sx})})}),c.jsx(F,{className:"gs-utl-text-sm",children:c.jsx(Br,{className:M(te.b,te.rnd,z.br),s:"xs",nopad:!0,children:c.jsxs($,{space:"xs",items:"center",nowrap:!0,children:[!!L&&L.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[Q("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(se,{icon:K.cellphoneLink,size:oe.sx})}),c.jsx(F,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[Q("target"),": ",c.jsx("b",{children:J}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(je=C==null?void 0:C.selectorsToString)==null?void 0:je.call(C,{skipState:1})]})]}),children:c.jsx(se,{icon:X?K.targetVariant:K.tag,size:oe.sx})}),!!V&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[Q("state"),": ",c.jsx("b",{children:V.getLabel()})]}),children:c.jsx(se,{icon:K.flare,size:oe.sx})})]})]})})}),c.jsx(St,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(se,{icon:K.codeBraces,size:oe.sx})})]})]}):c.jsxs($,{className:M(`${Wn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(F,{className:`${Wn}__empty-state-title`,children:Q("noSelecton")}),c.jsxs("ul",{className:M(`${Wn}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:Q("selectFromCanvas")}),c.jsx("li",{children:Q("selectFromList")})]})]})]})}),k9="gs-panel-selectors",R9=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:s,...r}){return c.jsx(Ps,{className:M(k9,t),...r,children:c.jsx(Ny,{children:o=>c.jsx(Aw,{...o,styleCatalog:n,stateSelector:s})})})}));function Mr({label:e,property:t,hasValue:n,empty:s,onClear:r,children:o,shallow:i,row:a,tooltip:l,skipClear:u,className:d,...p}){const f=e||(t==null?void 0:t.getLabel()),g=t==null?void 0:t.getParentTarget(),m=n||!s&&(t==null?void 0:t.hasValue({noParent:!0})),v=!m&&(t==null?void 0:t.hasValue())&&g,b=g==null?void 0:g.getDevice(),x=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),w=()=>r?r():t==null?void 0:t.clear(),S={className:M(d,"gs-utl-text-sm gs-utl-w-full"),col:!a,items:a?"center":void 0,...p},C=M("gs-utl-flex-1",m&&!i&&z.tAo);return t&&!t.isVisible()?null:c.jsxs($,{gap:"xs",...S,children:[c.jsxs($,{className:C,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(F,{children:c.jsx(zt,{title:l,children:c.jsx(se,{icon:K.information,size:oe.sx})})}),c.jsx(F,{children:s?c.jsx("span",{children:" "}):f}),!!v&&!i&&c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M("gs-utl-mb-1"),children:"Value inherited from"}),!!b&&c.jsxs($,{gap:"s",children:[c.jsx(F,{children:c.jsx(se,{icon:K.cellphoneLink,size:oe.sx})}),c.jsx(F,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs($,{gap:"s",children:[c.jsx(F,{children:c.jsx(se,{icon:y?K.targetVariant:K.tag,size:oe.sx})}),c.jsxs(F,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:M("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!x&&c.jsxs($,{gap:"s",children:[c.jsx(F,{children:c.jsx(se,{icon:K.flare,size:oe.sx})}),c.jsx(F,{children:c.jsx("b",{children:x.getLabel()})})]})]}),children:c.jsx("div",{className:M("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),m&&!i&&!u&&c.jsx(zt,{title:"Clear value",onClick:w,children:c.jsx(se,{className:_e.click,icon:K.close,size:oe.s2x})})]}),!!o&&c.jsx(F,{grow:!0,className:"gs-utl-max-w-full",children:o})]})}function Gu(e){const t=e.indexOf("(")+1,n=e.lastIndexOf(")");return{name:e.substring(0,t-1).trim(),value:String.prototype.substring.apply(e,[t,n>=0?n:void 0]).trim()}}const I9=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,V9=/,(?![^(]*\))/,np=/\s(?![^(]*\))/,H9=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,sp=/^circle|ellipse/i,eg=e=>{var d;const t=[],{name:n,value:s}=Gu(e),[r,...o]=s.split(V9).map(p=>p.trim()).filter(Boolean),i=o.length>1,a=i?r:"",l={type:"none"},u=i?o:[r,...o];if(I9.test(a))l.type="angle",l.value=a;else if(/^to\s/.test(a))l.type="side-or-corner",l.value=a;else if(H9.test(a))l.type="size",l.value=a;else if(sp.test(a)||/^at\s/.test(a)||/\sat\s/.test(a)){l.type="at",l.value=a;const p=((d=a.match(sp))==null?void 0:d[0])||"circle";l.shape=p;const f={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=a.replace(sp,"").trim().split("at").map(b=>b.trim());if(m){const[b,x]=m.split(np);f.x=b,f.y=x||b}if(v){const[b,x]=v.split(np);g.x=b,g.y=x||b}l.size=f,l.position=g}return u.forEach(p=>{const[f,g]=p.split(np);t.push({color:f,hint:g?parseFloat(g):null})}),t.forEach((p,f)=>{p.hint===null&&(p.hint=f/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},_r=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const r=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(o=>`${o.color} ${o.hint?`${o.hint}%`:""}`.trim()).join(", ");return r?`${n}(${t}, ${r})`:"none"},D9=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),F9="gs-cmp-grad-picker";function B9({className:e,value:t,onChange:n}){var V,U,H;const s=eg(t),[r,o]=h.useState(s.colorStops),[i,a]=h.useState(null),l=h.useRef(null),u=Y(F9,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=s.name||"linear-gradient",p=d.indexOf("radial")>=0,f=d.indexOf("repeating")>=0,g=s.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(V=s.orientation.size)==null?void 0:V.x}`)||0}`,b=`${parseFloat(`${(U=s.orientation.position)==null?void 0:U.x}`)||0}`,x=`${parseFloat(`${(H=s.orientation.position)==null?void 0:H.y}`)||0}`,y=0,w=100,S=(B,k=!1)=>{const I=D9(B);o(I),n==null||n(_r({name:d,orientation:g,stops:I}),k)},C=(B,k=!1)=>{n==null||n(_r({stops:r,name:d,orientation:`${B}deg`}),k)},j=(B,k=!1)=>{n==null||n(_r({stops:r,name:d,orientation:`${B}px at ${b}% ${x}%`}),k)},E=(B,k=!1)=>{n==null||n(_r({stops:r,name:d,orientation:`${v}px at ${B}% ${x}%`}),k)},O=(B,k=!1)=>{n==null||n(_r({stops:r,name:d,orientation:`${v}px at ${b}% ${B}%`}),k)},P=B=>{const k=`${B?"repeating-":""}${p?"radial":"linear"}-gradient`;n==null||n(_r({stops:r,orientation:g,name:k}))},T=B=>{const k=`${f?"repeating-":""}${B?"radial":"linear"}-gradient`;n==null||n(_r({stops:r,orientation:B?"100px at 50% 50%":"90deg",name:k}))};h.useEffect(()=>{if(!i)return;const B=parseFloat(`${i.stop.hint}`),k=R=>{let Z=(R.clientX-i.x)*100;Z=Z/i.w,Z=B+Z,Z=Z<y?y:Z,Z=Z>w?w:Z,i.stop.hint=parseInt(`${Z}`,10),S(r,!0)},I=()=>{a(null),S(r)};return window.addEventListener("pointermove",k),window.addEventListener("pointerup",I),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",I),I()}},[i]);const A=(B,k)=>{const I=l.current;a({stop:k,w:(I==null?void 0:I.clientWidth)||0,h:(I==null?void 0:I.clientHeight)||0,x:B.clientX,y:B.clientY})},_=B=>{const k=l.current,I=(k==null?void 0:k.clientWidth)||0,R=(k==null?void 0:k.clientHeight)||0,W=B.nativeEvent.offsetX-((k==null?void 0:k.clientLeft)||0),Z=B.nativeEvent.offsetY-((k==null?void 0:k.clientTop)||0),X=W/I*100,J=document.createElement("canvas"),Q=J.getContext("2d");if(!Q)return;J.width=I,J.height=R;const G=Q.createLinearGradient(0,0,I,R);r.forEach(Se=>G.addColorStop(parseFloat(`${Se.hint}`)/100,Se.color)),Q.fillStyle=G,Q.fillRect(0,0,J.width,J.height),J.style.background="black";const ee=Q.getImageData(W,Z,1,1).data,ae=ee[3]?(100/255*ee[3]/100).toFixed(2):0,ge=`rgba(${ee[0]}, ${ee[1]}, ${ee[2]}, ${ae})`,je=ge==="rgba(0, 0, 0, 0)"?"#000":ge;S([...r,{color:je,hint:X}])},N=B=>{S(r.filter(k=>k!==B))},D=(B,k,I)=>{k&&(B.color=k),S(r,I)},L=B=>(i==null?void 0:i.stop)===B;return c.jsxs($,{className:u,col:!0,children:[!!(i!=null&&i.stop)&&c.jsx("div",{className:Y("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:Y("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:Y("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:Y("w-full h-full cursor-cross",te.b,te.rnd,z.br),style:{backgroundImage:_r({stops:r})},onClick:_})}),r.map((B,k)=>c.jsxs("div",{className:Y("absolute top-0 h-full"),style:{left:`${B.hint}%`},children:[c.jsx("div",{className:Y("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>N(B),children:c.jsx(se,{icon:K.close,size:oe.s3x})}),c.jsx("div",{onPointerDown:I=>A(I,B),className:Y("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,L(B)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:Y("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(Mx,{value:B.color,onChange:(I,R)=>D(B,I,R),className:Y("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},k))]}),c.jsxs($,{space:"s",items:"center",children:[c.jsx(F,{grow:!0,children:c.jsx(Ia,{label:"Repeat",value:f,onChange:P})}),c.jsx(F,{grow:!0,children:c.jsx(Ia,{label:"Radial",value:p,onChange:T})})]}),p?c.jsxs($,{space:"s",col:!0,children:[c.jsx(F,{children:c.jsx($,{space:"s",items:"center",children:c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"S",size:"s",value:v,onChange:j,valueUnit:"px",units:["px"]})})})}),c.jsx(F,{children:c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"X",size:"s",value:b,onChange:E,valueUnit:"%",units:["%"]})}),c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"Y",size:"s",value:x,onChange:O,valueUnit:"%",units:["%"]})})]})})]}):c.jsx($,{space:"s",items:"center",nowrap:!0,children:c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"A",size:"s",value:m,onChange:C,valueUnit:"deg",units:["deg"]})})})]})}const z9="gs-sm-custom-type",U9=ce(function({property:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=n.StyleManager,i=o.getType(r),a=i==null?void 0:i.view;return h.useEffect(()=>{const l=s.current;if(a&&l){const u=new a({model:t,config:o.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[a,t,n]),a&&c.jsx("div",{className:z9,ref:s})});function Lw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const fv="gs-cmp-style-field";function Mw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:s}){const r=M(fv,`${fv}__${e.id}`),o={sector:t,styleManagerDataConfig:n},i=t.em.getEditor(),a=e.getType();switch(a){case"selectFont":return c.jsx(Du,{className:r,...Rw(e,o),...s});case"number":case"slider":case"integer":return c.jsx(Ne,{className:r,...it(e,o),...s});case"color":return c.jsx(Ks,{className:r,...Vo(e,o),...s});case"select":return c.jsx(Ae,{className:r,...Mt(e,o),...s});case"radio":return c.jsx(tn,{className:r,...Rs(e,o),...s});case"file":return c.jsx(Da,{className:r,...f7(e,o),...s});case"composite":return c.jsx(xn,{className:r,property:e,corners:e.get("corners"),generic:e.get("generic"),...o});case"stack":{const l=e.getProperties();return c.jsx($s,{className:r,...Nr(e,o),children:c.jsx(Qs,{properties:l,sector:t})})}default:{const l=i.StyleManager.getType(a);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(U9,{editor:i,property:e}):c.jsx(ot,{className:r,...tg(e,o)})}}}const hv="gs-cmp-style-prop-row";function Qs({properties:e,sector:t,styleManagerDataConfig:n}){const s={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(r=>{const o=r.getId(),i=M(hv,`${hv}__${o}`,Lw(r)&&"gs-utl-col-span-full");return r.isVisible()?c.jsx("div",{className:i,children:c.jsx(Mw,{property:r,...s})},o):null})})}function W9({sector:e,styleManagerDataConfig:t}){const n=dl(),s=e.getProperties().filter(r=>r.isVisible()).map(r=>(n.sdkAddFonts&&r.getId()==="font-family"&&r.set("type","selectFont"),r));return c.jsx("div",{className:M("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Qs,{properties:s,sector:e,styleManagerDataConfig:t})})}const G9="gs-cmp-sector-row";function ve({className:e,children:t,bottom:n,separator:s,separatorTop:r,property:o,...i}){const a=c.jsx("div",{className:Y("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,z.br)}),l=Y(G9,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(o)?o:[o]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?c.jsxs(c.Fragment,{children:[r&&a,c.jsx($,{className:l,nowrap:!0,...i,children:t}),s&&a]}):null}function Qi(e,t,n={}){const s=e.getType(),{compact:r=!1,sector:o,styleManagerDataConfig:i}=n,a=e.getParent(),l={sector:o,styleManagerDataConfig:i},u=e.getDefaultValue();if(s==="select"){const p={property:a.getName()};return c.jsx(Ae,{...Mt(e,l,p),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,p)||u:"Custom",onChange:f=>t.all.map(g=>g.upValue(f))}:{},label:void 0})}else return s==="color"?c.jsx(Ks,{...Vo(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p}))}:{},label:void 0}):c.jsx(Ne,{...it(e,l),...r?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p})),onChangeUnit:d=>t.all.map(p=>p.upUnit(d))}:{},label:void 0})}const ec="gs-cmp-style-prop-composite";function xn({className:e,property:t,sector:n,styleManagerDataConfig:s,corners:r,compact:o,generic:i,children:a,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const p={id:"custom",label:c.jsx(se,{icon:K.borderStyle,size:oe.s}),title:"Custom"},f=[{id:"all",label:c.jsx(se,{icon:K.borderAllVariant,size:oe.s}),title:"All"},p],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,x,y,w]=m,S=b.getFullValue(),j=m.map(H=>H.getFullValue()).every(H=>H===S),E=u!==null?u:j||l?"all":p.id,O=l?[...l,p]:[],P=t.getFullValue(),T=O.some(H=>H.id===P),A=E===p.id||(l?!T:!1)||!!i,_={compact:o,sector:n,styleManagerDataConfig:s},N=c.jsx(Mr,{property:o?null:b,shallow:!g,children:Qi(b,null,_)}),D=c.jsx(Mr,{property:o?null:x,shallow:!g,children:Qi(x,null,_)}),L=!!y&&c.jsx(Mr,{property:o?null:y,shallow:!g,children:Qi(y,null,_)}),V=!!w&&c.jsx(Mr,{property:o?null:w,shallow:!g,children:Qi(w,null,_)}),U=o?{label:t.getLabel()}:{property:t};return c.jsxs($,{className:Y(ec,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(ve,{className:`${ec}__main`,children:c.jsx(Mr,{...U,children:!i&&c.jsx(ve,{bottom:"0",children:a!==void 0?a:l?c.jsx(c.Fragment,{children:c.jsx(F,{grow:!0,children:c.jsx(tn,{size:"s",options:O,value:A?p.id:P,onChange:H=>{H===p.id?d(H):(t.upValue(H),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(F,{grow:!0,children:Qi(b,{same:j,all:m},_)}),c.jsx(F,{grow:!0,children:c.jsx(tn,{size:"s",options:f,value:E,onChange:d})})]})})})}),A&&c.jsx(ve,{col:!0,className:Y(`${ec}__details`,"gjs-px-2 gjs-py-1",z.bgH2,te.rnd,te.b,z.br),children:i?c.jsx("div",{className:Y(`${ec}__props`,"grid grid-cols-2 gap-2"),children:m.map(H=>c.jsx(Mr,{property:H,shallow:!g,className:Y(Lw(H)&&"col-span-full"),children:c.jsx(Mw,{property:H,..._,fieldProps:{label:void 0}})},H.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:D})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:D})]}),c.jsx($,{space:"s",children:c.jsx(F,{grow:!0,children:L})})]}):r?c.jsxs(c.Fragment,{children:[c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:D})]}),c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:V}),c.jsx(F,{grow:!0,children:L})]})]}):c.jsxs(c.Fragment,{children:[c.jsx($,{className:Y("gs-utl-w-1/2 gjs-m-auto"),children:N}),c.jsxs($,{space:"s",children:[c.jsx(F,{grow:!0,children:V}),c.jsx(F,{grow:!0,children:D})]}),c.jsx($,{className:Y("gs-utl-w-1/2 gjs-m-auto"),children:L})]})})]})}var Vr=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(Vr||{});const xc="background-image",Ds="__background-type",ya=xc,Nw="https://placehold.co/150/777/white.png?text=IMAGE",df="50px",q9={[Ds]:"image","background-image":`url("${Nw}")`,"background-size":`${df} ${df}`,"background-repeat":"repeat","background-position":"0px 0px"},K9=e=>(e.includes("gradient(")?eg(e).colorStops[0].color:e)||"";function Z9({sector:e,styleManagerDataConfig:t}){var S;const n=hl(),s=e.getProperty("background"),r=s.getProperty(Ds),o=s.getProperty("background-image"),i=s.getProperty("background-position"),a=s.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},p=[s,l,u].map(C=>C==null?void 0:C.id),f=e.getProperties().filter(C=>!p.includes(`${C.id}`)),g=((S=s.getSelectedLayer())==null?void 0:S.getIndex())||-1,m=r==null?void 0:r.getValue(),v=m==="image",b=o.getValue(),x=()=>{const C=n.Assets;C.open({select(j){const E=j.getSrc();o.upValue(`url("${E}")`),C.close()}})},y=C=>{let j="none",E="100%";C==="image"?(j=`url("${Nw}")`,E=df):C==="gradient"?j="linear-gradient(90deg, black 10%, white 90%)":C==="color"&&(j="rgba(0, 0, 0, 0.5)"),o.upValue(j),r.upValue(C),i.upValue("0 0"),a.upValue(`${E} ${E}`)},w=d7(r,[{id:"image",label:c.jsx(se,{icon:K.image,size:oe.s})},{id:"gradient",label:c.jsx(se,{icon:K.gradientVertical,size:oe.s})},{id:"color",label:c.jsx(se,{icon:K.checkboxBlank,size:oe.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(ve,{property:s,separator:!0,children:c.jsxs($s,{...Nr(s,d,q9),previewStyle:C=>s.getStyleFromLayer(C,{camelCase:!0}),children:[c.jsx(ve,{children:c.jsx(tn,{...Rs(r,d),options:w,onChange:y,label:void 0})}),c.jsx(ve,{children:c.jsxs(Mr,{children:[v&&c.jsx(Da,{value:Gu(b).value,onOpen:x}),m==="color"&&c.jsx(Ks,{...Vo(o,d),value:K9(b),label:void 0}),m==="gradient"&&c.jsx(B9,{value:b,onChange:(C,j)=>o.upValue(C,{partial:j})},g)]})}),v&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{col:!0,children:c.jsx(xn,{property:i,...d})}),c.jsx(ve,{col:!0,children:c.jsx(xn,{property:a,...d})}),c.jsxs(ve,{children:[c.jsx(Ae,{...Mt(s.getProperty("background-repeat"),{sector:e})}),c.jsx(Ae,{...Mt(s.getProperty("background-attachment"),{sector:e})})]}),c.jsx(ve,{children:c.jsx(Ae,{...Mt(s.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(ve,{property:l,children:c.jsx(Ks,{...Vo(l,d)})}),c.jsx(ve,{property:u,children:c.jsx(Ae,{...Mt(u,d)})}),f.length>0&&c.jsx(Qs,{properties:f,...d})]})}function Y9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),s=e.getProperty("border-width"),r=e.getProperty("border-style"),o=e.getProperty("border-color"),i={sector:e,styleManagerDataConfig:t},a=[n,s,r,o].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!a.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,corners:!0,...i}),c.jsx(xn,{property:s,...i}),c.jsx(xn,{property:r,...i}),c.jsx(xn,{property:o,...i}),l.length>0&&c.jsx(Qs,{properties:l,...i})]})}const mo=e=>Vu({value:parseFloat(e),min:-3,max:3}),rp=(e,t="filter",n)=>{const s=e.getProperty(`${t}-value`),r=e.getProperty(`${t}-name`).getOption()||{},o=r.units||[],i=s.getUnit(),a=kR(i,o)?i:o[0];return{...it(s,n),units:o,valueUnit:a,onChange:(l,u)=>{s.upValue(l,{partial:u,units:o,min:r.min,max:r.max})}}},gv=(e,t,n,s)=>{const r=e.getProperty(`${t}-name`),o=e.getProperty(`${t}-value`);return{...Mt(r,n,s),onChange:i=>{r.upValue(i),o.upValue("")}}},X9={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function J9({sector:e,styleManagerDataConfig:t}){const n=Ie(),s=O=>n.t(`styleManager.effects.${O}`),r=e.getProperty("box-shadow"),o=e.getProperty("text-shadow"),i=e.getProperty("filter"),a=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),p=e.getProperty("backface-visibility"),f=e.getProperty("perspective"),g=e.getProperty("transform-style"),m=e.getProperty("opacity"),v=e.getProperty("mix-blend-mode"),b=e.getProperty("cursor"),x=e.getProperty("transform-origin"),y=e.getProperty("overflow"),w={sector:e,styleManagerDataConfig:t},S=[r,o,i,a,l,u,d,p,f,g,m,v,b,x,y].map(O=>O==null?void 0:O.id),C=e.getProperties().filter(O=>!S.includes(`${O.id}`)),j=O=>{const{boxShadowH:P,boxShadowV:T,boxShadowBlur:A,boxShadowColor:_,boxShadowSpread:N,boxShadowType:D}=O.getValues({camelCase:!0}),L=mo(P),V=mo(T),U=mo(A),H=mo(N),B=`${L}px ${V}px ${U}px ${H}px ${_} ${D}`.trim();return c.jsxs($,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[P," ",T," ",A," ",N]}),c.jsx(F,{children:c.jsx("div",{className:Y("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:B}})})]})},E=O=>{const{textShadowH:P,textShadowV:T,textShadowBlur:A,textShadowColor:_}=O.getValues({camelCase:!0}),N=mo(P),D=mo(T),L=mo(A),V=`${N}px ${D}px ${L}px ${_}`.trim();return c.jsxs($,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[P," ",T," ",A]}),c.jsx(F,{children:c.jsx("div",{className:Y("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:V}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[m,v],children:[c.jsx(Ne,{...it(m,w)}),c.jsx(Ae,{...Mt(v,w)})]}),c.jsx(ve,{property:b,separator:!0,children:c.jsx(Ae,{...Mt(b,w)})}),c.jsx(ve,{property:r,separator:!0,children:c.jsxs($s,{...Nr(r,w),renderItem:j,children:[c.jsx(ve,{children:c.jsx(tn,{...Rs(r.getProperty("box-shadow-type"),w),label:""})}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(r.getProperty("box-shadow-h"),w),label:s("boxShadow.xOffset")}),c.jsx(Ne,{...it(r.getProperty("box-shadow-v"),w),label:s("boxShadow.yOffset")})]}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(r.getProperty("box-shadow-blur"),w),label:s("boxShadow.blur")}),c.jsx(Ne,{...it(r.getProperty("box-shadow-spread"),w),label:s("boxShadow.spread")})]}),c.jsx(ve,{children:c.jsx(Ks,{...Vo(r.getProperty("box-shadow-color"),w),label:s("boxShadow.color")})})]})}),c.jsx(ve,{property:o,separator:!0,children:c.jsxs($s,{...Nr(o,w,X9),renderItem:E,children:[c.jsxs(ve,{children:[c.jsx(Ne,{...it(o.getProperty("text-shadow-h"),w),label:s("textShadow.xOffset")}),c.jsx(Ne,{...it(o.getProperty("text-shadow-v"),w),label:s("textShadow.yOffset")})]}),c.jsx(ve,{children:c.jsx(Ne,{...it(o.getProperty("text-shadow-blur"),w),label:s("textShadow.blur")})}),c.jsx(ve,{children:c.jsx(Ks,{...Vo(o.getProperty("text-shadow-color"),w),label:s("textShadow.color")})})]})}),c.jsx(ve,{property:i,separator:!0,children:c.jsx($s,{...Nr(i,w,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Ae,{...gv(i,"filter",w),label:s("filter.type")}),c.jsx(Ne,{...rp(i,void 0,w),label:s("filter.value")})]})})}),c.jsx(ve,{property:a,separator:!0,children:c.jsx($s,{...Nr(a,w,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Ae,{...Mt(a.getProperty("backdrop-filter-name"),w),label:s("backdropFilter.type")}),c.jsx(Ne,{...rp(a,"backdrop-filter",w),label:s("backdropFilter.value")})]})})}),c.jsx(ve,{property:l,separator:!0,children:c.jsxs($s,{...Nr(l,w),children:[c.jsx(ve,{children:c.jsx(Ae,{...Mt(l.getProperty("transition-property"),w),label:s("transition.type")})}),c.jsx(ve,{children:c.jsx(Ae,{...Mt(l.getProperty("transition-timing-function"),w),label:s("transition.easing")})}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(l.getProperty("transition-duration"),w),label:s("transition.duration")}),c.jsx(Ne,{...it(l.getProperty("transition-delay"),w),label:s("transition.delay")})]})]})}),c.jsx(ve,{property:u,separator:!0,children:c.jsx($s,{...Nr(u,w),children:c.jsxs(ve,{children:[c.jsx(Ae,{...gv(u,"transform",w),label:s("transform.type")}),c.jsx(Ne,{...rp(u,"transform",w),label:s("transform.value")})]})})}),c.jsx(xn,{property:x,...w}),c.jsx(xn,{property:y,...w}),c.jsx(ve,{property:p,children:c.jsx(tn,{...Rs(p,w)})}),c.jsx(ve,{property:[f,g,d],separatorTop:!0,children:s("childrenTransform")}),c.jsxs(ve,{property:[f,g],children:[c.jsx(Ne,{...it(f,w)}),c.jsx(tn,{...Rs(g,w)})]}),c.jsx(xn,{property:d,...w}),C.length>0&&c.jsx(Qs,{properties:C,...w})]})}function Q9(e,t){return e.indexOf(t)>=0}const yt=oe.s,tc="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",nc="M6 6v12h13V6H6zm0-1h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm6-5h1v24h-1V0z",sc="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",mv="M2 6v12h6V6H2zm0 13v5H1V0h1v5h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H2zM16 6v12h6V6h-6zm6-1V0h1v24h-1v-5h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1h6z",vv="M11 0h1v24h-1V0zM1 6h6v12H1V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H1a1 1 0 01-1-1V6c0-.6.4-1 1-1zm15 1h6v12h-6V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1z",e7="M3 6v12h6V6H3zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H3a1 1 0 01-1-1V6c0-.6.4-1 1-1zM0 0h1v24H0V0zm14 6v12h6V6h-6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm8-5h1v24h-1V0zM11 0h1v24h-1V0z",op="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function t7({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),s=Ie(),[r,o]=h.useState({}),[i,a]=h.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),p=e.getProperty("align-items"),f=e.getProperty("flex-wrap"),g=e.getProperty("align-content"),m=e.getProperty("align-self"),v=e.getProperty("order"),b=e.getProperty("gap"),x=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},w=[l,u,d,p,f,g,m,v,b,x].map(H=>H.id),S=e.getProperties().filter(H=>!w.includes(`${H.id}`)),C=H=>s.t(`styleManager.layout.${H}`),j=l.getValue(),E=j==="flex",O=(i.display||"").indexOf("flex")>=0,P=u.getValue(),T=P.indexOf("reverse")>=0,A=!Q9(["column","column-reverse"],P),_=[{id:"row",label:c.jsx(se,{icon:K.arrowRight,size:oe.sx}),title:C("direction.title.row")},{id:"row-reverse",label:c.jsx(se,{icon:K.arrowRight,size:yt,horizontal:!0}),title:C("direction.title.row-reverse")},{id:"column",label:c.jsx(se,{icon:K.arrowDown,size:oe.sx}),title:C("direction.title.column")},{id:"column-reverse",label:c.jsx(se,{icon:K.arrowDown,size:yt,vertical:!0}),title:C("direction.title.column-reverse")}],N=[{id:"flex-start",title:C("justify.title.start"),label:c.jsx(se,{icon:tc,size:yt,rotate:A?0:90,horizontal:A&&T,vertical:!A&&T})},{id:"center",title:C("justify.title.center"),label:c.jsx(se,{icon:nc,size:yt,rotate:A?0:90})},{id:"flex-end",title:C("justify.title.end"),label:c.jsx(se,{icon:sc,size:yt,rotate:A?0:90,horizontal:A&&T,vertical:!A&&T})},{id:"space-between",title:C("justify.title.spaceBetween"),label:c.jsx(se,{icon:mv,size:yt,rotate:A?0:90})},{id:"space-around",title:C("justify.title.spaceAround"),label:c.jsx(se,{icon:vv,size:yt,rotate:A?0:90})},{id:"space-evenly",title:C("justify.title.spaceEvenly"),label:c.jsx(se,{icon:e7,size:yt,rotate:A?0:90})}],D=[{id:"stretch",title:C("align.title.stretch"),label:c.jsx(se,{icon:op,size:yt,rotate:A?0:90})},{id:"flex-start",title:C("align.title.start"),label:c.jsx(se,{icon:tc,size:yt,rotate:A?90:0})},{id:"center",title:C("align.title.center"),label:c.jsx(se,{icon:nc,size:yt,rotate:A?90:0})},{id:"flex-end",title:C("align.title.end"),label:c.jsx(se,{icon:sc,size:yt,rotate:A?90:0})}],L=[{id:"flex-start",title:C("alignContent.title.start"),label:c.jsx(se,{icon:tc,size:yt,rotate:A?90:0,horizontal:A&&T,vertical:!A&&T})},{id:"center",title:C("alignContent.title.center"),label:c.jsx(se,{icon:nc,size:yt,rotate:A?90:0})},{id:"flex-end",title:C("alignContent.title.end"),label:c.jsx(se,{icon:sc,size:yt,rotate:A?90:0,horizontal:A&&T,vertical:!A&&T})},{id:"space-between",title:C("alignContent.title.spaceBetween"),label:c.jsx(se,{icon:mv,size:yt,rotate:A?90:0})},{id:"space-around",title:C("alignContent.title.spaceAround"),label:c.jsx(se,{icon:vv,size:yt,rotate:A?90:0})},{id:"stretch",title:C("alignContent.title.stretch"),label:c.jsx(se,{icon:op,size:yt,rotate:A?0:90})}],V=[{id:"auto",title:C("alignSelf.title.auto"),label:c.jsx(se,{icon:K.close,size:yt})},{id:"flex-start",title:C("alignSelf.title.start"),label:c.jsx(se,{icon:tc,size:yt,rotate:90})},{id:"center",title:C("alignSelf.title.center"),label:c.jsx(se,{icon:nc,size:yt,rotate:90})},{id:"flex-end",title:C("alignSelf.title.end"),label:c.jsx(se,{icon:sc,size:yt,rotate:90})},{id:"stretch",title:C("alignSelf.title.stretch"),label:c.jsx(se,{icon:op,size:yt,rotate:0})}],U=[{id:"0 0 auto",label:c.jsx(se,{icon:K.close,size:yt}),title:C("flex.title.auto")},{id:"1 1 0%",label:c.jsx(se,{icon:K.unfoldMoreHorizontal,size:yt,rotate:90}),title:C("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(se,{icon:K.unfoldLessHorizontal,size:yt,rotate:90}),title:C("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:H}=n,B=()=>{const I=n.getSelected();let R={},W={};if(I){const Z=I.getEl();if(Z){R=window.getComputedStyle(Z);const X=Z.parentElement;X&&(W=window.getComputedStyle(X))}}o(R),a(W)},k=H.events.target;return n.on(k,B),B(),()=>n.off(k,B)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(Ae,{...Mt(l,y),...pf,tip:C(`display.tips.${j}`)})}),E&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(tn,{...Rs(u,y),options:_})}),c.jsx(ve,{children:c.jsx(tn,{...Rs(d,y),options:N})}),c.jsx(ve,{children:c.jsx(tn,{...Rs(p,y),options:D})}),c.jsx(ve,{children:c.jsx(xn,{property:b,...y})}),c.jsx(ve,{children:c.jsx(Ae,{...Mt(f,y),...pf})}),f.getValue()!=="nowrap"&&c.jsx(ve,{children:c.jsx(tn,{...Rs(g,y),options:L})})]}),O&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{separatorTop:!0,children:C("flexChild")}),c.jsx(ve,{children:c.jsx(xn,{property:x,options:U,...y})}),c.jsx(ve,{children:c.jsx(tn,{...Rs(m,y),options:V})}),c.jsx(ve,{children:c.jsx(Ne,{...it(v,{sector:e,styleManagerDataConfig:t})})})]}),S.length>0&&c.jsx(Qs,{properties:S,...y})]})}const n7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function s7({sector:e,styleManagerDataConfig:t}){var x;const n=Ie(),s=e.getProperty("position"),r=s.getValue(),o=e.getProperty("top"),i=e.getProperty("right"),a=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},p=y=>n.t(`styleManager.position.${y}`),f=[s,o,i,a,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!f.includes(`${y.id}`)),m=n7.map(y=>({id:y,label:p(`presets.options.${y}`)})),v=["absolute","fixed"].includes(r),b=y=>{let w="auto",S="auto",C="auto",j="auto";switch(y){case"topLeft":w="0%",j="0%";break;case"topRight":w="0%",S="0%";break;case"bottomLeft":C="0%",j="0%";break;case"bottomRight":C="0%",S="0%";break;case"left":w="0%",C="0%",j="0%";break;case"right":w="0%",C="0%",S="0%";break;case"bottom":j="0%",C="0%",S="0%";break;case"top":j="0%",w="0%",S="0%";break;case"full":j="0%",w="0%",S="0%",C="0%";break}o.upValue(w),i.upValue(S),a.upValue(C),l.upValue(j)};return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:s,children:[c.jsx(Ae,{...Mt(s,d),tip:p(`tips.${(x=s.getOption())==null?void 0:x.id}`),...pf}),v&&c.jsx(F,{children:c.jsx(zt,{title:p("presets.title"),children:c.jsx(Ae,{options:m,onChange:b,emptyState:"P",size:"s",caret:"",value:!0})})})]}),r!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(ve,{col:!0,children:[c.jsx($,{className:Y("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...it(o,d)})}),c.jsxs($,{gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(Ne,{...it(l,d)})}),c.jsx(F,{grow:!0,children:c.jsx(Ne,{...it(i,d)})})]}),c.jsx($,{className:Y("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...it(a,d)})})]}),c.jsx(ve,{children:c.jsx(Ne,{...it(u,d)})})]}),g.length>0&&c.jsx(Qs,{properties:g,...d})]})}function r7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),s=e.getProperty("min-width"),r=e.getProperty("max-width"),o=e.getProperty("height"),i=e.getProperty("min-height"),a=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,s,r,o,i,a].map(p=>p==null?void 0:p.id),d=e.getProperties().filter(p=>!u.includes(`${p.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[n,o],children:[c.jsx(Ne,{...it(n,l)}),c.jsx(Ne,{...it(o,l)})]}),c.jsxs(ve,{property:[s,i],children:[c.jsx(Ne,{...it(s,l)}),c.jsx(Ne,{...it(i,l)})]}),c.jsxs(ve,{property:[r,a],children:[c.jsx(Ne,{...it(r,l)}),c.jsx(Ne,{...it(a,l)})]}),d.length>0&&c.jsx(Qs,{properties:d,...l})]})}function o7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),s=e.getProperty("margin"),r={sector:e,styleManagerDataConfig:t},o=[n,s].map(a=>a==null?void 0:a.id),i=e.getProperties().filter(a=>!o.includes(`${a.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,...r}),c.jsx(xn,{property:s,...r}),i.length>0&&c.jsx(Qs,{properties:i,...r})]})}function i7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),s=e.getProperty("color"),r=e.getProperty("font-size"),o=e.getProperty("font-weight"),i=e.getProperty("line-height"),a=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),p=e.getProperty("text-transform"),f=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},v=[n,s,r,o,i,a,l,u,d,p,f,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:x}=dl();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(ve,{property:n,children:x?c.jsx(Du,{...Rw(n,m)}):c.jsx(Ae,{...Mt(n,m)})}),!!s&&c.jsx(ve,{property:s,children:c.jsx(Ks,{...Vo(s,m)})}),c.jsxs(ve,{property:[r,o],children:[!!r&&c.jsx(Ne,{...it(r,m)}),!!o&&c.jsx(Ae,{...Mt(o,m)})]}),c.jsxs(ve,{property:[i,a],children:[!!i&&c.jsx(Ne,{...it(i,m)}),!!a&&c.jsx(Ne,{...it(a,m)})]}),c.jsxs(ve,{property:[l,u],children:[!!l&&c.jsx(Ae,{...Mt(l,m)}),!!u&&c.jsx(Ae,{...Mt(u,m)})]}),c.jsxs(ve,{property:[p,f],children:[!!p&&c.jsx(Ae,{...Mt(p,m)}),!!f&&c.jsx(Ae,{...Mt(f,m)})]}),c.jsxs(ve,{property:[g,d],children:[!!g&&c.jsx(Ae,{...Mt(g,m)}),!!d&&c.jsx(Ae,{...Mt(d,m)})]}),b.length>0&&c.jsx(Qs,{properties:b,...m})]})}const pf={row:!0,classNameLabel:"gs-utl-w-full"},a7=({property:e,skipClear:t,label:n,afterLabelButtons:s=[]})=>c.jsxs($,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(F,{grow:!1,children:c.jsx(Mr,{property:e,skipClear:t,label:n})}),!!s.length&&c.jsx($,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:s.map((r,o)=>c.jsx(St,{...r},o))})]}),ff="gs-style-manager",Wc=`${ff}-sector`,l7=`${Wc}-header`,c7=`${Wc}-content`,$w=(e,t=0,n=!0)=>M(l7,z.bgH2,Pe.xyS,z.br,t&&te.bt,(e||n)&&te.bb),u7=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),d7=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),Cl=(e,t)=>{const n=p7(e,t),s=Tw(n),{hasDataResolverValue:r}=n,{label:o}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:r,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:s.length?"span":void 0,label:c.jsx(a7,{property:e,skipClear:r,label:o,afterLabelButtons:s})}}},tg=(e,t)=>{const{connectDataSources:n,commonProps:s}=Cl(e,t);return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(r,o)=>e.upValue(r,{partial:o})}},kw=(e,t,n)=>{const{connectDataSources:s,commonProps:r}=Cl(e,t),{hasDataResolverValue:o,initialDataValue:i}=s;return{fieldProps:{...r,value:o?i:e.getValue(),options:u7(e,n??{}),onChange:a=>e.upValue(a)},connectDataSources:s}},Rs=(e,t,n)=>kw(e,t,n).fieldProps,Mt=(e,t,n)=>{const{fieldProps:s,connectDataSources:r}=kw(e,t,n),{hasDataResolverValue:o}=r,i=o?e.getValue()||" ":s.emptyState;return{...s,emptyState:i,hideCaret:o}},Rw=(e,t)=>{const{commonProps:n,connectDataSources:s}=Cl(e,t),r=s.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:r,hideCaret:s.hasDataResolverValue,value:s.dataResolverValue??e.getValue(),onChange:o=>e.upValue(o)}},Nr=(e,t,n={})=>{const{connectDataSources:s,commonProps:r}=Cl(e,t),{hasDataResolverValue:o,dataResolverValue:i}=s;return{...r,title:e.getLabel(),emptyState:o?i:void 0,titleAdd:`Add new ${e.getLabel()}`,items:o?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:a=>e.getLayerLabel(a),add:o?void 0:()=>e.addLayer(n,{at:0}),select:a=>e.selectLayer(a),remove:a=>e.removeLayer(a),move:(a,l=0)=>e.moveLayer(a,l)}},it=(e,t)=>{const{connectDataSources:n,commonProps:s}=Cl(e,t),{hasDataResolverValue:r}=n;return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,i)=>e.upValue(o,{partial:i}),valueUnit:e.getUnit(),pan:!r,units:r?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:o=>e.upUnit(o)}};function p7(e,t){const{styleManagerDataConfig:n=!1,sector:s}=t,r=e.em.getEditor(),{Styles:o}=r,i=r.getSelected(),a=o.getSelectedAll(),l=o.getSelected();let u=!1;n===!0?u=!0:i&&yr(n)&&tt(n.enable)&&(u=n.enable({property:e,sector:s,component:i,editor:r}));const d=e.getName(),p=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",f=Yr(p),g=i==null?void 0:i.collectionsStateMap;return{hasDataResolverValue:f,dataResolverValue:f?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{a.forEach(v=>{v.addStyle({[d]:m})})},handleValueClear:()=>{a.forEach(m=>{const v=m.getStyle()[d]??"";m.addStyle({[d]:v})})},editor:r,additionalSources:g}}const Vo=(e,t)=>tg(e,t),f7=(e,t)=>{const{label:n,...s}=tg(e,t);return{...s,label:n,isContain:e.get("contain")??!0,hideButton:s.disabled,inputField:e.get("inputField"),onOpen(){const r=e.em.Assets;r.open({select(o){e.upValue(o.getSrc()),r.close()}})}}},h7=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let s=W9;switch(n){case"gs-layout":s=t7;break;case"gs-size":s=r7;break;case"gs-space":s=o7;break;case"gs-position":s=s7;break;case"gs-borders":s=Y9;break;case"gs-effects":s=J9;break;case"gs-typography":s=i7;break;case"gs-background":s=Z9;break}return c.jsx(s,{sector:e,styleManagerDataConfig:t})},ip={},Iw=ce(function({className:t,sectors:n}){var m;const[s,r]=h.useState(ip),o=xe(),{editor:i}=o,a=i==null?void 0:i.Styles,l=a==null?void 0:a.getSelected(),u=i==null?void 0:i.getSelected(),d=`${ff}__empty-state ${Pe.s} gs-utl-text-center`,p=v=>i==null?void 0:i.t(`styleManager.${v}`);if(h.useEffect(()=>{if(u&&i){const v=setTimeout(()=>{let b=ip;const x=u.get("styleManager");tt(x)&&(b=x({editor:i,component:u})),r(b||ip)});return()=>clearTimeout(v)}},[u,i]),!a||!l)return c.jsx(F,{className:d,children:p("empty")});const f=n.length?n:a.getSectors({visible:!0}),g=(m=o.sdkOptions.dataSources)==null?void 0:m.styleManager;return s.disabled?null:c.jsxs("div",{className:M(ff,t,"gs-utl-select-none"),children:[!f.length&&c.jsx(F,{className:d,children:p("notFound")}),f.map((v,b)=>c.jsx(vr,{open:v.isOpen(),onChange:({open:x})=>v.setOpen(x),classNameWrap:M(Wc,`${Wc}__${v.id}`),sticky:!0,handler:()=>{const x=v.getProperties({withValue:!0}).length>0,y=v.getProperties({withParentValue:!0}).length>0;return c.jsxs($,{gap:"xs",items:"center",children:[c.jsx(F,{className:"gs-utl-mr-2",children:v.getName()}),x&&c.jsx(F,{children:c.jsx("div",{className:M(_e.dot,z.bgA2)})}),y&&c.jsx(F,{children:c.jsx("div",{className:M(_e.dot,z.bgW)})})]})},className:x=>$w(x,b,b===f.length-1),children:c.jsx($,{className:M(c7,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:h7(v,{styleManagerDataConfig:g})})},v.id))]})}),g7=Zt(function({children:t,className:n,content:s,...r},o){return c.jsx("div",{className:M(ie("gs-design-manager-tab"),n),ref:o,...r,children:t})}),bv="gs-cmp-sidebar-right",yv="gs-cmp-traits-provider",ap=M("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function m7(e={}){var P,T,A;const{propsInStyles:t,hideTabs:n,hideSelectors:s,tabsProps:r}=e,{isCssPanelActive:o,selectedDesignerTab:i,showSelectors:a,setSelectedDesignerTab:l,sdkProps:u,sdkOptions:d,isProjectTypeEmail:p}=xe(),f=Ie(),g=M(o&&"gs-utl-hidden"),v=(((P=Xn(u.children,g7))==null?void 0:P.filter(Boolean))||[]).map(({props:_},N)=>({id:_.id,label:_.label,content:c.jsx(gl,{children:_.children}),order:_.order??2+N+1})),b=t??((T=d.designPanel)==null?void 0:T.propsInStyles),x=n??((A=d.designPanel)==null?void 0:A.hideTabs),y=b===!0||p&&b!==!1,w=x===!0||p&&x!==!1,S=s===void 0?a:!s,C=f.t("traitManager.panelLabel"),j=M(`${bv}__tabs`,w&&"gs-utl-hidden",r==null?void 0:r.className),O=[{id:"style",label:f.t("styleManager.panelLabel"),order:1,content:c.jsxs($,{col:!0,full:!0,children:[!!S&&c.jsx(F,{className:M("gs-cmp-selectors-provider",Pe.s,te.bb,z.br),children:c.jsx(Ny,{children:_=>c.jsx(Aw,{..._})})}),y&&c.jsx(F,{className:M(yv,ap),children:c.jsx(vr,{handler:C,className:$w(!1),sticky:!0,open:!0,children:c.jsx(zp,{children:_=>c.jsx(uf,{..._,className:M("gs-utl-p-2",z.br,te.bb)})})})}),c.jsx(F,{className:M("gs-cmp-styles-provider",ap),grow:!0,children:c.jsx($y,{children:_=>c.jsxs(c.Fragment,{children:[o&&c.jsx(ky,{}),c.jsx(Iw,{className:g,..._})]})})})]})},!y&&{id:"props",label:C,order:2,content:c.jsx($,{className:yv,col:!0,full:!0,children:c.jsx(F,{className:M(Pe.s,ap),children:c.jsx(zp,{children:_=>c.jsx(uf,{..._})})})})},...v].filter(Boolean).sort((_,N)=>_.order-N.order);return c.jsx($,{className:bv,col:!0,full:!0,nowrap:!0,children:c.jsx(io,{...r,value:i,onChange:l,tabs:O,className:j})})}const Vw=ce(m7),v7="gs-panel-sidebar-tabs",b7=h.memo(ce(function({className:t,propsInStyles:n,hideTabs:s,hideSelectors:r,tabsProps:o,...i}){return c.jsx(Ps,{className:M(v7,"gs-utl-h-full",t),...i,children:c.jsx(Vw,{propsInStyles:n,hideTabs:s,hideSelectors:r,tabsProps:o})})})),y7="gs-panel-styles",x7=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:s}=xe(),r=M(s&&" gs-utl-hidden");return c.jsx(Ps,{className:M(y7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx($y,{children:o=>c.jsxs(c.Fragment,{children:[s&&c.jsx(ky,{}),c.jsx(Iw,{className:r,...o})]})})})})),w7="gs-panel-templates",S7=h.memo(ce(function({className:t,templates:n,content:s,onSelect:r,...o}){const i=X0(),{projectTypeFilter:a}=i;let l=n??i.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||i.loadTemplates()},[n]),c.jsx(Ps,{className:M(w7,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...o,children:c.jsx($,{className:ie("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx($,{className:ie("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(bx,{templates:l,projectType:jt[a],content:s,onSelect:r,skipProjectNamePopover:!0})})})})})),C7="gs-cmp-row",j7=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(jn,{className:M(C7,z.bg,"gs-utl-flex",s&&"gs-utl-w-full",t),...r,children:$t(n)})}),E7="gs-cmp-select-field",P7=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,options:i,size:a,onChange:l,required:u,disabled:d,emptyState:p,editorEvents:f}){const{editor:g}=xe(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:s,name:r,value:o,options:i,size:a,emptyState:p})),b=x=>{l({value:x,editor:g,state:m,setState:y=>v(w=>({...w,...y}))})};return xr({editor:g,editorEvents:f,localState:m,setLocalState:v}),c.jsx(Ae,{classNameContainer:M(E7,m.className),style:m.style,label:m.label,name:m.name,value:m.value??"",options:m.options??[],size:m.size,required:m.required,disabled:m.disabled,emptyState:m.emptyState,onChange:b})})),T7="gs-cmp-select-field",O7=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,size:i,onChange:a,required:l,disabled:u,emptyState:d,editorEvents:p}){const{editor:f}=xe(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:s,name:r,value:o,size:i,emptyState:d})),v=b=>{a({value:b,editor:f,state:g,setState:x=>m(y=>({...y,...x}))})};return xr({editor:f,editorEvents:p,localState:g,setLocalState:m}),c.jsx(Du,{classNameContainer:M(T7,g.className),style:g.style,label:g.label,name:g.name,value:g.value??"",size:g.size,required:g.required,disabled:g.disabled,emptyState:g.emptyState,onChange:v})})),_7="gs-sidebar-bottom",A7=h.memo(ce(function({children:t,className:n,style:s,height:r,...o}){const{isInPreview:i,isBottomSidebarOpen:a}=xe(),l=r??35,u=h.useMemo(()=>({height:l,marginBottom:i||!a?`-${l}px`:0,...s}),[i,a,s]);return c.jsx(jn,{className:M(_7,"gs-utl-flex gs-utl-transition-spacing",te.bt,z.br,n),style:u,...o,children:t?$t(t):void 0})})),L7=ce(function(t){var w;const{leftSidebarSize:n,setLeftSidebarSize:s,editor:r,isInPreview:o,isLeftSidebarOpen:i,sdkProps:a,showPages:l}=xe(),u=a.children,d=((w=t.style)==null?void 0:w.width)??t.width,p=d??n,f=t.resizable===!1,g=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,z.br),m=M("gs-utl-w-full",te.bb,z.br),v=M("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:o||!i?`-${p}px`:0,...t.style}),[p,o,i,t.style]),x=()=>r==null?void 0:r.refresh(),y=(S,C,j)=>{s(j.getBoundingClientRect().width)};return c.jsx(Hu,{className:g,enable:f?!1:void 0,right:!f,style:b,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:x,onResizeStop:y,children:t.children??c.jsxs($,{full:!0,col:!0,children:[l&&c.jsx(F,{className:m,children:c.jsx(My,{children:S=>c.jsxs(c.Fragment,{children:[Xn(u,ww),c.jsx(yw,{...S}),Xn(u,xw)]})})}),c.jsx(F,{className:v,grow:!0,children:c.jsx(Ly,{children:S=>c.jsxs(c.Fragment,{children:[Xn(u,Yx),c.jsx(Kx,{...S}),Xn(u,Zx)]})})})]})})}),M7="gs-sidebar-left",N7=h.memo(ce(function({children:t,width:n,resizable:s,...r}){return c.jsx(L7,{className:M(M7,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Pu(r)),width:n,resizable:s,style:Tu(r),children:t?$t(t):void 0})})),$7=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:s,editor:r,isInPreview:o,isRightSidebarOpen:i}=xe(),a=((m=t.style)==null?void 0:m.width)??t.width,l=a??n,u=t.resizable===!1,d=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.bl,z.br),p=h.useMemo(()=>({marginRight:o||!i?`-${l}px`:0,...t.style}),[l,o,i,t.style]),f=()=>r==null?void 0:r.refresh(),g=(v,b,x)=>{s(x.getBoundingClientRect().width)};return c.jsx(Hu,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:l,minWidth:a??200,maxWidth:a??400,onResize:f,onResizeStop:g,children:t.children??c.jsx(Vw,{})})}),k7="gs-sidebar-right",R7=h.memo(ce(function({children:t,resizable:n,...s}){return c.jsx($7,{className:M(k7,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Pu(s)),resizable:n,style:Tu(s),children:t?$t(t):void 0})})),I7=ce(function({className:t,variant:n,value:s,tabs:r,style:o,editorEvents:i,onChange:a}){const{editor:l}=xe(),[u,d]=h.useState(()=>({tabs:r,style:o,value:s,variant:n,className:t})),p=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:$t(m.children)})))||[]},[u.tabs]),f=g=>{a&&l?a({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return xr({editor:l,editorEvents:i,localState:u,setLocalState:d}),c.jsx(io,{tabs:p,className:M(u.className),variant:u.variant,value:u.value,style:u.style,onChange:f})}),V7="gs-cmp-text",H7=h.memo(function({className:t,content:n,children:s,...r}){return c.jsx(jn,{className:M(V7,t),...r,children:s||n})}),D7="gs-cmp-virtual-list",F7=ce(function({id:t,items:n,itemLayout:s,footerLayout:r,onRef:o,itemsPerRow:i=12,className:a,style:l,htmlAttrs:u}){const[d,p]=h.useState(0),{editor:f,transitionTime:g}=xe(),m=$h(i),v=i===1;h.useEffect(()=>{const w=setTimeout(()=>p(S=>++S),g);return()=>clearTimeout(w)},[g]);const b={id:t,...u},x=!!d&&!!f,y={data:n,style:l,className:M(D7,"gs-utl-h-full",a),itemContent:(w,S)=>c.jsx(h.Fragment,{children:s?$t(s({item:S,index:w,editor:f})):c.jsx("pre",{children:JSON.stringify(S,void 0,2)})},S.id??w),components:{Footer:r&&f?()=>$t(r({editor:f})):void 0}};return x&&(v?c.jsx(V$,{...b,...y,ref:o},t):c.jsx($u,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:o},t))});var hf=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",e.colorField="colorField",e.colorPicker="colorPicker",e.menuList="menuList",e.inputField="inputField",e.codeField="codeField",e.selectField="selectField",e.selectFontField="selectFontField",e.tabs="tabs",e.devices="devices",e.custom="custom",e.panelLayers="panelLayers",e.panelPages="panelPages",e.panelSelectors="panelSelectors",e.panelStyles="panelStyles",e.panelProperties="panelProperties",e.panelSidebarTabs="panelSidebarTabs",e.panelPagesLayers="panelPagesLayers",e.panelBlocks="panelBlocks",e.panelPageSettings="panelPageSettings",e.panelGlobalStyles="panelGlobalStyles",e.panelAssets="panelAssets",e.panelTemplates="panelTemplates",e.sidebarLeft="sidebarLeft",e.sidebarRight="sidebarRight",e.sidebarTop="sidebarTop",e.sidebarBottom="sidebarBottom",e.canvas="canvas",e.canvasSidebarTop="canvasSidebarTop",e.virtualList="virtualList",e.dataPathField="dataPathField",e.panelDataVariablePicker="panelDataVariablePicker",e.panelDataConditionPicker="panelDataConditionPicker",e.panelDataCollectionPicker="panelDataCollectionPicker",e.panelDataValuePicker="panelDataValuePicker",e))(hf||{});const B7={icon:se,row:j7,column:SR,text:H7,tabs:I7,button:Eu,buttonMenu:eN,buttonGroupField:nN,colorField:bR,colorPicker:xR,menuList:f6,inputField:d6,codeField:jk,selectField:P7,selectFontField:O7,devices:xx,panelPages:Sw,panelPageSettings:UI,panelLayers:Xx,panelPagesLayers:XI,panelBlocks:G6,panelGlobalStyles:s8,panelSelectors:R9,panelStyles:x7,panelProperties:j9,panelSidebarTabs:b7,panelAssets:k6,panelTemplates:S7,sidebarRight:R7,sidebarLeft:N7,sidebarTop:wx,sidebarBottom:A7,canvas:Iy,canvasSidebarTop:Sk,virtualList:F7,dataPathField:n6,panelDataVariablePicker:c6,panelDataConditionPicker:e6,panelDataCollectionPicker:FR,panelDataValuePicker:o6},$t=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=F3();return t.filter(Boolean).map((s,r)=>{const{type:o,...i}=dt(s)?{type:hf.text,content:s}:s||{},a=i.id||"",l=B7[o],u=n.layoutChildren.get(a),d=n.customLayoutComponents.get(o),p=a||r;if(u)return c.jsx(Vp,{id:a,...u},p);if(d){const f=d({id:a,...i});return $t([f])[0]}else{if(o===hf.custom)return c.jsx(Vp,{id:a,...i},p);if(l)return c.jsx(l,{id:a,...i},p)}return null})},z7=ce(({components:e})=>(wu().customLayoutComponents,$t(e))),xr=e=>{const{editorEvents:t,editor:n,localState:s,setLocalState:r}=e;h.useEffect(()=>{if(!t||!n)return;const o=Object.keys(t).reduce((a,l)=>(a[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:s,setState:p=>r(f=>({...f,...p}))})},a),{}),i=Object.keys(o);return i.forEach(a=>n.on(a,o[a])),()=>{i.forEach(a=>n.off(a,o[a]))}},[n,s])},U7=e=>e.Assets.getAll().reduce((s,r)=>{const o=r.getSrc(),i=o.match(/^data:([^;]+);/);if(i){const a=o.split(",")[1],l=f3(r.get("name")||`${a.substring(0,20)}`);s[o]={mime:i[1],name:l,base64:a}}return s},{}),W7=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),xv=(e,t,n={})=>{let s=e;const r=n.pathPfx||"";for(const o in t)if(s.includes(o)){const i=t[o];s=s.replace(new RegExp(W7(o),"g"),`${r}${i.name}`),i.found=!0}return s},G7=(e,t,n)=>`${t||""}${e||""}${n||""}`,q7=(e,t)=>{const n=e?`<div ${$c}>${e}</div>`:"",s=t?`<div ${$c} data-gjs-global>${t}</div>`:"";return`${n}${s}`},K7=async(e,t={})=>{const{page:n,skipProject:s,assetsFolder:r="assets",filenameCss:o="style.css",styles:i,isMJML:a,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,f={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=U7(e),b=`${r}/`,x=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=xv(x,v,{pathPfx:b}),w=i==="inline",S=i==="skip",C=i==="skipInPage",j=p==="skip",E=u?{}:Ei(e).globalPageSettings||{},O=[],P=(T,A)=>{var Ft,er,po;const{pageSettingOpts:_}=A||{},N=T.getName(),D=w||(_==null?void 0:_.replaceDataSources),L=Tr(T,"title",_)||N,V=Tr(T,"favicon",_),U=Tr(T,"description",_),H=Tr(T,"keywords",_),B=Tr(T,"socialTitle",_),k=Tr(T,"socialDescription",_),I=Tr(T,"socialImage",_),R=u?"":F0(Tr(T,"fonts")),W=an({page:T,key:"customCodeHead",opts:_})??"",Z=G7(W,E.customCodeHead,R),X=an({page:T,key:"customCodeBody",opts:_})??"",J=d?"":q7(X,E.customCodeBody),Q=T.getMainComponent(),G=j?"":e.getJs({component:Q}),ee=G?`<script>${G}<\/script>`:"",ae=[],ge=[],je={asDocument:!1,...f},Se=Q.toHTML(je).replace("</body>",()=>`${J}${ee}</body>`),et=Q.head;let Ye=L&&`<title>${L}</title>`,Ct=V&&`<link rel="icon" href="${V}"/>`,ct=U&&`<meta name="description" content="${U}"/>`,we=H&&`<meta name="keywords" content="${H}"/>`,nt=B&&`<meta property="og:title" content="${B}"/>`,st=k&&`<meta property="og:description" content="${k}"/>`,vt=I&&`<meta property="og:image" content="${I}"/>`,Me='<meta charset="utf-8">',pt='<meta name="viewport" content="width=device-width,initial-scale=1">',ut='<meta name="robots" content="index,follow">',Fe='<meta name="generator" content="GrapesJS Studio">';et.components().forEach(Xe=>{const bt=Xe.toHTML(f);ft.title({cmp:Xe})?Ye=bt:ft.favicon({cmp:Xe})?Ct=bt:ft.description({cmp:Xe})?ct=bt:ft.keywords({cmp:Xe})?we=bt:ft.socialTitle({cmp:Xe})?nt=bt:ft.socialDescription({cmp:Xe})?st=bt:ft.socialImage({cmp:Xe})?vt=bt:ft.charset({cmp:Xe})?Me=bt:ft.viewport({cmp:Xe})?pt=bt:ft.robots({cmp:Xe})?ut=bt:ft.generator({cmp:Xe})&&(Fe=bt)}),Ye&&ae.push(Ye),Me&&ae.push(Me),pt&&ae.push(pt),ut&&ae.push(ut),Fe&&ae.push(Fe),ct&&ae.push(ct),we&&ae.push(we),nt&&ae.push(nt),st&&ae.push(st),vt&&ae.push(vt),Ct&&ae.push(Ct),ge.length&&ae.push(...ge),Z&&ae.push(Z),y&&!(S||C)&&ae.push(D?`<style>${y}</style>`:`<link rel="stylesheet" href="./${o}">`);const he=Q.doctype||"<!DOCTYPE html>",Ve=(er=(Ft=Q.docEl).__attrToString)==null?void 0:er.call(Ft,f),De=(po=et.__attrToString)==null?void 0:po.call(et,f),$e=e.getHtml(f).trim(),Ot=a?e.runCommand(Cu,{mjml:$e}).html:`${he}
335
- <html${Ve?` ${Ve}`:""}>
336
- <head${De?` ${De}`:""}>
337
- ${ae.join(`
334
+ }`),t},Gn="gs-cmp-selector-manager",op={},Ww=ue(function(t){var ie,ae,me;const{selectedState:n,states:s,setState:r,styleCatalog:o,stateSelector:i}=t,a=Se(),[l,u]=g.useState(!1),[d,p]=g.useState([]),[f,h]=g.useState(op),{toggleCssPanel:m,isCssPanelActive:b,editor:v,store:x}=Se(),{i18nStore:y,modalStore:w}=x,S=v==null?void 0:v.getSelected(),j=v==null?void 0:v.Styles.getSelected();if(g.useEffect(()=>{if(v&&j&&a){const ve=setTimeout(()=>{let ke=op;const Re=S==null?void 0:S.get("selectorManager");S&&rt(Re)&&(ke=Re({editor:v,component:S})),h(ke||op),p(s7(v,a))});return()=>clearTimeout(ve)}},[S,v,j,a]),!v)return null;const{Selectors:C}=v,E=f.disableClasses,O=f.disableComponent,P=E&&O,T=C.getComponentFirst()&&!O,A=C.getSelectedAll(),_=v.getSelectedAll(),N=s.map(ve=>({id:ve.getName(),label:ve.getLabel()})),V=v.getModel(),M=(ie=j==null?void 0:j.getDevice)==null?void 0:ie.call(j),I=(ae=j==null?void 0:j.getState)==null?void 0:ae.call(j),U=L("gs-utl-overflow-hidden",se.b,se.rnd,z.br),F=L(z.bA),W=L("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",se.br,z.br),H=`${z.bgA}`,R=r7(j),$=A.length>0,B=_.length>0,Z=$||B,Y=T&&B||!T&&!$,ee=Y?"Components":"Selectors",X=ve=>y.t(`selectorManager.${ve}`),G=y.t("modals.styleCatalog.title"),Q=()=>w.open({title:G,content:c.jsx(X9,{})});return c.jsxs(k,{className:Gn,gap:"s",col:!0,full:!0,children:[c.jsxs(k,{className:L(`${Gn}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(k,{className:L(`${Gn}__head-start`),items:"center",gap:"s",children:[c.jsx(D,{className:L(`${Gn}__head-title`),children:X("selection")}),o!==!1&&c.jsx(D,{className:L(`${Gn}__style-catalog`),children:c.jsx(Ut,{className:"gs-utl-cursor-pointer",onClick:Q,title:G,children:c.jsx(ne,{icon:K.paletteSwatch,size:oe.s})})})]}),!!j&&i!==!1&&!P&&c.jsx(D,{className:`${Gn}__head-end`,children:c.jsx(_e,{size:"s",value:n,options:N,includeEmpty:!0,onChange:r,emptyState:`- ${X("state")} -`,className:L(n&&z.bA)})})]}),Z&&!P?c.jsxs(c.Fragment,{children:[!E&&c.jsxs(k,{className:L(`${Gn}__field-selectors`,U,!Y&&F),items:"stretch",gap:"xs",children:[c.jsx(Ut,{title:X($?"applyOnSelector":"noSelectors"),className:L(W,!Y&&H),onClick:()=>$&&C.setComponentFirst(!1),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:K.tag,size:oe.sx})})}),c.jsx(D,{grow:!0,children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Vw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:X("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:ve=>{ve&&(C.addSelected(ve.id||ve.label),u(!1))}}):c.jsxs(c.Fragment,{children:[B&&c.jsx(St,{title:X("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(ne,{icon:K.plus,size:oe.sx})}),A.map(ve=>c.jsx(J9,{selector:ve,removable:B,toggleable:B&&A.filter(ke=>ke.getActive()||ke===ve).length>1},ve.toString()))]})})})]}),!O&&c.jsxs(k,{className:L(`${Gn}__field-components`,U,Y&&F),items:"stretch",gap:"xs",children:[c.jsx(Ut,{title:X(B?"applyOnComponents":"noComponents"),onClick:()=>B&&C.setComponentFirst(!0),className:L(W,Y&&H),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:K.targetVariant,size:oe.sx})})}),c.jsx(D,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:_.map(ve=>c.jsx(Ur,{s:"s",className:L("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>V.setHovered(ve),onPointerOut:()=>V.setHovered(),label:ve.getName()},ve.getId()))})})]}),c.jsxs(k,{className:`${Gn}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:X("selected")}),c.jsx("pre",{className:L("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",se.rnd,Pe.xyS),children:R}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:X("currentSelection")})]}),children:c.jsx(Ur,{className:L(se.b,se.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(ne,{icon:K.target,size:oe.sx})})}),c.jsx(D,{className:"gs-utl-text-sm",children:c.jsx(Ur,{className:L(se.b,se.rnd,z.br),s:"xs",nopad:!0,children:c.jsxs(k,{space:"xs",items:"center",nowrap:!0,children:[!!M&&M.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[X("device"),": ",c.jsx("b",{children:M.getName()})]}),children:c.jsx(ne,{icon:K.cellphoneLink,size:oe.sx})}),c.jsx(D,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[X("target"),": ",c.jsx("b",{children:ee}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(me=j==null?void 0:j.selectorsToString)==null?void 0:me.call(j,{skipState:1})]})]}),children:c.jsx(ne,{icon:Y?K.targetVariant:K.tag,size:oe.sx})}),!!I&&c.jsxs(c.Fragment,{children:[c.jsx(D,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[X("state"),": ",c.jsx("b",{children:I.getLabel()})]}),children:c.jsx(ne,{icon:K.flare,size:oe.sx})})]})]})})}),c.jsx(St,{title:y.t("toggleCss"),onClick:m,active:b,size:"s",children:c.jsx(ne,{icon:K.codeBraces,size:oe.sx})})]})]}):c.jsxs(k,{className:L(`${Gn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(D,{className:`${Gn}__empty-state-title`,children:X("noSelecton")}),c.jsxs("ul",{className:L(`${Gn}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:X("selectFromCanvas")}),c.jsx("li",{children:X("selectFromList")})]})]})]})}),o7="gs-panel-selectors",i7=g.memo(ue(function({className:t,styleCatalog:n,stateSelector:s,...r}){return c.jsx(_s,{className:L(o7,t),...r,children:c.jsx(zy,{children:o=>c.jsx(Ww,{...o,styleCatalog:n,stateSelector:s})})})}));function ar({label:e,property:t,hasValue:n,empty:s,onClear:r,children:o,shallow:i,row:a,tooltip:l,skipClear:u,afterLabel:d,className:p,...f}){const h=e||(t==null?void 0:t.getLabel()),m=t==null?void 0:t.getParentTarget(),b=n||!s&&(t==null?void 0:t.hasValue({noParent:!0})),v=!b&&(t==null?void 0:t.hasValue())&&m,x=m==null?void 0:m.getDevice(),y=m==null?void 0:m.getState(),w=m==null?void 0:m.getComponent(),S=()=>r?r():t==null?void 0:t.clear(),j={className:L(p,"gs-utl-text-sm gs-utl-w-full"),col:!a,items:a?"center":void 0,...f},C=L(b&&!i&&z.tAo);return t&&!t.isVisible()?null:c.jsxs(k,{gap:"xs",...j,children:[c.jsxs(k,{className:"gs-utl-flex-1",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(D,{children:c.jsx(Ut,{title:l,children:c.jsx(ne,{icon:K.information,size:oe.sx})})}),c.jsx(D,{className:C,children:s?c.jsx("span",{children:" "}):h}),!!v&&!i&&c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"gs-utl-mb-1",children:"Value inherited from"}),!!x&&c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(ne,{icon:K.cellphoneLink,size:oe.sx})}),c.jsx(D,{children:c.jsx("b",{children:x.getName()})})]}),c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(ne,{icon:w?K.targetVariant:K.tag,size:oe.sx})}),c.jsxs(D,{children:[c.jsx("b",{children:w?"Components":"Selectors"}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",m==null?void 0:m.selectorsToString({skipState:1})]})]})]}),!!y&&c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(ne,{icon:K.flare,size:oe.sx})}),c.jsx(D,{children:c.jsx("b",{children:y.getLabel()})})]})]}),children:c.jsx("div",{className:L("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),b&&!i&&!u&&c.jsx(Ut,{title:"Clear value",onClick:S,children:c.jsx(ne,{className:L(Ae.click,C),icon:K.close,size:oe.s2x})}),d]}),!!o&&c.jsx(D,{grow:!0,className:"gs-utl-max-w-full",children:o})]})}function Yu(e){const t=e.indexOf("(")+1,n=e.lastIndexOf(")");return{name:e.substring(0,t-1).trim(),value:String.prototype.substring.apply(e,[t,n>=0?n:void 0]).trim()}}const a7=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,l7=/,(?![^(]*\))/,ip=/\s(?![^(]*\))/,c7=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,ap=/^circle|ellipse/i,oh=e=>{var d;const t=[],{name:n,value:s}=Yu(e),[r,...o]=s.split(l7).map(p=>p.trim()).filter(Boolean),i=o.length>1,a=i?r:"",l={type:"none"},u=i?o:[r,...o];if(a7.test(a))l.type="angle",l.value=a;else if(/^to\s/.test(a))l.type="side-or-corner",l.value=a;else if(c7.test(a))l.type="size",l.value=a;else if(ap.test(a)||/^at\s/.test(a)||/\sat\s/.test(a)){l.type="at",l.value=a;const p=((d=a.match(ap))==null?void 0:d[0])||"circle";l.shape=p;const f={x:"0%",y:"0%"},h={x:"0%",y:"0%"},[m,b]=a.replace(ap,"").trim().split("at").map(v=>v.trim());if(m){const[v,x]=m.split(ip);f.x=v,f.y=x||v}if(b){const[v,x]=b.split(ip);h.x=v,h.y=x||v}l.size=f,l.position=h}return u.forEach(p=>{const[f,h]=p.split(ip);t.push({color:f,hint:h?parseFloat(h):null})}),t.forEach((p,f)=>{p.hint===null&&(p.hint=f/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},Mr=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const r=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(o=>`${o.color} ${o.hint!=null?`${o.hint}%`:""}`.trim()).join(", ");return r?`${n}(${t}, ${r})`:"none"},u7=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),d7="gs-cmp-grad-picker";function p7({className:e,value:t,onChange:n}){var F,W,H;const s=oh(t),[r,o]=g.useState(s.colorStops),[i,a]=g.useState(null),l=g.useRef(null),u=g.useRef(null),d=J(d7,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,se.rnd),p=s.name||"linear-gradient",f=p.indexOf("radial")>=0,h=p.indexOf("repeating")>=0,m=s.orientation.value,b=`${parseFloat(`${m}`)||180}`,v=`${parseFloat(`${(F=s.orientation.size)==null?void 0:F.x}`)||0}`,x=`${parseFloat(`${(W=s.orientation.position)==null?void 0:W.x}`)||0}`,y=`${parseFloat(`${(H=s.orientation.position)==null?void 0:H.y}`)||0}`,w=0,S=100,j=(R,$=!1)=>{const B=u7(R);o(B),n==null||n(Mr({name:p,orientation:m,stops:B}),$)},C=(R,$=!1)=>{n==null||n(Mr({stops:r,name:p,orientation:`${R}deg`}),$)},E=(R,$=!1)=>{n==null||n(Mr({stops:r,name:p,orientation:`${R}px at ${x}% ${y}%`}),$)},O=(R,$=!1)=>{n==null||n(Mr({stops:r,name:p,orientation:`${v}px at ${R}% ${y}%`}),$)},P=(R,$=!1)=>{n==null||n(Mr({stops:r,name:p,orientation:`${v}px at ${x}% ${R}%`}),$)},T=R=>{const $=`${R?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(Mr({stops:r,orientation:m,name:$}))},A=R=>{const $=`${h?"repeating-":""}${R?"radial":"linear"}-gradient`;n==null||n(Mr({stops:r,orientation:R?"100px at 50% 50%":"90deg",name:$}))},_=R=>{var B;const $=u.current;if(!$||R==null){u.current=null;return}(B=$.hasPointerCapture)!=null&&B.call($,R)&&$.releasePointerCapture(R),u.current=null};g.useEffect(()=>{if(!i)return;const R=parseFloat(`${i.stop.hint}`),$=i.pointerId,B=Y=>{let X=(Y.clientX-i.x)*100;X=X/i.w,X=R+X,X=X<w?w:X,X=X>S?S:X,i.stop.hint=parseInt(`${X}`,10),j(r,!0)},Z=()=>{_($),a(null),j(r)};return window.addEventListener("pointermove",B),window.addEventListener("pointerup",Z),window.addEventListener("pointercancel",Z),()=>{window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",Z),window.removeEventListener("pointercancel",Z),_($)}},[i]),g.useEffect(()=>{i||o(s.colorStops)},[t,i]);const N=(R,$)=>{if(R.button!==0)return;R.preventDefault(),R.stopPropagation(),R.currentTarget.setPointerCapture(R.pointerId),u.current=R.currentTarget;const B=l.current;a({stop:$,pointerId:R.pointerId,w:(B==null?void 0:B.clientWidth)||0,h:(B==null?void 0:B.clientHeight)||0,x:R.clientX,y:R.clientY})},V=R=>{const $=l.current,B=($==null?void 0:$.clientWidth)||0,Z=($==null?void 0:$.clientHeight)||0;if(!B||!Z)return;const Y=R.nativeEvent.offsetX-(($==null?void 0:$.clientLeft)||0),ee=R.nativeEvent.offsetY-(($==null?void 0:$.clientTop)||0),X=Y/B*100,G=document.createElement("canvas"),Q=G.getContext("2d");if(!Q)return;G.width=B,G.height=Z;const ie=Q.createLinearGradient(0,0,B,0);r.forEach(Re=>ie.addColorStop(parseFloat(`${Re.hint}`)/100,Re.color)),Q.fillStyle=ie,Q.fillRect(0,0,G.width,G.height),G.style.background="black";const ae=Q.getImageData(Y,ee,1,1).data,me=ae[3]?(100/255*ae[3]/100).toFixed(2):0,ve=`rgba(${ae[0]}, ${ae[1]}, ${ae[2]}, ${me})`,ke=ve==="rgba(0, 0, 0, 0)"?"#000":ve;j([...r,{color:ke,hint:X}])},M=R=>{j(r.filter($=>$!==R))},I=(R,$,B)=>{$&&(R.color=$),j(r,B)},U=R=>(i==null?void 0:i.stop)===R;return c.jsxs(k,{className:d,col:!0,children:[!!(i!=null&&i.stop)&&c.jsx($x,{className:"cursor-colr"}),c.jsxs("div",{className:J("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:J("bg-checker h-8",se.rnd),children:c.jsx("div",{ref:l,className:J("w-full h-full cursor-cross",se.b,se.rnd,z.br),style:{backgroundImage:Mr({stops:r})},onClick:V})}),r.map((R,$)=>c.jsxs("div",{className:J("absolute top-0 h-full"),style:{left:`${R.hint}%`},children:[c.jsx("div",{className:J("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>M(R),children:c.jsx(ne,{icon:K.close,size:oe.s3x})}),c.jsx("div",{onPointerDown:B=>N(B,R),className:J("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",se.br,se.bl,U(R)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:J("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(zx,{value:R.color,onChange:(B,Z)=>I(R,B,Z),className:J("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},$))]}),c.jsxs(k,{space:"s",items:"center",children:[c.jsx(D,{grow:!0,children:c.jsx(Fa,{label:"Repeat",value:h,onChange:T})}),c.jsx(D,{grow:!0,children:c.jsx(Fa,{label:"Radial",value:f,onChange:A})})]}),f?c.jsxs(k,{space:"s",col:!0,children:[c.jsx(D,{children:c.jsx(k,{space:"s",items:"center",children:c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"S",size:"s",value:v,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(D,{children:c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"X",size:"s",value:x,onChange:O,valueUnit:"%",units:["%"]})}),c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"Y",size:"s",value:y,onChange:P,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(k,{space:"s",items:"center",nowrap:!0,children:c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"A",size:"s",value:b,onChange:C,valueUnit:"deg",units:["deg"]})})})]})}const f7="gs-sm-custom-type",g7=ue(function({property:t,editor:n}){const s=g.useRef(null),r=t.getType(),o=n.StyleManager,i=o.getType(r),a=i==null?void 0:i.view;return g.useEffect(()=>{const l=s.current;if(a&&l){const u=new a({model:t,config:o.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[a,t,n]),a&&c.jsx("div",{className:f7,ref:s})});function Gw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const vb="gs-cmp-style-field";function qw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:s}){const r=L(vb,`${vb}__${e.id}`),o={sector:t,styleManagerDataConfig:n},i=t.em.getEditor(),a=e.getType();switch(a){case"selectFont":return c.jsx(Uu,{className:r,...Xw(e,o),...s});case"number":case"slider":case"integer":return c.jsx(Ne,{className:r,...lt(e,o),...s});case"color":return c.jsx(Xs,{className:r,...Ho(e,o),...s});case"select":return c.jsx(_e,{className:r,...jt(e,o),...s});case"radio":return c.jsx(tn,{className:r,...Hs(e,o),...s});case"file":return c.jsx(Ua,{className:r,...V7(e,o),...s});case"composite":return c.jsx(xn,{className:r,property:e,corners:e.get("corners"),generic:e.get("generic"),...o});case"stack":{const l=e.getProperties();return c.jsx(Is,{className:r,...kr(e,o),children:c.jsx(tr,{properties:l,sector:t})})}default:{const l=i.StyleManager.getType(a);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(g7,{editor:i,property:e}):c.jsx(at,{className:r,...ih(e,o)})}}}const yb="gs-cmp-style-prop-row";function tr({properties:e,sector:t,styleManagerDataConfig:n}){const s={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(r=>{const o=r.getId(),i=L(yb,`${yb}__${o}`,Gw(r)&&"gs-utl-col-span-full");return r.isVisible()?c.jsx("div",{className:i,children:c.jsx(qw,{property:r,...s})},o):null})})}function h7({sector:e,styleManagerDataConfig:t}){const n=hl(),s=e.getProperties().filter(r=>r.isVisible()).map(r=>(n.sdkAddFonts&&r.getId()==="font-family"&&r.set("type","selectFont"),r));return c.jsx("div",{className:L("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(tr,{properties:s,sector:e,styleManagerDataConfig:t})})}const m7="gs-cmp-sector-row";function ye({className:e,children:t,bottom:n,separator:s,separatorTop:r,property:o,...i}){const a=c.jsx("div",{className:J("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",se.bb,z.br)}),l=J(m7,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(o)?o:[o]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?c.jsxs(c.Fragment,{children:[r&&a,c.jsx(k,{className:l,nowrap:!0,...i,children:t}),s&&a]}):null}function ta(e,t,n={}){const s=e.getType(),{compact:r=!1,sector:o,styleManagerDataConfig:i}=n,a=e.getParent(),l={sector:o,styleManagerDataConfig:i},u=e.getDefaultValue();if(s==="select"){const p={property:a.getName()};return c.jsx(_e,{...jt(e,l,p),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,p)||u:"Custom",onChange:f=>t.all.map(h=>h.upValue(f))}:{},label:void 0})}else return s==="color"?c.jsx(Xs,{...Ho(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p}))}:{},label:void 0}):c.jsx(Ne,{...lt(e,l),...r?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(f=>f.upValue(d,{partial:p})),onChangeUnit:d=>t.all.map(p=>p.upUnit(d))}:{},label:void 0})}const oc="gs-cmp-style-prop-composite";function xn({className:e,property:t,sector:n,styleManagerDataConfig:s,corners:r,hideLabel:o,compact:i,generic:a,children:l,options:u}){const[d,p]=g.useState(null);if(!(t!=null&&t.isVisible()))return null;const f={id:"custom",label:c.jsx(ne,{icon:K.borderStyle,size:oe.s}),title:"Custom"},h=[{id:"all",label:c.jsx(ne,{icon:K.borderAllVariant,size:oe.s}),title:"All"},f],m=t.isDetached(),b=t.getProperties(),v=b.length,[x,y,w,S]=b,j=x.getFullValue(),E=b.map(H=>H.getFullValue()).every(H=>H===j),O=d!==null?d:E||u?"all":f.id,P=u?[...u,f]:[],T=t.getFullValue(),A=P.some(H=>H.id===T),_=O===f.id||(u?!A:!1)||!!a,N={compact:i,sector:n,styleManagerDataConfig:s},V=c.jsx(ar,{property:i?null:x,shallow:!m,children:ta(x,null,N)}),M=c.jsx(ar,{property:i?null:y,shallow:!m,children:ta(y,null,N)}),I=!!w&&c.jsx(ar,{property:i?null:w,shallow:!m,children:ta(w,null,N)}),U=!!S&&c.jsx(ar,{property:i?null:S,shallow:!m,children:ta(S,null,N)}),F=i?{label:t.getLabel()}:{property:t},W=!a&&c.jsx(ye,{bottom:"0",children:l!==void 0?l:u?c.jsx(c.Fragment,{children:c.jsx(D,{grow:!0,children:c.jsx(tn,{size:"s",options:P,value:_?f.id:T,onChange:H=>{H===f.id?p(H):(t.upValue(H),p(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(D,{grow:!0,children:ta(x,{same:E,all:b},N)}),c.jsx(D,{grow:!0,children:c.jsx(tn,{size:"s",options:h,value:O,onChange:p})})]})});return c.jsxs(k,{className:J(oc,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsxs(ye,{className:`${oc}__main`,children:[!o&&c.jsx(ar,{...F,children:W}),o&&W]}),_&&c.jsx(ye,{col:!0,className:J(`${oc}__details`,"gjs-px-2 gjs-py-1",z.bgH2,se.rnd,se.b,z.br),children:a?c.jsx("div",{className:J(`${oc}__props`,"grid grid-cols-2 gap-2"),children:b.map(H=>c.jsx(ar,{property:H,shallow:!m,className:J(Gw(H)&&"col-span-full"),children:c.jsx(qw,{property:H,...N,fieldProps:{label:void 0}})},H.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:V}),c.jsx(D,{grow:!0,children:M})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:V}),c.jsx(D,{grow:!0,children:M})]}),c.jsx(k,{space:"s",children:c.jsx(D,{grow:!0,children:I})})]}):r?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:V}),c.jsx(D,{grow:!0,children:M})]}),c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:U}),c.jsx(D,{grow:!0,children:I})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(k,{className:J("gs-utl-w-1/2 gjs-m-auto"),children:V}),c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:U}),c.jsx(D,{grow:!0,children:M})]}),c.jsx(k,{className:J("gs-utl-w-1/2 gjs-m-auto"),children:I})]})})]})}var Dr=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(Dr||{});const Ec="background-image",zs="__background-type",wa=Ec,ii="background-size-options",Kw="https://placehold.co/150/777/white.png?text=IMAGE",Sa="50px",b7={[zs]:"image","background-image":`url("${Kw}")`,"background-size":`${Sa} ${Sa}`,"background-repeat":"repeat","background-position":"0px 0px"},v7=e=>(e.includes("gradient(")?oh(e).colorStops[0].color:e)||"",mf=["cover","contain"],y7=(e="")=>mf.includes(e);function x7({sector:e,styleManagerDataConfig:t}){var _;const n=vl(),s=$e(),r=e.getProperty("background"),o=r.getProperty(zs),i=r.getProperty("background-image"),a=r.getProperty("background-position"),l=r.getProperty("background-size"),u=r.getProperty(ii),d=e.getProperty("background-color"),p=e.getProperty("background-clip"),f={sector:e,styleManagerDataConfig:t},h=[r,d,p].map(N=>N==null?void 0:N.id),m=e.getProperties().filter(N=>!h.includes(`${N.id}`)),b=((_=r.getSelectedLayer())==null?void 0:_.getIndex())||-1,v=o==null?void 0:o.getValue(),x=v==="image",y=i.getValue(),w=`${u.getValue()||""}`.trim(),S=y7(w)?"options":"numeric",j=S==="options",C=N=>s.t(`styleManager.background.${N}`),E=[{id:"numeric",label:C("sizeMode.custom")},{id:"options",label:C("sizeMode.preset")}],O=()=>{const N=n.Assets;N.open({select(V){const M=V.getSrc();i.upValue(`url("${M}")`),N.close()}})},P=N=>{let V="none",M="100%";N==="image"?(V=`url("${Kw}")`,M=Sa):N==="gradient"?V="linear-gradient(90deg, black 10%, white 90%)":N==="color"&&(V="rgba(0, 0, 0, 0.5)"),i.upValue(V),o.upValue(N),a.upValue("0 0"),u.upValue(""),l.upValue(`${M} ${M}`)},T=N=>{N!==S&&(N==="options"?(u.upValue("cover"),l.upValue("")):(u.upValue(""),l.upValue(`${Sa} ${Sa}`)))},A=R7(o,[{id:"image",label:c.jsx(ne,{icon:K.image,size:oe.s})},{id:"gradient",label:c.jsx(ne,{icon:K.gradientVertical,size:oe.s})},{id:"color",label:c.jsx(ne,{icon:K.checkboxBlank,size:oe.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(ye,{property:r,separator:!0,children:c.jsxs(Is,{...kr(r,f,b7),previewStyle:N=>r.getStyleFromLayer(N,{camelCase:!0}),children:[c.jsx(ye,{children:c.jsx(tn,{...Hs(o,f),options:A,onChange:P,label:void 0})}),c.jsx(ye,{children:c.jsxs(ar,{children:[x&&c.jsx(Ua,{value:Yu(y).value,onOpen:O}),v==="color"&&c.jsx(Xs,{...Ho(i,f),value:v7(y),label:void 0}),v==="gradient"&&c.jsx(p7,{value:y,onChange:(N,V)=>i.upValue(N,{partial:V})},b)]})}),x&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{col:!0,children:c.jsx(xn,{property:a,...f})}),c.jsx(ye,{col:!0,children:c.jsx(ar,{property:j?u:l,afterLabel:c.jsx("div",{className:"gs-utl-ml-auto",children:c.jsx(_e,{size:"xs",caret:"",label:void 0,value:S,options:E,onChange:T})}),children:j?c.jsx(_e,{...jt(u,f),label:void 0}):c.jsx(xn,{property:l,hideLabel:!0,...f})})}),c.jsxs(ye,{children:[c.jsx(_e,{...jt(r.getProperty("background-repeat"),{sector:e})}),c.jsx(_e,{...jt(r.getProperty("background-attachment"),{sector:e})})]}),c.jsx(ye,{children:c.jsx(_e,{...jt(r.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(ye,{property:d,children:c.jsx(Xs,{...Ho(d,f)})}),c.jsx(ye,{property:p,children:c.jsx(_e,{...jt(p,f)})}),m.length>0&&c.jsx(tr,{properties:m,...f})]})}function w7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),s=e.getProperty("border-width"),r=e.getProperty("border-style"),o=e.getProperty("border-color"),i={sector:e,styleManagerDataConfig:t},a=[n,s,r,o].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!a.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,corners:!0,...i}),c.jsx(xn,{property:s,...i}),c.jsx(xn,{property:r,...i}),c.jsx(xn,{property:o,...i}),l.length>0&&c.jsx(tr,{properties:l,...i})]})}const jo=e=>Bu({value:parseFloat(e),min:-3,max:3}),lp=(e,t="filter",n)=>{const s=e.getProperty(`${t}-value`),r=e.getProperty(`${t}-name`).getOption()||{},o=r.units||[],i=s.getUnit(),a=ZR(i,o)?i:o[0];return{...lt(s,n),units:o,valueUnit:a,onChange:(l,u)=>{s.upValue(l,{partial:u,units:o,min:r.min,max:r.max})}}},xb=(e,t,n,s)=>{const r=e.getProperty(`${t}-name`),o=e.getProperty(`${t}-value`);return{...jt(r,n,s),onChange:i=>{r.upValue(i),o.upValue("")}}},S7={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"},wb=e=>{const{boxShadowH:t,boxShadowV:n,boxShadowBlur:s,boxShadowColor:r,boxShadowSpread:o,boxShadowType:i}=e.getValues({camelCase:!0}),a=jo(t),l=jo(n),u=jo(s),d=jo(o);return{label:`${t} ${n} ${s} ${o}`,style:{boxShadow:`${a}px ${l}px ${u}px ${d}px ${r} ${i}`.trim()}}},Sb=e=>{const{textShadowH:t,textShadowV:n,textShadowBlur:s,textShadowColor:r}=e.getValues({camelCase:!0}),o=jo(t),i=jo(n),a=jo(s);return{label:`${t} ${n} ${s}`,style:{boxShadow:`${o}px ${i}px ${a}px ${r}`.trim()}}};function C7({sector:e,styleManagerDataConfig:t}){const n=$e(),s=C=>n.t(`styleManager.effects.${C}`),r=e.getProperty("box-shadow"),o=e.getProperty("text-shadow"),i=e.getProperty("filter"),a=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),p=e.getProperty("backface-visibility"),f=e.getProperty("perspective"),h=e.getProperty("transform-style"),m=e.getProperty("opacity"),b=e.getProperty("mix-blend-mode"),v=e.getProperty("cursor"),x=e.getProperty("transform-origin"),y=e.getProperty("overflow"),w={sector:e,styleManagerDataConfig:t},S=[r,o,i,a,l,u,d,p,f,h,m,b,v,x,y].map(C=>C==null?void 0:C.id),j=e.getProperties().filter(C=>!S.includes(`${C.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(ye,{property:[m,b],children:[c.jsx(Ne,{...lt(m,w)}),c.jsx(_e,{...jt(b,w)})]}),c.jsx(ye,{property:v,separator:!0,children:c.jsx(_e,{...jt(v,w)})}),c.jsx(ye,{property:r,separator:!0,children:c.jsxs(Is,{...kr(r,w),renderItem:C=>wb(C).label,previewStyle:C=>wb(C).style,children:[c.jsx(ye,{children:c.jsx(tn,{...Hs(r.getProperty("box-shadow-type"),w),label:""})}),c.jsxs(ye,{children:[c.jsx(Ne,{...lt(r.getProperty("box-shadow-h"),w),label:s("boxShadow.xOffset")}),c.jsx(Ne,{...lt(r.getProperty("box-shadow-v"),w),label:s("boxShadow.yOffset")})]}),c.jsxs(ye,{children:[c.jsx(Ne,{...lt(r.getProperty("box-shadow-blur"),w),label:s("boxShadow.blur")}),c.jsx(Ne,{...lt(r.getProperty("box-shadow-spread"),w),label:s("boxShadow.spread")})]}),c.jsx(ye,{children:c.jsx(Xs,{...Ho(r.getProperty("box-shadow-color"),w),label:s("boxShadow.color")})})]})}),c.jsx(ye,{property:o,separator:!0,children:c.jsxs(Is,{...kr(o,w,S7),renderItem:C=>Sb(C).label,previewStyle:C=>Sb(C).style,children:[c.jsxs(ye,{children:[c.jsx(Ne,{...lt(o.getProperty("text-shadow-h"),w),label:s("textShadow.xOffset")}),c.jsx(Ne,{...lt(o.getProperty("text-shadow-v"),w),label:s("textShadow.yOffset")})]}),c.jsx(ye,{children:c.jsx(Ne,{...lt(o.getProperty("text-shadow-blur"),w),label:s("textShadow.blur")})}),c.jsx(ye,{children:c.jsx(Xs,{...Ho(o.getProperty("text-shadow-color"),w),label:s("textShadow.color")})})]})}),c.jsx(ye,{property:i,separator:!0,children:c.jsx(Is,{...kr(i,w,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(ye,{children:[c.jsx(_e,{...xb(i,"filter",w),label:s("filter.type")}),c.jsx(Ne,{...lp(i,void 0,w),label:s("filter.value")})]})})}),c.jsx(ye,{property:a,separator:!0,children:c.jsx(Is,{...kr(a,w,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(ye,{children:[c.jsx(_e,{...jt(a.getProperty("backdrop-filter-name"),w),label:s("backdropFilter.type")}),c.jsx(Ne,{...lp(a,"backdrop-filter",w),label:s("backdropFilter.value")})]})})}),c.jsx(ye,{property:l,separator:!0,children:c.jsxs(Is,{...kr(l,w),children:[c.jsx(ye,{children:c.jsx(_e,{...jt(l.getProperty("transition-property"),w),label:s("transition.type")})}),c.jsx(ye,{children:c.jsx(_e,{...jt(l.getProperty("transition-timing-function"),w),label:s("transition.easing")})}),c.jsxs(ye,{children:[c.jsx(Ne,{...lt(l.getProperty("transition-duration"),w),label:s("transition.duration")}),c.jsx(Ne,{...lt(l.getProperty("transition-delay"),w),label:s("transition.delay")})]})]})}),c.jsx(ye,{property:u,separator:!0,children:c.jsx(Is,{...kr(u,w),children:c.jsxs(ye,{children:[c.jsx(_e,{...xb(u,"transform",w),label:s("transform.type")}),c.jsx(Ne,{...lp(u,"transform",w),label:s("transform.value")})]})})}),c.jsx(xn,{property:x,...w}),c.jsx(xn,{property:y,...w}),c.jsx(ye,{property:p,children:c.jsx(tn,{...Hs(p,w)})}),c.jsx(ye,{property:[f,h,d],separatorTop:!0,children:s("childrenTransform")}),c.jsxs(ye,{property:[f,h],children:[c.jsx(Ne,{...lt(f,w)}),c.jsx(tn,{...Hs(h,w)})]}),c.jsx(xn,{property:d,...w}),j.length>0&&c.jsx(tr,{properties:j,...w})]})}function j7(e,t){return e.indexOf(t)>=0}const xt=oe.s,ic="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",ac="M6 6v12h13V6H6zm0-1h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm6-5h1v24h-1V0z",lc="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Cb="M2 6v12h6V6H2zm0 13v5H1V0h1v5h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H2zM16 6v12h6V6h-6zm6-1V0h1v24h-1v-5h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1h6z",jb="M11 0h1v24h-1V0zM1 6h6v12H1V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H1a1 1 0 01-1-1V6c0-.6.4-1 1-1zm15 1h6v12h-6V6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1z",E7="M3 6v12h6V6H3zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H3a1 1 0 01-1-1V6c0-.6.4-1 1-1zM0 0h1v24H0V0zm14 6v12h6V6h-6zm0-1h6c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1h-6a1 1 0 01-1-1V6c0-.6.4-1 1-1zm8-5h1v24h-1V0zM11 0h1v24h-1V0z",cp="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function P7({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),s=$e(),[r,o]=g.useState({}),[i,a]=g.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),p=e.getProperty("align-items"),f=e.getProperty("flex-wrap"),h=e.getProperty("align-content"),m=e.getProperty("align-self"),b=e.getProperty("order"),v=e.getProperty("gap"),x=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},w=[l,u,d,p,f,h,m,b,v,x].map(F=>F.id),S=e.getProperties().filter(F=>!w.includes(`${F.id}`)),j=F=>s.t(`styleManager.layout.${F}`),C=l.getValue(),E=C==="flex",O=(i.display||"").indexOf("flex")>=0,P=u.getValue(),T=P.indexOf("reverse")>=0,A=!j7(["column","column-reverse"],P),_=[{id:"row",label:c.jsx(ne,{icon:K.arrowRight,size:oe.sx}),title:j("direction.title.row")},{id:"row-reverse",label:c.jsx(ne,{icon:K.arrowRight,size:xt,horizontal:!0}),title:j("direction.title.row-reverse")},{id:"column",label:c.jsx(ne,{icon:K.arrowDown,size:oe.sx}),title:j("direction.title.column")},{id:"column-reverse",label:c.jsx(ne,{icon:K.arrowDown,size:xt,vertical:!0}),title:j("direction.title.column-reverse")}],N=[{id:"flex-start",title:j("justify.title.start"),label:c.jsx(ne,{icon:ic,size:xt,rotate:A?0:90,horizontal:A&&T,vertical:!A&&T})},{id:"center",title:j("justify.title.center"),label:c.jsx(ne,{icon:ac,size:xt,rotate:A?0:90})},{id:"flex-end",title:j("justify.title.end"),label:c.jsx(ne,{icon:lc,size:xt,rotate:A?0:90,horizontal:A&&T,vertical:!A&&T})},{id:"space-between",title:j("justify.title.spaceBetween"),label:c.jsx(ne,{icon:Cb,size:xt,rotate:A?0:90})},{id:"space-around",title:j("justify.title.spaceAround"),label:c.jsx(ne,{icon:jb,size:xt,rotate:A?0:90})},{id:"space-evenly",title:j("justify.title.spaceEvenly"),label:c.jsx(ne,{icon:E7,size:xt,rotate:A?0:90})}],V=[{id:"stretch",title:j("align.title.stretch"),label:c.jsx(ne,{icon:cp,size:xt,rotate:A?0:90})},{id:"flex-start",title:j("align.title.start"),label:c.jsx(ne,{icon:ic,size:xt,rotate:A?90:0})},{id:"center",title:j("align.title.center"),label:c.jsx(ne,{icon:ac,size:xt,rotate:A?90:0})},{id:"flex-end",title:j("align.title.end"),label:c.jsx(ne,{icon:lc,size:xt,rotate:A?90:0})}],M=[{id:"flex-start",title:j("alignContent.title.start"),label:c.jsx(ne,{icon:ic,size:xt,rotate:A?90:0,horizontal:A&&T,vertical:!A&&T})},{id:"center",title:j("alignContent.title.center"),label:c.jsx(ne,{icon:ac,size:xt,rotate:A?90:0})},{id:"flex-end",title:j("alignContent.title.end"),label:c.jsx(ne,{icon:lc,size:xt,rotate:A?90:0,horizontal:A&&T,vertical:!A&&T})},{id:"space-between",title:j("alignContent.title.spaceBetween"),label:c.jsx(ne,{icon:Cb,size:xt,rotate:A?90:0})},{id:"space-around",title:j("alignContent.title.spaceAround"),label:c.jsx(ne,{icon:jb,size:xt,rotate:A?90:0})},{id:"stretch",title:j("alignContent.title.stretch"),label:c.jsx(ne,{icon:cp,size:xt,rotate:A?0:90})}],I=[{id:"auto",title:j("alignSelf.title.auto"),label:c.jsx(ne,{icon:K.close,size:xt})},{id:"flex-start",title:j("alignSelf.title.start"),label:c.jsx(ne,{icon:ic,size:xt,rotate:90})},{id:"center",title:j("alignSelf.title.center"),label:c.jsx(ne,{icon:ac,size:xt,rotate:90})},{id:"flex-end",title:j("alignSelf.title.end"),label:c.jsx(ne,{icon:lc,size:xt,rotate:90})},{id:"stretch",title:j("alignSelf.title.stretch"),label:c.jsx(ne,{icon:cp,size:xt,rotate:0})}],U=[{id:"0 0 auto",label:c.jsx(ne,{icon:K.close,size:xt}),title:j("flex.title.auto")},{id:"1 1 0%",label:c.jsx(ne,{icon:K.unfoldMoreHorizontal,size:xt,rotate:90}),title:j("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(ne,{icon:K.unfoldLessHorizontal,size:xt,rotate:90}),title:j("flex.title.hugContents")}];return g.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,W=()=>{const R=n.getSelected();let $={},B={};if(R){const Z=R.getEl();if(Z){$=window.getComputedStyle(Z);const Y=Z.parentElement;Y&&(B=window.getComputedStyle(Y))}}o($),a(B)},H=F.events.target;return n.on(H,W),W(),()=>n.off(H,W)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(ye,{children:c.jsx(_e,{...jt(l,y),...bf,tip:j(`display.tips.${C}`)})}),E&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{children:c.jsx(tn,{...Hs(u,y),options:_})}),c.jsx(ye,{children:c.jsx(tn,{...Hs(d,y),options:N})}),c.jsx(ye,{children:c.jsx(tn,{...Hs(p,y),options:V})}),c.jsx(ye,{children:c.jsx(xn,{property:v,...y})}),c.jsx(ye,{children:c.jsx(_e,{...jt(f,y),...bf})}),f.getValue()!=="nowrap"&&c.jsx(ye,{children:c.jsx(tn,{...Hs(h,y),options:M})})]}),O&&c.jsxs(c.Fragment,{children:[c.jsx(ye,{separatorTop:!0,children:j("flexChild")}),c.jsx(ye,{children:c.jsx(xn,{property:x,options:U,...y})}),c.jsx(ye,{children:c.jsx(tn,{...Hs(m,y),options:I})}),c.jsx(ye,{children:c.jsx(Ne,{...lt(b,{sector:e,styleManagerDataConfig:t})})})]}),S.length>0&&c.jsx(tr,{properties:S,...y})]})}const T7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function O7({sector:e,styleManagerDataConfig:t}){var x;const n=$e(),s=e.getProperty("position"),r=s.getValue(),o=e.getProperty("top"),i=e.getProperty("right"),a=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},p=y=>n.t(`styleManager.position.${y}`),f=[s,o,i,a,l,u].map(y=>y==null?void 0:y.id),h=e.getProperties().filter(y=>!f.includes(`${y.id}`)),m=T7.map(y=>({id:y,label:p(`presets.options.${y}`)})),b=["absolute","fixed"].includes(r),v=y=>{let w="auto",S="auto",j="auto",C="auto";switch(y){case"topLeft":w="0%",C="0%";break;case"topRight":w="0%",S="0%";break;case"bottomLeft":j="0%",C="0%";break;case"bottomRight":j="0%",S="0%";break;case"left":w="0%",j="0%",C="0%";break;case"right":w="0%",j="0%",S="0%";break;case"bottom":C="0%",j="0%",S="0%";break;case"top":C="0%",w="0%",S="0%";break;case"full":C="0%",w="0%",S="0%",j="0%";break}o.upValue(w),i.upValue(S),a.upValue(j),l.upValue(C)};return c.jsxs(c.Fragment,{children:[c.jsxs(ye,{property:s,children:[c.jsx(_e,{...jt(s,d),tip:p(`tips.${(x=s.getOption())==null?void 0:x.id}`),...bf}),b&&c.jsx(D,{children:c.jsx(Ut,{title:p("presets.title"),children:c.jsx(_e,{options:m,onChange:v,emptyState:"P",size:"s",caret:"",value:!0})})})]}),r!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(ye,{col:!0,children:[c.jsx(k,{className:J("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...lt(o,d)})}),c.jsxs(k,{gap:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(Ne,{...lt(l,d)})}),c.jsx(D,{grow:!0,children:c.jsx(Ne,{...lt(i,d)})})]}),c.jsx(k,{className:J("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...lt(a,d)})})]}),c.jsx(ye,{children:c.jsx(Ne,{...lt(u,d)})})]}),h.length>0&&c.jsx(tr,{properties:h,...d})]})}function _7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),s=e.getProperty("min-width"),r=e.getProperty("max-width"),o=e.getProperty("height"),i=e.getProperty("min-height"),a=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,s,r,o,i,a].map(p=>p==null?void 0:p.id),d=e.getProperties().filter(p=>!u.includes(`${p.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(ye,{property:[n,o],children:[c.jsx(Ne,{...lt(n,l)}),c.jsx(Ne,{...lt(o,l)})]}),c.jsxs(ye,{property:[s,i],children:[c.jsx(Ne,{...lt(s,l)}),c.jsx(Ne,{...lt(i,l)})]}),c.jsxs(ye,{property:[r,a],children:[c.jsx(Ne,{...lt(r,l)}),c.jsx(Ne,{...lt(a,l)})]}),d.length>0&&c.jsx(tr,{properties:d,...l})]})}function A7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),s=e.getProperty("margin"),r={sector:e,styleManagerDataConfig:t},o=[n,s].map(a=>a==null?void 0:a.id),i=e.getProperties().filter(a=>!o.includes(`${a.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,...r}),c.jsx(xn,{property:s,...r}),i.length>0&&c.jsx(tr,{properties:i,...r})]})}function M7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),s=e.getProperty("color"),r=e.getProperty("font-size"),o=e.getProperty("font-weight"),i=e.getProperty("line-height"),a=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),p=e.getProperty("text-transform"),f=e.getProperty("direction"),h=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},b=[n,s,r,o,i,a,l,u,d,p,f,h].map(y=>y==null?void 0:y.id),v=e.getProperties().filter(y=>!b.includes(`${y.id}`)),{sdkAddFonts:x}=hl();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(ye,{property:n,children:x?c.jsx(Uu,{...Xw(n,m)}):c.jsx(_e,{...jt(n,m)})}),!!s&&c.jsx(ye,{property:s,children:c.jsx(Xs,{...Ho(s,m)})}),c.jsxs(ye,{property:[r,o],children:[!!r&&c.jsx(Ne,{...lt(r,m)}),!!o&&c.jsx(_e,{...jt(o,m)})]}),c.jsxs(ye,{property:[i,a],children:[!!i&&c.jsx(Ne,{...lt(i,m)}),!!a&&c.jsx(Ne,{...lt(a,m)})]}),c.jsxs(ye,{property:[l,u],children:[!!l&&c.jsx(_e,{...jt(l,m)}),!!u&&c.jsx(_e,{...jt(u,m)})]}),c.jsxs(ye,{property:[p,f],children:[!!p&&c.jsx(_e,{...jt(p,m)}),!!f&&c.jsx(_e,{...jt(f,m)})]}),c.jsxs(ye,{property:[h,d],children:[!!h&&c.jsx(_e,{...jt(h,m)}),!!d&&c.jsx(_e,{...jt(d,m)})]}),v.length>0&&c.jsx(tr,{properties:v,...m})]})}const bf={row:!0,classNameLabel:"gs-utl-w-full"},L7=({property:e,skipClear:t,label:n,afterLabelButtons:s=[]})=>c.jsxs(k,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(D,{grow:!1,children:c.jsx(ar,{property:e,skipClear:t,label:n})}),!!s.length&&c.jsx(k,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:s.map((r,o)=>c.jsx(St,{...r},o))})]}),vf="gs-style-manager",Yc=`${vf}-sector`,N7=`${Yc}-header`,$7=`${Yc}-content`,Zw=(e,t=0,n=!0)=>L(N7,z.bgH2,Pe.xyS,z.br,t&&se.bt,(e||n)&&se.bb),k7=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),R7=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),Tl=(e,t)=>{const n=I7(e,t),s=Bw(n),{hasDataResolverValue:r}=n,{label:o}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:r,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:s.length?"span":void 0,label:c.jsx(L7,{property:e,skipClear:r,label:o,afterLabelButtons:s})}}},ih=(e,t)=>{const{connectDataSources:n,commonProps:s}=Tl(e,t);return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(r,o)=>e.upValue(r,{partial:o})}},Yw=(e,t,n)=>{const{connectDataSources:s,commonProps:r}=Tl(e,t),{hasDataResolverValue:o,initialDataValue:i}=s;return{fieldProps:{...r,value:o?i:e.getValue(),options:k7(e,n??{}),onChange:a=>e.upValue(a)},connectDataSources:s}},Hs=(e,t,n)=>Yw(e,t,n).fieldProps,jt=(e,t,n)=>{const{fieldProps:s,connectDataSources:r}=Yw(e,t,n),{hasDataResolverValue:o}=r,i=o?e.getValue()||" ":s.emptyState;return{...s,emptyState:i,hideCaret:o}},Xw=(e,t)=>{const{commonProps:n,connectDataSources:s}=Tl(e,t),r=s.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:r,hideCaret:s.hasDataResolverValue,value:s.dataResolverValue??e.getValue(),onChange:o=>e.upValue(o)}},kr=(e,t,n={})=>{const{connectDataSources:s,commonProps:r}=Tl(e,t),{hasDataResolverValue:o,dataResolverValue:i}=s;return{...r,title:e.getLabel(),emptyState:o?i:void 0,titleAdd:`Add new ${e.getLabel()}`,items:o?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:a=>e.getLayerLabel(a),add:o?void 0:()=>e.addLayer(n,{at:0}),select:a=>e.selectLayer(a),remove:a=>e.removeLayer(a),move:(a,l=0)=>e.moveLayer(a,l)}},lt=(e,t)=>{const{connectDataSources:n,commonProps:s}=Tl(e,t),{hasDataResolverValue:r}=n;return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,i)=>e.upValue(o,{partial:i}),valueUnit:e.getUnit(),pan:!r,units:r?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:o=>e.upUnit(o)}};function I7(e,t){const{styleManagerDataConfig:n=!1,sector:s}=t,r=e.em.getEditor(),{Styles:o}=r,i=r.getSelected(),a=o.getSelectedAll(),l=o.getSelected();let u=!1;n===!0?u=!0:i&&wr(n)&&rt(n.enable)&&(u=n.enable({property:e,sector:s,component:i,editor:r}));const d=e.getName(),p=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",f=Jr(p),h=i==null?void 0:i.collectionsStateMap;return{hasDataResolverValue:f,dataResolverValue:f?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{a.forEach(b=>{b.addStyle({[d]:m})})},handleValueClear:()=>{a.forEach(m=>{const b=m.getStyle()[d]??"";m.addStyle({[d]:b})})},editor:r,additionalSources:h}}const Ho=(e,t)=>ih(e,t),V7=(e,t)=>{const{label:n,...s}=ih(e,t);return{...s,label:n,isContain:e.get("contain")??!0,hideButton:s.disabled,inputField:e.get("inputField"),onOpen(){const r=e.em.Assets;r.open({select(o){e.upValue(o.getSrc()),r.close()}})}}},H7=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let s=h7;switch(n){case"gs-layout":s=P7;break;case"gs-size":s=_7;break;case"gs-space":s=A7;break;case"gs-position":s=O7;break;case"gs-borders":s=w7;break;case"gs-effects":s=C7;break;case"gs-typography":s=M7;break;case"gs-background":s=x7;break}return c.jsx(s,{sector:e,styleManagerDataConfig:t})},up={},Jw=ue(function({className:t,sectors:n}){var m;const[s,r]=g.useState(up),o=Se(),{editor:i}=o,a=i==null?void 0:i.Styles,l=a==null?void 0:a.getSelected(),u=i==null?void 0:i.getSelected(),d=`${vf}__empty-state ${Pe.s} gs-utl-text-center`,p=b=>i==null?void 0:i.t(`styleManager.${b}`);if(g.useEffect(()=>{if(u&&i){const b=setTimeout(()=>{let v=up;const x=u.get("styleManager");rt(x)&&(v=x({editor:i,component:u})),r(v||up)});return()=>clearTimeout(b)}},[u,i]),!a||!l)return c.jsx(D,{className:d,children:p("empty")});const f=n.length?n:a.getSectors({visible:!0}),h=(m=o.sdkOptions.dataSources)==null?void 0:m.styleManager;return s.disabled?null:c.jsxs("div",{className:L(vf,t,"gs-utl-select-none"),children:[!f.length&&c.jsx(D,{className:d,children:p("notFound")}),f.map((b,v)=>c.jsx(yr,{open:b.isOpen(),onChange:({open:x})=>b.setOpen(x),classNameWrap:L(Yc,`${Yc}__${b.id}`),sticky:!0,handler:()=>{const x=b.getProperties({withValue:!0}).length>0,y=b.getProperties({withParentValue:!0}).length>0;return c.jsxs(k,{gap:"xs",items:"center",children:[c.jsx(D,{className:"gs-utl-mr-2",children:b.getName()}),x&&c.jsx(D,{children:c.jsx("div",{className:L(Ae.dot,z.bgA2)})}),y&&c.jsx(D,{children:c.jsx("div",{className:L(Ae.dot,z.bgW)})})]})},className:x=>Zw(x,v,v===f.length-1),children:c.jsx(k,{className:L($7,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:H7(b,{styleManagerDataConfig:h})})},b.id))]})}),D7=Yt(function({children:t,className:n,content:s,...r},o){return c.jsx("div",{className:L(le("gs-design-manager-tab"),n),ref:o,...r,children:t})}),Eb="gs-cmp-sidebar-right",Pb="gs-cmp-traits-provider",dp=L("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function F7(e={}){var P,T,A;const{propsInStyles:t,hideTabs:n,hideSelectors:s,tabsProps:r}=e,{isCssPanelActive:o,selectedDesignerTab:i,showSelectors:a,setSelectedDesignerTab:l,sdkProps:u,sdkOptions:d,isProjectTypeEmail:p}=Se(),f=$e(),h=L(o&&"gs-utl-hidden"),b=(((P=Jn(u.children,D7))==null?void 0:P.filter(Boolean))||[]).map(({props:_},N)=>({id:_.id,label:_.label,content:c.jsx(yl,{children:_.children}),order:_.order??2+N+1})),v=t??((T=d.designPanel)==null?void 0:T.propsInStyles),x=n??((A=d.designPanel)==null?void 0:A.hideTabs),y=v===!0||p&&v!==!1,w=x===!0||p&&x!==!1,S=s===void 0?a:!s,j=f.t("traitManager.panelLabel"),C=L(`${Eb}__tabs`,w&&"gs-utl-hidden",r==null?void 0:r.className),O=[{id:"style",label:f.t("styleManager.panelLabel"),order:1,content:c.jsxs(k,{col:!0,full:!0,children:[!!S&&c.jsx(D,{className:L("gs-cmp-selectors-provider",Pe.s,se.bb,z.br),children:c.jsx(zy,{children:_=>c.jsx(Ww,{..._})})}),y&&c.jsx(D,{className:L(Pb,dp),children:c.jsx(yr,{handler:j,className:Zw(!1),sticky:!0,open:!0,children:c.jsx(Kp,{children:_=>c.jsx(hf,{..._,className:L("gs-utl-p-2",z.br,se.bb)})})})}),c.jsx(D,{className:L("gs-cmp-styles-provider",dp),grow:!0,children:c.jsx(Uy,{children:_=>c.jsxs(c.Fragment,{children:[o&&c.jsx(Wy,{}),c.jsx(Jw,{className:h,..._})]})})})]})},!y&&{id:"props",label:j,order:2,content:c.jsx(k,{className:Pb,col:!0,full:!0,children:c.jsx(D,{className:L(Pe.s,dp),children:c.jsx(Kp,{children:_=>c.jsx(hf,{..._})})})})},...b].filter(Boolean).sort((_,N)=>_.order-N.order);return c.jsx(k,{className:Eb,col:!0,full:!0,nowrap:!0,children:c.jsx(lo,{...r,value:i,onChange:l,tabs:O,className:C})})}const Qw=ue(F7),B7="gs-panel-sidebar-tabs",z7=g.memo(ue(function({className:t,propsInStyles:n,hideTabs:s,hideSelectors:r,tabsProps:o,...i}){return c.jsx(_s,{className:L(B7,"gs-utl-h-full",t),...i,children:c.jsx(Qw,{propsInStyles:n,hideTabs:s,hideSelectors:r,tabsProps:o})})})),U7="gs-panel-styles",W7=g.memo(ue(function({className:t,...n}){const{isCssPanelActive:s}=Se(),r=L(s&&" gs-utl-hidden");return c.jsx(_s,{className:L(U7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-auto"),...n,children:c.jsx(Uy,{children:o=>c.jsxs(c.Fragment,{children:[s&&c.jsx(Wy,{}),c.jsx(Jw,{className:r,...o})]})})})})),G7="gs-panel-templates",q7=g.memo(ue(function({className:t,templates:n,content:s,onSelect:r,...o}){const i=ay(),{projectTypeFilter:a}=i;let l=n??i.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),g.useEffect(()=>{n||i.loadTemplates()},[n]),c.jsx(_s,{className:L(G7,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:L("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...o,children:c.jsx(k,{className:le("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(k,{className:le("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(Ox,{templates:l,projectType:Et[a],content:s,onSelect:r,skipProjectNamePopover:!0})})})})})),K7="gs-cmp-row",Z7=g.memo(function({className:t,children:n,full:s,...r}){return c.jsx(jn,{className:L(K7,z.bg,"gs-utl-flex",s&&"gs-utl-w-full",t),...r,children:Nt(n)})}),Y7="gs-cmp-select-field",X7=g.memo(ue(function({className:t,style:n,label:s,name:r,value:o,options:i,size:a,onChange:l,required:u,disabled:d,emptyState:p,editorEvents:f}){const{editor:h}=Se(),[m,b]=g.useState(()=>({required:u,disabled:d,style:n,className:t,label:s,name:r,value:o,options:i,size:a,emptyState:p})),v=x=>{l({value:x,editor:h,state:m,setState:y=>b(w=>({...w,...y}))})};return Sr({editor:h,editorEvents:f,localState:m,setLocalState:b}),c.jsx(_e,{classNameContainer:L(Y7,m.className),style:m.style,label:m.label,name:m.name,value:m.value??"",options:m.options??[],size:m.size,required:m.required,disabled:m.disabled,emptyState:m.emptyState,onChange:v})})),J7="gs-cmp-select-field",Q7=g.memo(ue(function({className:t,style:n,label:s,name:r,value:o,size:i,onChange:a,required:l,disabled:u,emptyState:d,editorEvents:p}){const{editor:f}=Se(),[h,m]=g.useState(()=>({required:l,disabled:u,style:n,className:t,label:s,name:r,value:o,size:i,emptyState:d})),b=v=>{a({value:v,editor:f,state:h,setState:x=>m(y=>({...y,...x}))})};return Sr({editor:f,editorEvents:p,localState:h,setLocalState:m}),c.jsx(Uu,{classNameContainer:L(J7,h.className),style:h.style,label:h.label,name:h.name,value:h.value??"",size:h.size,required:h.required,disabled:h.disabled,emptyState:h.emptyState,onChange:b})})),eV="gs-sidebar-bottom",tV=g.memo(ue(function({children:t,className:n,style:s,height:r,...o}){const{isInPreview:i,isBottomSidebarOpen:a}=Se(),l=r??35,u=g.useMemo(()=>({height:l,marginBottom:i||!a?`-${l}px`:0,...s}),[i,a,s]);return c.jsx(jn,{className:L(eV,"gs-utl-flex gs-utl-transition-spacing",se.bt,z.br,n),style:u,...o,children:t?Nt(t):void 0})})),nV=ue(function(t){var w;const{leftSidebarSize:n,setLeftSidebarSize:s,editor:r,isInPreview:o,isLeftSidebarOpen:i,sdkProps:a,showPages:l}=Se(),u=a.children,d=((w=t.style)==null?void 0:w.width)??t.width,p=d??n,f=t.resizable===!1,h=L(t.className,"gs-utl-h-full gs-utl-transition-spacing",se.br,z.br),m=L("gs-utl-w-full",se.bb,z.br),b=L("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),v=g.useMemo(()=>({marginLeft:o||!i?`-${p}px`:0,...t.style}),[p,o,i,t.style]),x=()=>r==null?void 0:r.refresh(),y=(S,j,C)=>{s(C.getBoundingClientRect().width)};return c.jsx(zu,{className:h,enable:f?!1:void 0,right:!f,style:v,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:x,onResizeStop:y,children:t.children??c.jsxs(k,{full:!0,col:!0,children:[l&&c.jsx(D,{className:m,children:c.jsx(By,{children:S=>c.jsxs(c.Fragment,{children:[Jn(u,Rw),c.jsx($w,{...S}),Jn(u,kw)]})})}),c.jsx(D,{className:b,grow:!0,children:c.jsx(Fy,{children:S=>c.jsxs(c.Fragment,{children:[Jn(u,uw),c.jsx(lw,{...S}),Jn(u,cw)]})})})]})})}),sV="gs-sidebar-left",rV=g.memo(ue(function({children:t,width:n,resizable:s,...r}){return c.jsx(nV,{className:L(sV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Au(r)),width:n,resizable:s,style:Mu(r),children:t?Nt(t):void 0})})),oV=ue(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:s,editor:r,isInPreview:o,isRightSidebarOpen:i}=Se(),a=((m=t.style)==null?void 0:m.width)??t.width,l=a??n,u=t.resizable===!1,d=L(t.className,"gs-utl-h-full gs-utl-transition-spacing",se.bl,z.br),p=g.useMemo(()=>({marginRight:o||!i?`-${l}px`:0,...t.style}),[l,o,i,t.style]),f=()=>r==null?void 0:r.refresh(),h=(b,v,x)=>{s(x.getBoundingClientRect().width)};return c.jsx(zu,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:l,minWidth:a??200,maxWidth:a??400,onResize:f,onResizeStop:h,children:t.children??c.jsx(Qw,{})})}),iV="gs-sidebar-right",aV=g.memo(ue(function({children:t,resizable:n,...s}){return c.jsx(oV,{className:L(iV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Au(s)),resizable:n,style:Mu(s),children:t?Nt(t):void 0})})),lV=ue(function({className:t,variant:n,value:s,tabs:r,style:o,editorEvents:i,onChange:a}){const{editor:l}=Se(),[u,d]=g.useState(()=>({tabs:r,style:o,value:s,variant:n,className:t})),p=g.useMemo(()=>{var h;return((h=u.tabs)==null?void 0:h.map(m=>({...m,content:Nt(m.children)})))||[]},[u.tabs]),f=h=>{a&&l?a({value:h,editor:l,state:u,setState:m=>d(b=>({...b,...m}))}):d(m=>({...m,value:h}))};return Sr({editor:l,editorEvents:i,localState:u,setLocalState:d}),c.jsx(lo,{tabs:p,className:L(u.className),variant:u.variant,value:u.value,style:u.style,onChange:f})}),cV="gs-cmp-text",uV=g.memo(function({className:t,content:n,children:s,...r}){return c.jsx(jn,{className:L(cV,t),...r,children:s||n})}),dV="gs-cmp-virtual-list",pV=ue(function({id:t,items:n,itemLayout:s,footerLayout:r,onRef:o,itemsPerRow:i=12,className:a,style:l,htmlAttrs:u}){const[d,p]=g.useState(0),{editor:f,transitionTime:h}=Se(),m=Hg(i),b=i===1;g.useEffect(()=>{const w=setTimeout(()=>p(S=>++S),h);return()=>clearTimeout(w)},[h]);const v={id:t,...u},x=!!d&&!!f,y={data:n,style:l,className:L(dV,"gs-utl-h-full",a),itemContent:(w,S)=>c.jsx(g.Fragment,{children:s?Nt(s({item:S,index:w,editor:f})):c.jsx("pre",{children:JSON.stringify(S,void 0,2)})},S.id??w),components:{Footer:r&&f?()=>Nt(r({editor:f})):void 0}};return x&&(b?c.jsx(Q$,{...v,...y,ref:o},t):c.jsx(Vu,{...v,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:o},t))});var yf=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",e.colorField="colorField",e.colorPicker="colorPicker",e.menuList="menuList",e.inputField="inputField",e.codeField="codeField",e.selectField="selectField",e.selectFontField="selectFontField",e.tabs="tabs",e.devices="devices",e.custom="custom",e.panelLayers="panelLayers",e.panelPages="panelPages",e.panelSelectors="panelSelectors",e.panelStyles="panelStyles",e.panelProperties="panelProperties",e.panelSidebarTabs="panelSidebarTabs",e.panelPagesLayers="panelPagesLayers",e.panelBlocks="panelBlocks",e.panelPageSettings="panelPageSettings",e.panelGlobalStyles="panelGlobalStyles",e.panelAssets="panelAssets",e.panelEditCode="panelEditCode",e.panelTemplates="panelTemplates",e.sidebarLeft="sidebarLeft",e.sidebarRight="sidebarRight",e.sidebarTop="sidebarTop",e.sidebarBottom="sidebarBottom",e.canvas="canvas",e.canvasSidebarTop="canvasSidebarTop",e.virtualList="virtualList",e.dataPathField="dataPathField",e.panelDataVariablePicker="panelDataVariablePicker",e.panelDataConditionPicker="panelDataConditionPicker",e.panelDataCollectionPicker="panelDataCollectionPicker",e.panelDataValuePicker="panelDataValuePicker",e))(yf||{});const fV={icon:ne,row:Z7,column:RR,text:uV,tabs:lV,button:_u,buttonMenu:hN,buttonGroupField:bN,colorField:LR,colorPicker:$R,menuList:TI,inputField:EI,codeField:Hk,selectField:X7,selectFontField:Q7,devices:Ax,panelPages:Iw,panelPageSettings:g9,panelLayers:dw,panelPagesLayers:w9,panelBlocks:h6,panelGlobalStyles:P6,panelSelectors:i7,panelStyles:W7,panelProperties:K9,panelSidebarTabs:z7,panelAssets:ZI,panelEditCode:r6,panelTemplates:q7,sidebarRight:aV,sidebarLeft:rV,sidebarTop:Mx,sidebarBottom:tV,canvas:qy,canvasSidebarTop:Ik,virtualList:pV,dataPathField:mI,panelDataVariablePicker:CI,panelDataConditionPicker:gI,panelDataCollectionPicker:tI,panelDataValuePicker:yI},Nt=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=n4();return t.filter(Boolean).map((s,r)=>{const{type:o,...i}=pt(s)?{type:yf.text,content:s}:s||{},a=i.id||"",l=fV[o],u=n.layoutChildren.get(a),d=n.customLayoutComponents.get(o),p=a||r;if(u)return c.jsx(zp,{id:a,...u},p);if(d){const f=d({id:a,...i});return Nt([f])[0]}else{if(o===yf.custom)return c.jsx(zp,{id:a,...i},p);if(l)return c.jsx(l,{id:a,...i},p)}return null})},gV=ue(({components:e})=>(Eu().customLayoutComponents,Nt(e))),Sr=e=>{const{editorEvents:t,editor:n,localState:s,setLocalState:r}=e;g.useEffect(()=>{if(!t||!n)return;const o=Object.keys(t).reduce((a,l)=>(a[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:s,setState:p=>r(f=>({...f,...p}))})},a),{}),i=Object.keys(o);return i.forEach(a=>n.on(a,o[a])),()=>{i.forEach(a=>n.off(a,o[a]))}},[n,s])},hV=e=>e.Assets.getAll().reduce((s,r)=>{const o=r.getSrc(),i=o.match(/^data:([^;]+);/);if(i){const a=o.split(",")[1],l=_3(r.get("name")||`${a.substring(0,20)}`);s[o]={mime:i[1],name:l,base64:a}}return s},{}),mV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Tb=(e,t,n={})=>{let s=e;const r=n.pathPfx||"";for(const o in t)if(s.includes(o)){const i=t[o];s=s.replace(new RegExp(mV(o),"g"),`${r}${i.name}`),i.found=!0}return s},bV=(e,t,n)=>`${t||""}${e||""}${n||""}`,vV=(e,t)=>{const n=e?`<div ${Hc}>${e}</div>`:"",s=t?`<div ${Hc} data-gjs-global>${t}</div>`:"";return`${n}${s}`},yV=async(e,t={})=>{const{page:n,skipProject:s,assetsFolder:r="assets",filenameCss:o="style.css",styles:i,isMJML:a,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,f={...l,...e.config.optsHtml||{},...t.optionsHtml},h=[],m=n?[n]:e.Pages.getAll(),b=hV(e),v=`${r}/`,x=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=Tb(x,b,{pathPfx:v}),w=i==="inline",S=i==="skip",j=i==="skipInPage",C=p==="skip",E=u?{}:Ti(e).globalPageSettings||{},O=[],P=(T,A)=>{var Ft,nr,go;const{pageSettingOpts:_}=A||{},N=T.getName(),V=w||(_==null?void 0:_.replaceDataSources),M=_r(T,"title",_)||N,I=_r(T,"favicon",_),U=_r(T,"description",_),F=_r(T,"keywords",_),W=_r(T,"socialTitle",_),H=_r(T,"socialDescription",_),R=_r(T,"socialImage",_),$=u?"":Y0(_r(T,"fonts")),B=an({page:T,key:"customCodeHead",opts:_})??"",Z=bV(B,E.customCodeHead,$),Y=an({page:T,key:"customCodeBody",opts:_})??"",ee=d?"":vV(Y,E.customCodeBody),X=T.getMainComponent(),G=C?"":e.getJs({component:X}),Q=G?`<script>${G}<\/script>`:"",ie=[],ae=[],me={asDocument:!1,...f},ve=X.toHTML(me).replace("</body>",()=>`${ee}${Q}</body>`),ke=X.head;let Re=M&&`<title>${M}</title>`,ot=I&&`<link rel="icon" href="${I}"/>`,Ue=U&&`<meta name="description" content="${U}"/>`,we=F&&`<meta name="keywords" content="${F}"/>`,ze=W&&`<meta property="og:title" content="${W}"/>`,Xe=H&&`<meta property="og:description" content="${H}"/>`,vt=R&&`<meta property="og:image" content="${R}"/>`,Le='<meta charset="utf-8">',ft='<meta name="viewport" content="width=device-width,initial-scale=1">',dt='<meta name="robots" content="index,follow">',We='<meta name="generator" content="GrapesJS Studio">';ke.components().forEach(tt=>{const yt=tt.toHTML(f);gt.title({cmp:tt})?Re=yt:gt.favicon({cmp:tt})?ot=yt:gt.description({cmp:tt})?Ue=yt:gt.keywords({cmp:tt})?we=yt:gt.socialTitle({cmp:tt})?ze=yt:gt.socialDescription({cmp:tt})?Xe=yt:gt.socialImage({cmp:tt})?vt=yt:gt.charset({cmp:tt})?Le=yt:gt.viewport({cmp:tt})?ft=yt:gt.robots({cmp:tt})?dt=yt:gt.generator({cmp:tt})&&(We=yt)}),Re&&ie.push(Re),Le&&ie.push(Le),ft&&ie.push(ft),dt&&ie.push(dt),We&&ie.push(We),Ue&&ie.push(Ue),we&&ie.push(we),ze&&ie.push(ze),Xe&&ie.push(Xe),vt&&ie.push(vt),ot&&ie.push(ot),ae.length&&ie.push(...ae),Z&&ie.push(Z),y&&!(S||j)&&ie.push(V?`<style>${y}</style>`:`<link rel="stylesheet" href="./${o}">`);const he=X.doctype||"<!DOCTYPE html>",De=(nr=(Ft=X.docEl).__attrToString)==null?void 0:nr.call(Ft,f),Be=(go=ke.__attrToString)==null?void 0:go.call(ke,f),Ie=e.getHtml(f).trim(),_t=a?e.runCommand(Tu,{mjml:Ie}).html:`${he}
335
+ <html${De?` ${De}`:""}>
336
+ <head${Be?` ${Be}`:""}>
337
+ ${ie.join(`
338
338
  `)}
339
339
  </head>
340
- ${Se}
340
+ ${ve}
341
341
  </html>
342
- `;return{filename:Rp(e,T),content:xv(Ot,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(T=>{if(yu(T)){const _=T.getMainComponent(),{dataSourceItem:N}=t,D=N?[N]:_.getDataSourceItems(),L=_.resolverCurrentItem;Object.entries(D).forEach(([V,U])=>{const H=U;_.setResolverCurrentItem(H.id??V);const B=P(T,{pageSettingOpts:{replaceDataSources:!0}}),{path:k,filename:I}=K0(T,{currentItem:H});B.path=k,B.filename=I,O.push(B)}),_.setResolverCurrentItem(L)}else O.push(P(T))}),g.push(...O),a&&m.forEach(T=>{g.push({filename:Rp(e,T,"mjml"),content:T.getMainComponent().toHTML(f),mimeType:"text/mjml"})});for(const T in v){const A=v[T];A.found&&g.push({path:r,filename:A.name,content:atob(A.base64),mimeType:A.mime})}return y&&!w&&!S&&g.push({filename:o,content:y,mimeType:"text/css"}),s||g.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),g};function Z7(e){const{Components:t,Blocks:n}=e,s=r=>{const{model:o,id:i}=r,a=o.getDefaults(),l=n.get(i),u=a.icon,d=l==null?void 0:l.get("media"),p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M19 3H5c-1.11 0-2 .89-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z"></path></svg>',f=u&&u!==p&&!d?u:d||p;t.addType(i,{model:{defaults:{icon:f}}})};t.getTypes().forEach(s),e.on("component:type:add",s)}const Y7=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:s}=e;e.on(s.events.frameLoad,({window:r,el:o})=>{r.document.addEventListener("contextmenu",async a=>{if(!n.isEnabled||e.getEditing())return;a.preventDefault();const l=a.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=o.getBoundingClientRect(),p=s.getZoomDecimal();e.runCommand(ne.contextMenuComponent,{component:u,event:a,x:a.clientX*p+d.left,y:a.clientY*p+d.top})}})})};function X7(e,t){var g;const{Components:n,I18n:s}=e,{appStore:r}=t,o=s.t("dataSources.collection"),i=Ut.collection,a=Ut.collectionItem,l="data-type-data-collection",u='<svg viewBox="0 0 24 24"><path d="M2 14H8V20H2M16 8H10V10H16M2 10H8V4H2M10 4V6H22V4M10 20H16V18H10M10 16H22V14H10" /></svg>',d=(g=t.appStore.sdkOptions.dataSources)==null?void 0:g.blocks,p=m=>{const v=m.is(i)?m:m.closestType(i);if(!v)return;const b="dataCollectionPicker",x={id:b,header:!1,layout:{type:"panelDataCollectionPicker",component:v,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:b})},placer:{type:"dialog",title:s.t("dataSources.editCollection"),size:"l"}};e.runCommand(ne.layoutToggle,{...x})},f=({items:m,component:v})=>[{id:`open-${i}-picker`,label:Ih,command:()=>p(v)},...m];n.addType(a,{isComponent:m=>hi(m,a),model:{defaults:{...ef(r),name:s.t("dataSources.collectionItem"),copyable:!1,emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M22 13H14V11H22V13M22 7H14V9H22V7M14 17H22V15H14V17M12 9V15C12 16.1 11.1 17 10 17H4C2.9 17 2 16.1 2 15V9C2 7.9 2.9 7 4 7H10C11.1 7 12 7.9 12 9M10.5 15L8.3 12L6.5 14.3L5.3 12.8L3.5 15H10.5Z" /></svg>',toolbarItems:f}}}),n.addType(i,{isComponent:m=>ll(m,l)||hi(m,i),block:d&&{label:o,media:u,content:{type:i,components:{type:a},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...Vh},model:{defaults:{...Hh(r),icon:u,name:o,attributes:{[l]:!0},toolbarItems:f},init(){const m="collection-";if(!this.getCollectionId()){const b=m+Math.random().toString(36).substring(2,9);this.setCollectionId(b)}}},view:{onActive(m){m==null||m.stopPropagation(),p(this.model)}}})}function J7(e,t){var x;const{Components:n,I18n:s}=e,r=s.t("dataSources.condition"),o=s.t("dataSources.conditionTrue"),i=s.t("dataSources.conditionFalse"),a=s.t("dataSources.conditionElse"),{appStore:l}=t,u=(x=l.sdkOptions.dataSources)==null?void 0:x.blocks,d=Ut.condition,p=Ut.conditionTrue,f=Ut.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
342
+ `;return{filename:Fp(e,T),content:Tb(_t,b,{pathPfx:v}),mimeType:"text/html"}};m.forEach(T=>{if(Cu(T)){const _=T.getMainComponent(),{dataSourceItem:N}=t,V=N?[N]:_.getDataSourceItems(),M=_.resolverCurrentItem;Object.entries(V).forEach(([I,U])=>{const F=U;_.setResolverCurrentItem(F.id??I);const W=P(T,{pageSettingOpts:{replaceDataSources:!0}}),{path:H,filename:R}=ry(T,{currentItem:F});W.path=H,W.filename=R,O.push(W)}),_.setResolverCurrentItem(M)}else O.push(P(T))}),h.push(...O),a&&m.forEach(T=>{h.push({filename:Fp(e,T,"mjml"),content:T.getMainComponent().toHTML(f),mimeType:"text/mjml"})});for(const T in b){const A=b[T];A.found&&h.push({path:r,filename:A.name,content:atob(A.base64),mimeType:A.mime})}return y&&!w&&!S&&h.push({filename:o,content:y,mimeType:"text/css"}),s||h.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),h};function xV(e){const{Components:t,Blocks:n}=e,s=r=>{const{model:o,id:i}=r,a=o.getDefaults(),l=n.get(i),u=a.icon,d=l==null?void 0:l.get("media"),p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M19 3H5c-1.11 0-2 .89-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5a2 2 0 0 0-2-2m0 2v14H5V5h14z"></path></svg>',f=u&&u!==p&&!d?u:d||p;t.addType(i,{model:{defaults:{icon:f}}})};t.getTypes().forEach(s),e.on("component:type:add",s)}const wV=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:s}=e;e.on(s.events.frameLoad,({window:r,el:o})=>{r.document.addEventListener("contextmenu",async a=>{if(!n.isEnabled||e.getEditing())return;a.preventDefault();const l=a.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=o.getBoundingClientRect(),p=s.getZoomDecimal();e.runCommand(te.contextMenuComponent,{component:u,event:a,x:a.clientX*p+d.left,y:a.clientY*p+d.top})}})})};function SV(e,t){var h;const{Components:n,I18n:s}=e,{appStore:r}=t,o=s.t("dataSources.collection"),i=Wt.collection,a=Wt.collectionItem,l="data-type-data-collection",u='<svg viewBox="0 0 24 24"><path d="M2 14H8V20H2M16 8H10V10H16M2 10H8V4H2M10 4V6H22V4M10 20H16V18H10M10 16H22V14H10" /></svg>',d=(h=t.appStore.sdkOptions.dataSources)==null?void 0:h.blocks,p=m=>{const b=m.is(i)?m:m.closestType(i);if(!b)return;const v="dataCollectionPicker",x={id:v,header:!1,layout:{type:"panelDataCollectionPicker",component:b,onConfirm:()=>e.runCommand(te.layoutRemove,{id:v})},placer:{type:"dialog",title:s.t("dataSources.editCollection"),size:"l"}};e.runCommand(te.layoutToggle,{...x})},f=({items:m,component:b})=>[{id:`open-${i}-picker`,label:Bg,command:()=>p(b)},...m];n.addType(a,{isComponent:m=>mi(m,a),model:{defaults:{...of(r),name:s.t("dataSources.collectionItem"),copyable:!1,emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M22 13H14V11H22V13M22 7H14V9H22V7M14 17H22V15H14V17M12 9V15C12 16.1 11.1 17 10 17H4C2.9 17 2 16.1 2 15V9C2 7.9 2.9 7 4 7H10C11.1 7 12 7.9 12 9M10.5 15L8.3 12L6.5 14.3L5.3 12.8L3.5 15H10.5Z" /></svg>',toolbarItems:f}}}),n.addType(i,{isComponent:m=>pl(m,l)||mi(m,i),block:d&&{label:o,media:u,content:{type:i,components:{type:a},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...zg},model:{defaults:{...Ug(r),icon:u,name:o,attributes:{[l]:!0},toolbarItems:f},init(){const m="collection-";if(!this.getCollectionId()){const v=m+Math.random().toString(36).substring(2,9);this.setCollectionId(v)}}},view:{onActive(m){m==null||m.stopPropagation(),p(this.model)}}})}function CV(e,t){var x;const{Components:n,I18n:s}=e,r=s.t("dataSources.condition"),o=s.t("dataSources.conditionTrue"),i=s.t("dataSources.conditionFalse"),a=s.t("dataSources.conditionElse"),{appStore:l}=t,u=(x=l.sdkOptions.dataSources)==null?void 0:x.blocks,d=Wt.condition,p=Wt.conditionTrue,f=Wt.conditionFalse,h="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
343
343
  <path d="M14,4L16.29,6.29L13.41,9.17L14.83,10.59L17.71,7.71L20,10V4M10,4H4V10L6.29,7.71L11,12.41V20H13V11.59L7.71,6.29" />
344
- </svg>`,v=y=>{const w=y.is(d)?y:y.closestType(d);if(!w)return;const S="dataConditionPicker",C={id:S,header:!1,layout:{type:"panelDataConditionPicker",component:w,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:S})},placer:{type:"dialog",title:s.t("dataSources.editCondition"),size:"l"}};e.runCommand(ne.layoutToggle,{...C})},b=({items:y,component:w})=>[{id:`open-${d}-picker`,label:Ih,command:()=>v(w)},...y];n.addType(p,{isComponent:y=>hi(y,p),model:{defaults:{...ef(l),tagName:"span",name:o,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:b}}}),n.addType(f,{isComponent:y=>hi(y,f),model:{defaults:{...ef(l),tagName:"span",name:i,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:b}}}),n.addType(d,{isComponent:y=>ll(y,g)||hi(y,d),block:u&&{label:r,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:p},{type:f}]},...Vh},model:{defaults:{...Hh(l),icon:m,name:r,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:b}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,Hn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),v(this.model))},getConditionString(){const{model:y}=this,{operator:w,statements:S=[]}=y.getCondition(),C=w==="AND"?" AND ":" OR ",E=S.map(O=>{const{left:P="",operator:T="",right:A=""}=O,_=_1(P),N=_1(A);return`(${_} ${T} ${N})`}).join(C);return`${r}: ${E}`},renderDataResolver(){const y=this.model,w=y.getIfTrueContent(),S=y.getIfFalseContent(),C=w==null?void 0:w.getEl(),j=S==null?void 0:S.getEl();if(e.runCommand(ne.getStateDataSource).showPlaceholder){C&&(C.style.display="",C.style.setProperty(Co,`"${this.getConditionString()} "`)),j&&(j.style.display="",j.style.setProperty(Co,`" ${a} "`));return}const O=y.isTrue();C&&(C.style.removeProperty(Co),C.style.display=O?"":"none"),j&&(j.style.removeProperty(Co),j.style.display=O?"none":"")}}})}function Q7(e,t){var p;const{Components:n,I18n:s}=e,r=Ut.variable,o="data-type-data-variable",i="Variable",a=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${pc.codeBraces}"/></svg>`,{appStore:l}=t,u=(p=l.sdkOptions.dataSources)==null?void 0:p.blocks,d=f=>{const g="dataVariablePicker",m={id:g,header:!1,layout:{type:"panelDataVariablePicker",component:f,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:g})},placer:{type:"dialog",title:s.t("dataSources.editVariable"),size:"l"}};e.runCommand(ne.layoutToggle,{...m})};n.addType(r,{isComponent:f=>ll(f,o)||hi(f,r),block:u&&{label:i,media:a,content:{type:r,dataResolver:{path:"",defaultValue:s.t("dataSources.defaultValue")}},...Vh},model:{defaults:{...Hh(l),icon:a,name:i,textable:!0,tagName:"span",attributes:{[o]:!0},toolbarItems:({items:f,component:g})=>[{id:`open-${r}-modal`,label:Ih,command:()=>d(g)},...f]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:f}=this;this.listenTo(f,Hn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(f){e.getEditing()||(f==null||f.stopPropagation(),d(this.model))},renderDataResolver(){const{model:f,el:g}=this;if(e.runCommand(ne.getStateDataSource).showPlaceholder){const v=f.getPath();g.textContent="",g.style.setProperty(Co,`"${$x(v)}"`);return}g.style.removeProperty(Co),g.textContent=f.getDataValue()}}})}const ti=(e,t,n)=>{const s=e.Components.getType(t);if(!s){console.warn(`Component type ${t} not found`);return}const r=s.model;e.Components.addType(t,{model:{...n,toHTML(o){var a;const{exporter:i}=o??{};return i?((a=n.toHTML)==null?void 0:a.call(this,o))??"":r.prototype.toHTML.call(this,o)??""}}})};function rc({component:e,value:t,getCustomPath:n}){if(yr(t)&&t.path&&!t.collectionId&&n){const s=t.path??"",r=s.split(".");return{...t,path:n({component:e,path:s,paths:r})}}return t}function eV(e,{isProjectTypeEmail:t}){const n=({content:o})=>t?`<mj-raw>${o}</mj-raw>`:o,s=({content:o})=>o;function r(o){const i=this.getInnerHTML(o);if(t||o.skipTags)return i;const a=this.tagName,l=this.__attrToString(o),u=l?` ${l}`:"",d=`<${a}${u}>`,p=`</${a}>`;return`${d}${i}${p}`}ti(e,Ut.variable,{toHTML(o){var b;const i=o.skipTags??t,a=o.exporter,l=o.wrapTemplateContent??s,u=x=>l({component:this,content:x}),d=this.tagName,p=this.__attrToString(o),f=(b=this.getDataResolver)==null?void 0:b.call(this),g=rc({component:this,value:f,getCustomPath:o==null?void 0:o.getCustomPath}),m=a.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return i?v:`<${d}${p?` ${p}`:""}>${v}</${d}>`}}),ti(e,Ut.condition,{toHTML(o){var w,S,C;const{exporter:i}=o,a=o.wrapTemplateContent??n,l=j=>a({component:this,content:j}),u={component:this},d=o==null?void 0:o.getCustomPath,[p,f]=((w=this.components())==null?void 0:w.models)??[],g=(S=this.getDataResolver)==null?void 0:S.call(this),m=((C=this.resolveCondition)==null?void 0:C.call(this,g==null?void 0:g.condition,d))??{};let v="";if(f){const j=i.getConditionElseSyntax(u);v=`
345
- ${l(j)}
346
- ${f.toHTML(o)??""}`}const b=i.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),x=i.getConditionalEndSyntax(u);return`
347
- ${`${l(b)}
348
- ${(p==null?void 0:p.toHTML(o))??""}${v}
344
+ </svg>`,b=y=>{const w=y.is(d)?y:y.closestType(d);if(!w)return;const S="dataConditionPicker",j={id:S,header:!1,layout:{type:"panelDataConditionPicker",component:w,onConfirm:()=>e.runCommand(te.layoutRemove,{id:S})},placer:{type:"dialog",title:s.t("dataSources.editCondition"),size:"l"}};e.runCommand(te.layoutToggle,{...j})},v=({items:y,component:w})=>[{id:`open-${d}-picker`,label:Bg,command:()=>b(w)},...y];n.addType(p,{isComponent:y=>mi(y,p),model:{defaults:{...of(l),tagName:"span",name:o,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:v}}}),n.addType(f,{isComponent:y=>mi(y,f),model:{defaults:{...of(l),tagName:"span",name:i,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:v}}}),n.addType(d,{isComponent:y=>pl(y,h)||mi(y,d),block:u&&{label:r,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:p},{type:f}]},...zg},model:{defaults:{...Ug(l),icon:m,name:r,textable:!0,stylable:!1,tagName:"span",attributes:{[h]:!0},toolbarItems:v}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,Dn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),b(this.model))},getConditionString(){const{model:y}=this,{operator:w,statements:S=[]}=y.getCondition(),j=w==="AND"?" AND ":" OR ",E=S.map(O=>{const{left:P="",operator:T="",right:A=""}=O,_=$1(P),N=$1(A);return`(${_} ${T} ${N})`}).join(j);return`${r}: ${E}`},renderDataResolver(){const y=this.model,w=y.getIfTrueContent(),S=y.getIfFalseContent(),j=w==null?void 0:w.getEl(),C=S==null?void 0:S.getEl();if(e.runCommand(te.getStateDataSource).showPlaceholder){j&&(j.style.display="",j.style.setProperty(Co,`"${this.getConditionString()} "`)),C&&(C.style.display="",C.style.setProperty(Co,`" ${a} "`));return}const O=y.isTrue();j&&(j.style.removeProperty(Co),j.style.display=O?"":"none"),C&&(C.style.removeProperty(Co),C.style.display=O?"none":"")}}})}function jV(e,t){var p;const{Components:n,I18n:s}=e,r=Wt.variable,o="data-type-data-variable",i="Variable",a=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${bc.codeBraces}"/></svg>`,{appStore:l}=t,u=(p=l.sdkOptions.dataSources)==null?void 0:p.blocks,d=f=>{const h="dataVariablePicker",m={id:h,header:!1,layout:{type:"panelDataVariablePicker",component:f,onConfirm:()=>e.runCommand(te.layoutRemove,{id:h})},placer:{type:"dialog",title:s.t("dataSources.editVariable"),size:"l"}};e.runCommand(te.layoutToggle,{...m})};n.addType(r,{isComponent:f=>pl(f,o)||mi(f,r),block:u&&{label:i,media:a,content:{type:r,dataResolver:{path:"",defaultValue:s.t("dataSources.defaultValue")}},...zg},model:{defaults:{...Ug(l),icon:a,name:i,textable:!0,tagName:"span",attributes:{[o]:!0},toolbarItems:({items:f,component:h})=>[{id:`open-${r}-modal`,label:Bg,command:()=>d(h)},...f]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:f}=this;this.listenTo(f,Dn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(f){e.getEditing()||(f==null||f.stopPropagation(),d(this.model))},renderDataResolver(){const{model:f,el:h}=this;if(e.runCommand(te.getStateDataSource).showPlaceholder){const b=f.getPath();h.textContent="",h.style.setProperty(Co,`"${Wx(b)}"`);return}h.style.removeProperty(Co),h.textContent=f.getDataValue()}}})}const ni=(e,t,n)=>{const s=e.Components.getType(t);if(!s){console.warn(`Component type ${t} not found`);return}const r=s.model;e.Components.addType(t,{model:{...n,toHTML(o){var a;const{exporter:i}=o??{};return i?((a=n.toHTML)==null?void 0:a.call(this,o))??"":r.prototype.toHTML.call(this,o)??""}}})};function cc({component:e,value:t,getCustomPath:n}){if(wr(t)&&t.path&&!t.collectionId&&n){const s=t.path??"",r=s.split(".");return{...t,path:n({component:e,path:s,paths:r})}}return t}function EV(e,{isProjectTypeEmail:t}){const n=({content:o})=>t?`<mj-raw>${o}</mj-raw>`:o,s=({content:o})=>o;function r(o){const i=this.getInnerHTML(o);if(t||o.skipTags)return i;const a=this.tagName,l=this.__attrToString(o),u=l?` ${l}`:"",d=`<${a}${u}>`,p=`</${a}>`;return`${d}${i}${p}`}ni(e,Wt.variable,{toHTML(o){var v;const i=o.skipTags??t,a=o.exporter,l=o.wrapTemplateContent??s,u=x=>l({component:this,content:x}),d=this.tagName,p=this.__attrToString(o),f=(v=this.getDataResolver)==null?void 0:v.call(this),h=cc({component:this,value:f,getCustomPath:o==null?void 0:o.getCustomPath}),m=a.getVariableSyntax({component:this,dataResolver:h}),b=u(m);return i?b:`<${d}${p?` ${p}`:""}>${b}</${d}>`}}),ni(e,Wt.condition,{toHTML(o){var w,S,j;const{exporter:i}=o,a=o.wrapTemplateContent??n,l=C=>a({component:this,content:C}),u={component:this},d=o==null?void 0:o.getCustomPath,[p,f]=((w=this.components())==null?void 0:w.models)??[],h=(S=this.getDataResolver)==null?void 0:S.call(this),m=((j=this.resolveCondition)==null?void 0:j.call(this,h==null?void 0:h.condition,d))??{};let b="";if(f){const C=i.getConditionElseSyntax(u);b=`
345
+ ${l(C)}
346
+ ${f.toHTML(o)??""}`}const v=i.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),x=i.getConditionalEndSyntax(u);return`
347
+ ${`${l(v)}
348
+ ${(p==null?void 0:p.toHTML(o))??""}${b}
349
349
  ${l(x)}`}
350
- `},resolveCondition(o,i){if(typeof o=="boolean")return o;if(!o)return{};if(ER(o))return{...o,statements:o.statements.map(l=>this.resolveCondition(l,i))??[]};const a={component:this,getCustomPath:i};return{...o,left:rc({...a,value:o.left}),right:rc({...a,value:o.right})}}}),ti(e,Ut.collection,{toHTML(o){const i=o.skipTags??t,{exporter:a}=o,l=o.wrapTemplateContent??n,u=E=>l({component:this,content:E}),d={component:this},p=this.getDataResolver(),f={...p,dataSource:rc({component:this,value:p==null?void 0:p.dataSource,getCustomPath:o==null?void 0:o.getCustomPath})},g=this.components().at(0),m=a.getCollectionStartSyntax({...d,dataResolver:f}),v=a.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(o))??"",x=`${u(m)}
351
- ${b}
352
- ${u(v)}`;if(i)return`
350
+ `},resolveCondition(o,i){if(typeof o=="boolean")return o;if(!o)return{};if(HR(o))return{...o,statements:o.statements.map(l=>this.resolveCondition(l,i))??[]};const a={component:this,getCustomPath:i};return{...o,left:cc({...a,value:o.left}),right:cc({...a,value:o.right})}}}),ni(e,Wt.collection,{toHTML(o){const i=o.skipTags??t,{exporter:a}=o,l=o.wrapTemplateContent??n,u=E=>l({component:this,content:E}),d={component:this},p=this.getDataResolver(),f={...p,dataSource:cc({component:this,value:p==null?void 0:p.dataSource,getCustomPath:o==null?void 0:o.getCustomPath})},h=this.components().at(0),m=a.getCollectionStartSyntax({...d,dataResolver:f}),b=a.getCollectionEndSyntax(d),v=(h==null?void 0:h.toHTML(o))??"",x=`${u(m)}
351
+ ${v}
352
+ ${u(b)}`;if(i)return`
353
353
  ${x}
354
- `;const y=this.tagName,w=this.__attrToString(o),S=w?` ${w}`:"",C=`<${y}${S}>`,j=`</${y}>`;return`
355
- ${C}${x}${j}
356
- `}}),ti(e,Ut.conditionTrue,{toHTML:r}),ti(e,Ut.conditionFalse,{toHTML:r}),ti(e,Ut.collectionItem,{toHTML:r})}const tV=function(e,t){const{Components:n,Canvas:s,events:r}=e;if(!n.getType(Ut.conditionTrue))return;const{isProjectTypeEmail:o,sdkOptions:i}=t.appStore,{dataSources:a}=i;a!=null&&a.globalData&&e.on(r.projectLoad,()=>{e.DataSources.add({id:Wo.globalData,records:kx(a.globalData),skipFromStorage:!0})}),e.on(s.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const f=d.createElement("style"),g=[Ut.variable,Ut.condition,Ut.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);f.setAttribute(u,""),f.textContent=`
357
- ${g.join(",")} {
354
+ `;const y=this.tagName,w=this.__attrToString(o),S=w?` ${w}`:"",j=`<${y}${S}>`,C=`</${y}>`;return`
355
+ ${j}${x}${C}
356
+ `}}),ni(e,Wt.conditionTrue,{toHTML:r}),ni(e,Wt.conditionFalse,{toHTML:r}),ni(e,Wt.collectionItem,{toHTML:r})}const PV=function(e,t){const{Components:n,Canvas:s,events:r}=e;if(!n.getType(Wt.conditionTrue))return;const{isProjectTypeEmail:o,sdkOptions:i}=t.appStore,{dataSources:a}=i;a!=null&&a.globalData&&e.on(r.projectLoad,()=>{e.DataSources.add({id:Go.globalData,records:Gx(a.globalData),skipFromStorage:!0})}),e.on(s.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const f=d.createElement("style"),h=[Wt.variable,Wt.condition,Wt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);f.setAttribute(u,""),f.textContent=`
357
+ ${h.join(",")} {
358
358
  outline: 2px dotted #8b5cf6;
359
359
  }
360
360
 
@@ -377,7 +377,7 @@ ${C}${x}${j}
377
377
  font-weight: 500;
378
378
  font-family: sans-serif;
379
379
  }
380
- `,d.head.appendChild(f)}),Q7(e,t),J7(e,t),X7(e,t),eV(e,{isProjectTypeEmail:o})};function nV(e){const{Components:t}=e,n=s=>{const{id:r,model:o}=s;if(r==="custom-code"){const i="<span>Insert here your custom code</span>";t.addType(r,{model:{defaults:{emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path></svg>',classes:"gjs-custom-code",components:i,"custom-code-plugin__code":i,styles:".gjs-custom-code { padding: 5px; }"}}})}if(r==="typed"){const i=o.getDefaults().traits.map(a=>a.name==="strings"?{...a,type:"stack",addItem(l){return{id:l,label:`New string ${l}`}},getValue({component:l}){return l.get("strings").map((u,d)=>({id:`${d}`,label:u}))},setValue:({component:l,value:u})=>{const d=u.map(p=>p.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:a);t.addType(r,{model:{defaults:{traits:i,strings:["These are the default values...!!!","Use your own strings from Properties!","Have a great day!"],icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',classes:"gjs-typed",styles:`
380
+ `,d.head.appendChild(f)}),jV(e,t),CV(e,t),SV(e,t),EV(e,{isProjectTypeEmail:o})};function TV(e){const{Components:t}=e,n=s=>{const{id:r,model:o}=s;if(r==="custom-code"){const i="<span>Insert here your custom code</span>";t.addType(r,{model:{defaults:{emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path></svg>',classes:"gjs-custom-code",components:i,"custom-code-plugin__code":i,styles:".gjs-custom-code { padding: 5px; }"}}})}if(r==="typed"){const i=o.getDefaults().traits.map(a=>a.name==="strings"?{...a,type:"stack",addItem(l){return{id:l,label:`New string ${l}`}},getValue({component:l}){return l.get("strings").map((u,d)=>({id:`${d}`,label:u}))},setValue:({component:l,value:u})=>{const d=u.map(p=>p.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:a);t.addType(r,{model:{defaults:{traits:i,strings:["These are the default values...!!!","Use your own strings from Properties!","Have a great day!"],icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',classes:"gjs-typed",styles:`
381
381
  .gjs-typed {
382
382
  padding: 5px;
383
383
  }
@@ -385,4 +385,4 @@ ${C}${x}${j}
385
385
  <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
386
386
  <path d="M22 9.3c0-.8-.5-1.3-1.3-1.3H3.4C2.5 8 2 8.5 2 9.3v7.4c0 .8.5 1.3 1.3 1.3h17.4c.8 0 1.3-.5 1.3-1.3V9.3zM21 17H3V9h18v8z" fill-rule="nonzero"/><rect x="3" y="5" width="4" height="2" rx=".5"/><rect x="8" y="5" width="4" height="2" rx=".5"/><rect x="13" y="5" width="4" height="2" rx=".5"/>
387
387
  </svg>
388
- `:void 0};r==="tab"&&(a.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(Dw),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(r,{model:{defaults:a}})}};e.on("component:type:add",n)}const sV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:s})=>s&&n.onLoad())},rV=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:s}=e;s.getConfig().uploadFile=async(...r)=>{const o=r[0],i=await n.handleUpload(o),a=r[1];i&&(a==null||a({data:i}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},oV=()=>{const{baseApiUrl:e}=Z0();return`${e}/sdk/projects`},Hw=e=>`${oV()}/${e}`,iV=async({licenseKey:e,projectId:t,...n})=>{const s=await Zs.put(Hw(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return s==null?void 0:s.result},aV=async(e,t)=>await Zs.put(t,{body:e,headers:{"Content-Type":"application/json"}}),lV=async(e,t,n,s)=>{const r=JSON.stringify(e),o=await iV({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([r]).size},identityId:s,name:e.name,description:e.description});if(!o)throw new Error("Project not found");const{uploadUrl:i}=o;await aV(r,i)},cV=(e,t,n)=>Zs.get(Hw(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),uV=async e=>await Zs.get(e),dV=async(e,t,n,s)=>{const r=await cV(t,n,s),o=r==null?void 0:r.result,i=r==null?void 0:r.errorData;if(!o&&(i!=null&&i.notFoundInDb))return{id:n,project:{}};if(!o)throw new Error("Project not found");const{downloadUrl:a}=o,l=await uV(a);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},pV=(e,t)=>{const{appEditorStore:n,toastStore:s,i18nStore:r}=t.appStore.store,{isUsingProjectSelfHosted:o,isUsingProjectCloud:i,sdkOptions:a}=n,l=a.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:f,autosaveIntervalMs:g}=l;let m,v,b,x;if(o)b=d,x=p,m=f,v=g;else if(i){const E=a.licenseKey,O=n.sdkProjectId,P=n.sdkIdentityId,T=10,A=1e4;x=({project:_})=>lV(_,E,O,P),b=({editor:_})=>dV(_,E,O,P),m=Math.max(T,f??T),g&&(v=Math.max(A,g))}const{Storage:y,events:w}=e,{events:S}=y,C=E=>E instanceof Error?E.message:typeof E=="string"?E:"Unknown error";let j=!1;if(e.once(w.projectLoad,E=>{j=!!E.loaded}),e.once("change:readyLoad",()=>{var O;const E=(O=a.project)==null?void 0:O.default;!j&&E&&e.loadProjectData(E)}),e.on(S.startStore,()=>n.setIsSaving(!0)),e.on(S.endStore,()=>n.setIsSaving(!1)),(b||u)&&x){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await b({editor:e})).project},async store(O){await x({project:O,editor:e})}}),e.on(S.errorLoad,O=>{s.addError("storage-error-load",{header:r.t("storageManager.errorLoad"),content:C(O)})}),e.on(S.errorStore,O=>{s.addError("storage-error-store",{header:r.t("storageManager.errorStore"),content:C(O)})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const O=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(O))})}},Gc="select-target",Dw="enable-sm";function fV(e,t){var V,U,H,B;const{appStore:n}=t,{appEditorStore:s,blockManagerStore:r,toastStore:o,modalStore:i,layoutStore:a,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:f,sdkOptions:g}=s,m=()=>r.toggleOpen(),v=()=>s.toggleLeftSidebar(),b=()=>s.toggleRightSidebar(),x=e.getConfig(),{Assets:y,Storage:w,Commands:S}=e,C=S.events,j=e.events,E=(U=(V=g.gjsOptions)==null?void 0:V.assetManager)==null?void 0:U.custom;let O=!1;if(y.all.model.prototype.idAttribute="src",Dt(E)&&(y.getConfig().custom=E),f&&(x.projectData=f,s.setNextProjectData()),p){const k=w.getConfig().options;k&&(k.local.key=p)}e.on(j.projectLoad,({project:k})=>{var I;n.setProjectDataCustom(k.custom||{projectType:(I=s.sdkOptions.project)==null?void 0:I.type}),d.loadFonts()}),e.on(j.projectGet,({project:k})=>{k.custom=Ei(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:P}=e,T=Rr(()=>s.setCanvasPanning(!1),200);e.on(P.events.coords,()=>{s.setCanvasPanning(!0),T()}),e.on(P.events.frameLoad,({el:k})=>{k.tabIndex=-1});const{Parser:A}=e,_=((H=s.sdkOptions.parser)==null?void 0:H.showErrors)!==!1;(B=A.events)!=null&&B.css&&_&&e.on(A.events.css,k=>{const{error:I}=k;if(I){const R=dt(I)?I:I.name&&I.reason?`${I.name}: ${I.reason}`:I.message;o.addError("css-error",{header:"CSS Parser Error",content:R})}});const{builtIn:N}=e.StyleManager;N.add("border-radius",{type:"composite",properties:[{...N.get("border-top-left-radius"),id:"border-top-left-radius-sub"},{...N.get("border-top-right-radius"),id:"border-top-right-radius-sub"},{...N.get("border-bottom-right-radius"),id:"border-bottom-right-radius-sub"},{...N.get("border-bottom-left-radius"),id:"border-bottom-left-radius-sub"}]}),[{id:"toggle-lsidebar",keys:"alt+ctrl+,",cmd:v},{id:"toggle-lsidebar2",keys:"alt+⌘+,",cmd:v},{id:"toggle-rsidebar",keys:"alt+ctrl+., alt+⌘+.",cmd:b},{id:"show-blocks",keys:"ctrl+b, ⌘+b",cmd:m},{id:"add-symbol",keys:"alt+ctrl+k, alt+⌘+k",cmd:ne.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:ne.symbolDetach}].forEach(({id:k,keys:I,cmd:R})=>{e.Keymaps.add(`preset:${k}`,I,R,{prevent:!0})}),e.on(`${C.runCommand}core:preview`,()=>{s.setPreview(!0),r.setOpen(!1),Rm(e,!1)}),e.on(`${C.stopCommand}core:preview`,()=>{s.setPreview(!1),Rm(e,!0),setTimeout(()=>{e.refresh()},s.transitionTime)});const D="target-selection",{Components:L}=e;S.add(Gc,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(k,I){const R={id:D,type:"target",component:I};I?P.addSpot(R):P.removeSpots(R)},beforeSelect(k,I={}){I.abort=!0,I.useValid=!1,this.opts.onSelect(k),e.stopCommand(Gc)},run(k,I,R){this.opts=R,e.on("component:select:before",this.beforeSelect),e.on("change:componentHovered",this.onComponentHover)},stop(){e.off("component:select:before",this.beforeSelect),e.off("change:componentHovered",this.onComponentHover),P.removeSpots({id:D}),s.setSelectingTarget(!1)}}),S.add(Dw,()=>{s.setSelectedDesignerTab("style")}),S.add(ne.toastAdd,(k,I,R)=>{o.add(R.id,R)}),S.add(ne.toastRemove,(k,I,R)=>{o.remove(R.id)}),S.add(ne.dialogOpen,(k,I,R)=>{i.open(R)}),S.add(ne.dialogClose,()=>{i.close()}),S.add(ne.dialogExportCode,()=>{i.open({fullH:!0,preventOverflow:!0,title:e.t("actions.showCode.title"),content:()=>{var k,I;return h.createElement(XM,{options:(I=(k=g.commands)==null?void 0:k.options)==null?void 0:I[cs.showCode]})}})}),S.add(ne.dialogImportCode,()=>{i.open({fullH:!0,preventOverflow:!0,title:e.t("actions.importCode.title"),content:()=>h.createElement(Sy)})}),S.add(ne.sidebarLeftGet,()=>({visible:s.isLeftSidebarOpen})),S.add(ne.sidebarLeftSet,(k,I,R)=>{s.setLeftSidebarOpen(!!R.visible)}),S.add(ne.sidebarLeftToggle,()=>{s.setLeftSidebarOpen(!s.isLeftSidebarOpen)}),S.add(ne.sidebarRightGet,()=>({visible:s.isRightSidebarOpen})),S.add(ne.sidebarRightSet,(k,I,R)=>{s.setRightSidebarOpen(!!R.visible)}),S.add(ne.sidebarRightToggle,()=>{s.setRightSidebarOpen(!s.isRightSidebarOpen)}),S.add(ne.sidebarTopGet,()=>({visible:s.isTopSidebarOpen})),S.add(ne.sidebarTopSet,(k,I,R)=>{s.setTopSidebarOpen(!!R.visible)}),S.add(ne.sidebarTopToggle,()=>{s.setTopSidebarOpen(!s.isTopSidebarOpen)}),S.add(ne.sidebarBottomGet,()=>({visible:s.isBottomSidebarOpen})),S.add(ne.sidebarBottomSet,(k,I,R)=>{s.setBottomSidebarOpen(!!R.visible)}),S.add(ne.sidebarBottomToggle,()=>{s.setBottomSidebarOpen(!s.isBottomSidebarOpen)}),S.add(ne.layoutAdd,(k,I,R)=>{R.id&&a.add(R.id,R)}),S.add(ne.layoutRemove,(k,I,R)=>{const{id:W,...Z}=R;a.remove(W,Z)}),S.add(ne.layoutToggle,(k,I,R)=>{const{id:W,...Z}=R;W&&(a.get(W)?a.remove(W,Z):a.add(W,Z))}),S.add(ne.layoutUpdate,(k,I,R)=>{const W=R;e.runCommand(ne.layoutRemove,{id:W.id,layout:{placer:{...W.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(ne.layoutAdd,{...W}))}),S.add(ne.layoutGet,(k,I,R)=>[us(a.get(R.id))]),S.add(ne.layoutConfigGet,()=>us(a.customConfig)),S.add(ne.layoutConfigSet,(k,I,R)=>{const W=R;a.setCustomConfig(W)}),S.add(ne.layoutComponentAdd,(k,I,R)=>{const{type:W,component:Z}=R;W&&Z&&a.addCustomLayoutComponent(W,Z)}),S.add(ne.layoutComponentGet,(k,I,R)=>a.getCustomLayoutComponent(R.type)),S.add(ne.layoutComponentRemove,(k,I,R)=>{a.removeCustomLayoutComponent(R.type)}),S.add(ne.layoutComponentRender,(k,I,R)=>h.createElement(z7,{components:R.components})),S.add(ne.getStateTheme,()=>s.publicStateTheme),S.add(ne.setStateTheme,(k,I,R)=>s.setPublicStateTheme(R)),S.add(ne.settings,()=>({baseUrl:s.baseApiUrl,licenseKey:s.licenseKey,license:us(s.sdkLicense),licenseError:s.sdkLicenseError||void 0,licensePlan:us(s.licensePlan),loadsInfo:us(s.loadsInfo)})),S.add(ne.getPagesConfig,()=>s.sdkPagesConfig),S.add(ne.setPagesConfig,(k,I,R)=>{const{config:W}=R||{};Dt(W)&&s.setSdkPagesConfig(W)}),S.add(ne.getPageSettings,()=>JSON.parse(JSON.stringify(s.panelPageSettings))),S.add(ne.setPageSettings,(k,I,R)=>{s.setPanelPageSettings(R)}),S.add(ne.clearPage,()=>{const k=I=>e.t(`actions.${I}`);i.confirm({title:k("clearCanvas.title"),content:k("clearCanvas.content"),confirmButton:{variant:"danger",children:k("clearCanvas.title")},onConfirm:()=>{v3(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),S.add(ne.projectFiles,(k,I,R)=>{var J,Q;const W=(J=s.sdkOptions.dataSources)==null?void 0:J.exportConfig,Z=((Q=R.exportConfig)==null?void 0:Q.exportPreset)??W,X={isMJML:Vv(e),exportConfig:Z,...R};return K7(k,X)}),S.add(ne.validateCode,(k,I,R)=>ly({...R,appStore:n})),S.add(ne.getBlocksPanel,()=>({isOpen:r.isOpen})),S.add(ne.setBlocksPanel,(k,I,R)=>{const W=R||{};Dt(W.isOpen)&&r.setOpen(W.isOpen)}),S.add(ne.canvasReload,()=>{const k=e.getSelected(),I=P.getCanvasView(),{frames:R}=P.canvas;R.once("loaded:all",()=>{const W=k==null?void 0:k.getView();W&&!W.isInViewport()&&W.el.scrollIntoView({block:"center"})}),I.renderFrames()}),S.add(ne.contextMenuComponent,(k,I,R)=>{const{component:W,...Z}=R;l.showForComponent(W,Z)}),S.add(ne.getStateContextMenu,()=>l.publicState),S.add(ne.setStateContextMenu,(k,I,R)=>{l.setPublicState(R)}),S.add(ne.symbolAdd,(k,I,R)=>{const W=R.component||e.getSelected();if(W)return L.getSymbolInfo(W).isSymbol?o.add("skip-symbol",{header:"The selected element is already a symbol",variant:un.Warning}):L.addSymbol(W)}),S.add(ne.symbolDetach,(k,I,R)=>{const W=R.component||e.getSelected();W&&L.getSymbolInfo(W).isRoot&&L.detachSymbol(W)}),S.add(ne.symbolOverride,(k,I,R)=>{const W=R.component||e.getSelected();W&&(W.setSymbolOverride(R.override),e.Layers.updateLayer(W))}),S.add(ne.symbolPropagateStyles,(k,I,R)=>{const W=R.component||e.getSelected();if(!W)return;const{Css:Z}=e,X=Z.getComponentRules(W,{current:!0})[0];if(X){const{state:J,mediaText:Q}=X.attributes,G=X.getStyle();L.getSymbolInfo(W).relatives.forEach(ee=>{Z.setIdRule(ee.getId(),G,{state:J,mediaText:Q})})}R.deep&&W.components().forEach(J=>e.runCommand(ne.symbolPropagateStyles,{...R,component:J}))}),S.add(ne.assetProviderGet,()=>us(u.allProviders)),S.add(ne.assetProviderAdd,(k,I,{provider:R,index:W})=>{u.addProvider(R,W)}),S.add(ne.assetProviderRemove,(k,I,{id:R})=>{const W=u.allProviders.filter(Z=>Z.id!==R);u.setAllProviders(W)}),S.add(ne.fontGet,()=>us(d.fonts)),S.add(ne.fontAdd,(k,I,{font:R})=>{d.addFont(R)}),S.add(ne.fontRemove,(k,I,{family:R})=>{d.removeFont(R)}),S.add(ne.fontManagerOpen,(k,I,R)=>{Gh(k,R)}),S.add(ne.menuFontLoad,(k,I,{font:R})=>hh(R,!1)),S.add(ne.toggleStateDataSource,()=>(O=!O,e.trigger(Hn.toggleDataSourcesPreview,{showPlaceholder:O}),e.refresh({tools:!0}),{showPlaceholder:O})),S.add(ne.getStateDataSource,()=>({showPlaceholder:O})),S.add(ne.dataSourceSetGlobalData,(k,I,{globalData:R})=>{const W=kx(R);return e.DataSources.get(Wo.globalData).setRecords(W)}),S.add(ne.setDragAbsolute,(k,I,{enabled:R})=>{s.setIsDraggingAbsolute(!!R)}),S.add(ne.dataSourceSetImporter,(k,I,R)=>{e.on(e.Parser.events.htmlBefore,W=>{W.input=R.import(W.input)})}),S.add(ne.dataSourceSetExporter,(k,I,R)=>{e.config.optsHtml={...e.config.optsHtml,exporter:R}}),rV(e,t),pV(e,t),sV(e,t),nV(e),Z7(e),wM(e),Y7(e,t),tV(e,t)}const hV=/\s(?![^(]*\))/,wv=/^-?[0-9]+[a-zA-Z%]{0,}$/;function Sv(e){const t=e.split(hV),n=t.indexOf("inset")>=0,s=t.filter(d=>d!=="inset"),r=s.filter(d=>!wv.test(d))[0]||"currentColor",o=s.filter(d=>wv.test(d)),[i="0",a="0",l="0",u="0"]=o;return{x:i,y:a,blur:l,spread:u,inset:n,color:r}}const oc=["%"],ic=["s","ms"],ea=["deg","rad","grad"],Ls=["px","%","em","rem","vw","vh"],Cv={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},gV=e=>`linear-gradient(${e} 1%, ${e} 100%)`,qc=e=>({id:e,label:e.split("-").map(Is).join(" ")}),Fw=e=>({property:t,to:n})=>{if(n.value){const s=t.getOption(),r=t.getParent().getProperty(e),o=r.getUnit(),i={units:s.units||[],min:s.min,max:s.max,unit:""};(!o||(i==null?void 0:i.units.indexOf(o))<0)&&(i.unit=(i==null?void 0:i.units[0])||""),r.up(i)}},mV=e=>{const t=`${e}-name`,n=`${e}-value`;return(s,{separatorLayers:r})=>{const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Gu(i);return{[t]:a,[n]:l}}):[]}},jv=e=>{const t={[ya]:e};if(e.indexOf("url(")>-1)t[Ds]=Vr.Image;else if(e.indexOf("gradient(")>-1){const n=eg(e),s=n.colorStops,r=n.name.indexOf("linear")>=0;s.length===2&&r&&s[0].color===s[1].color?t[Ds]=Vr.Color:t[Ds]=Vr.Gradient}else t[Ds]=Vr.Color,t[ya]=gV(e);return t},Ev=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(s,{separatorLayers:r}){const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Gu(i);return{[t]:a,[n]:l}}):[]},toStyle(s,{name:r}){return{[r]:`${s[t]}(${s[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:Fw(n)},{property:n,type:"integer"}]}},ac=(e,{x:t,y:n,mergable:s}={})=>{const r={property:`${e}-x`,type:"integer",units:Ls,...t},o={property:`${e}-y`,type:"integer",units:Ls,...n};return{property:e,type:"composite",properties:[r,o],...s&&{fromStyle(i,{name:a,separator:l,property:u}){const[d,p]=u.getProperties(),[f,g]=(i[a]||"").split(l);return{[d.getId()]:i[d.getName()]||f||"",[p.getId()]:i[p.getName()]||g||f||""}},toStyle(i,{name:a,property:l}){const[u,d]=l.getProperties(),p=i[u.getId()],f=i[d.getId()];return{[a]:p===f?p:`${p} ${f}`}}}}},vV=(e,t="")=>{const n=`${e}-name`,s=`${e}-value`;return(r,{name:o})=>({[o]:`${r[n]}(${r[s]||t})`})};["top","middle","bottom"].map(qc),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(qc),["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,fixedValues:e==="background-position-x"?["left","center","right"]:["top","center","bottom"],units:["px"],default:"auto"}));ac("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(qc),gS("(?<!\\(.*[^)]),(?![^()]*\\))"),Vr.Image,Vr.Gradient,Vr.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:Ls,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:Ls,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:Ls})),["border-top-style","border-right-style","border-bottom-style","border-left-style"].map(e=>({type:"select",property:e,default:"none",options:[{id:"none",label:"None"},{id:"solid",label:"Solid"},{id:"dotted",label:"Dotted"},{id:"dashed",label:"Dashed"},{id:"double",label:"Double"},{id:"groove",label:"Groove"},{id:"ridge",label:"Ridge"},{id:"inset",label:"Inset"},{id:"outset",label:"Outset"}]})),["border-top-color","border-right-color","border-bottom-color","border-left-color"].map(e=>({type:"color",property:e,default:"currentColor"})),ac("overflow",{x:Cv,y:Cv,mergable:!0}),Ev(),Ev("backdrop-filter"),["width","height","min-width","min-height","max-width","max-height","padding","margin","color","font-size","line-height","letter-height","border","border-radius","background","opacity","box-shadow","text-shadow","filter","backdrop-filter","transform","all"].map(qc),ic[0],ic[0],mV("transform"),vV("transform","0"),Fw("transform-value"),ac("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),ac("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function Bw(e,t){return[n=>MM(n,t),...LM[e],n=>fV(n,t),TM(e,t)]}class bV{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,hn(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const s=(yield xV()).filter(r=>r.projectType.includes(t));this.setProjectPlugins(s)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const s=[...Bw(t,{appStore:n}),...this.projectPlugins||[]],r=n.sdkOptions.plugins||[];return tt(r)?r({plugins:s}):[...s,...r]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;s.includes(r)?this.pendingUninstalled=s.filter(o=>o!==r):n.includes(r)||n.push(r)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;n.includes(r)?this.pendingInstalled=n.filter(o=>o!==r):s.push(r)}setSelectedShown(t){this.selectedShown=t}}const yV={db:M0.gjsStudio},xV=()=>new Promise(async e=>{let t=[];try{t=await DA(mu.Settings,"plugins",yV)||[]}catch(n){os()&&console.error(n)}e(t)}),wV=h.createContext(void 0);class SV{constructor(t){this.blockManagerStore=new W3(this),this.appEditorStore=new P3(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new Y4(t==null?void 0:t.localSettingsStore),this.toastStore=new U3(this),this.modalStore=new X4(this),this.i18nStore=new I3(this),this.pluginStore=new bV(this),this.pointerBadgeStore=new B3(this),this.contextMenu=new CV(this),this.layoutStore=new D3(this),this.templatesStore=new z3(this),this.assetsStore=new k3(this),this.globalStylesStore=new G4(this),this.fontsStore=new R3(this),this.appEditorStore.init(),vf()&&(window.__gjss=this)}}const En=()=>{const e=h.useContext(wV);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},ng=()=>{throw new Error("Store has not been initialized")};class CV{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=No(function*(n,s={}){var x;if(!(n!=null&&n.em))return[];const r=n.em.getEditor(),{isSymbol:o,isRoot:i}=r.Components.getSymbolInfo(n),a=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:Ar.selectParent,icon:K.arrowUp,label:"Select parent",onClick:()=>{r.runCommand("core:component-exit",{force:!0})}},d&&{id:Ar.duplicate,icon:K.contentCopy,label:"Duplicate",onClick:()=>{r.runCommand("tlb-clone")}},!o&&l&&{id:Ar.symbolCreate,icon:K.rhombusSplit,label:"Create Symbol",onClick:()=>{r.runCommand(ne.symbolAdd)}},o&&i&&{id:Ar.symbolDetach,icon:K.alertRhombus,label:"Detach instance",onClick:()=>{r.runCommand(ne.symbolDetach)}},o&&!a&&{id:Ar.symbolOverride,icon:K.rhombusOutline,label:"Make overridable",onClick:()=>{r.runCommand(ne.symbolOverride,{override:!0})}},o&&a&&{id:Ar.symbolOverrideClear,icon:K.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{r.runCommand(ne.symbolOverride)}},l&&{id:Ar.delete,icon:K.delete,label:"Delete",onClick:()=>{r.runCommand("core:component-delete")}}].filter(Boolean),f=n.get("contextMenu"),g={...s,items:p,component:n,editor:r,type:n.get("type")||"default",source:s.source||fh.canvas},m=yield Pv(f,g),v=(x=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:x.contextMenu;return yield Pv(v,{...g,items:m})}),this.store=t,hn(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const s=t==null?void 0:t.em;if(!s)return;n.skipSelect||s.selected.hasComponent(t)||s.setSelected(t);const r=yield this.getItemsForComponent(t,n);r.length&&this.show({...n,items:r})}show({items:t,x:n,y:s,w:r,h:o}){this.isOpen=!0,this.coordinates={x:n,y:s,w:r,h:o},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const Pv=async(e,t)=>tt(e)?(await e(t)).filter(Boolean):t.items,jV=()=>En().contextMenu,Tv=os()&&document.body,sg=(e={})=>({...wh,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??Tv}},{name:"preventOverflow",options:{boundary:e.boundary??Tv}}]}),EV=sg(),lc="gs-ctx-menu-list",PV=ce(function({onItemClick:t,open:n,items:s,x:r,y:o,w:i,h:a,className:l}){const u=jV(),[d,p]=h.useState(),[f,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,o,i,a)}),[r,o,i,a,n]),{styles:v,attributes:b}=al(m,f,EV),x=M(`${lc}-wrp gs-utl-z-20`,l),y=M(`${lc} gs-utl-z-20`),w=M(`${lc}-body gs-utl-max-w-56`),S=M(`${lc}-item`),C="gs-utl-max-w-40",j=E=>{const{action:O,onClick:P}=E;if(O||P)return T=>{const A={editor:u.store.appEditorStore.editor,...T};tt(O)?(O(A),u.hide()):tt(P)&&(P(A),u.hide())}};return c.jsx("div",{className:x,ref:g,style:v.popper,...b.popper,children:c.jsx(rh,{show:!!n,...WE,unmount:!1,children:c.jsx(rs,{padding:!1,className:y,classNameBody:w,children:s.map((E,O)=>h.createElement(ki,{onItemClick:t,...E,key:E.id??O,className:S,classNameLabel:C,action:j(E),onActive:()=>p(E),active:d===E}))})})})}),lp="gs-cmp-tooltip";function zt({className:e,classNameWrp:t,classNameContent:n,strategy:s,placement:r="bottom",children:o,title:i,onClick:a,inline:l,size:u}){const[d,p]=h.useState(!1),[f,g]=h.useState(!1),m=Dt(u),[v,b]=h.useState(null),[x,y]=h.useState(null),w=al(v,x,{...sg(),placement:r,...s?{strategy:s}:{}});h.useEffect(()=>{var j;d&&((j=w.update)==null||j.call(w))},[d,w.update]),h.useEffect(()=>{const j=setTimeout(()=>p(f),10);return()=>clearTimeout(j)},[f]);const S=M(`${lp}-target`,!l&&"gs-utl-block",e,!a&&"gs-utl-cursor-auto"),C=M(`${lp}-content`,n,"gs-utl-fixed gs-utl-z-30 gs-utl-text-sm",!m&&!n&&"gs-utl-whitespace-nowrap",u==="s"&&"gs-utl-w-60");return c.jsxs("div",{className:M(lp,"gs-utl-relative",t),children:[c.jsx("span",{ref:b,className:S,onMouseEnter:()=>i&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:M(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),a==null||a()},children:o})}),!!f&&c.jsx("div",{className:C,ref:y,style:w.styles.popper,...w.attributes.popper,children:c.jsx(rh,{show:!!d,unmount:!1,...kb,children:c.jsx(rs,{className:Ng.txt,bg:Ng.bg,size:"s",border:!1,children:i})})})]})}function St({children:e,title:t,classNameWrp:n,tooltipProps:s,...r}){return c.jsx(zt,{title:t,classNameWrp:n,...s,children:c.jsx(Ke,{...r,children:e})})}const ni="gs-cmp-ai-chat-assets",TV=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},OV=e=>e.mediaType==="application/pdf",zw=({editor:e,assets:t,className:n,onRemove:s,style:r})=>{const o=`${ni}__asset-item`,i=M(`${ni}__asset-image`,"gs-utl-object-cover",te.rnd,_l.m),a=M(`${ni}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,_l.m),l=M(`${ni}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,_l.m,z.bgH2),u=M(`${ni}__asset-remove`,"gs-utl-absolute gs-utl--top-2 gs-utl--right-1 gs-utl-text-white gs-utl-flex gs-utl-items-center gs-utl-justify-center gs-utl-z-10",_l.s,te.pill,z.bgRed,z.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const p=(f,g)=>{const m={params:{num:g+1}},v=e.t(`${d}.imageAlt`,m),b=e.t(`${d}.pdfTitle`,m);return TV(f)?c.jsx("img",{src:f.src,alt:v,className:i}):OV(f)?c.jsx("iframe",{src:f.src,title:b,className:a}):c.jsx("div",{className:l,children:c.jsx(se,{icon:CC,size:oe.l})})};return c.jsx($,{className:M(ni,n),gap:"xs",wrap:"wrap",style:r,children:t.map((f,g)=>c.jsxs("div",{className:M(o,"gs-utl-relative gs-utl-inline-block"),children:[p(f,g),s&&c.jsx(St,{title:e.t(`${d}.remove`),icon:{icon:K.close,size:oe.s3x},onClick:()=>s(g),size:"x2s",border:!1,className:u})]},f.src))})},ln="gs-cmp-ai-chat-input",_V=e=>{const{className:t,style:n,editor:s,disabled:r,maxAssets:o,currentAssetsCount:i,acceptAssetType:a,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(o<=0)return null;const p=`${ln}__attach-btn`,f=`${ln}__file-input`,g=i>=o,m="aiChat.input.attach",v=s.t(`${m}.upload`),b=s.t(`${m}.selectFromAssets`),x=s.t(`${m}.title`),y=s.t(`${m}.maxAssets`,{params:{count:o}}),w=C=>{const j=Array.from(C.target.files||[]);j.length>0&&l(j),d.current&&(d.current.value="")},S=C=>{if(!s||g)return;const j="btnAttachImages",E=()=>s.runCommand(ne.layoutRemove,{id:j});s.runCommand(ne.layoutToggle,{id:j,header:!1,placer:{type:"popover",target:C.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:E,items:[{id:"upload",label:v,icon:K.trayArrowDown,onClick:()=>{var O;return(O=d.current)==null?void 0:O.click()}},{id:"assets",label:b,icon:NC,onClick:()=>{s.Assets.open({onSelect:({asset:O})=>{const P=O.getSrc();P&&u(P)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:a,multiple:!0,onChange:w,className:f,style:{display:"none"}}),c.jsx(St,{className:M(p,te.pill,t),style:n,title:g?y:x,icon:K.plus,border:!1,onClick:S,disabled:r||g,size:"s",block:!0})]})},AV=({editor:e,className:t,style:n,contextComponents:s,disabled:r})=>{const[o,i]=h.useState(()=>e.getSelectedAll()),a="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,w=()=>i(e.getSelectedAll());return e.on(y,w),()=>{e.off(y,w)}},[e]),h.useEffect(()=>{s.clear(),o.forEach(y=>s.add(y))},[o,s]);const l=()=>i([]);if(o.length===0)return null;const u=`${ln}__context`,d=`${ln}__context-icon`,p=`${ln}__context-badge`,f=`${ln}__context-name`,g=`${ln}__context-divider`,m=o.length===1,v=o[0],b=e.t(`${a}.multiple`,{params:{count:o.length}}),x=m?v.getName():b;return c.jsxs($,{className:M(u,r&&_e.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(se,{icon:K.target,size:oe.sx,className:M(d,z.txtLowEmphasis)}),c.jsx(Br,{className:M(p,Ib(v).bg,Pe.xyS2),s:"s",children:c.jsxs($,{gap:"xs",items:"center",nowrap:!0,children:[m&&z0(v),c.jsx("div",{className:M(f,_e.txtEllips,"gs-utl-max-w-36"),children:x}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M(g,te.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(St,{title:e.t(`${a}.clear`),icon:{icon:K.close,size:oe.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function Ov(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function LV(){const[e,t]=h.useState(""),[n,s]=h.useState(!1),[r,o]=h.useState(!1),i=h.useRef();h.useEffect(()=>o(!!Ov()),[]);const a=()=>{const u=Ov();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>s(!0),d.onend=l,d.onresult=p=>{const g=Array.from(p.results).map(m=>m[0].transcript).join("");t(g)},d.onerror=p=>{console.error("Speech recognition error",p),l()},i.current=d,d.start()},l=()=>{var u;(u=i.current)==null||u.stop(),s(!1)};return{transcript:e,isSupported:r,isListening:n,start:a,stop:l}}const MV=({editor:e,disabled:t,onTranscript:n,onListeningChange:s,className:r,style:o})=>{const i=`${ln}__dictate`,{transcript:a,isSupported:l,isListening:u,start:d,stop:p}=LV(),f="aiChat.input.dictate",g=e.t(`${f}.start`),m=e.t(`${f}.stop`),v=u?m:g;return h.useEffect(()=>{a&&n(a)},[a]),h.useEffect(()=>{s==null||s(u)},[u]),l?c.jsx(St,{block:!0,size:"s",border:!1,className:M(i,te.pill,r),style:o,title:v,disabled:t,icon:u?WC:UC,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},NV=({autoResize:e,autoFocus:t,style:n={},...s})=>{const r=h.useRef(null);return h.useEffect(()=>{!r.current||!e||(r.current.style.height="auto",r.current.style.height=r.current.scrollHeight+"px")},[s.value,e]),h.useEffect(()=>{const o=r.current;if(o&&t){const i=setTimeout(()=>o==null?void 0:o.focus(),150);return()=>clearTimeout(i)}},[r.current,t]),c.jsx("textarea",{ref:r,style:{...n,...e?{resize:"none"}:{}},...s})},_v=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},Av=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,$V=({className:e,style:t,chatContext:n,editor:s,maxAssets:r=5,acceptAssetType:o="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:i,layoutBefore:a,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:f,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[x,y]=h.useState(b||""),[w,S]=h.useState(""),[C,j]=h.useState(!1),[E,O]=h.useState([]),[P,T]=h.useState(!1),A="aiChat.input",_=s.runCommand(ds.getChatApi),N=s.runCommand(ds.getChatState),{status:D,stop:L,sendMessage:V,setError:U}=n||_,H=D==="streaming"||D==="submitted",B=E.length>0,k=w?Av(x,w):x,I=!P&&(H||k.trim()||B),R={input:k,assets:E},W=we=>{const nt=r-E.length,st=we.slice(0,nt);if(st.length===0)return;const vt=st.map(Me=>({src:URL.createObjectURL(Me),file:Me,mediaType:Me.type}));O(Me=>[...Me,...vt])},Z=we=>{E.length>=r||O(nt=>[...nt,{src:we,mediaType:"image/*"}])},X=we=>{const nt=E[we];nt!=null&&nt.file&&_v([nt.src]),O(st=>st.filter((vt,Me)=>Me!==we))},J=async we=>{if(we.preventDefault(),H||P)return;const nt=()=>Q();if(u){u({event:we,submit:nt,state:R});return}nt()},Q=async()=>{if(H||P)return;const we=k.trim();if(!we&&!B)return;const nt=E.filter(Me=>Me.file).map(Me=>Me.file);let vt=E.filter(Me=>!Me.file).map(Me=>({type:"file",url:Me.src.trim(),mediaType:Me.mediaType}));if(nt.length>0){T(!0);try{const pt=await async function(Fe){return i?await i({files:Fe}):new Promise((Yt,he)=>{try{const Ve={dataTransfer:{files:Fe}};s.Assets.FileUploader().uploadFile(Ve,({data:De})=>{Yt(De)})}catch(Ve){he(Ve)}})}(nt),ut=E.filter(Fe=>Fe.file).map(Fe=>Fe.src);vt=[...vt,...pt.map(Fe=>({type:"file",url:Fe.src,mediaType:Fe.mimeType}))],_v(ut)}catch(Me){const pt=s.t(`${A}.uploadError`);U(Me instanceof Error?Me:new Error(pt)),T(!1);return}finally{T(!1)}}V({text:we,files:vt.length>0?vt:void 0,metadata:{createdAt:Date.now()}}),y(""),O([])},G=we=>{we.key==="Enter"&&!we.shiftKey&&(we.preventDefault(),J(we))};h.useEffect(()=>{C||y(we=>Av(we,w)),S("")},[C]);const ee=`${ln}__root`,ae=`${ln}__actions`,ge=`${ln}__actions-left`,je=`${ln}__actions-right`,Se=`${ln}__submit-btn`,et=M(`${ln}__textarea gs-utl-w-full`,z.bgTr,zr.inputText,_e.noFocusOut,_e.noResize),Ye=s.t(`${A}.placeholder`),Ct=a==null?void 0:a({state:R}),ct=l==null?void 0:l({state:R});return c.jsxs("form",{onSubmit:J,className:M(ln,Pe.s,te.bt,z.br,e),style:t,children:[Ct&&nn(s,Ct),c.jsxs($,{className:M(ee,te.b,te.rndLg,z.br,z.bg,Pe.s,"gs-utl-relative"),col:!0,gap:"s",children:[P&&c.jsx(Ur,{abs:!0,full:!0,className:z.bgH25}),c.jsx(AV,{editor:s,disabled:H,contextComponents:N.contextComponents,...d}),c.jsx(NV,{value:k,name:"prompt",onChange:we=>y(we.target.value),onKeyDown:G,placeholder:Ye,readOnly:C,disabled:H,className:et,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),c.jsx(zw,{editor:s,assets:E,onRemove:X,...f}),c.jsxs($,{className:ae,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx($,{className:ge,gap:"s",items:"center",children:c.jsx(_V,{editor:s,disabled:H,maxAssets:r,currentAssetsCount:E.length,acceptAssetType:o,onFilesSelected:W,onAssetSelected:Z,...g})}),c.jsxs($,{className:je,gap:"s",items:"center",children:[c.jsx(MV,{editor:s,disabled:H,onTranscript:S,onListeningChange:j,...m}),c.jsx(Ke,{className:M(Se,te.pill),size:"s",type:H?"button":"submit",onClick:H?L:void 0,icon:H?K.stop:K.arrowUp,variant:H?"out-clear":"pr",disabled:!I,disabledClassName:_e.disabledM,...v})]})]})]}),ct&&nn(s,ct)]})},kV="gs-cmp-ai-chat-loading-state",RV=({className:e,chatContext:t,editor:n,...s})=>c.jsx($,{className:M(kV,e),items:"center",justify:"center",full:!0,col:!0,...s,children:c.jsx(Ur,{})}),IV="file-refs",Uw="gs-cmp-ai-chat-markdown",xt=`${Uw}__el`,VV={ul:({children:e})=>c.jsx("ul",{className:`${xt}-ul ${It.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${xt}-ol ${It.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${xt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${xt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${xt}-h1 ${It.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${xt}-h2 ${It.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${xt}-h3 ${It.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${xt}-h4 ${It.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${xt}-h5 ${It.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${xt}-h6 ${It.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${xt}-a ${zr.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${xt}-code-inline ${It.codeInline}`,children:e}):c.jsx("code",{className:`${xt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${xt}-pre ${It.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${xt}-blockquote ${It.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${xt}-hr ${It.hr} ${z.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${xt}-strong ${It.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${xt}-em ${It.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${xt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${xt}-table ${It.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${xt}-thead ${It.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${xt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${xt}-tr ${It.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${xt}-th ${It.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${xt}-td ${It.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${xt}-checkbox gs-utl-mr-2`,readOnly:!0}),[IV]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function HV(e){return Jw.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const DV=h.memo(function({content:t}){return c.jsx(Qw,{components:VV,remarkPlugins:[eS],children:t})},(e,t)=>e.content===t.content),Lv=h.memo(function({content:t,id:n,className:s}){const r=h.useMemo(()=>HV(t),[t]);return c.jsx("div",{className:`${Uw} ${s||""}`,children:r.map((o,i)=>c.jsx(DV,{content:o},`${n}-block_${i}`))})});function gf(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function Ww(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const cp="gs-cmp-ai-chat-message",si="aiChat.message",FV=h.memo(function({className:t,style:n,message:s,isStreaming:r,showSources:o=!1,editor:i,chatContext:a,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g}){const m=s.parts||[],v=m.filter(jo.isFileUIPart),b=m.filter(P=>!jo.isFileUIPart(P)&&(o||!gf(P)&&!Ww(P))),x=v.map(P=>({src:P.url,mediaType:P.mediaType??"image/*"})),y=b.length-1,w=s.role==="user",S=M(cp,`${cp}--${s.role}`,Pe.s,t),C=M(`${cp}__content gs-utl-break-words`,w?M(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Pe.xyS,te.rnd):"gs-utl-w-full"),j={editor:i,chatContext:a,message:s},E=l==null?void 0:l(j),O=u==null?void 0:u(j);return c.jsxs($,{col:!0,gap:"s",className:S,style:n,children:[E&&nn(i,E),c.jsxs($,{gap:"s",className:M(C,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((P,T)=>c.jsx(BV,{part:P,messageId:s.id,partIndex:T,isStreamingPart:T===y&&r,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g,layoutProps:j},`${s.id}-part-${T}`)),c.jsx(zw,{editor:i,assets:x,className:"gs-utl-justify-end"})]}),O&&nn(i,O)]})}),sr="gs-cmp-ai-chat-message-part",BV=h.memo(function({part:t,messageId:n,partIndex:s,isStreamingPart:r,layoutPart:o,layoutPartToolLabel:i,layoutPartToolDetail:a,layoutPartToolResult:l,layoutProps:u}){var d,p;if(o){const f=o({...u,part:t,partIndex:s});if(f)return nn(u.editor,f)}if(jo.isReasoningUIPart(t)){const{text:f,state:g}=t,m=f==null?void 0:f.trim(),v=r&&g==="streaming",b=`${sr} ${sr}__reasoning`,x=u.editor.t(`${si}.reasoning`);return!!m&&c.jsx(vr,{className:M(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs($,{className:M(`${b}-label`,bn.semibold),items:"center",gap:"s",children:[v?c.jsx(Ur,{size:"xs",currentColor:!0}):c.jsx(ta,{path:IC,size:oe.s2x}),c.jsx("div",{children:x})]}),children:c.jsx("div",{className:M(`${b}-text`,z.txtLowEmphasis,yn.xs,bn.italic),children:c.jsx(Lv,{id:`${n}-${s}`,content:m})})})}if(jo.isTextUIPart(t)){const f=t.text;if(!f)return null;const g=`${sr} ${sr}__text`;return c.jsx(Lv,{content:f,id:`${n}-${s}`,className:g})}if(jo.isToolUIPart(t)){const{type:f,toolCallId:g,input:m="",output:v="",errorText:b}=t,x=f.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),w=typeof v=="string"?v:JSON.stringify(v),S=typeof t.state=="string"?t.state:void 0,C=S==="output-available",j=!!r&&(S==="input-streaming"||S==="input-available"),E=`${sr}__tool`,O=`${sr}__tool-result`,P=`${E}-detail`,T=M(P,"gs-utl-max-w-full"),A="gs-utl-max-w-full gs-utl-whitespace-normal",_=M(`${P}-info gs-utl-max-h-24 gs-utl-overflow-auto`,A,z.txtLowEmphasis,yn.xs),N=M(`${sr}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,A,z.txtLowEmphasis,yn.xs),D=`${E}-section-label`,L=y&&y!=="{}",V=w&&w!=="{}",U=!!b,H=L||V||U,B=u.editor.t(`${si}.tool.input`),k=u.editor.t(`${si}.tool.output`),I=u.editor.t(`${si}.tool.error`),W=u.editor.t(`${si}.tools.${x}`,{params:m||{}})||x,X=u.editor.runCommand(ds.getChatManager).tools[x],J={...u,part:t,partIndex:s,toolName:x,isCompleted:C,isProcessing:j,input:t.input,output:t.output},Q=(i==null?void 0:i(J))||((d=X==null?void 0:X.layoutToolLabel)==null?void 0:d.call(X,J)),G=a==null?void 0:a(J),ee=(l==null?void 0:l(J))||((p=X==null?void 0:X.layoutToolResult)==null?void 0:p.call(X,J)),ae=Q?nn(u.editor,Q):W,ge=ee?nn(u.editor,ee):null,je=G?nn(u.editor,G):c.jsxs($,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[L&&c.jsxs($,{className:M(T,`${P}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:D,children:B}),c.jsx("pre",{className:_,children:y})]}),V&&c.jsxs($,{className:M(T,`${P}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:D,children:k}),c.jsx("pre",{className:_,children:w})]}),U&&c.jsxs($,{className:M(T,`${P}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:D,children:I}),c.jsx("pre",{className:_,children:b})]})]});return c.jsxs($,{className:M(`${sr} ${E}`,z.bgH2,te.rnd,Pe.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(vr,{disabled:!H&&!G,handler:c.jsxs($,{className:M(`${E}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${E}-status`,children:C?c.jsx(ta,{className:`${E}-status-success`,path:Hv,size:oe.s2x}):j?c.jsx(Ur,{className:`${E}-status-processing`,size:"xs",currentColor:!0}):c.jsx(ta,{className:`${E}-status-error`,path:Dv,size:oe.s2x})}),c.jsx("div",{className:M(`${E}-name`,GE.all),children:ae})]}),children:je}),c.jsx(zV,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:r,className:N}),!!ge&&c.jsx("div",{className:O,children:ge})]})}if(gf(t)||Ww(t)){const f=`${sr}__source`,m=gf(t)?t.url:void 0,v=t.title,b=u.editor.t(`${si}.source.document`),x=v||m||b,y=m?new URL(m).hostname:"",w=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:M(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:M(`${f}-title`,bn.semibold,yn.sm,"gs-utl-truncate"),children:x}),y&&c.jsx("div",{className:M(`${f}-url`,z.txtLowEmphasis,yn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(ta,{className:M(`${f}-icon`,z.txtLowEmphasis),path:Fv,size:oe.s2x})]}),S=M(f,z.bgH2,te.rnd,Pe.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&_e.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:S,children:w}):c.jsx("div",{className:S,children:w})}return null}),zV=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:s,className:r}){const[o,i]=h.useState(""),a=h.useRef(null);return h.useEffect(()=>{if(!s||!t){i("");return}const l=n.get(t);l!=null&&l.content&&i(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&i(d.content),d!=null&&d.completed&&(clearInterval(u),i(""))},100);return()=>clearInterval(u)},[t,n,s]),h.useEffect(()=>{a.current&&o&&(a.current.scrollTop=a.current.scrollHeight)},[o]),!o||!s?null:c.jsx("pre",{ref:a,className:r,children:o})}),UV="gs-cmp-ai-chat-messages-status",WV=({className:e,chatContext:t,style:n})=>{const{status:s}=t,r=s==="streaming"||s==="submitted",o=M(z.bgA,_e.dot,_e.bounce);return r?c.jsxs($,{items:"center",gap:"xs",className:M(UV,e,Pe.s),style:n,children:[c.jsx("div",{className:o}),c.jsx("div",{className:o,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:o,style:{animationDelay:"0.3s"}})]}):null},up="gs-cmp-ai-chat-messages";function GV({editor:e,chatContext:t,messages:n,pluginOptions:s}){const r=h.useRef(null),[o,i]=h.useState(null),{status:a}=t,l=a==="streaming"||a==="submitted",u=M(up,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>jp(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},s),[t,e,l,n.length,s]),p=h.useCallback(()=>({type:"column",className:`${up}__footer`,children:jp(e,{type:"aiChatMessagesStatus",chatContext:t},s)}),[t,e,s]),f=g=>{requestAnimationFrame(()=>{o==null||o.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{f(!0)},[n]),h.useEffect(()=>{f()},[o]),c.jsx($,{ref:r,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?nn(e,{type:"aiChatEmptyState",chatContext:t},s):nn(e,{type:"virtualList",className:`${up}__list`,itemsPerRow:1,items:n,onRef:i,itemLayout:d,footerLayout:p})})}const Gw=h.createContext(void 0),qV=({chatManager:e,children:t})=>{const n=e.currentChatState,s=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(Gw.Provider,{value:s,children:t})},KV=()=>h.useContext(Gw),ZV="gs-cmp-ai-chat-panel";function YV({editor:e,pluginOptions:t,style:n,className:s}){const{chatState:r}=KV(),[,o]=h.useState(0),[i,a]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=r;h.useEffect(()=>r.onUpdate(()=>o(j=>++j)),[]);const f=Mv.useChat({chat:r.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:x}=f,y=x||i,w=h.useMemo(()=>({id:f.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(C=>C.abort()),l.clear(),f.stop()),addToolApprovalResponse:f.addToolApprovalResponse,addToolOutput:f.addToolOutput,error:y,setError:C=>a(typeof C=="string"?new Error(C):C),clearError:()=>{f.clearError(),a(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),S=M(ZV,s,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx($,{className:S,style:n,col:!0,nowrap:!0,children:p?c.jsxs(c.Fragment,{children:[nn(e,{type:"aiChatHeader",chatContext:w},t),c.jsx(GV,{editor:e,chatContext:w,messages:g,pluginOptions:t}),w.error&&nn(e,{type:"aiChatError",chatContext:w},t),nn(e,{type:"aiChatInput",chatContext:w},t)]}):nn(e,{type:"aiChatLoadingState",chatContext:w},t)})}const XV=(e,t,n)=>(e.runCommand(ne.layoutComponentAdd,{type:"aiChatPanel",component:s=>({type:"custom",noWrapper:!0,component:()=>c.jsx(qV,{chatManager:n,children:c.jsx(YV,{...s,editor:e,pluginOptions:t})})})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatHeader",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:VP})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatError",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:IP})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatLoadingState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:RV})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatInput",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:$V})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatEmptyState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:RP})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessage",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:FV})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessagesStatus",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:WV})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(s=>{e.runCommand(ne.layoutComponentRemove,{type:s})})}),JV={aiChat:{header:{title:"AI Chat",clear:"Clear"},emptyState:{title:"AI Assistant",subtitle:"How can I help you build your project?",suggestions:{webHero:"Create a hero section with a headline and call-to-action",webFeatures:"Add a features grid with icons",webContact:"Create a contact form",webTestimonials:"Add testimonials section",emailHeader:"Add an email header",emailCta:"Add a call-to-action button",emailFooter:"Add an email footer with links",emailProduct:"Add a product showcase section"}},error:{title:"Error"},panel:{loadError:"Failed to load messages",messagesUpdate:"Error during messages update"},input:{placeholder:"Ask anything...",uploadError:"Failed to upload images",attach:{title:"Attach images",upload:"Upload new image",selectFromAssets:"Select image from Assets",maxAssets:"Maximum {count} assets allowed"},assets:{imageAlt:"Image {num}",pdfTitle:"PDF {num}",remove:"Remove"},context:{multiple:"{count} Components",clear:"Clear"},dictate:{start:"Dictate",stop:"Stop"}},message:{reasoning:"Reasoning",tools:{webSearch:"Web search",removeComponent:"Remove component",moveComponent:"Move component",getPageContent:"Get page content",listPages:"List pages",generateImage:"Generate image",runCommand:"Run command",addComponentCode:"Create component",editComponentCode:"Edit component",addPageCode:"Create page",addProjectPageCode:"Create new project page"},tool:{input:"Input",output:"Output",error:"Error",generateImage:{generating:"Generating...",imageAlt:"Generated image {num}",useImage:"Use image"},command:{notFound:'Command "{id}" not found',missingHandler:'Command "{id}" has no execute handler',showCode:{pending:"Opening code panel",done:"Code panel opened"},importCode:{pending:"Opening import panel",done:"Import panel opened"},preview:{pending:"Opening preview",done:"Preview opened"},pageSettings:{pending:"Opening page settings",done:"Page settings opened"}}},source:{document:"Document"}}}},QV="aiChat",eH=oi.startup,tH=function(e,t={}){t.getAccessToken&&(en.getAccessToken=t.getAccessToken),Hb();const n=new NP(e,t),{Commands:s}=e;s.add(ds.getChatManager,()=>n),s.add(ds.getChatState,()=>n.currentChatState),s.add(ds.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:JV});const r=XV(e,t,n),o=()=>{delete s.commands[ds.getChatManager],delete s.commands[ds.getChatState],delete s.commands[ds.getChatApi],r(),KE()};_S({editor:e,licenseKey:t.licenseKey,plan:eH,pluginName:QV,onLicenseCheckResponse:i=>{i?en.license=i:en.license=void 0},cleanup:o})},nH=OS(tH);module.exports=nH;
388
+ `:void 0};r==="tab"&&(a.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(tS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(r,{model:{defaults:a}})}};e.on("component:type:add",n)}const OV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:s})=>s&&n.onLoad())},_V=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:s}=e;s.getConfig().uploadFile=async(...r)=>{const o=r[0],i=await n.handleUpload(o),a=r[1];i&&(a==null||a({data:i}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},AV=()=>{const{baseApiUrl:e}=oy();return`${e}/sdk/projects`},eS=e=>`${AV()}/${e}`,MV=async({licenseKey:e,projectId:t,...n})=>{const s=await Js.put(eS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return s==null?void 0:s.result},LV=async(e,t)=>await Js.put(t,{body:e,headers:{"Content-Type":"application/json"}}),NV=async(e,t,n,s)=>{const r=JSON.stringify(e),o=await MV({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([r]).size},identityId:s,name:e.name,description:e.description});if(!o)throw new Error("Project not found");const{uploadUrl:i}=o;await LV(r,i)},$V=(e,t,n)=>Js.get(eS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),kV=async e=>await Js.get(e),RV=async(e,t,n,s)=>{const r=await $V(t,n,s),o=r==null?void 0:r.result,i=r==null?void 0:r.errorData;if(!o&&(i!=null&&i.notFoundInDb))return{id:n,project:{}};if(!o)throw new Error("Project not found");const{downloadUrl:a}=o,l=await kV(a);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},IV=(e,t)=>{const{appEditorStore:n,toastStore:s,i18nStore:r}=t.appStore.store,{isUsingProjectSelfHosted:o,isUsingProjectCloud:i,sdkOptions:a}=n,l=a.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:f,autosaveIntervalMs:h}=l;let m,b,v,x;if(o)v=d,x=p,m=f,b=h;else if(i){const E=a.licenseKey,O=n.sdkProjectId,P=n.sdkIdentityId,T=10,A=1e4;x=({project:_})=>NV(_,E,O,P),v=({editor:_})=>RV(_,E,O,P),m=Math.max(T,f??T),h&&(b=Math.max(A,h))}const{Storage:y,events:w}=e,{events:S}=y,j=E=>E instanceof Error?E.message:typeof E=="string"?E:"Unknown error";let C=!1;if(e.once(w.projectLoad,E=>{C=!!E.loaded}),e.once("change:readyLoad",()=>{var O;const E=(O=a.project)==null?void 0:O.default;!C&&E&&e.loadProjectData(E)}),e.on(S.startStore,()=>n.setIsSaving(!0)),e.on(S.endStore,()=>n.setIsSaving(!1)),(v||u)&&x){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await v({editor:e})).project},async store(O){await x({project:O,editor:e})}}),e.on(S.errorLoad,O=>{s.addError("storage-error-load",{header:r.t("storageManager.errorLoad"),content:j(O)})}),e.on(S.errorStore,O=>{s.addError("storage-error-store",{header:r.t("storageManager.errorStore"),content:j(O)})}),m&&y.setStepsBeforeSave(m),b&&e.onReady(()=>{const O=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},b);e.on("destroy",()=>clearInterval(O))})}},Xc="select-target",tS="enable-sm";function VV(e,t){var I,U,F,W;const{appStore:n}=t,{appEditorStore:s,blockManagerStore:r,toastStore:o,modalStore:i,layoutStore:a,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:f,sdkOptions:h}=s,m=()=>r.toggleOpen(),b=()=>s.toggleLeftSidebar(),v=()=>s.toggleRightSidebar(),x=e.getConfig(),{Assets:y,Storage:w,Commands:S}=e,j=S.events,C=e.events,E=(U=(I=h.gjsOptions)==null?void 0:I.assetManager)==null?void 0:U.custom;let O=!1;if(y.all.model.prototype.idAttribute="src",Dt(E)&&(y.getConfig().custom=E),f&&(x.projectData=f,s.setNextProjectData()),p){const H=w.getConfig().options;H&&(H.local.key=p)}e.on(C.projectLoad,({project:H})=>{var R;n.setProjectDataCustom(H.custom||{projectType:(R=s.sdkOptions.project)==null?void 0:R.type}),d.loadFonts()}),e.on(C.projectGet,({project:H})=>{H.custom=Ti(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:P}=e,T=Vr(()=>s.setCanvasPanning(!1),200);e.on(P.events.coords,()=>{s.setCanvasPanning(!0),T()}),e.on(P.events.frameLoad,({el:H})=>{H.tabIndex=-1});const{Parser:A}=e,_=((F=s.sdkOptions.parser)==null?void 0:F.showErrors)!==!1;(W=A.events)!=null&&W.css&&_&&e.on(A.events.css,H=>{const{error:R}=H;if(R){const $=pt(R)?R:R.name&&R.reason?`${R.name}: ${R.reason}`:R.message;o.addError("css-error",{header:"CSS Parser Error",content:$})}});const{builtIn:N}=e.StyleManager;N.add("border-radius",{type:"composite",properties:[{...N.get("border-top-left-radius"),id:"border-top-left-radius-sub"},{...N.get("border-top-right-radius"),id:"border-top-right-radius-sub"},{...N.get("border-bottom-right-radius"),id:"border-bottom-right-radius-sub"},{...N.get("border-bottom-left-radius"),id:"border-bottom-left-radius-sub"}]}),[{id:"toggle-lsidebar",keys:"alt+ctrl+,",cmd:b},{id:"toggle-lsidebar2",keys:"alt+⌘+,",cmd:b},{id:"toggle-rsidebar",keys:"alt+ctrl+., alt+⌘+.",cmd:v},{id:"show-blocks",keys:"ctrl+b, ⌘+b",cmd:m},{id:"add-symbol",keys:"alt+ctrl+k, alt+⌘+k",cmd:te.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:te.symbolDetach}].forEach(({id:H,keys:R,cmd:$})=>{e.Keymaps.add(`preset:${H}`,R,$,{prevent:!0})}),e.on(`${j.runCommand}core:preview`,()=>{s.setPreview(!0),r.setOpen(!1),Fm(e,!1)}),e.on(`${j.stopCommand}core:preview`,()=>{s.setPreview(!1),Fm(e,!0),setTimeout(()=>{e.refresh()},s.transitionTime)});const V="target-selection",{Components:M}=e;S.add(Xc,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(H,R){const $={id:V,type:"target",component:R};R?P.addSpot($):P.removeSpots($)},beforeSelect(H,R={}){R.abort=!0,R.useValid=!1,this.opts.onSelect(H),e.stopCommand(Xc)},run(H,R,$){this.opts=$,e.on("component:select:before",this.beforeSelect),e.on("change:componentHovered",this.onComponentHover)},stop(){e.off("component:select:before",this.beforeSelect),e.off("change:componentHovered",this.onComponentHover),P.removeSpots({id:V}),s.setSelectingTarget(!1)}}),S.add(tS,()=>{s.setSelectedDesignerTab("style")}),S.add(te.toastAdd,(H,R,$)=>{o.add($.id,$)}),S.add(te.toastRemove,(H,R,$)=>{o.remove($.id)}),S.add(te.dialogOpen,(H,R,$)=>{i.open($)}),S.add(te.dialogClose,()=>{i.close()}),S.add(te.dialogExportCode,()=>{i.open({fullH:!0,preventOverflow:!0,title:e.t("actions.showCode.title"),content:()=>{var H,R;return g.createElement(pN,{options:(R=(H=h.commands)==null?void 0:H.options)==null?void 0:R[us.showCode]})}})}),S.add(te.dialogImportCode,()=>{i.open({fullH:!0,preventOverflow:!0,title:e.t("actions.importCode.title"),content:()=>g.createElement(Ly)})}),S.add(te.openEditCode,(H,R,$={})=>{const{editCode:B,layout:Z,...Y}=$;e.runCommand(te.layoutToggle,{id:"dialogEditCode",header:!1,layout:{type:"panelEditCode",...B},placer:{type:"dialog",size:"xl",fullH:!0,title:e.t("actions.editCode.title")},...Y})}),S.add(te.sidebarLeftGet,()=>({visible:s.isLeftSidebarOpen})),S.add(te.sidebarLeftSet,(H,R,$)=>{s.setLeftSidebarOpen(!!$.visible)}),S.add(te.sidebarLeftToggle,()=>{s.setLeftSidebarOpen(!s.isLeftSidebarOpen)}),S.add(te.sidebarRightGet,()=>({visible:s.isRightSidebarOpen})),S.add(te.sidebarRightSet,(H,R,$)=>{s.setRightSidebarOpen(!!$.visible)}),S.add(te.sidebarRightToggle,()=>{s.setRightSidebarOpen(!s.isRightSidebarOpen)}),S.add(te.sidebarTopGet,()=>({visible:s.isTopSidebarOpen})),S.add(te.sidebarTopSet,(H,R,$)=>{s.setTopSidebarOpen(!!$.visible)}),S.add(te.sidebarTopToggle,()=>{s.setTopSidebarOpen(!s.isTopSidebarOpen)}),S.add(te.sidebarBottomGet,()=>({visible:s.isBottomSidebarOpen})),S.add(te.sidebarBottomSet,(H,R,$)=>{s.setBottomSidebarOpen(!!$.visible)}),S.add(te.sidebarBottomToggle,()=>{s.setBottomSidebarOpen(!s.isBottomSidebarOpen)}),S.add(te.layoutAdd,(H,R,$)=>{$.id&&a.add($.id,$)}),S.add(te.layoutRemove,(H,R,$)=>{const{id:B,...Z}=$;a.remove(B,Z)}),S.add(te.layoutToggle,(H,R,$)=>{const{id:B,...Z}=$;B&&(a.get(B)?a.remove(B,Z):a.add(B,Z))}),S.add(te.layoutUpdate,(H,R,$)=>{const B=$;e.runCommand(te.layoutRemove,{id:B.id,layout:{placer:{...B.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(te.layoutAdd,{...B}))}),S.add(te.layoutGet,(H,R,$)=>[ds(a.get($.id))]),S.add(te.layoutConfigGet,()=>ds(a.customConfig)),S.add(te.layoutConfigSet,(H,R,$)=>{const B=$;a.setCustomConfig(B)}),S.add(te.layoutComponentAdd,(H,R,$)=>{const{type:B,component:Z}=$;B&&Z&&a.addCustomLayoutComponent(B,Z)}),S.add(te.layoutComponentGet,(H,R,$)=>a.getCustomLayoutComponent($.type)),S.add(te.layoutComponentRemove,(H,R,$)=>{a.removeCustomLayoutComponent($.type)}),S.add(te.layoutComponentRender,(H,R,$)=>g.createElement(gV,{components:$.components})),S.add(te.getStateTheme,()=>s.publicStateTheme),S.add(te.setStateTheme,(H,R,$)=>s.setPublicStateTheme($)),S.add(te.settings,()=>({baseUrl:s.baseApiUrl,licenseKey:s.licenseKey,license:ds(s.sdkLicense),licenseError:s.sdkLicenseError||void 0,licensePlan:ds(s.licensePlan),loadsInfo:ds(s.loadsInfo)})),S.add(te.getPagesConfig,()=>s.sdkPagesConfig),S.add(te.setPagesConfig,(H,R,$)=>{const{config:B}=$||{};Dt(B)&&s.setSdkPagesConfig(B)}),S.add(te.getPageSettings,()=>JSON.parse(JSON.stringify(s.panelPageSettings))),S.add(te.setPageSettings,(H,R,$)=>{s.setPanelPageSettings($)}),S.add(te.clearPage,()=>{const H=R=>e.t(`actions.${R}`);i.confirm({title:H("clearCanvas.title"),content:H("clearCanvas.content"),confirmButton:{variant:"danger",children:H("clearCanvas.title")},onConfirm:()=>{X0(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),S.add(te.projectFiles,(H,R,$)=>{var ee,X;const B=(ee=s.sdkOptions.dataSources)==null?void 0:ee.exportConfig,Z=((X=$.exportConfig)==null?void 0:X.exportPreset)??B,Y={isMJML:qb(e),exportConfig:Z,...$};return yV(H,Y)}),S.add(te.validateCode,(H,R,$)=>vy({...$,appStore:n})),S.add(te.getBlocksPanel,()=>({isOpen:r.isOpen})),S.add(te.setBlocksPanel,(H,R,$)=>{const B=$||{};Dt(B.isOpen)&&r.setOpen(B.isOpen)}),S.add(te.canvasReload,()=>{const H=e.getSelected(),R=P.getCanvasView(),{frames:$}=P.canvas;$.once("loaded:all",()=>{const B=H==null?void 0:H.getView();B&&!B.isInViewport()&&B.el.scrollIntoView({block:"center"})}),R.renderFrames()}),S.add(te.contextMenuComponent,(H,R,$)=>{const{component:B,...Z}=$;l.showForComponent(B,Z)}),S.add(te.getStateContextMenu,()=>l.publicState),S.add(te.setStateContextMenu,(H,R,$)=>{l.setPublicState($)}),S.add(te.symbolAdd,(H,R,$)=>{const B=$.component||e.getSelected();if(B)return M.getSymbolInfo(B).isSymbol?o.add("skip-symbol",{header:"The selected element is already a symbol",variant:un.Warning}):M.addSymbol(B)}),S.add(te.symbolDetach,(H,R,$)=>{const B=$.component||e.getSelected();B&&M.getSymbolInfo(B).isRoot&&M.detachSymbol(B)}),S.add(te.symbolOverride,(H,R,$)=>{const B=$.component||e.getSelected();B&&(B.setSymbolOverride($.override),e.Layers.updateLayer(B))}),S.add(te.symbolPropagateStyles,(H,R,$)=>{const B=$.component||e.getSelected();if(!B)return;const{Css:Z}=e,Y=Z.getComponentRules(B,{current:!0})[0];if(Y){const{state:ee,mediaText:X}=Y.attributes,G=Y.getStyle();M.getSymbolInfo(B).relatives.forEach(Q=>{Z.setIdRule(Q.getId(),G,{state:ee,mediaText:X})})}$.deep&&B.components().forEach(ee=>e.runCommand(te.symbolPropagateStyles,{...$,component:ee}))}),S.add(te.assetProviderGet,()=>ds(u.allProviders)),S.add(te.assetProviderAdd,(H,R,{provider:$,index:B})=>{u.addProvider($,B)}),S.add(te.assetProviderRemove,(H,R,{id:$})=>{const B=u.allProviders.filter(Z=>Z.id!==$);u.setAllProviders(B)}),S.add(te.fontGet,()=>ds(d.fonts)),S.add(te.fontAdd,(H,R,{font:$})=>{d.addFont($)}),S.add(te.fontRemove,(H,R,{family:$})=>{d.removeFont($)}),S.add(te.fontManagerOpen,(H,R,$)=>{Xg(H,$)}),S.add(te.menuFontLoad,(H,R,{font:$})=>yg($,!1)),S.add(te.toggleStateDataSource,()=>(O=!O,e.trigger(Dn.toggleDataSourcesPreview,{showPlaceholder:O}),e.refresh({tools:!0}),{showPlaceholder:O})),S.add(te.getStateDataSource,()=>({showPlaceholder:O})),S.add(te.dataSourceSetGlobalData,(H,R,{globalData:$})=>{const B=Gx($);return e.DataSources.get(Go.globalData).setRecords(B)}),S.add(te.setDragAbsolute,(H,R,{enabled:$})=>{s.setIsDraggingAbsolute(!!$)}),S.add(te.dataSourceSetImporter,(H,R,$)=>{e.on(e.Parser.events.htmlBefore,B=>{B.input=$.import(B.input)})}),S.add(te.dataSourceSetExporter,(H,R,$)=>{e.config.optsHtml={...e.config.optsHtml,exporter:$}}),_V(e,t),IV(e,t),OV(e,t),TV(e),xV(e),RL(e),wV(e,t),PV(e,t)}const HV=/\s(?![^(]*\))/,Ob=/^-?[0-9]+[a-zA-Z%]{0,}$/;function _b(e){const t=e.split(HV),n=t.indexOf("inset")>=0,s=t.filter(d=>d!=="inset"),r=s.filter(d=>!Ob.test(d))[0]||"currentColor",o=s.filter(d=>Ob.test(d)),[i="0",a="0",l="0",u="0"]=o;return{x:i,y:a,blur:l,spread:u,inset:n,color:r}}const uc=["%"],dc=["s","ms"],na=["deg","rad","grad"],$s=["px","%","em","rem","vw","vh"],Ab={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},DV=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Ca=e=>({id:e,label:e.split("-").map(Ds).join(" ")}),nS=e=>({property:t,to:n})=>{if(n.value){const s=t.getOption(),r=t.getParent().getProperty(e),o=r.getUnit(),i={units:s.units||[],min:s.min,max:s.max,unit:""};(!o||(i==null?void 0:i.units.indexOf(o))<0)&&(i.unit=(i==null?void 0:i.units[0])||""),r.up(i)}},FV=e=>{const t=`${e}-name`,n=`${e}-value`;return(s,{separatorLayers:r})=>{const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Yu(i);return{[t]:a,[n]:l}}):[]}},Mb=e=>{const t={[wa]:e};if(e.indexOf("url(")>-1)t[zs]=Dr.Image;else if(e.indexOf("gradient(")>-1){const n=oh(e),s=n.colorStops,r=n.name.indexOf("linear")>=0;s.length===2&&r&&s[0].color===s[1].color?t[zs]=Dr.Color:t[zs]=Dr.Gradient}else t[zs]=Dr.Color,t[wa]=DV(e);return t},Lb=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(s,{separatorLayers:r}){const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Yu(i);return{[t]:a,[n]:l}}):[]},toStyle(s,{name:r}){return{[r]:`${s[t]}(${s[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:nS(n)},{property:n,type:"integer"}]}},pc=(e,{x:t,y:n,mergable:s}={})=>{const r={property:`${e}-x`,type:"integer",units:$s,...t},o={property:`${e}-y`,type:"integer",units:$s,...n};return{property:e,type:"composite",properties:[r,o],...s&&{fromStyle(i,{name:a,separator:l,property:u}){const[d,p]=u.getProperties(),[f,h]=(i[a]||"").split(l);return{[d.getId()]:i[d.getName()]||f||"",[p.getId()]:i[p.getName()]||h||f||""}},toStyle(i,{name:a,property:l}){const[u,d]=l.getProperties(),p=i[u.getId()],f=i[d.getId()];return{[a]:p===f?p:`${p} ${f}`}}}}},BV=(e,t="")=>{const n=`${e}-name`,s=`${e}-value`;return(r,{name:o})=>({[o]:`${r[n]}(${r[s]||t})`})};["top","middle","bottom"].map(Ca),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Ca),["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,fixedValues:e==="background-position-x"?["left","center","right"]:["top","center","bottom"],units:["px"],default:"auto"}));pc("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Ca),AS("(?<!\\(.*[^)]),(?![^()]*\\))"),Dr.Image,Dr.Gradient,Dr.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:$s,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:$s,default:"auto"})),mf.map(Ca),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:$s})),["border-top-style","border-right-style","border-bottom-style","border-left-style"].map(e=>({type:"select",property:e,default:"none",options:[{id:"none",label:"None"},{id:"solid",label:"Solid"},{id:"dotted",label:"Dotted"},{id:"dashed",label:"Dashed"},{id:"double",label:"Double"},{id:"groove",label:"Groove"},{id:"ridge",label:"Ridge"},{id:"inset",label:"Inset"},{id:"outset",label:"Outset"}]})),["border-top-color","border-right-color","border-bottom-color","border-left-color"].map(e=>({type:"color",property:e,default:"currentColor"})),pc("overflow",{x:Ab,y:Ab,mergable:!0}),Lb(),Lb("backdrop-filter"),["width","height","min-width","min-height","max-width","max-height","padding","margin","color","font-size","line-height","letter-height","border","border-radius","background","opacity","box-shadow","text-shadow","filter","backdrop-filter","transform","all"].map(Ca),dc[0],dc[0],FV("transform"),BV("transform","0"),nS("transform-value"),pc("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),pc("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function sS(e,t){return[n=>qL(n,t),...GL[e],n=>VV(n,t),BL(e,t)]}class zV{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,gn(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const s=(yield WV()).filter(r=>r.projectType.includes(t));this.setProjectPlugins(s)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const s=[...sS(t,{appStore:n}),...this.projectPlugins||[]],r=n.sdkOptions.plugins||[];return rt(r)?r({plugins:s}):[...s,...r]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;s.includes(r)?this.pendingUninstalled=s.filter(o=>o!==r):n.includes(r)||n.push(r)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;n.includes(r)?this.pendingInstalled=n.filter(o=>o!==r):s.push(r)}setSelectedShown(t){this.selectedShown=t}}const UV={db:F0.gjsStudio},WV=()=>new Promise(async e=>{let t=[];try{t=await n3(xu.Settings,"plugins",UV)||[]}catch(n){is()&&console.error(n)}e(t)}),GV=g.createContext(void 0);class qV{constructor(t){this.blockManagerStore=new i4(this),this.appEditorStore=new F3(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new dM(t==null?void 0:t.localSettingsStore),this.toastStore=new o4(this),this.modalStore=new pM(this),this.i18nStore=new J3(this),this.pluginStore=new zV(this),this.pointerBadgeStore=new s4(this),this.contextMenu=new KV(this),this.layoutStore=new t4(this),this.templatesStore=new r4(this),this.assetsStore=new Y3(this),this.globalStylesStore=new aM(this),this.fontsStore=new X3(this),this.appEditorStore.init(),Sf()&&(window.__gjss=this)}}const En=()=>{const e=g.useContext(GV);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},ah=()=>{throw new Error("Store has not been initialized")};class KV{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=$o(function*(n,s={}){var x;if(!(n!=null&&n.em))return[];const r=n.em.getEditor(),{isSymbol:o,isRoot:i}=r.Components.getSymbolInfo(n),a=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:Nr.selectParent,icon:K.arrowUp,label:"Select parent",onClick:()=>{r.runCommand("core:component-exit",{force:!0})}},d&&{id:Nr.duplicate,icon:K.contentCopy,label:"Duplicate",onClick:()=>{r.runCommand("tlb-clone")}},!o&&l&&{id:Nr.symbolCreate,icon:K.rhombusSplit,label:"Create Symbol",onClick:()=>{r.runCommand(te.symbolAdd)}},o&&i&&{id:Nr.symbolDetach,icon:K.alertRhombus,label:"Detach instance",onClick:()=>{r.runCommand(te.symbolDetach)}},o&&!a&&{id:Nr.symbolOverride,icon:K.rhombusOutline,label:"Make overridable",onClick:()=>{r.runCommand(te.symbolOverride,{override:!0})}},o&&a&&{id:Nr.symbolOverrideClear,icon:K.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{r.runCommand(te.symbolOverride)}},l&&{id:Nr.delete,icon:K.delete,label:"Delete",onClick:()=>{r.runCommand("core:component-delete")}}].filter(Boolean),f=n.get("contextMenu"),h={...s,items:p,component:n,editor:r,type:n.get("type")||"default",source:s.source||vg.canvas},m=yield Nb(f,h),b=(x=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:x.contextMenu;return yield Nb(b,{...h,items:m})}),this.store=t,gn(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const s=t==null?void 0:t.em;if(!s)return;n.skipSelect||s.selected.hasComponent(t)||s.setSelected(t);const r=yield this.getItemsForComponent(t,n);r.length&&this.show({...n,items:r})}show({items:t,x:n,y:s,w:r,h:o}){this.isOpen=!0,this.coordinates={x:n,y:s,w:r,h:o},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const Nb=async(e,t)=>rt(e)?(await e(t)).filter(Boolean):t.items,ZV=()=>En().contextMenu,$b=is()&&document.body,lh=(e={})=>({...Pg,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??$b}},{name:"preventOverflow",options:{boundary:e.boundary??$b}}]}),YV=lh(),fc="gs-ctx-menu-list",XV=ue(function({onItemClick:t,open:n,items:s,x:r,y:o,w:i,h:a,className:l}){const u=ZV(),[d,p]=g.useState(),[f,h]=g.useState(null),m=g.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,o,i,a)}),[r,o,i,a,n]),{styles:b,attributes:v}=dl(m,f,YV),x=L(`${fc}-wrp gs-utl-z-20`,l),y=L(`${fc} gs-utl-z-20`),w=L(`${fc}-body gs-utl-max-w-56`),S=L(`${fc}-item`),j="gs-utl-max-w-40",C=E=>{const{action:O,onClick:P}=E;if(O||P)return T=>{const A={editor:u.store.appEditorStore.editor,...T};rt(O)?(O(A),u.hide()):rt(P)&&(P(A),u.hide())}};return c.jsx("div",{className:x,ref:h,style:b.popper,...v.popper,children:c.jsx(cg,{show:!!n,...oP,unmount:!1,children:c.jsx(os,{padding:!1,className:y,classNameBody:w,children:s.map((E,O)=>g.createElement(Ii,{onItemClick:t,...E,key:E.id??O,className:S,classNameLabel:j,action:C(E),onActive:()=>p(E),active:d===E}))})})})}),pp="gs-cmp-tooltip";function Ut({className:e,classNameWrp:t,classNameContent:n,strategy:s,placement:r="bottom",children:o,title:i,onClick:a,inline:l,size:u}){const[d,p]=g.useState(!1),[f,h]=g.useState(!1),m=Dt(u),[b,v]=g.useState(null),[x,y]=g.useState(null),w=dl(b,x,{...lh(),placement:r,...s?{strategy:s}:{}});g.useEffect(()=>{var C;d&&((C=w.update)==null||C.call(w))},[d,w.update]),g.useEffect(()=>{const C=setTimeout(()=>p(f),10);return()=>clearTimeout(C)},[f]);const S=L(`${pp}-target`,!l&&"gs-utl-block",e,!a&&"gs-utl-cursor-auto"),j=L(`${pp}-content`,n,"gs-utl-fixed gs-utl-z-30 gs-utl-text-sm",!m&&!n&&"gs-utl-whitespace-nowrap",u==="s"&&"gs-utl-w-60");return c.jsxs("div",{className:L(pp,"gs-utl-relative",t),children:[c.jsx("span",{ref:v,className:S,onMouseEnter:()=>i&&h(!0),onMouseLeave:()=>h(!1),children:c.jsx("div",{className:L(l&&"gs-utl-inline-block"),onClick:()=>{h(!1),a==null||a()},children:o})}),!!f&&c.jsx("div",{className:j,ref:y,style:w.styles.popper,...w.attributes.popper,children:c.jsx(cg,{show:!!d,unmount:!1,...Uv,children:c.jsx(os,{className:Hh.txt,bg:Hh.bg,size:"s",border:!1,children:i})})})]})}function St({children:e,title:t,classNameWrp:n,tooltipProps:s,...r}){return c.jsx(Ut,{title:t,classNameWrp:n,...s,children:c.jsx(Qe,{...r,children:e})})}const si="gs-cmp-ai-chat-assets",JV=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},QV=e=>e.mediaType==="application/pdf",rS=({editor:e,assets:t,className:n,onRemove:s,style:r})=>{const o=`${si}__asset-item`,i=L(`${si}__asset-image`,"gs-utl-object-cover",se.rnd,Nl.m),a=L(`${si}__asset-pdf`,"gs-utl-overflow-hidden",se.rnd,Nl.m),l=L(`${si}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",se.rnd,Nl.m,z.bgH2),u=L(`${si}__asset-remove`,"gs-utl-absolute gs-utl--top-2 gs-utl--right-1 gs-utl-text-white gs-utl-flex gs-utl-items-center gs-utl-justify-center gs-utl-z-10",Nl.s,se.pill,z.bgRed,z.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const p=(f,h)=>{const m={params:{num:h+1}},b=e.t(`${d}.imageAlt`,m),v=e.t(`${d}.pdfTitle`,m);return JV(f)?c.jsx("img",{src:f.src,alt:b,className:i}):QV(f)?c.jsx("iframe",{src:f.src,title:v,className:a}):c.jsx("div",{className:l,children:c.jsx(ne,{icon:IC,size:oe.l})})};return c.jsx(k,{className:L(si,n),gap:"xs",wrap:"wrap",style:r,children:t.map((f,h)=>c.jsxs("div",{className:L(o,"gs-utl-relative gs-utl-inline-block"),children:[p(f,h),s&&c.jsx(St,{title:e.t(`${d}.remove`),icon:{icon:K.close,size:oe.s3x},onClick:()=>s(h),size:"x2s",border:!1,className:u})]},f.src))})},ln="gs-cmp-ai-chat-input",eH=e=>{const{className:t,style:n,editor:s,disabled:r,maxAssets:o,currentAssetsCount:i,acceptAssetType:a,onFilesSelected:l,onAssetSelected:u}=e,d=g.useRef(null);if(o<=0)return null;const p=`${ln}__attach-btn`,f=`${ln}__file-input`,h=i>=o,m="aiChat.input.attach",b=s.t(`${m}.upload`),v=s.t(`${m}.selectFromAssets`),x=s.t(`${m}.title`),y=s.t(`${m}.maxAssets`,{params:{count:o}}),w=j=>{const C=Array.from(j.target.files||[]);C.length>0&&l(C),d.current&&(d.current.value="")},S=j=>{if(!s||h)return;const C="btnAttachImages",E=()=>s.runCommand(te.layoutRemove,{id:C});s.runCommand(te.layoutToggle,{id:C,header:!1,placer:{type:"popover",target:j.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:E,items:[{id:"upload",label:b,icon:K.trayArrowDown,onClick:()=>{var O;return(O=d.current)==null?void 0:O.click()}},{id:"assets",label:v,icon:qC,onClick:()=>{s.Assets.open({onSelect:({asset:O})=>{const P=O.getSrc();P&&u(P)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:a,multiple:!0,onChange:w,className:f,style:{display:"none"}}),c.jsx(St,{className:L(p,se.pill,t),style:n,title:h?y:x,icon:K.plus,border:!1,onClick:S,disabled:r||h,size:"s",block:!0})]})},tH=({editor:e,className:t,style:n,contextComponents:s,disabled:r})=>{const[o,i]=g.useState(()=>e.getSelectedAll()),a="aiChat.input.context";g.useEffect(()=>{const y=e.Components.events.select,w=()=>i(e.getSelectedAll());return e.on(y,w),()=>{e.off(y,w)}},[e]),g.useEffect(()=>{s.clear(),o.forEach(y=>s.add(y))},[o,s]);const l=()=>i([]);if(o.length===0)return null;const u=`${ln}__context`,d=`${ln}__context-icon`,p=`${ln}__context-badge`,f=`${ln}__context-name`,h=`${ln}__context-divider`,m=o.length===1,b=o[0],v=e.t(`${a}.multiple`,{params:{count:o.length}}),x=m?b.getName():v;return c.jsxs(k,{className:L(u,r&&Ae.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:K.target,size:oe.sx,className:L(d,z.txtLowEmphasis)}),c.jsx(Ur,{className:L(p,Gv(b).bg,Pe.xyS2),s:"s",children:c.jsxs(k,{gap:"xs",items:"center",nowrap:!0,children:[m&&Q0(b),c.jsx("div",{className:L(f,Ae.txtEllips,"gs-utl-max-w-36"),children:x}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:L(h,se.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(St,{title:e.t(`${a}.clear`),icon:{icon:K.close,size:oe.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function kb(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function nH(){const[e,t]=g.useState(""),[n,s]=g.useState(!1),[r,o]=g.useState(!1),i=g.useRef();g.useEffect(()=>o(!!kb()),[]);const a=()=>{const u=kb();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>s(!0),d.onend=l,d.onresult=p=>{const h=Array.from(p.results).map(m=>m[0].transcript).join("");t(h)},d.onerror=p=>{console.error("Speech recognition error",p),l()},i.current=d,d.start()},l=()=>{var u;(u=i.current)==null||u.stop(),s(!1)};return{transcript:e,isSupported:r,isListening:n,start:a,stop:l}}const sH=({editor:e,disabled:t,onTranscript:n,onListeningChange:s,className:r,style:o})=>{const i=`${ln}__dictate`,{transcript:a,isSupported:l,isListening:u,start:d,stop:p}=nH(),f="aiChat.input.dictate",h=e.t(`${f}.start`),m=e.t(`${f}.stop`),b=u?m:h;return g.useEffect(()=>{a&&n(a)},[a]),g.useEffect(()=>{s==null||s(u)},[u]),l?c.jsx(St,{block:!0,size:"s",border:!1,className:L(i,se.pill,r),style:o,title:b,disabled:t,icon:u?o2:r2,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},rH=({autoResize:e,autoFocus:t,style:n={},...s})=>{const r=g.useRef(null);return g.useEffect(()=>{!r.current||!e||(r.current.style.height="auto",r.current.style.height=r.current.scrollHeight+"px")},[s.value,e]),g.useEffect(()=>{const o=r.current;if(o&&t){const i=setTimeout(()=>o==null?void 0:o.focus(),150);return()=>clearTimeout(i)}},[r.current,t]),c.jsx("textarea",{ref:r,style:{...n,...e?{resize:"none"}:{}},...s})},Rb=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},Ib=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,oH=({className:e,style:t,chatContext:n,editor:s,maxAssets:r=5,acceptAssetType:o="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:i,layoutBefore:a,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:f,attachButtonProps:h,dictateButtonProps:m,submitButtonProps:b,value:v})=>{const[x,y]=g.useState(v||""),[w,S]=g.useState(""),[j,C]=g.useState(!1),[E,O]=g.useState([]),[P,T]=g.useState(!1),A="aiChat.input",_=s.runCommand(ps.getChatApi),N=s.runCommand(ps.getChatState),{status:V,stop:M,sendMessage:I,setError:U}=n||_,F=V==="streaming"||V==="submitted",W=E.length>0,H=w?Ib(x,w):x,R=!P&&(F||H.trim()||W),$={input:H,assets:E},B=we=>{const ze=r-E.length,Xe=we.slice(0,ze);if(Xe.length===0)return;const vt=Xe.map(Le=>({src:URL.createObjectURL(Le),file:Le,mediaType:Le.type}));O(Le=>[...Le,...vt])},Z=we=>{E.length>=r||O(ze=>[...ze,{src:we,mediaType:"image/*"}])},Y=we=>{const ze=E[we];ze!=null&&ze.file&&Rb([ze.src]),O(Xe=>Xe.filter((vt,Le)=>Le!==we))},ee=async we=>{if(we.preventDefault(),F||P)return;const ze=()=>X();if(u){u({event:we,submit:ze,state:$});return}ze()},X=async()=>{if(F||P)return;const we=H.trim();if(!we&&!W)return;const ze=E.filter(Le=>Le.file).map(Le=>Le.file);let vt=E.filter(Le=>!Le.file).map(Le=>({type:"file",url:Le.src.trim(),mediaType:Le.mediaType}));if(ze.length>0){T(!0);try{const ft=await async function(We){return i?await i({files:We}):new Promise((Xt,he)=>{try{const De={dataTransfer:{files:We}};s.Assets.FileUploader().uploadFile(De,({data:Be})=>{Xt(Be)})}catch(De){he(De)}})}(ze),dt=E.filter(We=>We.file).map(We=>We.src);vt=[...vt,...ft.map(We=>({type:"file",url:We.src,mediaType:We.mimeType}))],Rb(dt)}catch(Le){const ft=s.t(`${A}.uploadError`);U(Le instanceof Error?Le:new Error(ft)),T(!1);return}finally{T(!1)}}I({text:we,files:vt.length>0?vt:void 0,metadata:{createdAt:Date.now()}}),y(""),O([])},G=we=>{we.key==="Enter"&&!we.shiftKey&&(we.preventDefault(),ee(we))};g.useEffect(()=>{j||y(we=>Ib(we,w)),S("")},[j]);const Q=`${ln}__root`,ie=`${ln}__actions`,ae=`${ln}__actions-left`,me=`${ln}__actions-right`,ve=`${ln}__submit-btn`,ke=L(`${ln}__textarea gs-utl-w-full`,z.bgTr,Wr.inputText,Ae.noFocusOut,Ae.noResize),Re=s.t(`${A}.placeholder`),ot=a==null?void 0:a({state:$}),Ue=l==null?void 0:l({state:$});return c.jsxs("form",{onSubmit:ee,className:L(ln,Pe.s,se.bt,z.br,e),style:t,children:[ot&&nn(s,ot),c.jsxs(k,{className:L(Q,se.b,se.rndLg,z.br,z.bg,Pe.s,"gs-utl-relative"),col:!0,gap:"s",children:[P&&c.jsx(Gr,{abs:!0,full:!0,className:z.bgH25}),c.jsx(tH,{editor:s,disabled:F,contextComponents:N.contextComponents,...d}),c.jsx(rH,{value:H,name:"prompt",onChange:we=>y(we.target.value),onKeyDown:G,placeholder:Re,readOnly:j,disabled:F,className:ke,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),c.jsx(rS,{editor:s,assets:E,onRemove:Y,...f}),c.jsxs(k,{className:ie,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(k,{className:ae,gap:"s",items:"center",children:c.jsx(eH,{editor:s,disabled:F,maxAssets:r,currentAssetsCount:E.length,acceptAssetType:o,onFilesSelected:B,onAssetSelected:Z,...h})}),c.jsxs(k,{className:me,gap:"s",items:"center",children:[c.jsx(sH,{editor:s,disabled:F,onTranscript:S,onListeningChange:C,...m}),c.jsx(Qe,{className:L(ve,se.pill),size:"s",type:F?"button":"submit",onClick:F?M:void 0,icon:F?K.stop:K.arrowUp,variant:F?"out-clear":"pr",disabled:!R,disabledClassName:Ae.disabledM,...b})]})]})]}),Ue&&nn(s,Ue)]})},iH="gs-cmp-ai-chat-loading-state",aH=({className:e,chatContext:t,editor:n,...s})=>c.jsx(k,{className:L(iH,e),items:"center",justify:"center",full:!0,col:!0,...s,children:c.jsx(Gr,{})}),lH="file-refs",oS="gs-cmp-ai-chat-markdown",wt=`${oS}__el`,cH={ul:({children:e})=>c.jsx("ul",{className:`${wt}-ul ${It.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${wt}-ol ${It.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${wt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${wt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${wt}-h1 ${It.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${wt}-h2 ${It.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${wt}-h3 ${It.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${wt}-h4 ${It.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${wt}-h5 ${It.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${wt}-h6 ${It.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${wt}-a ${Wr.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${wt}-code-inline ${It.codeInline}`,children:e}):c.jsx("code",{className:`${wt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${wt}-pre ${It.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${wt}-blockquote ${It.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${wt}-hr ${It.hr} ${z.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${wt}-strong ${It.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${wt}-em ${It.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${wt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${wt}-table ${It.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${wt}-thead ${It.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${wt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${wt}-tr ${It.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${wt}-th ${It.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${wt}-td ${It.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${wt}-checkbox gs-utl-mr-2`,readOnly:!0}),[lH]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function uH(e){return fS.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const dH=g.memo(function({content:t}){return c.jsx(gS,{components:cH,remarkPlugins:[hS],children:t})},(e,t)=>e.content===t.content),Vb=g.memo(function({content:t,id:n,className:s}){const r=g.useMemo(()=>uH(t),[t]);return c.jsx("div",{className:`${oS} ${s||""}`,children:r.map((o,i)=>c.jsx(dH,{content:o},`${n}-block_${i}`))})});function xf(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function iS(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const fp="gs-cmp-ai-chat-message",ri="aiChat.message",pH=g.memo(function({className:t,style:n,message:s,isStreaming:r,showSources:o=!1,editor:i,chatContext:a,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:h}){const m=s.parts||[],b=m.filter(Eo.isFileUIPart),v=m.filter(P=>!Eo.isFileUIPart(P)&&(o||!xf(P)&&!iS(P))),x=b.map(P=>({src:P.url,mediaType:P.mediaType??"image/*"})),y=v.length-1,w=s.role==="user",S=L(fp,`${fp}--${s.role}`,Pe.s,t),j=L(`${fp}__content gs-utl-break-words`,w?L(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Pe.xyS,se.rnd):"gs-utl-w-full"),C={editor:i,chatContext:a,message:s},E=l==null?void 0:l(C),O=u==null?void 0:u(C);return c.jsxs(k,{col:!0,gap:"s",className:S,style:n,children:[E&&nn(i,E),c.jsxs(k,{gap:"s",className:L(j,"gs-utl-self-end"),col:!0,nowrap:!0,children:[v.map((P,T)=>c.jsx(fH,{part:P,messageId:s.id,partIndex:T,isStreamingPart:T===y&&r,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:h,layoutProps:C},`${s.id}-part-${T}`)),c.jsx(rS,{editor:i,assets:x,className:"gs-utl-justify-end"})]}),O&&nn(i,O)]})}),or="gs-cmp-ai-chat-message-part",fH=g.memo(function({part:t,messageId:n,partIndex:s,isStreamingPart:r,layoutPart:o,layoutPartToolLabel:i,layoutPartToolDetail:a,layoutPartToolResult:l,layoutProps:u}){var d,p;if(o){const f=o({...u,part:t,partIndex:s});if(f)return nn(u.editor,f)}if(Eo.isReasoningUIPart(t)){const{text:f,state:h}=t,m=f==null?void 0:f.trim(),b=r&&h==="streaming",v=`${or} ${or}__reasoning`,x=u.editor.t(`${ri}.reasoning`);return!!m&&c.jsx(yr,{className:L(v,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(k,{className:L(`${v}-label`,vn.semibold),items:"center",gap:"s",children:[b?c.jsx(Gr,{size:"xs",currentColor:!0}):c.jsx(sa,{path:XC,size:oe.s2x}),c.jsx("div",{children:x})]}),children:c.jsx("div",{className:L(`${v}-text`,z.txtLowEmphasis,yn.xs,vn.italic),children:c.jsx(Vb,{id:`${n}-${s}`,content:m})})})}if(Eo.isTextUIPart(t)){const f=t.text;if(!f)return null;const h=`${or} ${or}__text`;return c.jsx(Vb,{content:f,id:`${n}-${s}`,className:h})}if(Eo.isToolUIPart(t)){const{type:f,toolCallId:h,input:m="",output:b="",errorText:v}=t,x=f.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),w=typeof b=="string"?b:JSON.stringify(b),S=typeof t.state=="string"?t.state:void 0,j=S==="output-available",C=!!r&&(S==="input-streaming"||S==="input-available"),E=`${or}__tool`,O=`${or}__tool-result`,P=`${E}-detail`,T=L(P,"gs-utl-max-w-full"),A="gs-utl-max-w-full gs-utl-whitespace-normal",_=L(`${P}-info gs-utl-max-h-24 gs-utl-overflow-auto`,A,z.txtLowEmphasis,yn.xs),N=L(`${or}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,A,z.txtLowEmphasis,yn.xs),V=`${E}-section-label`,M=y&&y!=="{}",I=w&&w!=="{}",U=!!v,F=M||I||U,W=u.editor.t(`${ri}.tool.input`),H=u.editor.t(`${ri}.tool.output`),R=u.editor.t(`${ri}.tool.error`),B=u.editor.t(`${ri}.tools.${x}`,{params:m||{}})||x,Y=u.editor.runCommand(ps.getChatManager).tools[x],ee={...u,part:t,partIndex:s,toolName:x,isCompleted:j,isProcessing:C,input:t.input,output:t.output},X=(i==null?void 0:i(ee))||((d=Y==null?void 0:Y.layoutToolLabel)==null?void 0:d.call(Y,ee)),G=a==null?void 0:a(ee),Q=(l==null?void 0:l(ee))||((p=Y==null?void 0:Y.layoutToolResult)==null?void 0:p.call(Y,ee)),ie=X?nn(u.editor,X):B,ae=Q?nn(u.editor,Q):null,me=G?nn(u.editor,G):c.jsxs(k,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[M&&c.jsxs(k,{className:L(T,`${P}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:W}),c.jsx("pre",{className:_,children:y})]}),I&&c.jsxs(k,{className:L(T,`${P}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:H}),c.jsx("pre",{className:_,children:w})]}),U&&c.jsxs(k,{className:L(T,`${P}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:R}),c.jsx("pre",{className:_,children:v})]})]});return c.jsxs(k,{className:L(`${or} ${E}`,z.bgH2,se.rnd,Pe.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(yr,{disabled:!F&&!G,handler:c.jsxs(k,{className:L(`${E}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${E}-status`,children:j?c.jsx(sa,{className:`${E}-status-success`,path:Kb,size:oe.s2x}):C?c.jsx(Gr,{className:`${E}-status-processing`,size:"xs",currentColor:!0}):c.jsx(sa,{className:`${E}-status-error`,path:Zb,size:oe.s2x})}),c.jsx("div",{className:L(`${E}-name`,iP.all),children:ie})]}),children:me}),c.jsx(gH,{toolCallId:h,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:r,className:N}),!!ae&&c.jsx("div",{className:O,children:ae})]})}if(xf(t)||iS(t)){const f=`${or}__source`,m=xf(t)?t.url:void 0,b=t.title,v=u.editor.t(`${ri}.source.document`),x=b||m||v,y=m?new URL(m).hostname:"",w=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:L(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:L(`${f}-title`,vn.semibold,yn.sm,"gs-utl-truncate"),children:x}),y&&c.jsx("div",{className:L(`${f}-url`,z.txtLowEmphasis,yn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(sa,{className:L(`${f}-icon`,z.txtLowEmphasis),path:Yb,size:oe.s2x})]}),S=L(f,z.bgH2,se.rnd,Pe.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Ae.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:S,children:w}):c.jsx("div",{className:S,children:w})}return null}),gH=g.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:s,className:r}){const[o,i]=g.useState(""),a=g.useRef(null);return g.useEffect(()=>{if(!s||!t){i("");return}const l=n.get(t);l!=null&&l.content&&i(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&i(d.content),d!=null&&d.completed&&(clearInterval(u),i(""))},100);return()=>clearInterval(u)},[t,n,s]),g.useEffect(()=>{a.current&&o&&(a.current.scrollTop=a.current.scrollHeight)},[o]),!o||!s?null:c.jsx("pre",{ref:a,className:r,children:o})}),hH="gs-cmp-ai-chat-messages-status",mH=({className:e,chatContext:t,style:n})=>{const{status:s}=t,r=s==="streaming"||s==="submitted",o=L(z.bgA,Ae.dot,Ae.bounce);return r?c.jsxs(k,{items:"center",gap:"xs",className:L(hH,e,Pe.s),style:n,children:[c.jsx("div",{className:o}),c.jsx("div",{className:o,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:o,style:{animationDelay:"0.3s"}})]}):null},gp="gs-cmp-ai-chat-messages";function bH({editor:e,chatContext:t,messages:n,pluginOptions:s}){const r=g.useRef(null),[o,i]=g.useState(null),{status:a}=t,l=a==="streaming"||a==="submitted",u=L(gp,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=g.useCallback(({item:h,index:m})=>_p(e,{type:"aiChatMessage",chatContext:t,message:h,isStreaming:l&&m===n.length-1},s),[t,e,l,n.length,s]),p=g.useCallback(()=>({type:"column",className:`${gp}__footer`,children:_p(e,{type:"aiChatMessagesStatus",chatContext:t},s)}),[t,e,s]),f=h=>{requestAnimationFrame(()=>{o==null||o.scrollToIndex({index:n.length-1,align:"end",behavior:h?"smooth":void 0})})};return g.useEffect(()=>{f(!0)},[n]),g.useEffect(()=>{f()},[o]),c.jsx(k,{ref:r,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?nn(e,{type:"aiChatEmptyState",chatContext:t},s):nn(e,{type:"virtualList",className:`${gp}__list`,itemsPerRow:1,items:n,onRef:i,itemLayout:d,footerLayout:p})})}const aS=g.createContext(void 0),vH=({chatManager:e,children:t})=>{const n=e.currentChatState,s=g.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(aS.Provider,{value:s,children:t})},yH=()=>g.useContext(aS),xH="gs-cmp-ai-chat-panel";function wH({editor:e,pluginOptions:t,style:n,className:s}){const{chatState:r}=yH(),[,o]=g.useState(0),[i,a]=g.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=r;g.useEffect(()=>r.onUpdate(()=>o(C=>++C)),[]);const f=Hb.useChat({chat:r.chat}),{messages:h,sendMessage:m,status:b,setMessages:v,error:x}=f,y=x||i,w=g.useMemo(()=>({id:f.id,messages:h,setMessages:v,sendMessage:m,status:b,stop:()=>(l.forEach(j=>j.abort()),l.clear(),f.stop()),addToolApprovalResponse:f.addToolApprovalResponse,addToolOutput:f.addToolOutput,error:y,setError:j=>a(typeof j=="string"?new Error(j):j),clearError:()=>{f.clearError(),a(void 0)},toolStatusProgress:u,contextComponents:d}),[e,b,h,y]),S=L(xH,s,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx(k,{className:S,style:n,col:!0,nowrap:!0,children:p?c.jsxs(c.Fragment,{children:[nn(e,{type:"aiChatHeader",chatContext:w},t),c.jsx(bH,{editor:e,chatContext:w,messages:h,pluginOptions:t}),w.error&&nn(e,{type:"aiChatError",chatContext:w},t),nn(e,{type:"aiChatInput",chatContext:w},t)]}):nn(e,{type:"aiChatLoadingState",chatContext:w},t)})}const SH=(e,t,n)=>(e.runCommand(te.layoutComponentAdd,{type:"aiChatPanel",component:s=>({type:"custom",noWrapper:!0,component:()=>c.jsx(vH,{chatManager:n,children:c.jsx(wH,{...s,editor:e,pluginOptions:t})})})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatHeader",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:eT})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatError",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:QP})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatLoadingState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:aH})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatInput",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:oH})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatEmptyState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:XP})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatMessage",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:pH})}),e.runCommand(te.layoutComponentAdd,{type:"aiChatMessagesStatus",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:mH})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(s=>{e.runCommand(te.layoutComponentRemove,{type:s})})}),CH={aiChat:{header:{title:"AI Chat",clear:"Clear"},emptyState:{title:"AI Assistant",subtitle:"How can I help you build your project?",suggestions:{webHero:"Create a hero section with a headline and call-to-action",webFeatures:"Add a features grid with icons",webContact:"Create a contact form",webTestimonials:"Add testimonials section",emailHeader:"Add an email header",emailCta:"Add a call-to-action button",emailFooter:"Add an email footer with links",emailProduct:"Add a product showcase section"}},error:{title:"Error"},panel:{loadError:"Failed to load messages",messagesUpdate:"Error during messages update"},input:{placeholder:"Ask anything...",uploadError:"Failed to upload images",attach:{title:"Attach images",upload:"Upload new image",selectFromAssets:"Select image from Assets",maxAssets:"Maximum {count} assets allowed"},assets:{imageAlt:"Image {num}",pdfTitle:"PDF {num}",remove:"Remove"},context:{multiple:"{count} Components",clear:"Clear"},dictate:{start:"Dictate",stop:"Stop"}},message:{reasoning:"Reasoning",tools:{webSearch:"Web search",removeComponent:"Remove component",moveComponent:"Move component",getPageContent:"Get page content",listPages:"List pages",fetchWebsite:"Fetch website",generateImage:"Generate image",runCommand:"Run command",addComponentCode:"Create component",editComponentCode:"Edit component",addPageCode:"Create page",addProjectPageCode:"Create new project page"},tool:{input:"Input",output:"Output",error:"Error",generateImage:{generating:"Generating...",imageAlt:"Generated image {num}",useImage:"Use image"},fetchWebsite:{pending:"Fetching website {url}",done:"Fetched website {url}",missingContent:"Missing website content.",defaultPageName:"Imported page"},command:{notFound:'Command "{id}" not found',missingHandler:'Command "{id}" has no execute handler',showCode:{pending:"Opening code panel",done:"Code panel opened"},importCode:{pending:"Opening import panel",done:"Import panel opened"},preview:{pending:"Opening preview",done:"Preview opened"},publish:{pending:"Opening publish dialog",done:"Publish dialog opened"},pageSettings:{pending:"Opening page settings",done:"Page settings opened"}}},source:{document:"Document"}}}},jH="aiChat",EH=ai.startup,PH=function(e,t={}){t.getAccessToken&&(Bt.getAccessToken=t.getAccessToken),Op();const n=new KP(e,t),{Commands:s}=e;s.add(ps.getChatManager,()=>n),s.add(ps.getChatState,()=>n.currentChatState),s.add(ps.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:CH});const r=SH(e,t,n),o=()=>{delete s.commands[ps.getChatManager],delete s.commands[ps.getChatState],delete s.commands[ps.getChatApi],r(),uP()};zS({editor:e,licenseKey:t.licenseKey,plan:EH,pluginName:jH,onLicenseCheckResponse:i=>{i?Bt.license=i:Bt.license=void 0},cleanup:o})},TH=BS(PH);module.exports=TH;